Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1Te3-00CZtS-Mm for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Apr 2024 16:14:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1s1Te0-000P5T-M2 for pgsql-hackers@arkaria.postgresql.org; Mon, 29 Apr 2024 16:14:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1Te0-000P5K-CT for pgsql-hackers@lists.postgresql.org; Mon, 29 Apr 2024 16:14:21 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1s1Tdw-000hRz-E5 for pgsql-hackers@lists.postgresql.org; Mon, 29 Apr 2024 16:14:20 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 43TGEA0K1245435; Mon, 29 Apr 2024 12:14:10 -0400 From: Tom Lane To: Peter Eisentraut cc: Greg Sabino Mullane , pgsql-hackers@lists.postgresql.org, Magnus Hagander Subject: Re: Tarball builds in the new world order In-reply-to: <1e596327-9698-4111-a528-a6a2749351fe@eisentraut.org> References: <3552543.1713909947@sss.pgh.pa.us> <3709288.1713972073@sss.pgh.pa.us> <15181.1714159448@sss.pgh.pa.us> <1e596327-9698-4111-a528-a6a2749351fe@eisentraut.org> Comments: In-reply-to Peter Eisentraut message dated "Mon, 29 Apr 2024 14:36:29 +0200" MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----- =_aaaaaaaaaa0" Content-ID: <1245135.1714407193.0@sss.pgh.pa.us> Date: Mon, 29 Apr 2024 12:14:10 -0400 Message-ID: <1245434.1714407250@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ------- =_aaaaaaaaaa0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1245135.1714407193.1@sss.pgh.pa.us> Peter Eisentraut writes: > On 26.04.24 21:24, Tom Lane wrote: >> Concretely, I'm proposing the attached. Peter didn't like >> PG_COMMIT_HASH, so I have PG_COMMIT_REFSPEC below, but I'm not >> wedded to that if a better name is proposed. > This seems ok to me, but note that we do have an equivalent > implementation in meson. If we don't want to update that in a similar > way, maybe we should disable it. OK. After poking at that for awhile, it seemed like "default to HEAD" fits into meson a lot better than "throw an error if the variable isn't set", so I switched to doing it like that. One reason is that AFAICT you can only set the variable during "meson setup" not during "ninja". This won't matter to the tarball build script, which does a one-off configuration run anyway. But for manual use, a movable target like HEAD might be more convenient given that behavior. I tested this by building tarballs using the makefiles on a RHEL8 box, and using meson on my MacBook (with recent MacPorts tools). I got bit-for-bit identical files, which I found rather impressive given the gap between the platforms. Maybe this "reproducible builds" wheeze will actually work. I also changed the variable name to PG_GIT_REVISION per your other suggestion. regards, tom lane ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="v2-0001-make-packaged-commit-selectable.patch"; charset="us-ascii" Content-ID: <1245135.1714407193.2@sss.pgh.pa.us> Content-Description: v2-0001-make-packaged-commit-selectable.patch Content-Transfer-Encoding: quoted-printable diff --git a/GNUmakefile.in b/GNUmakefile.in index 30553b2a95..9e41794f60 100644 --- a/GNUmakefile.in +++ b/GNUmakefile.in @@ -87,6 +87,9 @@ update-unicode: | submake-generated-headers submake-libp= gport distdir =3D postgresql-$(VERSION) dummy =3D =3Dinstall=3D = +# git revision to be packaged +PG_GIT_REVISION ?=3D HEAD + GIT =3D git = dist: $(distdir).tar.gz $(distdir).tar.bz2 @@ -102,10 +105,10 @@ distdir-location: # on, Unix machines. = $(distdir).tar.gz: - $(GIT) -C $(srcdir) -c core.autocrlf=3Dfalse archive --format tar.gz -9 = --prefix $(distdir)/ HEAD -o $(abs_top_builddir)/$@ + $(GIT) -C $(srcdir) -c core.autocrlf=3Dfalse archive --format tar.gz -9 = --prefix $(distdir)/ $(PG_GIT_REVISION) -o $(abs_top_builddir)/$@ = $(distdir).tar.bz2: - $(GIT) -C $(srcdir) -c core.autocrlf=3Dfalse -c tar.tar.bz2.command=3D'$= (BZIP2) -c' archive --format tar.bz2 --prefix $(distdir)/ HEAD -o $(abs_to= p_builddir)/$@ + $(GIT) -C $(srcdir) -c core.autocrlf=3Dfalse -c tar.tar.bz2.command=3D'$= (BZIP2) -c' archive --format tar.bz2 --prefix $(distdir)/ $(PG_GIT_REVISIO= N) -o $(abs_top_builddir)/$@ = distcheck: dist rm -rf $(dummy) diff --git a/meson.build b/meson.build index cdfd31377d..1c0579d5a6 100644 --- a/meson.build +++ b/meson.build @@ -3469,6 +3469,8 @@ bzip2 =3D find_program('bzip2', required: false, nat= ive: true) = distdir =3D meson.project_name() + '-' + meson.project_version() = +pg_git_revision =3D get_option('PG_GIT_REVISION') + # Note: core.autocrlf=3Dfalse is needed to avoid line-ending conversion # in case the environment has a different setting. Without this, a # tarball created on Windows might be different than on, and unusable @@ -3483,7 +3485,7 @@ tar_gz =3D custom_target('tar.gz', '-9', '--prefix', distdir + '/', '-o', join_paths(meson.build_root(), '@OUTPUT@'), - 'HEAD', '.'], + pg_git_revision], output: distdir + '.tar.gz', ) = @@ -3497,7 +3499,7 @@ if bzip2.found() '--format', 'tar.bz2', '--prefix', distdir + '/', '-o', join_paths(meson.build_root(), '@OUTPUT@'), - 'HEAD', '.'], + pg_git_revision], output: distdir + '.tar.bz2', ) else diff --git a/meson_options.txt b/meson_options.txt index 249ecc5ffd..246cecf382 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -55,6 +55,9 @@ option('atomics', type: 'boolean', value: true, option('spinlocks', type: 'boolean', value: true, description: 'Use spinlocks') = +option('PG_GIT_REVISION', type: 'string', value: 'HEAD', + description: 'git revision to be packaged by pgdist target') + = # Compilation options = ------- =_aaaaaaaaaa0 Content-Type: text/x-diff; name="v2-0002-fix-tarball-build-script.patch"; charset="us-ascii" Content-ID: <1245135.1714407193.3@sss.pgh.pa.us> Content-Description: v2-0002-fix-tarball-build-script.patch --- mk-one-release.orig 2024-04-23 17:30:08.983226671 -0400 +++ mk-one-release 2024-04-29 12:10:38.106723387 -0400 @@ -39,13 +39,17 @@ mkdir pgsql git archive ${gitref} | tar xf - -C pgsql # Include the git ref in the output tarballs +# (This has no effect with v17 and up; instead we rely on "git archive" +# to include the commit hash in the tar header) echo ${gitref} >pgsql/.gitrevision cd pgsql ./configure # Produce .tar.gz and .tar.bz2 files -make dist +# (With v17 and up, this will repeat the "git archive" call; the contents +# of the working directory don't matter directly to the results.) +make dist PG_GIT_REVISION=${gitref} # Generate md5 and sha256 sums, and copy files to output for x in *.tar.*; do ------- =_aaaaaaaaaa0--