[PATCH] rpm: Fix handling of SOURCE_DATE_EPOCH

Neal Gompa ngompa13 at gmail.com
Thu Oct 29 13:01:05 UTC 2020


On Thu, Oct 29, 2020 at 7:39 AM Daniel P. Berrangé <berrange at redhat.com> wrote:
>
> On Thu, Oct 29, 2020 at 12:27:16PM +0100, Michal Privoznik wrote:
> > On 10/28/20 9:47 PM, Neal Gompa wrote:
> > > On Wed, Oct 28, 2020 at 7:49 AM Michal Privoznik <mprivozn at redhat.com> wrote:
> > > >
> > > > On 10/27/20 1:06 PM, Neal Gompa wrote:
> > > > > On Tue, Oct 27, 2020 at 6:24 AM Michal Privoznik <mprivozn at redhat.com> wrote:
> > > > > >
> > > > > > On 10/26/20 11:08 PM, Neal Gompa wrote:
> > > > > > > Contemporary versions of Fedora automatically set SOURCE_DATE_EPOCH
> > > > > > > based on the changelog entry date stamp. In scenarios where it already
> > > > > > > is defined, we do not want to redefine it.
> > > > > > >
> > > > > >
> > > > > > This part is okay.
> > > > > >
> > > > > > > Additionally, when building the libvirt package in an Open Build Service
> > > > > > > instance, the spec file is not present in %_specdir, but instead in %_sourcedir.
> > > > > > >
> > > > > >
> > > > > > But this looks fishy. Is the %_specdir defined in that case?
> > > > > >
> > > > >
> > > > > It is (that comes from RPM itself), however the directory is empty.
> > > >
> > > > That feels like a bug in OBS then. IIUC this macro can be specified on
> > > > the rpmbuild's cmd line. Can't it set the %_specdir to be the same as
> > > > %_sourcedir?
> > > >
> > >
> > > Nothing about RPM mandates that %_specdir is actually *used* for anything.
> > >
> >
> > But this is not the case, is it? %_specdir is defined and points to an
> > actual directory. Having said that, I am not against the change, but maybe
> > we can document this weirdness somewhere? Also, with the latest specfile
> > discussion I'll let Andrea take a look.
>

RPM internally populates a specfile variable that is the true pointer
to the spec file, regardless of path. This is not exposed as a macro
despite attempts to do so[1]. There is no rule that the spec file
*must* come from %_specdir, and it's really only used for the location
to store the specfile when extracting an SRPM.

[1]: https://github.com/rpm-software-management/rpm/pull/202

> I'm inclined to just delete all the source epoch stuff from the spec and
> rely on the build environment set it if they want reproducable builds.
>

Considering that RHEL 8 doesn't have the change to turn on
SOURCE_DATE_EPOCH[2], I am inclined to keep it.

[2]: https://src.fedoraproject.org/rpms/redhat-rpm-config/c/86aae600e62fadc18760d95d1fddd323cf9e9a86


-- 
真実はいつも一つ!/ Always, there's only one truth!





More information about the libvir-list mailing list