Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boolean dependencies for RPM #1457

Open
hakman opened this issue Jan 12, 2018 · 6 comments
Open

Boolean dependencies for RPM #1457

hakman opened this issue Jan 12, 2018 · 6 comments

Comments

@hakman
Copy link

hakman commented Jan 12, 2018

This feature is quite new, but will be very useful to have in the near future:
http://rpm.org/user_doc/boolean_dependencies.html

Weak dependencies (recommends and suggests) would also be nice to have:
http://rpm.org/user_doc/dependencies.html

@EarthCitizen
Copy link

I was just looking at how to do that, and I see that it is not yet implemented. I am in a situation that needs weak dependencies.

@danmx
Copy link

danmx commented Aug 27, 2018

😈 dump, +1

@9point6
Copy link

9point6 commented Jun 14, 2019

Weak dependencies would be a nice addition given the support for --deb-recommends

@nook24
Copy link

nook24 commented May 21, 2021

I'm interested in this as well

@gkralik
Copy link

gkralik commented Jul 16, 2021

This is already possible, but not obvious.

When using the fpm CLI, include a --rpm-tag 'Suggests: <CAPABILITY>' parameter.

Using the API, just add it to the :rpm_tag attribute:

rpm_package.attributes[:rpm_tag] = "Suggests: <CAPABILITY>"

Instead of Suggests also one of Enhances, Supplements or Enhances can be used, depending on the use case.

@nook24
Copy link

nook24 commented Oct 17, 2021

It is worth mentioning that if you want to use weak dependencies with an RPM repository you HAVE TO USE https://github.com/rpm-software-management/createrepo_c to create the repository. Otherwise weak dependencies will not work.

Thanks to @gkralik I was able to build an rpm which recommends another rpm via fpm using --rpm-tag "Recommends: pkg-b"

[root@localhost ~]# LANG=c dnf install pkg-a
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:00:33 ago on Sun Oct 17 17:51:08 2021.
Dependencies resolved.
======================================================================================================
 Package          Architecture      Version               Repository                             Size
======================================================================================================
Installing:
 pkg-a            x86_64            1.0.5-1               foo.lan_rpm_            6.0 k
Installing weak dependencies:
 pkg-b            x86_64            1.0.5-1               foo.lan_rpm_            5.9 k

Transaction Summary
======================================================================================================
Install  2 Packages

Total download size: 12 k
Installed size: 51
Is this ok [y/N]:

You can use rpm to check if the packges got add to recommends and requires:

[17:57]root@build~# rpm -qp /tmp/pkg-a_1.0.5.x86_64.rpm --recommends --requires
pkg-b
basesystem
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1

You can also query the --recommends from the repo:

[root@localhost ~]# LANG=c dnf repoquery --recommends pkg-a
Failed to set locale, defaulting to C.UTF-8
Last metadata expiration check: 0:07:19 ago on Sun Oct 17 17:51:08 2021.
pkg-b

If you get an empty list at this point, than the RPM repository was most likely created using the old python createrepo command instead of createrepo_c.

This took me a couple of hours to figure out.

Full fpm commands (Just for reference)

fpm --verbose --debug-workspace -s tar -t rpm -n pkg-a -p /tmp/pkg-a_1.0.5.x86_64.rpm -v 1.0.5 --license GPLv3 --maintainer 'a' --description "pkg a" --architecture x86_64 --depends basesystem --rpm-tag "Recommends: pkg-b" /root/pkg-a.tar.gz


fpm --verbose -s tar -t rpm -n pkg-b -p /tmp/pkg-b_1.0.5.x86_64.rpm -v 1.0.5 --license GPLv3 --maintainer 'b' --description "pkg b" --architecture x86_64 --depends basesystem  /root/pkg-b.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants