Skip to content

Commit 4d757e1

Browse files
author
tudor
committed
revert changes to pgbuild.sh
1 parent 1b3c6c5 commit 4d757e1

File tree

1 file changed

+54
-7
lines changed

1 file changed

+54
-7
lines changed

pglite/cibuild/pgbuild.sh

Lines changed: 54 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,32 +93,35 @@ CC_PGLITE=$CC_PGLITE
9393
if $WASI
9494
then
9595
export EXT=wasi
96-
ACCVEXEEXT==.wasi
97-
96+
cat > ${PGROOT}/config.site <<END
97+
ac_cv_exeext=.wasi
98+
END
9899
if $GETZIC
99100
then
100101
cat > bin/zic <<END
101102
#!/bin/bash
102103
#. /opt/python-wasm-sdk/wasm32-wasi-shell.sh
103-
TZ=UTC PGTZ=UTC $(which wasi-run) $(pwd)/src/timezone/zic.wasi \$@
104+
TZ=UTC PGTZ=UTC $(command -v wasi-run) $(pwd)/src/timezone/zic.wasi \$@
104105
END
105106
fi
106107

107108
else
108109
export EXT=wasm
109-
ACCVEXEEXT=.cjs
110+
cat > ${PGROOT}/config.site <<END
111+
ac_cv_exeext=.cjs
112+
END
110113

111114
if $GETZIC
112115
then
113116
cat > bin/zic <<END
114117
#!/bin/bash
115118
#. /opt/python-wasm-sdk/wasm32-bi-emscripten-shell.sh
116-
TZ=UTC PGTZ=UTC $(which node) $(pwd)/src/timezone/zic.cjs \$@
119+
TZ=UTC PGTZ=UTC $(command -v node) $(pwd)/src/timezone/zic.cjs \$@
117120
END
118121
fi
119122
fi
120123

121-
if EM_PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig ac_cv_exeext=$ACCVEXEEXT emconfigure $CNF --with-template=$BUILD
124+
if EM_PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig CONFIG_SITE=${PGROOT}/config.site emconfigure $CNF --with-template=$BUILD
122125
then
123126
echo configure ok
124127
else
@@ -251,7 +254,7 @@ END
251254
mv -vf ./src/bin/pg_resetwal/pg_resetwal.$EXT ./src/bin/initdb/initdb.$EXT ./src/backend/postgres.$EXT ${PGROOT}/bin/
252255

253256

254-
cat > ${PGROOT}/PGPASSFILE <<END
257+
python3 > ${PGROOT}/PGPASSFILE <<END
255258
USER="${PGPASS:-postgres}"
256259
PASS="${PGUSER:-postgres}"
257260
md5pass = "md5" + __import__('hashlib').md5(USER.encode() + PASS.encode()).hexdigest()
@@ -305,6 +308,50 @@ END
305308
# for extensions building
306309
chmod +x ${PGROOT}/bin/pg_config
307310

311+
312+
echo "initdb for PGDATA=${PGDATA} "
313+
314+
# create empty db hack
315+
316+
cat >$PGROOT/initdb.sh <<END
317+
#!/bin/bash
318+
rm -rf ${PGDATA} /tmp/initdb-* ${PGROOT}/wal/*
319+
export TZ=UTC
320+
export PGTZ=UTC
321+
SQL=/tmp/initdb-\$\$
322+
# TODO: --waldir=${PGROOT}/wal
323+
> /tmp/initdb.txt
324+
325+
${PGROOT}/initdb --no-clean --wal-segsize=1 -g $LANG $CRED --pgdata=${PGDATA}
326+
327+
mv /tmp/initdb.boot.txt \${SQL}.boot.sql
328+
mv /tmp/initdb.single.txt \${SQL}.single.sql
329+
330+
if \${CI:-false}
331+
then
332+
cp -vf \$SQL ${PGROOT}/\$(md5sum \$SQL|cut -c1-32).sql
333+
fi
334+
335+
# --wal-segsize=1 -> -X 1048576
336+
337+
# CKSUM_B -k --data-checksums
338+
# 2024-04-24 05:53:28.121 GMT [42] WARNING: page verification failed, calculated checksum 5487 but expected 0
339+
# 2024-04-24 05:53:28.121 GMT [42] FATAL: invalid page in block 0 of relation base/1/1259
340+
341+
CMD="${PGROOT}/postgres --boot -D ${PGDATA} -d 3 $PGOPTS -X 1048576"
342+
echo "\$CMD < \$SQL.boot.sql"
343+
\$CMD < \$SQL.boot.sql 2>&1 \\
344+
| grep -v --line-buffered 'bootstrap> boot' \\
345+
| grep -v --line-buffered 'index'
346+
347+
echo "
348+
349+
\$(md5sum /tmp/initdb-\$\$.*.sql)
350+
351+
boot done
352+
"
353+
END
354+
308355
popd
309356
echo "pgbuild:end
310357

0 commit comments

Comments
 (0)