From 458987e4ba71d53598c4ff306e19fbeef9c4426c Mon Sep 17 00:00:00 2001 From: Davide Madrisan Date: Sun, 27 May 2012 19:55:01 +0200 Subject: [PATCH] pck-update: new options --update-autobuildreq which replace a block AUTOBUILDREQ-BEGIN ... AUTOBUILDREQ-END by an updated one Signed-off-by: Davide Madrisan --- ChangeLog | 5 +++++ plugins/pck-update.in | 25 +++++++++++++++++++++---- po/it/pck-update.po | 6 ++++++ 3 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 13a8b5e..7860896 100644 --- a/ChangeLog +++ b/ChangeLog @@ -15,6 +15,11 @@ Changes in version 1.12.2 * templates/kde4 Add a requirement for kdelibs-devel in the -devel package preamble. ++ improvement + * pck-update - Davide Madrisan: + Action 6: new option '--update-autobuildreq' which replace a block + 'AUTOBUILDREQ-BEGIN' ... 'AUTOBUILDREQ-END' by an updated one. + ------------------------------------------------------------------------------- Changes in version 1.12.1 diff --git a/plugins/pck-update.in b/plugins/pck-update.in index 929c745..b6c3c94 100644 --- a/plugins/pck-update.in +++ b/plugins/pck-update.in @@ -55,6 +55,8 @@ let "norpms = 0" let "list_check = 0" # do not use rpm variables for unix tools let "format_unix_tools = 0" +# do not replace the automatically discovered build requirements +let "replace_autobuildreq = 0" unset ignore_test_list @@ -139,6 +141,8 @@ function usage() { --norpm "$"action"" 5: "$"Only build the srpm package"" "$"action"" 10: "$"Do not upload the rpm packages"" --list-check "$"action"" 5: "$"Do a \`list check'"" + -b, --update-autobuildreq"" + "$"action"" 6: "$"Replace the block AUTOBUILDREQ"" -c, --clear "$"Remove all the temporary files except (s)rpm packages"" -f, --format "$"Enable specfile autoformatting"" -L, --log "$"Unable logging to file (logging dir: \`\$logging_dir')"" @@ -185,11 +189,11 @@ for arg in $@; do done exec_options=`LC_ALL=C getopt \ - -o ua:d:l:S:A:cfLRDqrhV \ + -o ua:d:l:S:A:bcfLRDqrhV \ --long \ update,action:,define:,login:,specfile:,arch:,\ server-download:,server-upload:,server:,\ -changelog:,nosrpm,norpm,list-check,\ +changelog:,nosrpm,norpm,list-check,update-autobuildreq\ force-update,force-build,force-install,force-download,force,\ ignore-test:,clear,format,log,rebuild,root:,\ debug,quiet,colorize,help,version,\ @@ -239,6 +243,8 @@ while :; do let "norpms = 1" ;; --list-check) let "list_check = 1" ;; + -b|--update-autobuildreq) + let "replace_autobuildreq = 1" ;; --force-update) let "force_update = 1" ;; --force-build) @@ -2231,13 +2237,24 @@ $(echo $solibpath | sed "s|-[0-9.]*\.so|.so|")" [ "$p" = "$buildreq" ] && echo "$p" done)" ] && echo "BuildRequires: $buildreq" fi - done ) >> $frequires + done ) | sort -u >> $frequires + + [ "$replace_autobuildreq" = 1 ] && + notify.note " +${NOTE}"$"replacing the AUTOBUILDREQ block by:""${NORM}" notify.note " ## AUTOBUILDREQ-BEGIN" - sort -u $frequires + cat $frequires notify.note "## AUTOBUILDREQ-END " + if [ "$replace_autobuildreq" = 1 ]; then + sed -i "/^## AUTOBUILDREQ/d" $frequires + sed -i -ne "/## AUTOBUILDREQ-BEGIN/{p;r $frequires" \ + -e ':a;n;/## AUTOBUILDREQ-END/{p;b};ba};p' \ + $SRPM_SPECFILE_WITH_PATH + fi + rm -f $frequires ;; 7) notify.note "[${NOTE}step $step${NORM}] -- ${NOTE}"$"\ diff --git a/po/it/pck-update.po b/po/it/pck-update.po index 9dfbcc9..4c0e293 100644 --- a/po/it/pck-update.po +++ b/po/it/pck-update.po @@ -150,6 +150,9 @@ msgstr "Non effettua l'upload dei pacchetti rpm" msgid "Do a \\`list check'" msgstr "Cerca i file non pacchettizzati" +msgid "Replace the block AUTOBUILDREQ" +msgstr "Aggiorna il blocco AUTOBUILDREQ" + msgid "Remove all the temporary files except (s)rpm packages" msgstr "Rimuove tutti i file temporanei" @@ -536,3 +539,6 @@ msgstr "controllo dello specfile alla ricerca di comuni errori" msgid "checking packages for common mistakes" msgstr "controllo dei pacchetti alla ricerca di comuni errori" + +msgid "replacing the AUTOBUILDREQ block by:" +msgstr "sostituzione del blocco AUTOBUILDREQ con:"