Skip to content

Commit 01df147

Browse files
committed
Allow selecting the git revision to be packaged by "make dist".
Commit 619bc23 changed "make dist" to invoke "git archive", but hard-wired the call to specify that the HEAD revision should be packaged. Our tarball building process needs to be able to specify which git commit to package (notably, for packaging back branches). While we could make that work with some hackery to operate in detached-HEAD state, it's a lot nicer just to expose git archive's ability to specify what to package. Hence, invent a new make variable PG_GIT_REVISION. This is undocumented, but so is "make dist". Also make corresponding changes in the meson scripts. We have no near-term intention of using that for package building, but it will likely happen eventually, so stay prepared. Discussion: https://postgr.es/m/[email protected]
1 parent a42fc1c commit 01df147

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

Diff for: GNUmakefile.in

+5-2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ update-unicode: | submake-generated-headers submake-libpgport
8787
distdir = postgresql-$(VERSION)
8888
dummy = =install=
8989

90+
# git revision to be packaged
91+
PG_GIT_REVISION = HEAD
92+
9093
GIT = git
9194

9295
dist: $(distdir).tar.gz $(distdir).tar.bz2
@@ -102,10 +105,10 @@ distdir-location:
102105
# on, Unix machines.
103106

104107
$(distdir).tar.gz:
105-
$(GIT) -C $(srcdir) -c core.autocrlf=false archive --format tar.gz -9 --prefix $(distdir)/ HEAD -o $(abs_top_builddir)/$@
108+
$(GIT) -C $(srcdir) -c core.autocrlf=false archive --format tar.gz -9 --prefix $(distdir)/ $(PG_GIT_REVISION) -o $(abs_top_builddir)/$@
106109

107110
$(distdir).tar.bz2:
108-
$(GIT) -C $(srcdir) -c core.autocrlf=false -c tar.tar.bz2.command='$(BZIP2) -c' archive --format tar.bz2 --prefix $(distdir)/ HEAD -o $(abs_top_builddir)/$@
111+
$(GIT) -C $(srcdir) -c core.autocrlf=false -c tar.tar.bz2.command='$(BZIP2) -c' archive --format tar.bz2 --prefix $(distdir)/ $(PG_GIT_REVISION) -o $(abs_top_builddir)/$@
109112

110113
distcheck: dist
111114
rm -rf $(dummy)

Diff for: meson.build

+4-2
Original file line numberDiff line numberDiff line change
@@ -3469,6 +3469,8 @@ bzip2 = find_program('bzip2', required: false, native: true)
34693469

34703470
distdir = meson.project_name() + '-' + meson.project_version()
34713471

3472+
pg_git_revision = get_option('PG_GIT_REVISION')
3473+
34723474
# Note: core.autocrlf=false is needed to avoid line-ending conversion
34733475
# in case the environment has a different setting. Without this, a
34743476
# tarball created on Windows might be different than on, and unusable
@@ -3483,7 +3485,7 @@ tar_gz = custom_target('tar.gz',
34833485
'-9',
34843486
'--prefix', distdir + '/',
34853487
'-o', join_paths(meson.build_root(), '@OUTPUT@'),
3486-
'HEAD', '.'],
3488+
pg_git_revision],
34873489
output: distdir + '.tar.gz',
34883490
)
34893491

@@ -3497,7 +3499,7 @@ if bzip2.found()
34973499
'--format', 'tar.bz2',
34983500
'--prefix', distdir + '/',
34993501
'-o', join_paths(meson.build_root(), '@OUTPUT@'),
3500-
'HEAD', '.'],
3502+
pg_git_revision],
35013503
output: distdir + '.tar.bz2',
35023504
)
35033505
else

Diff for: meson_options.txt

+3
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,9 @@ option('atomics', type: 'boolean', value: true,
5555
option('spinlocks', type: 'boolean', value: true,
5656
description: 'Use spinlocks')
5757

58+
option('PG_GIT_REVISION', type: 'string', value: 'HEAD',
59+
description: 'git revision to be packaged by pgdist target')
60+
5861

5962
# Compilation options
6063

0 commit comments

Comments
 (0)