]> git.pld-linux.org Git - projects/pld-builder.new.git/blob - client/rebuild-th-kernel.sh
handle cases for multiple "/" mounts
[projects/pld-builder.new.git] / client / rebuild-th-kernel.sh
1 #!/bin/sh
2 set -e
3
4 dir=$(cd "$(dirname "$0")"; pwd)
5 rpmdir=$(rpm -E %_topdir)
6 dist=th
7
8 pkgs_head="
9         dahdi-linux
10         e1000e
11         igb
12         ipset
13         ixgbe
14         lin_tape
15         linuxrdac
16         lirc
17         madwifi-ng
18         open-vm-tools
19         r8168
20         VirtualBox
21         xorg-driver-video-fglrx
22         xorg-driver-video-fglrx-legacy-12.x
23         xorg-driver-video-nvidia
24         xtables-addons
25 "
26
27 pkgs_longterm=
28
29 # autotag from rpm-build-macros
30 # displays latest used tag for a specfile
31 autotag() {
32         local out spec pkg ref
33         for spec in "$@"; do
34                 # strip branches
35                 pkg=${spec%:*}
36                 # ensure package ends with .spec
37                 spec=${pkg%.spec}.spec
38                 # and pkg without subdir
39                 pkg=${pkg#*/}
40                 # or .ext
41                 pkg=${pkg%%.spec}
42                 cd $pkg
43                 git fetch --tags
44                 if [ -n "$alt_kernel" ]; then
45                         ref="refs/tags/auto/${dist}/${pkg}-${alt_kernel}-[0-9]*"
46                 else
47                         ref="refs/tags/auto/${dist}/${pkg}-[0-9]*"
48                 fi
49                 out=$(git for-each-ref $ref --sort=-authordate --format='%(refname:short)' --count=1)
50                 echo "$spec:$out"
51                 cd - >/dev/null
52         done
53 }
54
55 get_last_tags() {
56         local pkg spec
57
58         echo >&2 "Fetching package tags: $*..."
59         for pkg in "$@"; do
60                 echo >&2 "$pkg... "
61                 if [ ! -e $pkg/$pkg.spec ]; then
62                         $rpmdir/builder -g $pkg -ns -r HEAD 1>&2
63                 fi
64                 if [ ! -e $pkg/$pkg.spec ]; then
65                         # just print it out, to fallback to base pkg name
66                         echo "$pkg"
67                 else
68                         spec=$(autotag $pkg/$pkg.spec)
69                         spec=${spec#*/}
70                         echo >&2 "... $spec"
71                         echo $spec
72                 fi
73         done
74 }
75
76 cd $rpmdir
77 case "$1" in
78         head)
79                 kernel=$(get_last_tags kernel)
80                 kernel=$(echo ${kernel#*auto/??/} | tr _ .)
81                 specs=""
82                 for pkg in $pkgs_head; do
83                         echo >&2 "Rebuilding $pkg..."
84                         $rpmdir/builder -g $pkg -ns
85                         $rpmdir/relup.sh -m "rebuild for $kernel" -ui $pkg/$pkg.spec
86                         specs="$specs $pkg.spec"
87                 done
88                 $dir/make-request.sh -nd -r -d $dist $specs
89                 ;;
90         longterm)
91                 kernel=$(alt_kernel=longterm get_last_tags kernel)
92                 kernel=$(echo ${kernel#*auto/??/} | tr _ .)
93                 specs=""
94                 if [ -n "$pkgs_longterm" ]; then
95                         for pkg in $pkgs_longterm; do
96                                 echo >&2 "Rebuilding $pkg..."
97                                 $rpmdir/builder -g $pkg -ns
98                                 $rpmdir/relup.sh -m "rebuild for $kernel" -ui $pkg/$pkg.spec
99                                 specs="$specs $pkg.spec"
100                         done
101                         # first build with main pkg (userspace), later build from tag
102                         $dir/make-request.sh -nd -r -d $dist --without kernel $specs
103                 fi
104                 specs=$(get_last_tags $pkgs_head $pkgs_longterm)
105                 $dir/make-request.sh -nd -r -d $dist --kernel longterm --without userspace $specs
106                 ;;
107         *)
108                 # try to parse all args, filling them with last autotag
109                 while [ $# -gt 0 ]; do
110                         case "$1" in
111                         --kernel|--with|--without)
112                                 args="$1 $2"
113                                 shift
114                                 ;;
115                         -*)
116                                 args="$args $1"
117                                 ;;
118                         *)
119                                 specs="$specs $1"
120                                 ;;
121                         esac
122                         shift
123                 done
124                 specs=$(get_last_tags $specs)
125                 $dir/make-request.sh -nd -r -d $dist $args $specs
126                 ;;
127 esac
This page took 0.032228 seconds and 3 git commands to generate.