[build2] Set RPM epoch
Karen Arutyunov
karen at codesynthesis.com
Thu Jun 5 13:24:59 UTC 2025
> To set the epoch, I added the “fedora-version” to the
> project manifest file (“fedora-version: 1:1.2.3”)
> Regenerate the RPM files using the “bpkg bindist
> –wipe-output–keep-output <project>” command.
> I expected this to result in the “Epoch:” line being
> added to the generated spec file, but no such luck.
I actually don't see why this may not work. Works fine for me:
$ bdep new hello
$ bdep init -d hello -C @cfg --
$ bpkg bindist -d hello-cfg --keep-output --wipe-output hello
$ fgrep -e "Epoch:" ~/rpmbuild/SPECS/hello.spec # Expectedly not found.
$ echo "fedora-version: 1:1.2.3" >>hello/manifest
$ bdep sync -d hello
$ bpkg bindist -d hello-cfg --keep-output --wipe-output hello
$ fgrep -e "Epoch:" ~/rpmbuild/SPECS/hello.spec
Epoch: 1
Paul, if you do it differently, could you file an issue providing a
reproducer with the step-by-step instructions?
On 6/4/25 19:26, Paul Stath via users wrote:
> Hi Boris,
>
> The code comment block you cite is in the generated documentation section "7.2.2 Fedora Package Mapping for Production".
> Under the following paragraph:
> "Let's start with the case where neither distribution (fedora-version) nor upstream
> version (upstream-version) is specified and we need to derive everything from the
> bpkg version (what follows is as much description as rationale)."
>
> I had expected that since the distribution specific (fedora-version) attribute was
> being set that this logic would not apply and the <epoch> "So we shift this value range" logic would not apply.
>
> Please note that the text in the cited code block does not exactly match the generated
> documentation for the build2 0.17.0 version that I am using.
>
>> So try `fedora-version: 2:1.2.3`.
> I tried this as well, hoping that "Epoch: 1" would show up in the RPM spec file, but it didn't seem to make any difference.
> The "Epoch:" in the spec file is still not being set.
>
> Any other suggestions or debugging that I can do?
> I set "bindist --verbose 6" in the hopes it might provide a clue, but I didn't see anything helpful.
>
> I suppose in the very short term, I could use the bindist "--fedora-prepare-only" argument
> and add the "Epoch: 1" to the generated RPM spec before running the rpmbuild commands.
>
>> We could probably support something like 1:$ with a bit of effort so feel free
>> to file an issue for that.
> That would be great. I will make a feature request.
>
> Since the order of "version" and "fedora-version" in the package manifest file
> does not matter, for now I can place them on adjacent lines to make it
> more likely that they will get changed at the same time.
>
> version: 1.2.3
> fedora-version: 1:1.2.3
>
> Best regards
>
> ----
> Paul Stath
> Principal Systems Engineer
> JMA Wireless
> pstats at jmawireless.com
>
>
>
>> -----Original Message-----
>> From: Boris Kolpackov <boris at codesynthesis.com>
>> Sent: Wednesday, June 4, 2025 8:28 AM
>> To: build2 toolchain mailing list <users at build2.org>
>> Cc: Paul Stath <PStath at jmawireless.com>
>> Subject: Re: [build2] Set RPM epoch
>>
>> Paul Stath via users <users at build2.org> writes:
>>
>>> To set the epoch, I added the "fedora-version" to the project
>>> manifest file ("fedora-version: 1:1.2.3") Regenerate the RPM files
>>> using the "bpkg bindist -wipe-output -keep-output <project>" command.
>>> I expected this to result in the "Epoch:" line being added to the
>>> generated spec file, but no such luck.
>>
>> This comment from the source code I believe explains why this is:
>>
>> // <epoch>
>> //
>> // On one hand, if we keep the epoch, it won't necessarily match
>> // Fedora's native package epoch. But on the other it will allow our
>> // binary packages from different epochs to co-exist. Seeing that this
>> // can be easily overridden with a custom distribution version, let's
>> // keep it.
>> //
>> // Note that while the Fedora start/default epoch is 0, ours is 1 (we
>> // use the 0 epoch for stub packages). So we will need to shift this
>> // value range.
>>
>> So try `fedora-version: 2:1.2.3`.
>>
>>> Also, can the "fedora-version" attribute in the package manifest file
>>> use the bpkg "version"? Since all I want to do is set the epoch of the
>>> RPM, is it possible to specify the "fedora-version" attribute in a DRY
>>> fashion so that it uses the bpkg "version" ? Something like:
>>> "fedora-version: 1:$version" or "fedora-version: 1:"
>>
>> No, not quite. The details are here:
>>
>> https://build2.org/bpkg/doc/build2-package-manager-
>> manual.xhtml#manifest-package-distribution
>>
>> We could probably support something like 1:$ with a bit of effort so feel free
>> to file an issue for that.
More information about the users
mailing list