1 |
#!/bin/sh |
2 |
|
3 |
. /usr/share/mgatools/functions |
4 |
moveupdate_allowed_group=mga-qa |
5 |
|
6 |
dryrun=echo |
7 |
|
8 |
distrorelease="$1" |
9 |
section="$2" |
10 |
srcname="$3" |
11 |
if test -z $distrorelease || test -z $section || test -z $srcname |
12 |
then |
13 |
echo 'Missing argument' >&2 |
14 |
exit 1 |
15 |
fi |
16 |
|
17 |
for file in "$distribdir/$distrorelease/SRPMS/$section/updates_testing/"*.rpm |
18 |
do |
19 |
fname=$(rpm -qp --qf '%{NAME}' "$file") |
20 |
if [ a"$fname" = a"$srcname" ] |
21 |
then |
22 |
srcpkg=$(basename "$file") |
23 |
break |
24 |
fi |
25 |
done |
26 |
|
27 |
if [ -z $srcpkg ] |
28 |
then |
29 |
echo "The package $srcname could not be found in $distrorelease/$section/updates_testing repository." >&2 |
30 |
exit 2 |
31 |
fi |
32 |
|
33 |
function movepkg() |
34 |
{ |
35 |
srcdir="$1" |
36 |
destdir="$2" |
37 |
srcpkg="$3" |
38 |
output="$4" |
39 |
|
40 |
for file in "$srcdir/"*.rpm |
41 |
do |
42 |
fname=$(rpm -qp --qf '%{SOURCERPM}' "$file") |
43 |
if [ a"$fname" = a"$srcpkg" ] |
44 |
then |
45 |
$dryrun mv -v -f "$file" "$destdir" >> "$output" |
46 |
fi |
47 |
done |
48 |
} |
49 |
|
50 |
mailcontent=$(mktemp) |
51 |
for arch in $arches |
52 |
do |
53 |
movepkg "$distribdir/$distrorelease/$arch/media/$section/updates_testing" "$distribdir/$distrorelease/$arch/media/$section/updates/" "$srcpkg" "$mailcontent" |
54 |
movepkg "$distribdir/$distrorelease/$arch/media/debug/$section/updates_testing" "$distribdir/$distrorelease/$arch/media/debug/$section/updates/" "$srcpkg" "$mailcontent" |
55 |
done |
56 |
|
57 |
if [ -z $dryrun ] |
58 |
then |
59 |
cat "$mailcontent" |
60 |
else |
61 |
/usr/bin/mailx -s "mga-move-update $distrorelease $section $srcname" -S "from=moveupdate_mailfrom" "$moveupdate_mailto" < "$mailcontent" |
62 |
fi |
63 |
rm -f "$mailcontent" |
64 |
|