You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2026-10-23 21:28:56 +03:00
The export-ignore rules applied to every archive git produced, not just the one meson dist builds, so the source archives GitHub generates for a tag were missing the code generation tooling, the declarations it reads, and the documentation source. That left them unbuildable even for someone willing to run the tooling, which was never the intent -- the rules existed to keep the distribution tarball to what a packager needs. Remove the rules and have dist.sh trim the distribution root instead, keeping the same set: src, the root meson files, LICENSE, and the smoke test that packagers use to verify a build. The trimming runs before the generated files are added so the documentation source is replaced by the rendered man page and HTML rather than shipped alongside them. Trimming in a script rather than with export-ignore means git no longer guarantees the result, so check the full tarball path list in CI rather than just the generated files. Everything under src collapses to the directory since it changes too often to list, except the generated code, which stays listed so a failed generation is still caught. This catches a keep list that drifts as well as a missing dist marker, and the zero-size check widens to every file since none that ships is empty.
47 lines
2.6 KiB
Bash
Executable File
47 lines
2.6 KiB
Bash
Executable File
#!/bin/sh
|
|
####################################################################################################################################
|
|
# Prepare the distribution so the tarball can be built and installed without the code generation or documentation tooling: remove
|
|
# everything that is not needed to build, generate the code files, copy the man pages and HTML documentation into doc, copy the
|
|
# distribution README, and write the dist marker that tells the build to use the shipped generated files.
|
|
#
|
|
# The generator reads its inputs from the source tree and writes the generated files into the distribution, since the declarations
|
|
# it reads are not shipped in the tarball.
|
|
####################################################################################################################################
|
|
set -eu
|
|
|
|
# Remove everything that is not needed to build pgbackrest. The trimming is done here rather than with export-ignore in
|
|
# .gitattributes so the source archives that GitHub generates for a tag remain complete and can be built by anyone willing to run
|
|
# the code generation tooling. Keep src, the root meson files, and LICENSE. The code generation tooling in build and the
|
|
# documentation source in doc are removed because the generated files are added below instead. The smoke test (test/smoke.py) and
|
|
# the meson.build that runs it are kept so packagers can verify a build; the rest of test is removed.
|
|
find "$MESON_DIST_ROOT" -mindepth 1 -maxdepth 1 \
|
|
! -name LICENSE ! -name meson.build ! -name meson_options.txt ! -name src ! -name test -exec rm -rf {} +
|
|
find "$MESON_DIST_ROOT/test" -mindepth 1 -maxdepth 1 ! -name meson.build ! -name smoke.py -exec rm -rf {} +
|
|
|
|
build_code="$MESON_SOURCE_ROOT/build/build.py"
|
|
|
|
"$build_code" help --repo-path="$MESON_SOURCE_ROOT" --build-path="$MESON_DIST_ROOT"
|
|
"$build_code" postgres --repo-path="$MESON_SOURCE_ROOT" --build-path="$MESON_DIST_ROOT"
|
|
|
|
# Copy the man pages and HTML documentation generated by doc/release.py --dist into doc/man and doc/html
|
|
mkdir -p "$MESON_DIST_ROOT/doc"
|
|
|
|
for doc in man html; do
|
|
doc_src="$MESON_SOURCE_ROOT/doc/output/$doc"
|
|
|
|
if [ ! -d "$doc_src" ]; then
|
|
echo "dist: $doc_src not found; run 'doc/release.py --dist' before meson dist" >&2
|
|
exit 1
|
|
fi
|
|
|
|
cp -R "$doc_src" "$MESON_DIST_ROOT/doc/"
|
|
done
|
|
|
|
# Copy the distribution README into the tarball root
|
|
cp "$MESON_SOURCE_ROOT/doc/DIST.md" "$MESON_DIST_ROOT/README.md"
|
|
|
|
# Write the dist marker to the root. Its presence is what switches the build to the shipped generated files; it records the version
|
|
# for traceability.
|
|
version=$(basename "$MESON_DIST_ROOT")
|
|
echo "${version#pgbackrest-}" > "$MESON_DIST_ROOT/dist"
|