automaint: added verbose output (-v) and test mode (-t); skip package with same release as upstream

This commit is contained in:
Silvan Calarco 2013-07-13 13:52:23 +02:00
parent a6bcf08a21
commit 0669999e60

View File

@ -23,11 +23,13 @@ ${me[0]} ${me[1]}
"$"Usage"": "$"Usage"":
$me [-s repository -d repository ] [-p repository] [-h] [-v] $me [-s repository -d repository ] [-p repository] [-h] [-v]
-s repository "$"Automatic/Staging builds source repository
-d repository "$"Main destination repository -d repository "$"Main destination repository
-p repository "$"Port repository -p repository "$"Port repository
-s repository "$"Automatic/Staging builds source repository
-h "$"Show this help and exit -h "$"Show this help and exit
-v "$"Verbose mode -t "$"Test mode (no change will be made)
-v "$"Verbose output
" "
} }
@ -130,6 +132,8 @@ for ((i=1; i<=$#; i++)); do
-p) shift -p) shift
PORT_REPOSITORY="${!i}" PORT_REPOSITORY="${!i}"
;; ;;
-t) TESTMODE=1
;;
-v) VERBOSE=1 -v) VERBOSE=1
;; ;;
-h|--help) -h|--help)
@ -146,6 +150,8 @@ done
exit 1 exit 1
} }
[ "$TESTMODE" ] && echo "** TEST MODE enabled: no changes will be made **"
for a in `seq 1 ${#ARCHS[*]}`; do for a in `seq 1 ${#ARCHS[*]}`; do
. $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY/builds-${ARCHS[$a-1]}.sh . $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY/builds-${ARCHS[$a-1]}.sh
pkglist[$a-1]="${pkg_list[*]}" pkglist[$a-1]="${pkg_list[*]}"
@ -178,6 +184,10 @@ for p in ${pkglist[0]}; do
} }
if [ "$pkg_version" = "$spkg_version" ]; then if [ "$pkg_version" = "$spkg_version" ]; then
if [ "$pkg_release" = "$spkg_release" ]; then
echo "$p: same release as upstream; skipping."
continue
fi
update_type="release" update_type="release"
else else
OIFS=$IFS OIFS=$IFS
@ -201,17 +211,21 @@ for p in ${pkglist[0]}; do
fi fi
if [ "$needsport" ]; then if [ "$needsport" ]; then
echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($spkg_version-$spkg_release -> $pkg_version-$pkg_release)" echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($spkg_version-$spkg_release -> $pkg_version-$pkg_release)"
openmamba-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null if [ ! "$TESTMODE" ]; then
if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then openmamba-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=${WEBBUILD_SECRET}&USER_EMAIL=$WEBBUILD_EMAIL&\ if [ $? -eq 0 -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 \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$PORT_REPOSITORY</b> for porting\"`" >/dev/null MESSAGE=`cgi_encodevar \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$PORT_REPOSITORY</b> for porting\"`" >/dev/null
fi
fi fi
else else
echo "$p: importing from $SOURCE_REPOSITORY to $DEST_REPOSITORY ($spkg_version-$spkg_release -> $pkg_version-$pkg_release; update type: $update_type)" echo "$p: importing from $SOURCE_REPOSITORY to $DEST_REPOSITORY ($spkg_version-$spkg_release -> $pkg_version-$pkg_release; update type: $update_type)"
openmamba-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null if [ ! "$TESTMODE" ]; then
if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then openmamba-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null
curl -s "$WEBBUILD_URL?REQUEST=message&USER=$WEBBUILD_USER&SECRET=${WEBBUILD_SECRET}&USER_EMAIL=$WEBBUILD_EMAIL&\ if [ $? -eq 0 -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 \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$DEST_REPOSITORY</b>\"`" >/dev/null MESSAGE=`cgi_encodevar \"imported <b>$p</b> from <b>$SOURCE_REPOSITORY</b> to <b>$DEST_REPOSITORY</b>\"`" >/dev/null
fi
fi fi
fi fi
done done