/[soft]/mgatools/trunk/mga-move-update
ViewVC logotype

Contents of /mgatools/trunk/mga-move-update

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1704 - (show annotations) (download)
Tue Jun 21 16:53:57 2011 UTC (12 years, 10 months ago) by boklm
File size: 1697 byte(s)
move dryrun to config
1 #!/bin/sh
2
3 . /usr/share/mgatools/functions
4 moveupdate_allowed_group=mga-qa
5
6 if [ $# != 3 ]
7 then
8 echo 'Usage: mga-move-update distrorelease section srcname' >&2
9 exit 1
10 fi
11
12 distrorelease="$1"
13 section="$2"
14 srcname="$3"
15
16 if ! inlist "$distrorelease" "$distroreleases"
17 then
18 echo "Incorrect distrorelease $distrorelease" >&2
19 exit 1
20 fi
21
22 if ! inlist "$section" "$distrosections"
23 then
24 echo "Incorrect section $section" >&2
25 exit 1
26 fi
27
28 for file in "$distribdir/$distrorelease/SRPMS/$section/updates_testing/"*.rpm
29 do
30 fname=$(rpm -qp --qf '%{NAME}' "$file")
31 if [ a"$fname" = a"$srcname" ]
32 then
33 srcpkg=$(basename "$file")
34 break
35 fi
36 done
37
38 if [ -z $srcpkg ]
39 then
40 echo "The package $srcname could not be found in $distrorelease/$section/updates_testing repository." >&2
41 exit 2
42 fi
43
44 function movepkg()
45 {
46 srcdir="$1"
47 destdir="$2"
48 srcpkg="$3"
49 output="$4"
50
51 for file in "$srcdir/"*.rpm
52 do
53 fname=$(rpm -qp --qf '%{SOURCERPM}' "$file")
54 if [ a"$fname" = a"$srcpkg" ]
55 then
56 $dryrun mv -v -f "$file" "$destdir" >> "$output"
57 fi
58 done
59 }
60
61 mailcontent=$(mktemp)
62 for arch in $arches
63 do
64 movepkg "$distribdir/$distrorelease/$arch/media/$section/updates_testing" "$distribdir/$distrorelease/$arch/media/$section/updates/" "$srcpkg" "$mailcontent"
65 movepkg "$distribdir/$distrorelease/$arch/media/debug/$section/updates_testing" "$distribdir/$distrorelease/$arch/media/debug/$section/updates/" "$srcpkg" "$mailcontent"
66 done
67
68 if [ -n $dryrun ]
69 then
70 cat "$mailcontent"
71 else
72 /usr/bin/mailx -s "mga-move-update $distrorelease $section $srcname" -S "from=moveupdate_mailfrom" "$moveupdate_mailto" < "$mailcontent"
73 fi
74 rm -f "$mailcontent"
75

  ViewVC Help
Powered by ViewVC 1.1.30