What's cooking (2013/10 #07)
[git.git] / DoKernelOrg
blobb31452a921d24eca43d57ad66afc730c8a22cafd
1 #!/bin/sh
3 exec 3>&2 >./:all.log 2>&1
5 ln_or_cp () {
6 ln -f "$@" || cp -f "$@"
9 STAGE= narch= arch= master= jobs= rpm=t final= clean_stage=
10 G=/pub/software/scm/git
11 THIS=$(git describe HEAD)
13 while case "$1" in -*) ;; *) break ;; esac
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 --clean-stage) clean_stage=t ;;
22 --final) final=t ;;
23 --pub=?*) G=${1#--pub=} ;;
24 *) echo >&3 "Eh? $1"; exit 1 ;;
25 esac
26 shift
27 done
29 while test -n "$STAGE" && test "$STAGE" != "${STAGE%/}"
31 STAGE="${STAGE%/}"
32 done
34 if test -n "$clean_stage" && test -d "$STAGE/$G"
35 then
36 echo -n "Remove $STAGE/$G [y/N]? "
37 read yesno
38 case "$yesno" in
39 [yY])
40 rm -fr "$STAGE/$G" &&
41 mkdir -p "$STAGE/$G" || exit ;;
43 echo "Not removing, then"
44 exit 0 ;;
45 esac
48 if test -z "$master"
49 then
50 case "$(hostname)" in
51 hera.kernel.org) master=t ;;
52 *) master=f ;;
53 esac
56 if test t = "$master"
57 then
58 narch='x86_64 i386 i686'
59 if test -z "$final"
60 then
61 case "$STAGE" in
62 ?*) final=f ;;
63 '') final=t ;;
64 esac
66 else
67 if test t != "$rpm"
68 then
69 echo >&3 "'--dist-only' only makes sense on the master machine"
70 exit 1
72 if test t = "$final"
73 then
74 echo >&3 "'--final' only makes sense on the master machine"
75 exit 1
79 eval $(rpm --showrc | sed -ne '
80 s/^-14: dist[ ]*\./dist=/p
81 s/^-11= _target_cpu[ ]*/arch=/p
82 ') && test -n "$dist" && test -n "$arch" || exit 1
84 d='
85 MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
86 ASCIIDOC_NO_ROFF=YesPlease
87 ASCIIDOC8=YesPlease
88 BLK_SHA1=YesPlease
89 GNU_ROFF=YesPlease
92 rm -f version
93 echo "* Building $THIS"
95 make $jobs git &&
96 V=`./git --version | sed -e 's/git version //'` || exit
98 make $jobs dist || exit
100 if test t = "$rpm"
101 then
102 NEEDS_CRYPTO_WITH_SSL=YesPlease make $jobs $d rpm || exit
105 if test t != "$master"
106 then
108 cd "$HOME/rpms/" &&
109 tar cf "TARPIT/$V.$arch.$dist.tar" \
110 RPMS/$arch/*-$V-*.$dist.$arch.rpm &&
111 ls -ld $HOME/rpms/TARPIT/$V.$arch.$dist.tar
112 ) || exit
113 make clean
114 echo >&2 "Done -- move RPMS to the master machine."
115 echo >&2 "scp $HOME/rpms/TARPIT/$V.$arch.$dist.tar master.kernel.org:rpms/TARPIT"
116 echo >&2 "sha1sum -c <<\EOF"
117 (cd $HOME/rpms && sha1sum TARPIT/$V.$arch.$dist.tar) >&2
118 echo >&2 "EOF"
119 exit
122 make $jobs $d dist-doc || exit
124 mkdir -p "$STAGE$G" &&
125 ln_or_cp git-$V.tar.gz "$STAGE$G/." &&
126 ln_or_cp git-htmldocs-$V.tar.gz git-manpages-$V.tar.gz "$STAGE$G/." &&
127 mkdir -p "$STAGE$G/docs/v$V" &&
128 tar Cxf "$STAGE$G/docs/v$V" "$STAGE$G/git-htmldocs-$V.tar.gz" || exit
130 case "$V" in
131 *.rc[0-9]* | *-rc[0-9]*)
132 mkdir -p "$STAGE$G/testing" || exit
133 for a in $narch
135 for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
137 test -f "$rr" || continue
138 ln_or_cp "$rr" "$STAGE$G/testing/." || exit
139 done
140 done
141 ln_or_cp $HOME/rpms/SRPMS/git-$V-*.src.rpm "$STAGE$G/testing/." || exit
144 mkdir -p "$STAGE$G/RPMS/$arch" "$STAGE$G/RPMS/SRPMS" || exit
145 for a in $narch
147 mkdir -p "$STAGE$G/RPMS/$a" || exit
148 for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
150 test -f "$rr" || continue
151 ln_or_cp "$rr" "$STAGE$G/RPMS/$a/." || exit
152 done
153 done
154 ln_or_cp $HOME/rpms/SRPMS/git-$V-*.src.rpm "$STAGE$G/RPMS/SRPMS/." || exit
155 esac
157 make clean
159 if test t = "$final"
160 then
161 if test -n "$STAGE"
162 then
164 cd "$STAGE$G" &&
165 find . ! -type d -print0 | cpio -0plumda "$G" ||
166 find . ! -type d -print0 | cpio -0pumda "$G"
168 fi || exit
169 if test -f /usr/local/bin/yummy
170 then
171 for a in $narch
173 /usr/local/bin/yummy "$G/RPMS/$a"
174 done
175 /usr/local/bin/yummy "$G/RPMS/SRPMS"