Re: RPM question: How to get the package VR from a dependency generator

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Feb 28, 2022 at 04:26:02PM +0200, Panu Matilainen wrote:
> On 2/28/22 16:12, Richard W.M. Jones wrote:
> >On Mon, Feb 28, 2022 at 01:46:38PM +0000, Richard W.M. Jones wrote:
> >>
> >>I'm writing a simple provides generator.  The documentation is a bit
> >>light on detail:
> >>
> >>   https://rpm-software-management.github.io/rpm/manual/dependency_generators.html
> >>
> >>How do I get the version-release of the package currently being built?
> >>At the moment I can only print simple provides like:
> >>
> >>   Provides: foo
> >>
> >>but I want to include the version of the package being built, eg:
> >>
> >>   Provides: foo = 1.2-3.fc36
> >>
> >>In theory it seems like the environment variables $RPM_PACKAGE_VERSION
> >>and $RPM_PACKAGE_RELEASE should be set in the dependency generator,
> >>but I just confirmed they are not set.
> >
> >I dumped out the environment from the dependency generator and the
> >only RPM-specific environment variable is $RPM_BUILD_ROOT.  I could
> >get the version from that, but it would be a bit of a hack.
> 
> Name, epoch, version and release are available as macros in the
> .attr file so you can pass what you need from there, eg to pass
> version and release as arguments to the provides generator, you can
> do:
> 
> %__my_provides /path/to/my/depgen %{version} %{release}
> 
> This seems to be missing in the docs, will fix.

Ah nice, I didn't realise you could add parameters there.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
Read my programming and virtualization blog: http://rwmj.wordpress.com
virt-builder quickly builds VMs from scratch
http://libguestfs.org/virt-builder.1.html
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux