summaryrefslogtreecommitdiffstats
path: root/mga-move-update
diff options
context:
space:
mode:
authorColin Guthrie <colin@mageia.org>2014-07-29 01:30:10 +0100
committerColin Guthrie <colin@mageia.org>2014-07-29 01:42:38 +0100
commit678ea8153d78ab578535f9a1bbad41890352dfa3 (patch)
treeea56c23525f5dec11d84c2f093c0beb382b7c371 /mga-move-update
parent5a59bfda0e70d5314f831ee7010220b5e78744a8 (diff)
downloadmgatools-678ea8153d78ab578535f9a1bbad41890352dfa3.tar
mgatools-678ea8153d78ab578535f9a1bbad41890352dfa3.tar.gz
mgatools-678ea8153d78ab578535f9a1bbad41890352dfa3.tar.bz2
mgatools-678ea8153d78ab578535f9a1bbad41890352dfa3.tar.xz
mgatools-678ea8153d78ab578535f9a1bbad41890352dfa3.zip
move: Add support for moving backport packages.
This replaces two scripts found on the build system: mga-move-backports-{nosync,sync-mail} The latter scripts name includes the word 'sync' but it didn't actually do the sync. but as this script supports a --no-sync option, this is now fully optional. There seemed to be a stray $ in the old file. I don't think it was deliberate. The mail sent to the backports ML is nicer than before as it doesn't include output from raw commands, just a human readable equiv. This also still sends a mail for audit purposes regardless of the nice announce email
Diffstat (limited to 'mga-move-update')
-rwxr-xr-xmga-move-update62
1 files changed, 45 insertions, 17 deletions
diff --git a/mga-move-update b/mga-move-update
index a43605e..3e29d8a 100755
--- a/mga-move-update
+++ b/mga-move-update
@@ -21,8 +21,15 @@ if [ "$1" = "--no-confirm" ]; then
shift
fi
+backport=
+if [ "$1" = "--backports" ]; then
+ shift
+ backport=$1
+ shift
+fi
+
if [ $# != 3 ]; then
- echo "Usage: $0 [--dry-run] [--no-sync] [--no-confirm] <release> <section> <src-rpm-name>" >&2
+ echo "Usage: $0 [--dry-run] [--no-sync] [--no-confirm] [--backport <bug>] <release> <section> <src-rpm-name>" >&2
exit 1
fi
@@ -34,10 +41,22 @@ section="$2"
srcname="$3"
exactsrpm=
-destination='updates'
-[ 'cauldron' = "$release" ] && destination='release'
+sourcesubsection='updates_testing'
+destinationsubsection='updates'
+if [ 'cauldron' = "$release" ]; then
+ if [ -n "$backport" ]; then
+ echo "Error: Cannot use --backport with cauldron" >&2
+ exit 1
+ fi
+ destinationsubsection='release'
+fi
-for file in "$distribdir/$release/SRPMS/$section/updates_testing/"*.rpm; do
+if [ -n "$backport" ]; then
+ sourcesubsection='backports_testing'
+ destinationsubsection='backports'
+fi
+
+for file in "$distribdir/$release/SRPMS/$section/$sourcesubsection/"*.rpm; do
pkg=$(rpm -qp --qf '%{NAME}' "$file")
# Check exact match
@@ -57,12 +76,12 @@ for file in "$distribdir/$release/SRPMS/$section/updates_testing/"*.rpm; do
done
if [ -z "$srcpkg" ]; then
- echo "The package '$srcname' could not be found in the '$release/$section/updates_testing' repository." >&2
+ echo "The package '$srcname' could not be found in the '$release/$section/$sourcesubsection' repository." >&2
exit 2
fi
oldsrcpkg=
-if [ 'release' = "$destination" ]; then
+if [ 'release' = "$destinationsubsection" ]; then
# In cauldron we also have to move the old version from release to ~schedbot/old/
# We know srcname is a %{name} now.
for file in "$distribdir/$release/SRPMS/$section/release/"*.rpm; do
@@ -76,18 +95,18 @@ if [ 'release' = "$destination" ]; then
# (cg) Is this a valid check? What if it's a new package introduced first into testing
# Ultimately this is not very likely, so ignore it for now.
if [ -z "$oldsrcpkg" ]; then
- echo "The package '$srcname' could not be found in the '$release/$section/updates_testing' repository." >&2
+ echo "The package '$srcname' could not be found in the '$release/$section/$sourcesubsection' repository." >&2
exit 2
fi
fi
# Safety check
-if [ -n "$exactsrpm" -a -z "$noconfirm" -o 'release' = "$destination" ]; then
- echo "This SRPM (and matching binaries) will be moved from 'updates_testing' to '$destination':"
+if [ -n "$exactsrpm" -a -z "$noconfirm" -o 'release' = "$destinationsubsection" ]; then
+ echo "This SRPM (and matching binaries) will be moved from '$sourcesubsection' to '$destinationsubsection':"
echo "- $srcpkg"
echo
- if [ 'release' = "$destination" ]; then
+ if [ 'release' = "$destinationsubsection" ]; then
echo "This SRPM (and matching binaries) will be moved from 'release' to '\~schedbot/old':"
echo "- $oldsrcpkg"
echo
@@ -121,7 +140,7 @@ function movepkg()
mailcontent=$(mktemp)
mailcommands=$(mktemp)
-if [ 'release' = "$destination" ]; then
+if [ 'release' = "$destinationsubsection" ]; then
echo ""
echo "Moving binary and source rpms:" | tee -a "$mailcontent"
for arch in $arches; do
@@ -140,14 +159,14 @@ echo ""
echo "Moving binary and source rpms:" | tee -a "$mailcontent"
for arch in $arches; do
echo "- $arch:" | tee -a "$mailcontent"
- movepkg "$distribdir/$release/$arch/media/$section/updates_testing" "$distribdir/$release/$arch/media/$section/$destination/" "$srcpkg" "$mailcontent" "$mailcommands"
- movepkg "$distribdir/$release/$arch/media/debug/$section/updates_testing" "$distribdir/$release/$arch/media/debug/$section/$destination/" "$srcpkg" "$mailcontent" "$mailcommands"
+ movepkg "$distribdir/$release/$arch/media/$section/$sourcesubsection" "$distribdir/$release/$arch/media/$section/$destinationsubsection/" "$srcpkg" "$mailcontent" "$mailcommands"
+ movepkg "$distribdir/$release/$arch/media/debug/$section/$sourcesubsection" "$distribdir/$release/$arch/media/debug/$section/$destinationsubsection/" "$srcpkg" "$mailcontent" "$mailcommands"
done
echo "- source:" | tee -a "$mailcontent"
echo " $srcpkg" | tee -a "$mailcontent"
echo >> "$mailcontent"
echo >> "$mailcontent"
-$dryrun mv -v -f "$distribdir/$release/SRPMS/$section/updates_testing/$srcpkg" "$distribdir/$release/SRPMS/$section/$destination/" >>"$mailcommands" 2>&1
+$dryrun mv -v -f "$distribdir/$release/SRPMS/$section/$sourcesubsection/$srcpkg" "$distribdir/$release/SRPMS/$section/$destinationsubsection/" >>"$mailcommands" 2>&1
if [ -n "$dryrun" ]; then
cat "$mailcontent" "$mailcommands"
@@ -158,13 +177,22 @@ else
echo >>"$mailcontent"
echo >>"$mailcontent"
fi
- cat "$mailcommands" >>"$mailcontent"
+ if [ -n "$backport" ]; then
+ export SIG="https://bugs.mageia.org/show_bug.cgi?id=$backport"
+ $dryrun mutt -e 'set from="Mageia Backports <buildsystem-daemon@mageia.org>"' \
+ -e 'set signature="echo $SIG|"' \
+ -e 'set sig_dashes=no' \
+ backports-announce@ml.mageia.org -s "Package Backport: MGA $release/$section: $srcname" \
+ -i "$mailcontent"
+ fi
+
+ cat "$mailcommands" >>"$mailcontent"
/usr/bin/mailx -s "mga-move-update $release $section $srcname" -S "from=$moveupdate_mailfrom" "$moveupdate_mailto" < "$mailcontent"
if [ -z "$nosync" ]; then
- update_distro_hdlist "$release" "$section" "updates_testing"
- update_distro_hdlist "$release" "$section" "$destination"
+ update_distro_hdlist "$release" "$section" "$sourcesubsection"
+ update_distro_hdlist "$release" "$section" "$destinationsubsection"
update_common_MD5SUM "$release"
mirror_repository "$release"
fi