From 0669999e609618079eb9c66e4b9ab99c310b2a0c Mon Sep 17 00:00:00 2001 From: Silvan Calarco Date: Sat, 13 Jul 2013 13:52:23 +0200 Subject: [PATCH] automaint: added verbose output (-v) and test mode (-t); skip package with same release as upstream --- automaint | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/automaint b/automaint index d082974..d0c57cf 100755 --- a/automaint +++ b/automaint @@ -23,11 +23,13 @@ ${me[0]} ${me[1]} "$"Usage"": $me [-s repository -d repository ] [-p repository] [-h] [-v] - -s repository "$"Automatic/Staging builds source repository -d repository "$"Main destination repository -p repository "$"Port repository + -s repository "$"Automatic/Staging builds source repository + -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 PORT_REPOSITORY="${!i}" ;; + -t) TESTMODE=1 + ;; -v) VERBOSE=1 ;; -h|--help) @@ -146,6 +150,8 @@ done exit 1 } +[ "$TESTMODE" ] && echo "** TEST MODE enabled: no changes will be made **" + for a in `seq 1 ${#ARCHS[*]}`; do . $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY/builds-${ARCHS[$a-1]}.sh pkglist[$a-1]="${pkg_list[*]}" @@ -178,6 +184,10 @@ for p in ${pkglist[0]}; do } if [ "$pkg_version" = "$spkg_version" ]; then + if [ "$pkg_release" = "$spkg_release" ]; then + echo "$p: same release as upstream; skipping." + continue + fi update_type="release" else OIFS=$IFS @@ -201,17 +211,21 @@ for p in ${pkglist[0]}; do fi if [ "$needsport" ]; then 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 [ $? -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&\ + if [ ! "$TESTMODE" ]; then + openmamba-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null + 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 $p from $SOURCE_REPOSITORY to $PORT_REPOSITORY for porting\"`" >/dev/null + fi fi else 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 [ $? -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&\ + if [ ! "$TESTMODE" ]; then + openmamba-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null + 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 $p from $SOURCE_REPOSITORY to $DEST_REPOSITORY\"`" >/dev/null + fi fi fi done