diff options
Diffstat (limited to 'mga-move-cauldron-nosync')
-rwxr-xr-x | mga-move-cauldron-nosync | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/mga-move-cauldron-nosync b/mga-move-cauldron-nosync new file mode 100755 index 0000000..3920c5f --- /dev/null +++ b/mga-move-cauldron-nosync @@ -0,0 +1,125 @@ +#!/bin/sh + +. /usr/share/mgatools/functions + +if [ $# != 2 ] +then + echo 'Usage: mga-move-cauldron-nosync section srcname' >&2 + exit 1 +fi + +section="$1" +srcname="$2" + + +if ! inlist "$section" "$distrosections" +then + echo "Incorrect section $section" >&2 + exit 1 +fi + +# old package +for file in "$distribdir/cauldron/SRPMS/$section/release/"*.rpm +do + fname=$(rpm -qp --qf '%{NAME}' "$file") + if [ a"$fname" = a"$srcname" ] + then + oldsrcpkg=$(basename "$file") + break + fi +done + +if [ -z $oldsrcpkg ] +then + echo "The package $srcname could not be found in cauldron/$section/release repository." >&2 +fi + +# new package +for file in "$distribdir/cauldron/SRPMS/$section/updates_testing/"*.rpm +do + fname=$(rpm -qp --qf '%{NAME}' "$file") + if [ a"$fname" = a"$srcname" ] + then + srcpkg=$(basename "$file") + break + fi +done + +if [ -z $srcpkg ] +then + echo "The package $srcname could not be found in cauldron/$section/updates_testing repository." >&2 +fi + +# safety check +echo " This SRPM (and matching binarys) will be removed from release to old: $oldsrcpkg" >&2 + +echo " This SRPM (and matching binarys) will be moved from updates_testing to release: $srcpkg" >&2 + +read -p " Are you sure ? " yn >&2 + +case $yn in + [Yy]* ) continue;; + * ) exit;; +esac + +function movepkg() +{ + srcdir="$1" + destdir="$2" + srcpkg="$3" + output="$4" + + for file in "$srcdir/"*.rpm + + do + fname=$(rpm -qp --qf '%{SOURCERPM}' "$file") + if [ a"$fname" = a"$srcpkg" ] + then + $dryrun mv -v -f "$file" "$destdir" >> "$output" + echo "$(basename $file)<br/>" + fi + done +} + +echo "" +echo "moving old binary and source rpms to shedbot/old:" +mailcontent=$(mktemp) +for arch in $arches +do + echo "" + echo "$arch:<br/>" + movepkg "$distribdir/cauldron/$arch/media/$section/release" "/var/lib/schedbot/old/" "$oldsrcpkg" "$mailcontent" + movepkg "$distribdir/cauldron/$arch/media/debug/$section/release" "/var/lib/schedbot/old/" "$oldsrcpkg" "$mailcontent" +done +echo "" +echo "SRPMS:<br/>" +echo "$oldsrcpkg<br/>" +echo "" +$dryrun mv -v -f "$distribdir/cauldron/SRPMS/$section/updates_testing/$srcpkg" "$distribdir/cauldron/SRPMS/$section/release/" >> "$output" + +echo "" +echo "moving binary and source rpms:" +mailcontent=$(mktemp) +for arch in $arches +do + echo "" + echo "$arch:<br/>" + movepkg "$distribdir/cauldron/$arch/media/$section/updates_testing" "$distribdir/cauldron/$arch/media/$section/release/" "$srcpkg" "$mailcontent" + movepkg "$distribdir/cauldron/$arch/media/debug/$section/updates_testing" "$distribdir/cauldron/$arch/media/debug/$section/release/" "$srcpkg" "$mailcontent" +done +echo "" +echo "SRPMS:<br/>" +echo "$srcpkg<br/>" +echo "" +$dryrun mv -v -f "$distribdir/cauldron/SRPMS/$section/updates_testing/$srcpkg" "$distribdir/cauldron/SRPMS/$section/release/" >> "$output" + +if [ -n "$dryrun" ] +then + cat "$mailcontent" +else + /usr/bin/mailx -s "mga-move-update cauldron $section $srcname" -S "from=moveupdate_mailfrom" "$moveupdate_mailto" < "$mailcontent" +# +# (tmb) dont do post before all rpms are moved, call update_hdlists manually +# post +fi +rm -f "$mailcontent" |