-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeall
274 lines (236 loc) · 13.7 KB
/
makeall
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
#!/bin/sh
VERS_BISECTING="REL8_4_0~885 REL8_4_0~857 REL8_4_0~830 REL8_4_0~816 REL8_4_0~802 REL8_4_0~788 REL8_4_0~775 REL8_4_0~567 REL8_4_0~360"
VERS_BAD="REL7_0~1310 REL7_0~1296 REL7_0~949 REL7_0~243 REL7_0~1310 REL7_1~2184 REL7_0 REL7_0_3 REL6_5_3"
VERS_BAD2="REL9_0_0~1761 REL9_0_0~1536 REL9_0_0~1654 REL7_2~2074 REL7_2~1771 REL8_4_0~1799 REL8_4_0~1819"
VERS_MORE="REL8_2_0~119 REL8_2_0~2170 REL8_2_0~1811 REL8_3_0~1076 REL8_4_0~1603 REL8_4_0~2268 REL8_4_0~856 REL8_4_0~151 REL8_2_0~119 REL8_0_0~277 REL8_1_0~1754 REL8_2_0~1409 REL8_2_0~119 REL8_2_0~2298 REL8_3_0~1752 REL8_3_0~1076 REL8_4_0~1603 REL8_4_0~2268 REL8_4_0~856 REL8_4_0~480 REL8_4_0~151 REL9_1_0~1867 REL9_1_0~382 REL9_2_0~309 REL9_4_0~1688 REL9_3_0~223 REL9_4_0~462 REL9_5_ALPHA1-683-ge073490 REL9_5_ALPHA1-299-g47ebbdc REL7_3~2135 REL7_4~2373 REL9_5_ALPHA1-1114-g57a6a72 REL9_0_0~1538 REL8_0_0~2934"
VERS_MORE_BAD="REL9_5_0~804 REL8_3_0~1753 REL8_2_0~1410 REL8_4_0~481"
VERS_QUARTERS="REL7_2~1060 REL7_2~226 REL7_3~1793 REL7_3~1268 REL7_3~366 REL7_4~2136 REL7_4~1629 REL7_4~1073 REL7_4~350 REL8_0_0~2683 REL8_0_0~2132 REL8_0_0~1539 REL8_0_0~839 REL8_0_0~130 REL8_1_0~1542 REL8_1_0~884 REL8_1_0~247 REL8_2_0~2042 REL8_2_0~1581 REL8_2_0~1012 REL8_2_0~332 REL8_3_0~2316 REL8_3_0~1603 REL8_3_0~1189 REL8_3_0~732 REL8_3_0~119 REL8_4_0~1907 REL8_4_0~1498 REL8_4_0~1218 REL8_4_0~775 REL8_4_0~360 REL9_0_0~1855 REL9_0_0~1454 REL9_0_0~1249 REL9_0_0~627 REL9_0_0~202 REL9_1_0~1695 REL9_1_0~1328 REL9_1_0~628 REL9_2_0~1825 REL9_2_0~1396 REL9_2_0~984 REL9_2_0~551 REL9_3_0~1509 REL9_3_0~1099 REL9_3_0~789 REL9_3_0~390 REL9_4_0~1894 REL9_4_0~1617 REL9_4_0~1246 REL9_4_0~744 REL9_5_0~2370 REL9_5_0~1996 REL9_5_0~1569 REL9_5_ALPHA1-20-g7b156c1 REL9_5_ALPHA1-489-ge06b2e1 REL9_5_ALPHA1-844-gdfcd9cb REL9_5_ALPHA1-972-g7dc09c1"
VRES_QUARTERS_BAD="REL9_5_0~1100"
VERS_BIQUART="REL7_2~908 REL7_2~1415 REL7_2~643 REL7_3~1009 REL7_3~1530 REL7_3~817 REL7_4~1251 REL7_4~1882 REL7_4~1351 REL7_4~711 REL8_0_0~1516 REL8_0_0~2407 REL8_0_0~1835 REL8_0_0~1189 REL8_0_0~484 REL8_1_0~483 REL8_1_0~1189 REL8_1_0~1213 REL8_1_0~565 REL8_2_0~1144 REL8_2_0~1811 REL8_2_0~1296 REL8_2_0~672 REL8_3_0~1324 REL8_3_0~1959 REL8_3_0~1396 REL8_3_0~960 REL8_3_0~425 REL8_4_0~1013 REL8_4_0~1702 REL8_4_0~1358 REL8_4_0~996 REL8_4_0~567 REL9_0_0~1107 REL9_0_0~1654 REL9_0_0~1351 REL9_0_0~938 REL9_0_0~414 REL9_1_0~948 REL9_1_0~1511 REL9_1_0~978 REL9_2_0~1226 REL9_2_0~1610 REL9_2_0~1190 REL9_2_0~767 REL9_3_0~1030 REL9_3_0~1304 REL9_3_0~944 REL9_3_0~589 REL9_4_0~1142 REL9_4_0~1755 REL9_4_0~1431 REL9_4_0~995 REL9_5_0~1557 REL9_5_0~2183 REL9_5_0~1782 REL9_5_ALPHA1-1352-gb283096 REL9_5_ALPHA1-1189-g3fc6e2d"
VERS_RELEASES="REL7_1_3 REL7_2_8 REL7_3_21 REL7_4_30 REL8_0_26 REL8_1_23 REL8_2_23 REL8_3_23 REL8_4_22 REL9_0_23 REL9_1_19 REL9_2_14 REL9_3_10 REL9_4_5 REL9_5_0"
VERS_SLIDES="REL8_2_0~1764 REL8_3_0~1344 REL8_3_0~1416 REL9_2_0~1071 REL9_3_0~735 REL9_4_0~1923 REL9_5_ALPHA1-1556-g80cf189 REL9_5_ALPHA1-1361-g3df9c37 REL9_5_ALPHA1-586-g5be94a9"
VERS_SLIDES_BAD="REL9_5_0~1471 REL9_5_0~1497 REL9_4_0~1930 REL9_2_0~771 REL9_3_0~744"
VERS_SLIDES_BEFORE="REL8_2_0~1766 REL8_3_0~1349 REL8_3_0~1417 REL9_2_0~1072 REL9_2_0~777 REL9_5_ALPHA1-1514-g6928484 REL9_5_ALPHA1-544-g41562b1"
#VERS=""
VERS="${VERS_SLIDES} ${VERS_SLIDES_BEFORE} ${VERS_RELEASES} ${VERS_QUARTERS} ${VERS_BIQUART} ${VERS_MORE}"
#VERS="REL6_3_2"
#VERS="REL6_5_3 REL6_4_2 REL6_3_2 REL6_2_1 REL6_1_1"
#VERS="REL8_0_0 REL7_0 REL7_0~949 REL7_0~243 REL7_1~2184 REL7_1~1748 REL7_1~943 REL7_1~45"
#VERS="$(cat revs.quarters)"
#VERS="6f64c2e54a0b14154a335249f4dca91a39c61c50 06c376605d82fffbe174d61d8b853de53f5f51a9 f6a51cfa919f22133a970fb8ae3bf42f7181ddcb 51cc51945e4cb3a9a114ab4e5c3cfa358311f27e 469ebeefd644e829facdb9fab2dc8b8a47352795 72ad5fe15c93fefa8debb0fc8ef5c85b560ffac7 3a94e789f5c9537d804210be3cb26f7fb08e3b9e"
#VERS="REL7_0-771-g06c3766 REL7_0-775-g61234c1 REL7_0-784-g5ba666b"
#VERS="REL7_1 REL7_1~1966 REL7_1~1867 REL7_1~1769 REL7_1~1706 REL7_1~1596 REL7_1~1451 REL7_1~1176 REL7_1~947 REL7_1~593 REL7_1~278"
#VERS="REL7_1_3"
#VERS="REL7_1_3 REL7_2_8 REL7_3_9 REL7_3_21 REL7_4_30 REL8_0_26 REL8_1_23 REL8_2_23 REL8_3_23 REL8_4_22 REL9_0_23 REL9_1_19 REL9_2_14 REL9_3_10 REL9_4_5 REL9_5_0"
#VERS="REL7_4_30 REL8_0_26 REL8_1_23 REL8_2_23 REL8_3_23"
#VERS="26c48b5e8cffafaf3b8acf345ca9fd8a1e408a54 df700e6b40195d28dc764e0c694ac8cef90d4638 2415ad983174164ff30ce487c0e6b4b53321b83a c6e3ac11b60ac4a8942ab964252d51c1c0bd8845 337b6f5ecf05b21b5e997986884d097d60e4e3d0 8ae35e91807508872cabd3b0e8db35fc78e194ac 263865a48973767ce8ed7b7788059a38a24a9f37 4ea51cdfe85ceef8afabceb03c446574daa0ac23"
#VERS3="REL7_2-3176-g78d2156 REL7_4_RC1-1422-g474875f REL8_0_0-947-g294505e REL8_1_0-1371-g9e196d7 REL8_3_0-1153-gf346a23 REL8_4_0-873-gef51fa5 REL9_1_ALPHA4-55-ga2eb9e0 REL9_3_BETA1-1457-g1a917ae REL9_5_ALPHA1-54-g3096ff9"
RETRODIR="$(dirname "$0")"
OLDFIXES="$RETRODIR/old-postgres-fixes"
TOPLEVEL=`pwd`
RVERS="$(for v in $VERS ; do echo "$v" ; done | sort -R)"
if [[ ! -d .git ]] ; then
echo "Must be run at top level of Postgres source tree"
exit 1
fi
NVERS="$(for v in $RVERS; do echo "$v" ; done | wc -l)"
N=0
for ver in $RVERS; do
set -e
N=$(( N + 1 ))
describe="$(git describe --tags --candidates=0 "$ver" 2>/dev/null || git describe --tags --contains --match REL[0-9]_[0-9] "$ver" 2>/dev/null || git describe --tags --contains --match REL[0-9]_[0-9]_0 "$ver" 2>/dev/null || git describe --tags "$ver" 2>/dev/null)"
gitdate="$(git log -n 1 --date=short "$ver" | awk '/^Date:/{print $2}')"
prefix="/usr/local/oldpgsql/$gitdate-$describe"
if [[ -n "$DEBUG" ]] ; then
prefix="$prefix-debug"
fi
if [[ -f "$prefix/bin/initdb" && -z "$FORCE" ]]; then
echo "Skipping already built $ver in $prefix"
continue
fi
cd $TOPLEVEL
echo "Cleaning source tree using git reset and git clean"
git reset --hard >/dev/null
git clean -x -d -f -q >/dev/null
echo "Checking out $ver"
git checkout "$ver" >/dev/null
logfile="${prefix}.log"
echo "Building $ver to install into $prefix" > $logfile
echo
echo "========================================================================"
echo "Building $ver ($N/$NVERS) to install into $prefix logging to $logfile"
echo "========================================================================"
set +e
if [[ -z "$DEBUG" ]] ; then
export CFLAGS='-w -fno-aggressive-loop-optimizations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -O2 -D_GNU_SOURCE'
else
export CFLAGS='-fno-aggressive-loop-optimizations -fno-strict-aliasing -fwrapv -fexcess-precision=standard -g -D_GNU_SOURCE -Wall -Wno-address -Wno-unused-but-set-variable -Wno-pointer-sign -Wno-format'
fi
export YFLAGS='-Wnone'
if [ -f ./configure ] ; then
echo "Configuring $ver to install into $prefix"
patch -p1 < $OLDFIXES/flex-autoconf-fix.diff >>$logfile 2>&1
patch -p1 < $OLDFIXES/fix_configure_cc_version.diff >>$logfile 2>&1
patch -p1 < $OLDFIXES/fix-sysvshmem-cast.diff >>$logfile 2>&1
configureargs="--prefix=$prefix"
if ./configure --help | grep -q host=HOST ; then
configureargs="$configureargs --host=i386-linux"
fi
# if ./configure --help | grep -q template ; then
# configureargs="$configureargs --with-template=linux"
# fi
if ./configure --help | grep -q locale ; then
configureargs="$configureargs --enable-locale"
fi
if ./configure --help | grep -q multibyte ; then
configureargs="$configureargs --enable-multibyte"
fi
echo "Running ./configure $configureargs"
./configure $configureargs >>$logfile 2>&1
if [ $? -ne 0 ]; then
echo "configure failed -- skipping $ver"
continue
fi
if grep -q 's%@CFLAGS@%-O2%g' config.status; then
echo "Hacking and rerunning config.status"
sed "/CFLAGS/s/-O2/$CFLAGS/" config.status > config.status.hacked
bash ./config.status.hacked >>$logfile 2>&1
elif grep -q 's%@CFLAGS@%-O2 -Wall -Wmissing-prototypes -Wmissing-declarations%g' config.status; then
echo "Hacking and rerunning config.status"
sed "/CFLAGS/s/-O2 -Wall -Wmissing-prototypes -Wmissing-declarations/$CFLAGS/" config.status > config.status.hacked
bash ./config.status.hacked >>$logfile 2>&1
fi
elif [ -f src/configure ] ; then
echo "Using old-style configuration approach for release <= 7.0"
echo "Configuring $ver to install into $prefix"
patch -f -p1 < $OLDFIXES/70-fixes2.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/653-fixes.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/63-fixes.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/62-fixes.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/61-fixes.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-genbki-stray-backslash.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-stray-default.diff >>$logfile 2>&1
cd src
if ./configure --host=i386-pc-linux-gnu --with-template=list | grep -q linux-elf ; then
template=linux-elf
elif ./configure --host=i386-pc-linux-gnu --with-template=list | grep -q linux_i386 ; then
template=linux_i386
else
echo "Couldn't find a template I recognized"
exit 1
fi
echo "Running configure --without-CXX --host=i386-linux --with-template=$template --enable-locale --enable-multibyte --prefix=\"$prefix\""
PATH=.:$PATH ./configure --without-CXX --host=i386-linux --with-template=$template --enable-locale --enable-multibyte --prefix="$prefix" >>$logfile 2>&1 < /dev/null
if [[ -f config.status ]] ; then
echo "replacing CFLAGS and YFLAGS"
sed "/CFLAGS/s/-O2/$CFLAGS/;/YFLAGS/s/-y/$YFLAGS/" config.status > config.status.hacked
echo "Reruning config.status"
bash ./config.status.hacked >>$logfile 2>&1
else
echo "Couldn't find a config.status to hack CFLAGS and YFLAGS in"
exit 1
fi
cd $TOPLEVEL
else
echo "Cannot configure $ver -- skipping"
continue
fi
# Desperate measures
if [[ $gitdate < "2000-08-03" ]] ; then
patch -f -p1 < $OLDFIXES/postgresql-6.5.2-alpha.patch >>$logfile 2>&1
fi
# https://access.redhat.com/solutions/37218
patch -f -p1 < $OLDFIXES/linux-system-returns-echild.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/excise-va_args-in-makelist.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/excise-va_args-in-makelist-2.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-perl-configure-test.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-ecpg-missing-semicolon.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-ecpg-descriptors.diff >>$logfile 2>&1
patch -F1 -f -p1 < $OLDFIXES/fix-ecpg-strndup.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-ecpg-daytab.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-datetime-datetktbl.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-stray-default.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-genbki-ame.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-x86_64.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/yyleng-fix.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-readline2.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix_ecpg_bison_yyerror.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-postgres-h-extern-errno.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-postgres-h-extern-errno2.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-postgres-h-extern-errno3.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-plpgsql-bison.diff >>$logfile 2>&1
patch -f -p1 < $OLDFIXES/fix-bison-base_yyscan_t-ordering.diff >>$logfile 2>&1
f="$(find . -name preproc.y)"
if [[ -n "$f" ]] ; then
echo "Hacking preproc.y to remove duplicates..."
cp "$f" "${f}.hacked"
for s in s_struct join_clause AlterTableStmt table_list; do
n="$(grep -c "^%type *<str>.*\s${s}\s" "$f")"
if [[ 0 == $n ]]; then
: echo "Only $n instances of $s "
elif [[ 1 == $n ]]; then
: echo "Only $n instances of $s "
elif [[ 2 == $n ]]; then
: echo "Found $n instances of $s removing one"
sed "0,/^%type.*\s${s}\s/{/^%type.*\s${s}\s/s/\s${s}\s/ /}" < "${f}.hacked" > "${f}.hacked.out"
mv "${f}.hacked.out" "${f}.hacked"
nn="$(grep -c "^%type *<str>.*\s${s}\s" "${f}.hacked")"
echo "Eliminated duplicate $s ($n -> $nn instances)"
elif [[ 3 == $n ]]; then
echo "WTF $n instances of $s"
fi
done
dupdiff="$OLDFIXES/fix-ecpg-duplicates-${ver}.diff"
diff -u "${f}" "${f}.hacked" > "$dupdiff"
if [[ -s "$dupdiff" ]]; then
echo "Saved diff in $dupdiff"
mv "${f}.hacked" "$f"
else
rm "$dupdiff"
fi
echo "Hacking preproc.y to remove duplicates...done"
fi
cd $TOPLEVEL
netdiff="$RETRODIR/net-diffs/net-${ver}.diff"
git diff -p --stat > "$netdiff"
echo "Saved net diff to $netdiff"
if [[ -f Makefile ]] ; then
:
elif [[ -f src/Makefile ]] ; then
cd src
else
echo "Can't find Makefile?!"
exit 1
fi
date >>$logfile 2>&1
starttime="$(date +%s)"
echo "Running Make..."
make >>$logfile 2>&1
if [ $? -ne 0 ]; then
tail -20 $logfile
echo "make failed -- skipping $ver"
continue
fi
echo "Running Make...done"
endtime="$(date +%s)"
date >>$logfile 2>&1
elapsedtime=$(( endtime - starttime ))
echo "Elapsed seconds for make: $elapsedtime"
echo "Elapsed seconds for make: $elapsedtime" >> $logfile 2>&1
# make check
# if [ $? -ne 0 ]; then
# echo "make check failed -- skipping $ver"
# continue
# fi
if [[ -f "$prefix/bin/initdb" && -n "$FORCE" ]]; then
echo "Removing previous install at $prefix"
rm -rf "$prefix"
fi
echo "Running Make install into $prefix..."
mkdir "$prefix" >>$logfile 2>&1
make install >>$logfile 2>&1 || echo "make install failed"
echo "Running Make install into $prefix...done"
# echo "Running initdb into /var/tmp/d-$ver..."
# PATH=$prefix/bin:$PATH LD_LIBRARY_PATH=$prefix/lib $prefix/bin/initdb -D /var/tmp/d-$ver >>$logfile 2>&1
# echo "Running initdb into /var/tmp/d-$ver...done"
done