From 2f6984ed3bd7c3e27e83963746c3762bd1386be6 Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Tue, 20 Nov 2012 00:00:51 +0100 Subject: [PATCH] autoport: added rebuild with changelog support throgh new -u option --- autoport | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/autoport b/autoport index 04d6786..cbe3442 100755 --- a/autoport +++ b/autoport @@ -33,9 +33,10 @@ ${me[0]} ${me[1]} --fix "$"Fix .la files for cross linking and exit -r "$"Work on given repository (default: $PORT_REPOSITORY) -d "$"Release packages to given repository (default: $PORT_REPOSITORY) - -x "$"Operate in cross build mode -h "$"Show this help and exit + -u changelog "$"Rebuild packages with given changelog -v "$"More verbose output + -x "$"Operate in cross build mode arch "$"Target architecture job "$"Job specification for autodist"" @@ -49,7 +50,7 @@ function autoport_log() { local result=$3 local logfile=$4 - [ "$pkg" -a "$operation" -a "$result" ] || return + [ "$pkg" -a "$operation" -a "$result" -a "$BATCH_MODE" ] || return echo "$pkg $operation $result $logfile" >> /var/autodist/log/autoport-$PORT_REPOSITORY-current } @@ -218,6 +219,14 @@ for ((i=1; i<=$#; i++)); do -b) BATCH_MODE=1 ;; -f) FORCE_MODE=1 ;; -v) VERBOSE_MODE=1 ;; + -u) REBUILD_MODE=1 + shift + REBUILD_CHANGELOG="${!i}" + [ "$REBUILD_CHANGELOG" ] || { + echo "ERROR: changelog not given as -u option parameter; aborting." + exit 1 + } + ;; -npa) DONT_PREPARE_ANY=1 DONT_PREPARE=1 ;; -np) DONT_PREPARE=1 ;; @@ -275,7 +284,7 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do logdate=`date +"%F@%T"` logfile=$DATAARCHDIR/$logdate.log - mv $DATAARCHDIR/$PORT_REPOSITORY-current.log $DATAARCHDIR/$PORT_REPOSITORY-last.log + [ -e $DATAARCHDIR/$PORT_REPOSITORY-current.log ] && mv $DATAARCHDIR/$PORT_REPOSITORY-current.log $DATAARCHDIR/$PORT_REPOSITORY-last.log > $logfile ln -sf $logdate.log $DATAARCHDIR/$PORT_REPOSITORY-current.log @@ -453,7 +462,20 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do echo -n "(OK) " autoport_log ${JOB_CURRENT} prepare ok } - if [ "$PORT_REPOSITORY" != "$DEST_REPOSITORY" ]; then + if [ "$REBUILD_MODE" = "1" ]; then + echo -n "update" + [ "$VERBOSE_MODE" ] && echo " +%% COMMAND: LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\"" + LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"$REBUILD_CHANGELOG\" &>>$logfile + [ $? -gt 0 ] && { + echo "(FAILED) " + autoport_log ${JOB_CURRENT} update failed + continue + } || { + autoport_log ${JOB_CURRENT} update ok + echo -n "(OK) " + } + elif [ "$PORT_REPOSITORY" != "$DEST_REPOSITORY" ]; then echo -n "update" [ "$VERBOSE_MODE" ] && echo " %% COMMAND: LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"automatic port from $PORT_REPOSITORY\"" @@ -489,12 +511,12 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do echo "(FAILED)" JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'` [ "$JOB_LOG" ] || JOB_LOG=$tmpfile - autoport_log ${JOB_CURRENT} update failed $tmpfile + autoport_log ${JOB_CURRENT} update failed continue } || { cat $tmpfile >> $logfile echo -n "(OK) " - autoport_log ${JOB_CURRENT} update ok $tmpfile + autoport_log ${JOB_CURRENT} update ok } fi } @@ -526,14 +548,14 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'` [ "$JOB_LOG" ] || JOB_LOG=$tmpfile [ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG - autoport_log ${JOB_CURRENT} port failed $tmpfile + autoport_log ${JOB_CURRENT} port failed continue } || { cat $tmpfile >> $logfile JOB_SENT=(${JOB_SENT[*]} $JOB_CURRENT) echo $JOB_CURRENT >> $DATAARCHDIR/sentjobs echo -n "(OK) " - autoport_log ${JOB_CURRENT} port ok $tmpfile + autoport_log ${JOB_CURRENT} port ok if [ "$BATCH_MODE" -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\ MESSAGE=`cgi_encodevar \"ported $JOB_CURRENT to $TARGET_ARCH and sent it to $pkg_repository\"`" >/dev/null @@ -562,7 +584,7 @@ MESSAGE=`cgi_encodevar \"ported $JOB_CURRENT to $TARGET_ARCH and s JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'` [ "$JOB_LOG" ] || JOB_LOG=$tmpfile [ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG - autoport_log ${JOB_CURRENT} install failed $tmpfile + autoport_log ${JOB_CURRENT} install failed continue } || { cat $tmpfile >> $logfile @@ -570,7 +592,7 @@ MESSAGE=`cgi_encodevar \"ported $JOB_CURRENT to $TARGET_ARCH and s JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT) JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT) echo -n "(OK)" - autoport_log ${JOB_CURRENT} install ok $tmpfile + autoport_log ${JOB_CURRENT} install ok } echo done @@ -617,7 +639,7 @@ MESSAGE=`cgi_encodevar \"ported $JOB_CURRENT to $TARGET_ARCH and s JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT) JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT) echo -n "(OK)" - autoport_log ${JOB_CURRENT} retryinstall ok $tmpfile + autoport_log ${JOB_CURRENT} retryinstall ok } echo done