summaryrefslogtreecommitdiffstats
path: root/mga-move-update
diff options
context:
space:
mode:
Diffstat (limited to 'mga-move-update')
-rwxr-xr-xmga-move-update72
1 files changed, 60 insertions, 12 deletions
diff --git a/mga-move-update b/mga-move-update
index cd9138a..a43605e 100755
--- a/mga-move-update
+++ b/mga-move-update
@@ -33,17 +33,24 @@ release="$1"
section="$2"
srcname="$3"
+exactsrpm=
+destination='updates'
+[ 'cauldron' = "$release" ] && destination='release'
+
for file in "$distribdir/$release/SRPMS/$section/updates_testing/"*.rpm; do
+ pkg=$(rpm -qp --qf '%{NAME}' "$file")
+
# Check exact match
bfile=$(basename "$file")
if [ "$bfile" = "$srcname" ]; then
+ exactsrpm=y
+ srcname=$pkg
srcpkg=$bfile
break
fi
# Check for src package name
- fname=$(rpm -qp --qf '%{NAME}' "$file")
- if [ "$fname" = "$srcname" ]; then
+ if [ "$pkg" = "$srcname" ]; then
srcpkg=$bfile
break
fi
@@ -54,12 +61,37 @@ if [ -z "$srcpkg" ]; then
exit 2
fi
+oldsrcpkg=
+if [ 'release' = "$destination" ]; 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
+ pkg=$(rpm -qp --qf '%{NAME}' "$file")
+ if [ "$pkg" = "$srcname" ]; then
+ oldsrcpkg=$bfile
+ break
+ fi
+ done
+
+ # (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
+ exit 2
+ fi
+fi
+
+
# Safety check
-if [ "$srcname" != "$srcpkg" -a -z "$noconfirm" ]; then
- echo "This SRPM (and matching binaries) will be moved from 'updates_testing' to 'updates':"
- echo
- echo " $srcpkg"
+if [ -n "$exactsrpm" -a -z "$noconfirm" -o 'release' = "$destination" ]; then
+ echo "This SRPM (and matching binaries) will be moved from 'updates_testing' to '$destination':"
+ echo "- $srcpkg"
echo
+ if [ 'release' = "$destination" ]; then
+ echo "This SRPM (and matching binaries) will be moved from 'release' to '\~schedbot/old':"
+ echo "- $oldsrcpkg"
+ echo
+ fi
read -p "Are you sure? [Y/n] " yn
[ -z "$yn" ] yn=y
@@ -78,8 +110,8 @@ function movepkg()
commands="$5"
for file in "$srcdir/"*.rpm; do
- fname=$(rpm -qp --qf '%{SOURCERPM}' "$file")
- if [ "$fname" = "$srcpkg" ]; then
+ srpm=$(rpm -qp --qf '%{SOURCERPM}' "$file")
+ if [ "$srpm" = "$srcpkg" ]; then
echo " $(basename $file)" | tee -a "$content"
$dryrun mv -v -f "$file" "$destdir" >>"$commands" 2>&1
fi
@@ -88,18 +120,34 @@ function movepkg()
mailcontent=$(mktemp)
mailcommands=$(mktemp)
+
+if [ 'release' = "$destination" ]; then
+ 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/release" "/var/lib/schedbot/old/" "$oldsrcpkg" "$mailcontent" "$mailcommands"
+ movepkg "$distribdir/$release/$arch/media/debug/$section/release" "/var/lib/schedbot/old/" "$oldsrcpkg" "$mailcontent" "$mailcommands"
+ done
+ echo "- source:" | tee -a "$mailcontent"
+ echo " $oldsrcpkg" | tee -a "$mailcontent"
+ echo >> "$mailcontent"
+ echo >> "$mailcontent"
+ $dryrun mv -v -f "$distribdir/$release/SRPMS/$section/release/$oldsrcpkg" "/var/lib/schedbot/old/" >>"$mailcommands" 2>&1
+fi
+
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/updates/" "$srcpkg" "$mailcontent" "$mailcommands"
- movepkg "$distribdir/$release/$arch/media/debug/$section/updates_testing" "$distribdir/$release/$arch/media/debug/$section/updates/" "$srcpkg" "$mailcontent" "$mailcommands"
+ 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"
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/updates/" >>"$mailcommands" 2>&1
+$dryrun mv -v -f "$distribdir/$release/SRPMS/$section/updates_testing/$srcpkg" "$distribdir/$release/SRPMS/$section/$destination/" >>"$mailcommands" 2>&1
if [ -n "$dryrun" ]; then
cat "$mailcontent" "$mailcommands"
@@ -116,7 +164,7 @@ else
if [ -z "$nosync" ]; then
update_distro_hdlist "$release" "$section" "updates_testing"
- update_distro_hdlist "$release" "$section" "updates"
+ update_distro_hdlist "$release" "$section" "$destination"
update_common_MD5SUM "$release"
mirror_repository "$release"
fi