autoport: added rebuild with changelog support throgh new -u option

This commit is contained in:
Silvan Calarco 2012-11-20 00:00:51 +01:00
parent aabe20a9ad
commit 2f6984ed3b

View File

@ -33,9 +33,10 @@ ${me[0]} ${me[1]}
--fix "$"Fix .la files for cross linking and exit --fix "$"Fix .la files for cross linking and exit
-r "$"Work on given repository (default: $PORT_REPOSITORY) -r "$"Work on given repository (default: $PORT_REPOSITORY)
-d "$"Release packages to 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 -h "$"Show this help and exit
-u changelog "$"Rebuild packages with given changelog
-v "$"More verbose output -v "$"More verbose output
-x "$"Operate in cross build mode
arch "$"Target architecture arch "$"Target architecture
job "$"Job specification for autodist"" job "$"Job specification for autodist""
@ -49,7 +50,7 @@ function autoport_log() {
local result=$3 local result=$3
local logfile=$4 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 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 ;; -b) BATCH_MODE=1 ;;
-f) FORCE_MODE=1 ;; -f) FORCE_MODE=1 ;;
-v) VERBOSE_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 -npa) DONT_PREPARE_ANY=1
DONT_PREPARE=1 ;; DONT_PREPARE=1 ;;
-np) DONT_PREPARE=1 ;; -np) DONT_PREPARE=1 ;;
@ -275,7 +284,7 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
logdate=`date +"%F@%T"` logdate=`date +"%F@%T"`
logfile=$DATAARCHDIR/$logdate.log 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 > $logfile
ln -sf $logdate.log $DATAARCHDIR/$PORT_REPOSITORY-current.log ln -sf $logdate.log $DATAARCHDIR/$PORT_REPOSITORY-current.log
@ -453,7 +462,20 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
echo -n "(OK) " echo -n "(OK) "
autoport_log ${JOB_CURRENT} prepare 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" echo -n "update"
[ "$VERBOSE_MODE" ] && echo " [ "$VERBOSE_MODE" ] && echo "
%% COMMAND: LANG=C LC_ALL=C autodist -u -r ${JOB_CURRENT} --severity 2 -- $STAGEOPTS --changelog \"automatic port from $PORT_REPOSITORY\"" %% 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)" echo "(FAILED)"
JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'` JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'`
[ "$JOB_LOG" ] || JOB_LOG=$tmpfile [ "$JOB_LOG" ] || JOB_LOG=$tmpfile
autoport_log ${JOB_CURRENT} update failed $tmpfile autoport_log ${JOB_CURRENT} update failed
continue continue
} || { } || {
cat $tmpfile >> $logfile cat $tmpfile >> $logfile
echo -n "(OK) " echo -n "(OK) "
autoport_log ${JOB_CURRENT} update ok $tmpfile autoport_log ${JOB_CURRENT} update ok
} }
fi fi
} }
@ -526,14 +548,14 @@ for TARGET_ARCH in ${TARGET_ARCHS}; do
JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'` JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'`
[ "$JOB_LOG" ] || JOB_LOG=$tmpfile [ "$JOB_LOG" ] || JOB_LOG=$tmpfile
[ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG [ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG
autoport_log ${JOB_CURRENT} port failed $tmpfile autoport_log ${JOB_CURRENT} port failed
continue continue
} || { } || {
cat $tmpfile >> $logfile cat $tmpfile >> $logfile
JOB_SENT=(${JOB_SENT[*]} $JOB_CURRENT) JOB_SENT=(${JOB_SENT[*]} $JOB_CURRENT)
echo $JOB_CURRENT >> $DATAARCHDIR/sentjobs echo $JOB_CURRENT >> $DATAARCHDIR/sentjobs
echo -n "(OK) " 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 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&\ curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=$WEBBUILD_SECRET&USER_EMAIL=$WEBBUILD_EMAIL&\
MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and sent it to <b>$pkg_repository</b>\"`" >/dev/null MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and sent it to <b>$pkg_repository</b>\"`" >/dev/null
@ -562,7 +584,7 @@ MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and s
JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'` JOB_LOG=`grep "^?= See " $tmpfile | awk '{ print $3 }'`
[ "$JOB_LOG" ] || JOB_LOG=$tmpfile [ "$JOB_LOG" ] || JOB_LOG=$tmpfile
[ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG [ ! "$REBUILD_MILESTONE" ] && find_requirements $JOB_LOG
autoport_log ${JOB_CURRENT} install failed $tmpfile autoport_log ${JOB_CURRENT} install failed
continue continue
} || { } || {
cat $tmpfile >> $logfile cat $tmpfile >> $logfile
@ -570,7 +592,7 @@ MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and s
JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT) JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT)
JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT) JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT)
echo -n "(OK)" echo -n "(OK)"
autoport_log ${JOB_CURRENT} install ok $tmpfile autoport_log ${JOB_CURRENT} install ok
} }
echo echo
done done
@ -617,7 +639,7 @@ MESSAGE=`cgi_encodevar \"ported <b>$JOB_CURRENT</b> to <b>$TARGET_ARCH</b> and s
JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT) JOB_MAYBEINSTALLED_NEW=(${JOB_MAYBEINSTALLED_NEW[*]} $JOB_CURRENT)
JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT) JOB_COMPLETED=(${JOB_COMPLETED[*]} $JOB_CURRENT)
echo -n "(OK)" echo -n "(OK)"
autoport_log ${JOB_CURRENT} retryinstall ok $tmpfile autoport_log ${JOB_CURRENT} retryinstall ok
} }
echo echo
done done