diff options
author | Colin Guthrie <colin@mageia.org> | 2014-07-28 14:50:01 +0100 |
---|---|---|
committer | Colin Guthrie <colin@mageia.org> | 2014-07-28 14:50:01 +0100 |
commit | b20033f3f63706b6fd6cc92168eb58ff1e97d58d (patch) | |
tree | df7724e6e454038ee40193d665bc93fe583e38e9 /mga-move-update-nosync | |
parent | f532a717bedc0282204b3dd48871e810bb0cb79f (diff) | |
download | mgatools-b20033f3f63706b6fd6cc92168eb58ff1e97d58d.tar mgatools-b20033f3f63706b6fd6cc92168eb58ff1e97d58d.tar.gz mgatools-b20033f3f63706b6fd6cc92168eb58ff1e97d58d.tar.bz2 mgatools-b20033f3f63706b6fd6cc92168eb58ff1e97d58d.tar.xz mgatools-b20033f3f63706b6fd6cc92168eb58ff1e97d58d.zip |
Changes made on live clone on valstar as at 28th July 2014topic/valstar
Diffstat (limited to 'mga-move-update-nosync')
-rwxr-xr-x | mga-move-update-nosync | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/mga-move-update-nosync b/mga-move-update-nosync new file mode 100755 index 0000000..ad0782c --- /dev/null +++ b/mga-move-update-nosync @@ -0,0 +1,114 @@ +#!/bin/sh + +. /usr/share/mgatools/functions + +if [ $# != 3 ] +then + echo 'Usage: mga-move-update distrorelease section srcname' >&2 + exit 1 +fi + +distrorelease="$1" +section="$2" +srcname="$3" + +if ! inlist "$distrorelease" "$distroreleases" +then + echo "Incorrect distrorelease $distrorelease" >&2 + exit 1 +fi + +if ! inlist "$section" "$distrosections" +then + echo "Incorrect section $section" >&2 + exit 1 +fi + +for file in "$distribdir/$distrorelease/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 $distrorelease/$section/updates_testing repository." >&2 + exit 2 +fi + +# safety check +echo " This SRPM (and matching binarys) will be moved from updates_testing to updates:" >&2 +echo " " >&2 +echo " $srcpkg" >&2 +echo " " >&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)" + fi + done +} + +#function post() +#{ +# for arch in $arches +# do +# update_hdlist "$distribdir/$distrorelease/$arch/media/$section/updates_testing" +# update_hdlist "$distribdir/$distrorelease/$arch/media/$section/updates" +# update_hdlist "$distribdir/$distrorelease/$arch/media/debug/$section/updates_testing" +# update_hdlist "$distribdir/$distrorelease/$arch/media/debug/$section/updates" +# done +# update_hdlist "$distribdir/$distrorelease/SRPMS/$section/updates_testing" +# update_hdlist "$distribdir/$distrorelease/SRPMS/$section/updates" +# update_common_MD5SUM $distrorelease +# mirror_repository $distrorelease +#} + +echo "" +echo "moving binary and source rpms:" +mailcontent=$(mktemp) +for arch in $arches +do + echo "" + echo "$arch:" + movepkg "$distribdir/$distrorelease/$arch/media/$section/updates_testing" "$distribdir/$distrorelease/$arch/media/$section/updates/" "$srcpkg" "$mailcontent" + movepkg "$distribdir/$distrorelease/$arch/media/debug/$section/updates_testing" "$distribdir/$distrorelease/$arch/media/debug/$section/updates/" "$srcpkg" "$mailcontent" +done +echo "" +echo "SRPMS:" +echo "$srcpkg" +echo "" +$dryrun mv -v -f "$distribdir/$distrorelease/SRPMS/$section/updates_testing/$srcpkg" "$distribdir/$distrorelease/SRPMS/$section/updates/" >> "$output" + +if [ -n "$dryrun" ] +then + cat "$mailcontent" +else + /usr/bin/mailx -s "mga-move-update $distrorelease $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" |