#!/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 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" 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 } mailcontent=$(mktemp) for arch in $arches do 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 $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" post fi rm -f "$mailcontent"