Re: Tarball builds in the new world order

Peter Eisentraut <peter@eisentraut.org>

From: Peter Eisentraut <peter@eisentraut.org>
To: Tom Lane <tgl@sss.pgh.pa.us>, pgsql-hackers@lists.postgresql.org
Cc: Peter Eisentraut <peter.eisentraut@enterprisedb.com>, Magnus Hagander <magnus@hagander.net>
Date: 2024-04-24T14:46:46Z
Lists: pgsql-hackers
On 24.04.24 00:05, Tom Lane wrote:
> It makes tarballs all right, but whatever commit ID you specify
> is semi-ignored, and you get a tarball corresponding to HEAD
> of master.  (The PDFs come from the right version, though!)
> 
> The reason for that is that the mk-one-release script does this
> (shorn of not-relevant-here details):
> 
> 	export BASE=/home/pgsql
> 	export GIT_DIR=$BASE/postgresql.git
> 
> 	mkdir pgsql
> 
> 	# Export the selected git ref
> 	git archive ${gitref} | tar xf - -C pgsql

Where does ${gitref} come from?  Why doesn't this line use git archive 
HEAD | ... ?

> What I suggest is doing this in mk-one-release:
> 
> -make dist
> +make dist PG_COMMIT_HASH=${gitref}
> 
> and changing the "make dist" rules to write $(PG_COMMIT_HASH) not
> HEAD.  The extra make variable will have no effect in the back
> branches, while it should cause the right thing to happen with
> the new implementation of "make dist".

I suppose we could do something like that, but we'd also need to come up 
with a meson version.

(Let's not use "hash" though, since other ways to commit specify a 
commit can be used.)

> This change seems like a good thing anyway for anyone who's tempted
> to use "make dist" manually, since they wouldn't necessarily want
> to package HEAD either.

A tin-foil-hat argument is that we might not want to encourage that, 
because for reproducibility, we need a known git commit and also a known 
implementation of make dist.  If in the future someone uses the make 
dist implementation of PG19 to build a tarball for PG17, it might not 
come out the same way as using the make dist implementation of PG17.




Commits

  1. Allow selecting the git revision to be packaged by "make dist".