pgbackrest.git / summary / log / commit / refs
commit 5aece4075e677e6ec4fdd84854ea2ed73467a7dc
Author: David Steele <david@pgbackrest.org>
Date: Fri Aug 07 10:39:24 2026 +0000
Move the distribution trimming from .gitattributes to dist.sh.
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.
.gitattributes | 14 --------------
.github/workflows/test-dist.yml | 41 ++++++++++++++++++++---------------------
build/dist.sh | 17 +++++++++++++----
3 files changed, 33 insertions(+), 39 deletions(-)
diff --git a/.gitattributes b/.gitattributes
index 9ba7b44b7..0378189c3 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -1,17 +1,3 @@
# Classify all .h/c.inc files as C
*.h linguist-language=C
*.c.inc linguist-language=C
-
-# The distribution tarball (git archive) ships only what is needed to build pgbackrest: exclude everything, then re-include the
-# build inputs. The code generation tooling in /build is excluded because dist.sh ships the generated files instead. dist.sh also
-# adds the generated docs, the .inc files, the dist marker, and a distribution README. The smoke test (test/smoke.py) and the
-# meson.build that runs it are shipped so packagers can verify a build; the rest of test is excluded.
-/* export-ignore
-/src -export-ignore
-/test -export-ignore
-/test/* export-ignore
-/test/meson.build -export-ignore
-/test/smoke.py -export-ignore
-/meson.build -export-ignore
-/meson_options.txt -export-ignore
-/LICENSE -export-ignore
diff --git a/.github/workflows/test-dist.yml b/.github/workflows/test-dist.yml
index 6a3396921..79e2f3cdf 100644
--- a/.github/workflows/test-dist.yml
+++ b/.github/workflows/test-dist.yml
@@ -52,27 +52,22 @@ jobs:
# each on its own distribution.
meson dist -C build --formats gztar --no-tests
- # Check that the tarball ships exactly the expected generated files (the *.auto.c.inc code and the rendered documentation) and
- # that none of them is empty. Only the path list is compared, not sizes or timestamps, so a missing or unexpected file is
- # caught here while the zero-size check below catches a file that exists but was generated or rendered empty. Update the list
- # when the generated or documentation file set changes.
+ # Check that the tarball ships exactly what is needed to build and nothing else. build/dist.sh trims the distribution rather
+ # than git archive, so a keep list that drifts is caught here instead of shipping a tarball full of tooling and test data.
+ # Everything under src collapses to the directory since it changes too often to list, except the generated *.auto.c.inc code,
+ # which is listed so a failed generation is caught. Only the path list is compared, not sizes or timestamps, so the zero-size
+ # check below catches a file that exists but was generated or rendered empty. Update the list when the shipped file set
+ # changes.
- name: Check Tarball
- env:
- # Generated files shipped in the tarball, as path regexps relative to the version directory. Joined into a single
- # expression below and used for both the path list and the zero-size check.
- FILES: |
- src/command/help/help\.auto\.c\.inc
- src/postgres/interface\.auto\.c\.inc
- doc/html/[^/]+
- doc/man/[^/]+
run: |
- # Join the file list above into one extended-regexp expression
- files=$(printf '%s' "$FILES" | awk 'NF' | paste -sd '|' -)
-
diff - <(tar tzf build/meson-dist/pgbackrest-*.tar.gz \
| sed 's#^pgbackrest-[^/]*/##' \
- | grep -E "^(${files})\$" \
- | LC_ALL=C sort) <<'EOF'
+ | grep -v -e '/$' -e '^$' \
+ | sed -E '\%^src/(command/help/help|postgres/interface)\.auto\.c\.inc$%!s#^src/.*#src/#' \
+ | LC_ALL=C sort -u) <<'EOF'
+ LICENSE
+ README.md
+ dist
doc/html/command.html
doc/html/configuration.html
doc/html/default.css
@@ -86,15 +81,19 @@ jobs:
doc/html/user-guide-rhel.html
doc/html/user-guide.html
doc/man/pgbackrest.1.txt
+ meson.build
+ meson_options.txt
+ src/
src/command/help/help.auto.c.inc
src/postgres/interface.auto.c.inc
+ test/meson.build
+ test/smoke.py
EOF
- # Confirm none of those generated files is zero size, which would pass the path check above but indicate a broken
- # generation or render.
+ # Confirm no file in the tarball is zero size, which would pass the path check above but indicate a broken generation or
+ # render. Directory entries are also zero size so they are skipped.
tar tzvf build/meson-dist/pgbackrest-*.tar.gz \
- | grep -E "pgbackrest-[^/]+/(${files})\$" \
- | awk '$3 == 0 { print "ERROR: zero-size file: " $NF; rc = 1 } END { exit rc }'
+ | awk '$1 !~ /^d/ && $3 == 0 { print "ERROR: zero-size file: " $NF; rc = 1 } END { exit rc }'
# The release process depends on the upload filename so do not modify it without also modifying the release process
- name: Upload Tarball
diff --git a/build/dist.sh b/build/dist.sh
index 30ad3ee2d..34a2f9170 100755
--- a/build/dist.sh
+++ b/build/dist.sh
@@ -1,14 +1,23 @@
#!/bin/sh
####################################################################################################################################
-# Prepare the distribution so the tarball can be built and installed without the code generation or documentation tooling: 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.
+# 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 excluded from the tarball.
+# 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"
[parent: ee5664233ca8]