Re: make dist using git archive - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: make dist using git archive
Date
Msg-id 673bbcc2-3e38-44b6-9710-e7c1b2446334@eisentraut.org
Whole thread Raw
In response to Re: make dist using git archive  ("Tristan Partin" <tristan@neon.tech>)
Responses Re: make dist using git archive
List pgsql-hackers
On 22.01.24 21:04, Tristan Partin wrote:
>> +git = find_program('git', required: false, native: true, disabler: true)
>> +bzip2 = find_program('bzip2', required: false, native: true, 
>> disabler: true)
> 
> This doesn't need to be a disabler. git is fine as-is. See later 
> comment. Disablers only work like you are expecting when they are used 
> like how git is used. Once you call a method like .path(), all bets are 
> off.

ok, fixed

>> +distdir = meson.project_name() + '-' + meson.project_version()
>> +
>> +check_dirty_index = run_target('check-dirty-index',
>> +                               command: [git, 'diff-index', 
>> '--quiet', 'HEAD'])
> 
> Seems like you might want to add -C here too?

done

>> +tar_bz2 = custom_target('tar.bz2',
>> +  build_always_stale: true,
>> +  command: [git, '-C', '@SOURCE_ROOT@', '-c', 'tar.tar.bz2.command=' 
>> + bzip2.path() + ' -c', 'archive',
>> +            '--format', 'tar.bz2',
>> +            '--prefix', distdir + '/',
> 
> -            '-o', '@BUILD_ROOT@/@OUTPUT@',
> +            '-o', join_paths(meson.build_root(), '@OUTPUT@'),
> 
> This will generate the tarballs in the build directory. Do the same for 
> the previous target. Tested locally.

Fixed, thanks.  I had struggled with this one.

>> +            'HEAD', '.'],
>> +  install: false,
>> +  output: distdir + '.tar.bz2',
>> +)
> 
> The bz2 target should be wrapped in an `if bzip2.found()`.

Well, I think we want the dist step to fail if bzip2 is not there.  At 
least that is the current expectation.

>> +alias_target('pgdist', [check_dirty_index, tar_gz, tar_bz2])
> 
> Are you intending for the check_dirty_index target to prohibit the other 
> two targets from running? Currently that is not the case.

Yes, that was the hope, and that's how the make dist variant works.  But 
I couldn't figure this out with meson.  Also, the above actually also 
doesn't work with older meson versions, so I had to comment this out to 
get CI to work.

> If it is what 
> you intend, use a stamp file or something to indicate a relationship. 
> Alternatively, inline the git diff-index into the other commands. These 
> might also do better as external scripts. It would reduce duplication 
> between the autotools and Meson builds.

Yeah, maybe that's a direction.

The updated patch also supports vpath builds with make now.

I have also added a CI patch, for amusement.  Maybe we'll want to keep 
it, though.
Attachment

pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Patch: Improve Boolean Predicate JSON Path Docs
Next
From: Nathan Bossart
Date:
Subject: Re: cleanup patches for incremental backup