automaint: update with changes from current operating version

This commit is contained in:
Silvan Calarco 2021-09-04 14:56:26 +02:00
parent 33c3a3ca36
commit f852838441

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
# automaint -- batch automatic maintainance tool of the autodist suite # automaint -- batch automatic maintainance tool of the autodist suite
# Copyright (C) 2013-2020 by Silvan Calarco <silvan.calarco@mambasoft.it> # Copyright (C) 2013-2021 by Silvan Calarco <silvan.calarco@mambasoft.it>
# #
# Released under the terms of the GNU GPL release 3 license # Released under the terms of the GNU GPL release 3 license
# #
@ -13,7 +13,7 @@ me=(${0##*/} $VERSION "Sat Mar 20 2011")
function usage() { function usage() {
echo "\ echo "\
${me[0]} ${me[1]} ${me[0]} ${me[1]}
"$"Copyright (C) 2013 Silvan Calarco <silvan.calarco@mambasoft.it>"" "$"Copyright (C) 2013-2021 Silvan Calarco <silvan.calarco@mambasoft.it>""
"$"Released under the terms of the GNU GPL v3 license" "$"Released under the terms of the GNU GPL v3 license"
echo " echo "
"$"Batch automatic maintainance tool of the autodist suite."" "$"Batch automatic maintainance tool of the autodist suite.""
@ -178,14 +178,17 @@ for p in ${allpkgs}; do
[ "$pkgcontinue" ] && continue [ "$pkgcontinue" ] && continue
for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do
# Get pkg info from port repository
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$PORT_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$PORT_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p
# If not found get info from main repository
if [ ! "$pkg_name" ]; then if [ ! "$pkg_name" ]; then
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$DEST_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$DEST_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p
fi fi
if [ "$pkg_name" ]; then if [ "$pkg_name" ]; then
spkg_version=$pkg_version old_pkg_version=$pkg_version
spkg_release=$pkg_release old_pkg_release=$pkg_release
old_pkg_repository=$pkg_repository
break break
fi fi
done done
@ -195,12 +198,12 @@ for p in ${allpkgs}; do
continue continue
} }
[ "$VERBOSE" ] && echo "$p: old release in $DEST_REPOSITORY is $spkg_version-$spkg_release" [ "$VERBOSE" ] && echo "$p: old release in $DEST_REPOSITORY is $old_pkg_version-$old_pkg_release"
for o in ${needportlist[*]}; do for o in ${needportlist[*]}; do
[ "$p" = "$o" ] && { needsport=1; break; } [ "$p" = "$o" ] && { needsport=1; break; }
done done
[ "$needsport" -a ! "$PORT_REPOSITORY" ] && continue #[ "$needsport" -a ! "$PORT_REPOSITORY" ] && continue
for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do for a in `seq 1 ${#AUTODIST_ARCHS[*]}`; do
get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p get_pkg_buildinfo $LOCAL_REPS_BASE_DIR/distromatic/$SOURCE_REPOSITORY ${AUTODIST_ARCHS[$a-1]} $p
@ -214,8 +217,8 @@ for p in ${allpkgs}; do
[ "$VERBOSE" ] && echo "$p: new release in $SOURCE_REPOSITORY is $pkg_version-$pkg_release" [ "$VERBOSE" ] && echo "$p: new release in $SOURCE_REPOSITORY is $pkg_version-$pkg_release"
if [ "$pkg_version" = "$spkg_version" ]; then if [ "$pkg_version" = "$old_pkg_version" ]; then
if [ "$pkg_release" = "$spkg_release" ]; then if [ "$pkg_release" = "$old_pkg_release" ]; then
echo "$p: same release as upstream; skipping." echo "$p: same release as upstream; skipping."
continue continue
fi fi
@ -223,7 +226,7 @@ for p in ${allpkgs}; do
else else
OIFS=$IFS OIFS=$IFS
IFS='.' IFS='.'
read -ra SVER <<< "$spkg_version" read -ra SVER <<< "$old_pkg_version"
read -ra VER <<< "$pkg_version" read -ra VER <<< "$pkg_version"
IFS=$OIFS IFS=$OIFS
dotdiff=`expr ${#VER[*]} - ${#SVER[*]}` dotdiff=`expr ${#VER[*]} - ${#SVER[*]}`
@ -240,24 +243,26 @@ for p in ${allpkgs}; do
elif [ $dotdiff -lt 0 ]; then elif [ $dotdiff -lt 0 ]; then
[ "$VERBOSE" ] && echo "$p: newer version has less dots than older ${#VER[*]} < ${#SVER[*]}; skipping." [ "$VERBOSE" ] && echo "$p: newer version has less dots than older ${#VER[*]} < ${#SVER[*]}; skipping."
continue continue
elif [ "$i" != "${#SVER[*]}" ]; then #elif [ "$i" != "${#SVER[*]}" ]; then
# e.g. SVER=0.11 -> VER=1.0 # # e.g. SVER=0.11 -> VER=1.0
[ "$VERBOSE" ] && echo "$p: not a minor version update at position $i/${#SVER[*]}: ${SVER[i-1]} != ${VER[i-1]}; skipping." # [ "$VERBOSE" ] && echo "$p: not a minor version update at position $i/${#SVER[*]}: ${SVER[i-1]} != ${VER[i-1]}; skipping."
continue # continue
elif [ "${SVER[i-1]}" = "${VER[i-1]}" -a $dotdiff -ge 1 ]; then elif [ "${SVER[i-1]}" = "${VER[i-1]}" -a $dotdiff -ge 1 ]; then
# e.g. SVER=0.11.2 -> VER=0.11.2.3 # e.g. SVER=0.11.2 -> VER=0.11.2.3
update_type="minor" update_type="minor"
else elif [[ 64#${VER[i-1]} -gt 64#89 && 64#${SVER[i-1]} -lt 64#80 ]]; then
if [[ 64#${VER[i-1]} -gt 64#89 && 64#${SVER[i-1]} -lt 64#80 ]]; then
[ "$VERBOSE" ] && echo "$p: dubious beta upgrade from ${SVER[i-1]} to ${VER[i-1]}; skipping." [ "$VERBOSE" ] && echo "$p: dubious beta upgrade from ${SVER[i-1]} to ${VER[i-1]}; skipping."
continue continue
fi elif [[ 64#${VER[i-1]} -gt 64#${SVER[i-1]} && $i -gt 1 ]]; then
echo "$p: UNEXPECTED CASE - CHECK CODE; skipping." # e.g. SVER=1.0.2 -> VER=1.0.3.dev1234
continue update_type="minor"
#else
# [ "$VERBOSE" ] && echo "$p: major version update ${SVER[i-1]} vs ${VER[i-1]}; skipping"
# continue
fi fi
fi fi
if [ "$needsport" -o "$pkg_repository" == "$PORT_REPOSITORY" ]; then if [ "$old_pkg_repository" == "$PORT_REPOSITORY" -o "$old_pkg_repository" == "$DEST_REPOSITORY" ]; then
echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($pkg_version-$pkg_release -> $spkg_version-$spkg_release)" echo "$p: importing from $SOURCE_REPOSITORY to $PORT_REPOSITORY ($pkg_version-$pkg_release -> $old_pkg_version-$old_pkg_release)"
if [ ! "$TESTMODE" ]; then if [ ! "$TESTMODE" ]; then
autodist-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null autodist-repository import $SOURCE_REPOSITORY $p -d $PORT_REPOSITORY -y >/dev/null
if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then
@ -265,17 +270,17 @@ for p in ${allpkgs}; do
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 fi
elif [ "$pkg_repository" == "$DEST_REPOSITORY" ]; then #elif [ "$old_pkg_repository" == "$DEST_REPOSITORY" ]; then
echo "$p: importing from $SOURCE_REPOSITORY to $DEST_REPOSITORY ($pkg_version-$pkg_release -> $spkg_version-$spkg_release; update type: $update_type)" # echo "$p: importing from $SOURCE_REPOSITORY to $DEST_REPOSITORY ($pkg_version-$pkg_release -> $old_pkg_version-$old_pkg_release; update type: $update_type)"
if [ ! "$TESTMODE" ]; then # if [ ! "$TESTMODE" ]; then
autodist-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null # autodist-repository import $SOURCE_REPOSITORY $p -d $DEST_REPOSITORY -y >/dev/null
if [ $? -eq 0 -a "$WEBBUILD_URL" -a "$WEBBUILD_USER" ]; then # 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&\ # 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
else # else
echo "$p: unexpected upstream package repository; ignoring." # echo "$p: upstream package repository $pkg_repository does not match with $DEST_REPOSITORY; skipping."
fi fi
done done