DoKernelOrg: stage and then install
Junio C Hamano committed
Dec 16, 2010 at 16:51 UTC
da74a90e263461e86d1010dc2bf2b350dceea21d
1 file changed
+129
-66
DoKernelOrg
+129
-66
@@ -1,97 +1,160 @@
1
#!/bin/sh
2
3
-: ${J='-l 4 -j'}
4
-G=/pub/software/scm/git &&
3
+exec 3>&2 >./:all.log 2>&1
4
6
-# HERE=$(git symbolic-ref HEAD) || exit 1
5
+ln_or_cp () {
6
+ ln -f "$@" || cp -f "$@"
7
+}
8
+
9
+STAGE= narch= arch= master= jobs= rpm=t final=
10
+G=/pub/software/scm/git
11
THIS=$(git describe HEAD)
12
13
+while case "$1" in -*) ;; *) break ;; esac
14
+do
15
+ case "$1" in
16
+ --master) master=t ;;
17
+ --slave) master=f ;;
18
+ -j*) jobs="$1" ;;
19
+ --dist-only) rpm=f ;;
20
+ --stage=?*) STAGE=${1#--stage=} ;;
21
+ --final) final=t ;;
22
+ --pub=?*) G=${1#--pub=} ;;
23
+ *) echo >&3 "Eh? $1"; exit 1 ;;
24
+ esac
25
+ shift
26
+done
27
+
28
+while test -n "$STAGE" && test "$STAGE" != "${STAGE%/}"
29
+do
30
+ STAGE="${STAGE%/}"
31
+done
32
+
33
+if test -z "$final"
34
+then
35
+ case "$STAGE" in
36
+ ?*) final=f ;;
37
+ '') final=t ;;
38
+ esac
39
+fi
40
+
41
+if test -z "$master"
42
+then
43
+ case "$(hostname)" in
44
+ hera.kernel.org) master=t ;;
45
+ *) master=f ;;
46
+ esac
47
+fi
48
+
49
+if test t = "$master"
50
+then
51
+ narch='x86_64 i386 i686'
52
+else
53
+ if test t != "$rpm"
54
+ then
55
+ echo >&3 "'--dist-only' only makes sense on the master machine"
56
+ exit 1
57
+ fi
58
+ if test t = "$final"
59
+ then
60
+ echo >&3 "'--final' only makes sense on the master machine"
61
+ exit 1
62
+ fi
63
+fi
64
+
65
+eval $(rpm --showrc | sed -ne '
66
+ s/^-14: dist[ ]*\./dist=/p
67
+ s/^-11= _target_cpu[ ]*/arch=/p
68
+') && test -n "$dist" && test -n "$arch" || exit 1
69
+
70
d='
71
MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
72
ASCIIDOC_NO_ROFF=YesPlease
73
ASCIIDOC8=YesPlease
74
BLK_SHA1=YesPlease
14
-GNU_ROFF=YesPlease'
75
+GNU_ROFF=YesPlease
76
+'
77
78
rm -f version
17
-case `hostname` in
18
-hera.kernel.org)
19
- narch='x86_64 i386 i686'
20
- arch=x86_64 ;;
21
-wing-fc*|fc*.siamese.dyndns.org|fc*)
22
- eval $(rpm --showrc | sed -ne '
23
- s/^-14: dist[ ]*\./dist=/p
24
- s/^-11= _target_cpu[ ]*/arch=/p
25
- ') &&
26
- test -n "$dist" && test -n "$arch" || exit 1
27
- ;;
28
-*) echo >&2 "What are you talking about???"
29
- exit 1 ;;
30
-esac &&
31
-: >./:all.log &&
32
-echo "* Building $THIS" &&
33
-make $J git >./:all.log 2>&1 &&
34
-V=`./git --version | sed -e 's/git version //'` &&
35
-NEEDS_CRYPTO_WITH_SSL=YesPlease make $d rpm >>./:all.log 2>&1 &&
36
-case "$narch" in
37
-'')
38
- # This is not the primary build machine.
39
- status=$?
40
- case "$status" in
41
- 0)
42
- echo >&2 "Done -- move RPMS to the master machine."
43
- (
44
- cd "$HOME/rpms/" &&
45
- tar cf "TARBALL/$V.$arch.$dist.tar" \
46
- RPMS/$arch/*-$V-*.$dist.$arch.rpm &&
47
- ls -ld $HOME/rpms/TARBALL/$V.$arch.$dist.tar
48
- ) &&
49
- make clean
50
- ;;
51
- ?)
52
- echo >&2 "Failed with status $status"
53
- ;;
54
- esac
55
- exit $status ;;
56
-*)
57
- make $d dist-doc >>./:all.log 2>&1 &&
58
- ln -f git-$V.tar.gz $G/. &&
59
- ln -f git-htmldocs-$V.tar.gz git-manpages-$V.tar.gz $G/.
60
- ;;
61
-esac >>./:all.log 2>&1 &&
79
+echo "* Building $THIS"
80
+
81
+make $jobs git &&
82
+V=`./git --version | sed -e 's/git version //'` || exit
83
+
84
+make $jobs dist || exit
85
+
86
+if test t = "$rpm"
87
+then
88
+ NEEDS_CRYPTO_WITH_SSL=YesPlease make $jobs $d rpm || exit
89
+fi
90
+
91
+if test t != "$master"
92
+then
93
+ (
94
+ cd "$HOME/rpms/" &&
95
+ tar cf "TARPIT/$V.$arch.$dist.tar" \
96
+ RPMS/$arch/*-$V-*.$dist.$arch.rpm &&
97
+ ls -ld $HOME/rpms/TARPIT/$V.$arch.$dist.tar
98
+ ) || exit
99
+ make clean
100
+ echo >&2 "Done -- move RPMS to the master machine."
101
+ echo >&2 "scp $HOME/rpms/TARPIT/$V.$arch.$dist.tar master.kernel.org:rpms/TARPIT"
102
+ exit
103
+fi
104
+
105
+make $jobs $d dist-doc || exit
106
+
107
+mkdir -p "$STAGE$G" &&
108
+ln_or_cp git-$V.tar.gz "$STAGE$G/." &&
109
+ln_or_cp git-htmldocs-$V.tar.gz git-manpages-$V.tar.gz "$STAGE$G/." &&
110
+mkdir -p "$STAGE$G/docs/v$V" &&
111
+tar Cxf "$STAGE$G/docs/v$V" "$STAGE$G/git-htmldocs-$V.tar.gz" || exit
112
+
113
case "$V" in
114
*.rc[0-9]* | *-rc[0-9]*)
64
- mkdir -p $G/testing &&
115
+ mkdir -p "$STAGE$G/testing" || exit
116
for a in $narch
117
do
118
for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
119
do
120
test -f "$rr" || continue
70
- ln -f "$rr" $G/testing/.
121
+ ln_or_cp "$rr" "$STAGE$G/testing/." || exit
122
done
72
- done &&
73
- ln -f $HOME/rpms/SRPMS/git-$V-*.src.rpm $G/testing/.
123
+ done
124
+ ln_or_cp $HOME/rpms/SRPMS/git-$V-*.src.rpm "$STAGE$G/testing/." || exit
125
;;
126
*)
76
- mkdir -p $G/RPMS/$arch $G/RPMS/SRPMS &&
127
+ mkdir -p "$STAGE$G/RPMS/$arch" "$STAGE$G/RPMS/SRPMS" || exit
128
for a in $narch
129
do
79
- mkdir -p "$G/RPMS/$a" &&
130
+ mkdir -p "$STAGE$G/RPMS/$a" || exit
131
for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
132
do
133
test -f "$rr" || continue
83
- ln -f "$rr" $G/RPMS/$a/.
134
+ ln_or_cp "$rr" "$STAGE$G/RPMS/$a/." || exit
135
done
85
- done &&
86
- ln -f $HOME/rpms/SRPMS/git-$V-*.src.rpm $G/RPMS/SRPMS/. &&
87
- {
88
- # I do not know how it exits, and I do not care much.
136
+ done
137
+ ln_or_cp $HOME/rpms/SRPMS/git-$V-*.src.rpm "$STAGE$G/RPMS/SRPMS/." || exit
138
+esac
139
+
140
+make clean
141
+
142
+if test t = "$final"
143
+then
144
+ if test -n "$STAGE"
145
+ then
146
+ (
147
+ cd "$STAGE$G" &&
148
+ find . ! -type d -print0 | cpio -0plumda "$G" ||
149
+ find . ! -type d -print0 | cpio -0pumda "$G"
150
+ )
151
+ fi || exit
152
+ if test -f /usr/local/bin/yummy
153
+ then
154
for a in $narch
155
do
91
- /usr/local/bin/yummy $G/RPMS/$a
156
+ /usr/local/bin/yummy "$G/RPMS/$a"
157
done
93
- /usr/local/bin/yummy $G/RPMS/SRPMS
94
- :
95
- } >>./:all.log 2>&1 ;;
96
-esac &&
97
-make clean
158
+ /usr/local/bin/yummy "$G/RPMS/SRPMS"
159
+ fi
160
+fi