What's cooking (2011/04 #04)
[alt-git.git] / DoKernelOrg
blob7e3e9c607018ab00efae9e8a93f99fd132ba9827
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=
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 --final) final=t ;;
22 --pub=?*) G=${1#--pub=} ;;
23 *) echo >&3 "Eh? $1"; exit 1 ;;
24 esac
25 shift
26 done
28 while test -n "$STAGE" && test "$STAGE" != "${STAGE%/}"
30 STAGE="${STAGE%/}"
31 done
33 if test -z "$master"
34 then
35 case "$(hostname)" in
36 hera.kernel.org) master=t ;;
37 *) master=f ;;
38 esac
41 if test t = "$master"
42 then
43 narch='x86_64 i386 i686'
44 if test -z "$final"
45 then
46 case "$STAGE" in
47 ?*) final=f ;;
48 '') final=t ;;
49 esac
51 else
52 if test t != "$rpm"
53 then
54 echo >&3 "'--dist-only' only makes sense on the master machine"
55 exit 1
57 if test t = "$final"
58 then
59 echo >&3 "'--final' only makes sense on the master machine"
60 exit 1
64 eval $(rpm --showrc | sed -ne '
65 s/^-14: dist[ ]*\./dist=/p
66 s/^-11= _target_cpu[ ]*/arch=/p
67 ') && test -n "$dist" && test -n "$arch" || exit 1
69 d='
70 MAN_BASE_URL="http://www.kernel.org/pub/software/scm/git/docs/"
71 ASCIIDOC_NO_ROFF=YesPlease
72 ASCIIDOC8=YesPlease
73 BLK_SHA1=YesPlease
74 GNU_ROFF=YesPlease
77 rm -f version
78 echo "* Building $THIS"
80 make $jobs git &&
81 V=`./git --version | sed -e 's/git version //'` || exit
83 make $jobs dist || exit
85 if test t = "$rpm"
86 then
87 NEEDS_CRYPTO_WITH_SSL=YesPlease make $jobs $d rpm || exit
90 if test t != "$master"
91 then
93 cd "$HOME/rpms/" &&
94 tar cf "TARPIT/$V.$arch.$dist.tar" \
95 RPMS/$arch/*-$V-*.$dist.$arch.rpm &&
96 ls -ld $HOME/rpms/TARPIT/$V.$arch.$dist.tar
97 ) || exit
98 make clean
99 echo >&2 "Done -- move RPMS to the master machine."
100 echo >&2 "scp $HOME/rpms/TARPIT/$V.$arch.$dist.tar master.kernel.org:rpms/TARPIT"
101 exit
104 make $jobs $d dist-doc || exit
106 mkdir -p "$STAGE$G" &&
107 ln_or_cp git-$V.tar.gz "$STAGE$G/." &&
108 ln_or_cp git-htmldocs-$V.tar.gz git-manpages-$V.tar.gz "$STAGE$G/." &&
109 mkdir -p "$STAGE$G/docs/v$V" &&
110 tar Cxf "$STAGE$G/docs/v$V" "$STAGE$G/git-htmldocs-$V.tar.gz" || exit
112 case "$V" in
113 *.rc[0-9]* | *-rc[0-9]*)
114 mkdir -p "$STAGE$G/testing" || exit
115 for a in $narch
117 for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
119 test -f "$rr" || continue
120 ln_or_cp "$rr" "$STAGE$G/testing/." || exit
121 done
122 done
123 ln_or_cp $HOME/rpms/SRPMS/git-$V-*.src.rpm "$STAGE$G/testing/." || exit
126 mkdir -p "$STAGE$G/RPMS/$arch" "$STAGE$G/RPMS/SRPMS" || exit
127 for a in $narch
129 mkdir -p "$STAGE$G/RPMS/$a" || exit
130 for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
132 test -f "$rr" || continue
133 ln_or_cp "$rr" "$STAGE$G/RPMS/$a/." || exit
134 done
135 done
136 ln_or_cp $HOME/rpms/SRPMS/git-$V-*.src.rpm "$STAGE$G/RPMS/SRPMS/." || exit
137 esac
139 make clean
141 if test t = "$final"
142 then
143 if test -n "$STAGE"
144 then
146 cd "$STAGE$G" &&
147 find . ! -type d -print0 | cpio -0plumda "$G" ||
148 find . ! -type d -print0 | cpio -0pumda "$G"
150 fi || exit
151 if test -f /usr/local/bin/yummy
152 then
153 for a in $narch
155 /usr/local/bin/yummy "$G/RPMS/$a"
156 done
157 /usr/local/bin/yummy "$G/RPMS/SRPMS"