cook.sh: separate reading and output of template in separate phases
[git] / DoKernelOrg
1 #!/bin/sh
2
3 : ${J='-l 4 -j'}
4 G=/pub/software/scm/git &&
5
6 HERE=$(git symbolic-ref HEAD) || exit 1
7 THIS=$(git describe HEAD)
8
9 rm -f version
10 case `hostname` in
11 hera.kernel.org)
12         narch='x86_64 i386'
13         arch=x86_64 ;;
14 wing-fc*|fc*.siamese.dyndns.org)
15         eval $(rpm --showrc | sed -ne '
16                 s/^-14: dist[   ]*\./dist=/p
17                 s/^-14: _build_arch[    ]*/arch=/p
18         ') &&
19         test -n "$dist" && test -n "$arch" || exit 1
20         ;;
21 *)      echo >&2 "What are you talking about???"
22         exit 1 ;;
23 esac &&
24 : >./:all.log &&
25 echo "* Building $THIS" &&
26 make $J git >./:all.log 2>&1 &&
27 V=`./git --version | sed -e 's/git version //'` &&
28 make rpm >>./:all.log 2>&1 &&
29 case "$narch" in
30 '')
31         # This is not the primary build machine.
32         status=$?
33         case "$status" in
34         0)
35                 echo >&2 "Done -- move RPMS to the master machine."
36                 (
37                         cd "$HOME/rpms/" &&
38                         tar cf "TARBALL/$V.$arch.$dist.tar" \
39                                 RPMS/$arch/*-$V-*.$dist.$arch.rpm &&
40                         ls -ld $HOME/rpms/TARBALL/$V.$arch.$dist.tar
41                 ) &&
42                 make clean
43                 ;;
44         ?)
45                 echo >&2 "Failed with status $status"
46                 ;;
47         esac
48         exit $status ;;
49 *)
50         make dist-doc >>./:all.log 2>&1 &&
51         ln -f git-$V.tar.gz $G/. &&
52         ln -f git-htmldocs-$V.tar.gz git-manpages-$V.tar.gz $G/.
53         ;;
54 esac >>./:all.log 2>&1 &&
55 case "$V" in
56 *.rc[0-9]* | *-rc[0-9]*)
57         mkdir -p $G/testing &&
58         for a in $narch
59         do
60                 for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
61                 do
62                         test -f "$rr" || continue
63                         ln -f "$rr" $G/testing/.
64                 done
65         done &&
66         ln -f $HOME/rpms/SRPMS/git-$V-*.src.rpm $G/testing/.
67         ;;
68 *)
69         mkdir -p $G/RPMS/$arch $G/RPMS/SRPMS &&
70         for a in $narch
71         do
72                 mkdir -p "$G/RPMS/$a" &&
73                 for rr in $HOME/rpms/RPMS/$a/*-$V-*.$a.rpm
74                 do
75                         test -f "$rr" || continue
76                         ln -f "$rr" $G/RPMS/$a/.
77                 done
78         done &&
79         ln -f $HOME/rpms/SRPMS/git-$V-*.src.rpm $G/RPMS/SRPMS/. &&
80         {
81                 # I do not know how it exits, and I do not care much.
82                 for a in $narch
83                 do
84                         /usr/local/bin/yummy $G/RPMS/$a
85                 done
86                 /usr/local/bin/yummy $G/RPMS/SRPMS
87                 :
88         } >>./:all.log 2>&1 ;;
89 esac &&
90 make clean