Re: make dist using git archive

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Cc: Tristan Partin <tristan(at)neon(dot)tech>
Subject: Re: make dist using git archive
Date: 2024-01-25 16:04:43
Message-ID: 673bbcc2-3e38-44b6-9710-e7c1b2446334@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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 Content-Type Size
v1-0001-make-dist-uses-git-archive.patch text/plain 3.6 KB
v1-0002-WIP-Add-dist-building-to-CI.patch text/plain 3.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2024-01-25 16:08:50 Re: cleanup patches for incremental backup
Previous Message Tom Lane 2024-01-25 16:03:24 Re: Patch: Improve Boolean Predicate JSON Path Docs