[SOLVED] - How to use Requires in SPEC file

Issues related to applications and software problems
Post Reply
User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

[SOLVED] - How to use Requires in SPEC file

Post by warron.french » 2019/04/17 14:05:21

Hello, I am working on building an RPM from scratch and have a few requirements to meet for the complete functionality of the software suite.

The software suite, whether packaged as an RPM or not, has various software tools that require the following:
*java (openjdk's or oracle's) at version 1.8 or greater
*firefox
*RHEL-7 x86_64 or CentOS-7 x86_64
*bash
*csh
*perl at version 5
*perl-Data-Dumper, perl-XML-Parser, perl-XML-Simple, perl-XML-TreeBuilder
*python 2.7
and
*python 3.3

So, I believe the syntax I require in my SPEC file will look like this:

Code: Select all

Requires:  java >= 1.8
Requires:  firefox
Requires:   (I don't know what to do about the OS dependency for the RPM)
Requires:  bash
Requires:  csh
Requires:  perl
Requires:  perl-Data-Dumper
Requires:  perl-XML-Parser, perl-XML-Simple, perl-XML-TreeBuilder
Requires:  python  >= 2.7
Requires:  rh-python      
Note: (Red Hat releases Python 3.x in packages of the naming convention rh-python3x; what the heck?! python2-2.x and python3-3.x makes much more sense!)

Am I correct for java?
Am I correct for firefox, bash, csh, and perl?


Thank you for your patience and support.
Truly,
Last edited by warron.french on 2019/04/26 14:48:35, edited 1 time in total.
Thanks,
War

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to use Requires in SPEC file

Post by TrevorH » 2019/04/17 14:16:15

I think you probably have to pick one of the Oracle or openjdk packages as they "Provide" different things though you might be able to use java-1.8.0 as that appears to be the only thing I can see in common between them. You can't use java >= 1.8.0 as the Oracle jdk package doesn't supply a versioned "java" only java-1.8.0. Compare the output from rpm -q --provides java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64 and the same command against the Oracle package to see what they provide in common.

You'll find perl and all 4 of those perl packages in the CentOS base repos.

You can use a Provides: redhat-release >= 7.6 and that should work on both RHEL and CentOS (rpm -q --provides centos-release)

Python 2.7 will always be installed on CentOS/RHEL 7 as it's the default system python.

The rh-python* packages are all SCLs not packages provided by base/updates. SCLs require special action to activate them so that may not be a useful thing to use. There are python36* packages in EPEL that are not SCLs.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

Re: How to use Requires in SPEC file

Post by warron.french » 2019/04/17 18:21:29

Hi TrevorH, thanks for the quick reply.

So my Requires lines for bash, csh, perl, perl-XML* and perl-Data-Dumper are pretty simple; and my syntax for them are correct? Yes?

You pointed out my very same concern about the Java and versioning; so, I think I will just stick with the openjdk package appropriate for java - incorporating your input; thanks. However, here is what I learned (thanks to the rpm -q --provides command by the way) about Oracle's Java and OpenJDK's Java (in snipped format):

Code: Select all

rpm -q --provides  java-1.8.0-openjdk
java = 1:1.8.0
jre = 1.8.0

Code: Select all

rpm -q --provides  java-1.8.0-oracle
java = 1:1.8.0
jre = 1:1.8.0
<- this was an interesting difference from java-1.8.0-openjdk

What sort of Requires line can I use? Can I use?

Code: Select all

Requires: java == 1:1.8.0
As for Python 2.7 versus 3.3; I was thinking the same conclusion, so perhaps I will require python at version 2.7; and not worry about Python3 as an RPM requirement to satisfy the software suite.

As for the redhat-release tidbit with the Provides: from what I understand that tag "Provides:" indicates what the specific package associated with the specific SPEC files offers as a feature. Am I incorrect in this understanding?
Thanks,
War

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to use Requires in SPEC file

Post by TrevorH » 2019/04/17 18:29:48

If you have java-1.8.0-oracle then it's not a CentOS system, it's most likely RHEL. Redhat have hte necessary agreements in place with Oracle to allow them to ship the Oracle jdk. CentOS does not and the RHEL package is in a channel that CentOS does not rebuild.

From the openjdk package on CentOS I get

Code: Select all

 rpm -q --provides java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64 
application()
application(java-1.8.0-openjdk-1.8.0.201.b09-2.el7_6.x86_64-policytool.desktop)
java = 1:1.8.0
java-1.8.0 = 1:1.8.0.201.b09-2.el7_6
java-1.8.0-openjdk = 1:1.8.0.201.b09-2.el7_6
java-1.8.0-openjdk(x86-64) = 1:1.8.0.201.b09-2.el7_6
java-fonts = 1:1.8.0.201.b09
java-openjdk = 1:1.8.0.201.b09-2.el7_6
jre = 1.8.0
jre-1.8.0 = 1:1.8.0.201.b09-2.el7_6
jre-1.8.0-openjdk = 1:1.8.0.201.b09-2.el7_6
jre-openjdk = 1:1.8.0.201.b09-2.el7_6
libjawt.so()(64bit)
libjawt.so(SUNWprivate_1.1)(64bit)
and from the Oracle one (a bit backlevel but...)

Code: Select all

$ rpm -q --provides jdk1.8-1.8.0_192-fcs.x86_64
jdk
jaxp_parser_impl
xml-commons-apis
java
java-1.8.0
java-fonts
jre
jre-1.8.0
jdk1.8 = 2000:1.8.0_192-fcs
Be aware that python 2 and 3 have different syntax in places and the code is not necessarily compatible between the 2.

As for Provides:, many things use that and rpmbuild can auto set some values - for example a random perl package I picked - rpm -q --provides perl-Date-Manip-6.41-2.el7.noarch has a provide of "perl(Date::Manip)" and that convention is true across all perl packages - they show the exact perl function as a provide.

In the particular case of centos-release, it has to provide redhat-release in order for CentOS to be RHEL compatible - what happens if you try to install a package from a vendor that has Require: redhat-release >= 7 for example?
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

Re: How to use Requires in SPEC file

Post by warron.french » 2019/04/17 18:37:42

TrevorH wrote:
2019/04/17 18:29:48
If you have java-1.8.0-oracle then it's not a CentOS system, it's most likely RHEL. Redhat have hte necessary agreements in place with Oracle to allow them to ship the Oracle jdk. CentOS does not and the RHEL package is in a channel that CentOS does not rebuild.
My organization proactively grabs the latest Oracle JAVA RPM from www.java.com; built by Oracle. We are using Red Hat Client, Workstation and Server on our project.
Thanks,
War

User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

Re: How to use Requires in SPEC file

Post by warron.french » 2019/04/17 18:42:58

Can I use

Code: Select all

Requires: java == 1:1.8.0
Thanks,
War

User avatar
TrevorH
Site Admin
Posts: 33221
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: How to use Requires in SPEC file

Post by TrevorH » 2019/04/17 19:25:17

You can certainly use things like "Requires: java >= 1:1.8.0", I presume you can also use == (or is it just =) though you might find that a bit too exact.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

User avatar
warron.french
Posts: 616
Joined: 2014/03/27 20:21:58

Re: How to use Requires in SPEC file

Post by warron.french » 2019/04/18 00:15:56

Thanks TrevorH, I am going to try that.

For the same RPM I now need to look into how to implement a second Source tag, Source1. I remember the other link you provided me with respect to %setup.

Thanks for that.
Thanks,
War

Post Reply