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