Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I'm trying to build a cross-distro binary RPM package that works under Fedora and openSUSE. I'm using a Require: tag to set the dependencies package names. The problem is that the package names are different in each GNU/Linux distro repo.

Reading:, and using '%if 0%{?suse_version} ' statements give a cross-distro .spec file. That is, the list of deps will be determined at build-time not install-time.

Is there a way to set a conditional list of deps inside a binary RPM package?

share|improve this question

2 Answers 2

up vote 1 down vote accepted

No. This isn't how you go about it. You really do need to build separate packages for each distro. This will require a slightly different looking spec file for each distro, and sometimes for different versions of a distro of you are targetting more than the current release.

Your "conditionals" should go one step higher up ... on picking which RPM to use, not inside the RPM itself. If you want you can generate these spec files from a script with conditionals so to automate this process for you, but when you build a package from a spec you will need a distro-specific spec.

share|improve this answer
This is true, but some background might be nice.... – mattdm Apr 13 '11 at 14:56

No way. sorry. You couldn't do conditional list of deps inside RPM. The only way to do this is to remove all distro specific deps from your spec file.

share|improve this answer
Ok thanks. I need the list of deps for my app to install without the need for the user to install the deps himself. – Saleh Apr 15 '11 at 8:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.