rpm conditional dependency requirements - linux

I'm working on a piece of software just now that needs to run on a newer version of Redhat. It currently works fine on 6 and 7 but now needs to install and run on Redhat 8.
There is nothing really specific in the software that will stop it running on the newer OS version but i'm having a problem with the dependency requirements. The script that runs the software needs access to semanage (/usr/sbin/semanage). On Redhat 6 and 7 this was supplied by policycoreutils-python package and was given as a requirement argument when the rpm was built. From Redhat 8 onwards, the package has been renamed to policycoreutils-python-utils (see this link, section 8.6.2).
From rpm 4.13, there is support for boolean dependencies (see here) which would make this an easy fix as I could just do something like -R (policycoreutils-python or policycoreutils-python-utils) but changing the rpm-build package from its current 4.8 version is a major pain as it's used by another team for another piece of software. I also need to keep it a distro independent rpm so can't have different versions of the rpm for newer versions of the OS.
So, my questions:
1) Is there some other way to have a conditional requirement in the spec file with the older rpm 4.8 version?
2) If I was to get approval to upgrade rpm to latest 4.15, is there likely to be any issue on target systems that have older rpm installed e.g. not understanding the conditional?
Update: The rpm will be built once on a RH 6 box and should work on RH 7 & 8.

if you build one rpm for all platforms
You can depend on semanage itself:
Requires: /usr/sbin/semanage
yum, dnf or rpm should be smart enough to work that out.
if you build each rpm on the corresponding target:
you can use the %rhel_version macros, see https://en.opensuse.org/openSUSE:Build_Service_cross_distribution_howto :
%if 0%{?rhel_version} < 800
Requires: policycoreutils-python
%else
Requires: policycoreutils-python-utils
%endif

Related

Is it possible to run a newer version of cloc (or any package) onto an older version of ubuntu?

I have to work with ubuntu 14.04, but I need to use cloc 1.92. The highest cloc version via package update for Ubuntu is 1.6.
https://packages.ubuntu.com/search?keywords=cloc
I did a wget https://github.com/AlDanial/cloc/releases/download/v1.92/cloc-1.92.tar.gz to download this package to my machine, but it's not showing up in the package list when I do dpkg --list. I'm not sure how to make the cloc 1.92 folder run the same way that 1.6 does on my VM, or if it's even possible to do so.
The git page for cloc explains all related aspects, and skimming over it, in the Why use cloc? section says that the "program is self-contained, only download and run it". This program is developed in Perl 5, present in all Ubuntu distros. You can check that with the command perl --version.
Simply extract the file cloc from the tar.gz and copy it in an appropiate directory, for example /usr/local/bin, and confirm it has the proper executable rights with the command chmod a+rx /usr/local/bin/cloc.
Caveat: cloc claims to use only standard Perl modules. If your installed Perl doesn't have all needed, you will have to install them using CPAN.
Edit: See the comments by Knud Larsen for manual installing as Ubuntu mantainers do.
In this case, as the program is run by an interpreter, it wasn't needed to compile it, but in general programs/libraries in source form could to be compiled and installed independently from the apt/dkpg package management, but could need other libraries/programs to operate. The mantainer of the distro ensures this dependencies are installed together with the desired package. If we want to compile/install manually, then also we have to compile/install all requirements of the program if they aren't there already.
In other cases, the additional required software for the package could be already installed in some older versions, but it is used by other installed programs that could fail if we install new versions. That is the main problem when updating software in older distros: We need to investigate and resolve any conflicts manually.
So, the second answer is: Yes, we can update software in older versions of Ubuntu, but could be impractical to do so.

Making sure all CORE Perl Modules are Installed on Oracle Linux

I am pretty careful to use CORE Perl modules -- the modules that are documented in http://perldoc.perl.org -- whenever I can. For example, I use Time::Piece rather than DateTime or IO::Uncompress rather than Archive::Zip.
We have thousands of Chef managed servers, and we can guarantee a particular version of Perl is installed, but it becomes a nightmare to guarantee that particular CPAN modules are also installed.
Imagine my surprise when a script failed on a new server because Data::Dumper wasn't installed. That module had been part of the CORE modules since the very earliest versions of Perl 5.
I found out that Oracle Linux Release 7 (which is modeled after RHEL 7) divided up the standard Perl packages, so the base Perl no longer installs all of the CORE modules.
What RPM packages do I need to install on Oracle Linux Release 7 (and probably RHEL 7) to guarantee all CORE Perl modules are installed?
On RHEL 7, you have to install these packages:
perl: includes the Perl interpreter, perldoc, and a subset of the core modules
perl-core: the rest of the core modules
I'm guessing Oracle Linux 7 is the same because there's a perl-core-5.16.3-286.el7.x86_64.rpm in the public yum repo.
If you want to be doubly sure, you can check what perl-core provides by installing yum-utils and running:
repoquery --requires perl-core
(perl-core is just a meta package that lists a bunch of other perl-* packages as dependencies)

issue with upgrading net-snmp5.5 to net-snmp5.7.3

I have to manage an Ethernet traffic card (my Linux target board(mips32)) having net-snmp 5.5 installed on it.
I want to upgrade it to latest net-snmp 5.7.3 and have successfully compiled net-snmp.
After that I had changed the all the libnetsnmp* library files, MIB text files and snmpd and snmptrapd daemons...but it gives errors like failed to open shared library ....can not find libnesnmp.so.20 files Why it is throwing this error even though I have updated net-snmp library files.
I am confused that what files of 5.5 has to be replaced by the 5.7.3, in order to upgrade my net-snmp package.
Also please guide me the steps to install a Fresh net-snmp package on any Linux board.
The net-snmp suite comes in 3 distinct Linux packages.
net-snmp (the snmpd agent and snmptrapd daemons, documentation, etc)
net-snmp-utils (various utilities e.g. for interrogating SNMP agents,
sending traps, etc )
net-snmp-libs (runtime libraries)
Have a look at https://stackoverflow.com/a/32093525/449347 to a more detailed listing of files in each.
Make sure you have updated ALL that you have installed.
EDIT ...
Paraphrasing http://www.betweendots.com/topic/45-install-the-latest-version-of-net-snmp/
When you have a CentOS box and type "yum install net-snmp", you'll get
version 5.5. If for some reason you want the latest version (5.7 at
the time of writing), then here's what you have to do:
yum remove net-snmp net-snmp-utils
Install dependencies: yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
Unpack and install net-snmp:
tar zvxf net-snmp-*.tar.gz
cd net-snmp-*
./configure
make
make install
Create an snmpd.conf and put it in /usr/local/share/snmp.
But follow above link for more info!

Compatibility Issue from centos 5.x to 6.x

I have an rpm compiled in centos 5.x which requires libnetsnmp.so.10 and other shared objects. I want to create an rpm of it which is to be run on centos 6.x but it fails to install as on installation it says :
error: Failed dependencies:
libnetsnmp.so.10()(64bit) is needed and so on...
But Centos 6.x contains libnetsnmp.so.20
So I created symbolic links of libnetsnmp.so.10 of libnetsnmp.so.20.
But problem is still the same.
So can you please help me to resolve this problem?
If recompiling for Centos 6 isn't an option, you can try two things, first, install the correct libnetsnmp in the Centos 6 server. If that's not an option, you can add the following to your RPM spec file:
Autoreq: no
This will cause it not to scan your binary for dependencies (such as dynamically linked libraries), and automatically build that into the RPM.
Of course, if that version of libnetsnmp is ACTUALLY required, your just hosing yourself down the road, but likely newer versions will work just fine.

Postgresql 8.3 version needed for OpenSUSE

I have installed OpenSUSE 12.1 installed on machine.
and i have postgresql-contrib-8.3.11-0.1.i586.rpm,postgresql-devel-8.3.11-0.1.i586.rpm, postgresql-docs-8.3.11-0.1.i586.rpm,postgresql-libs-8.3.11-0.1.i586.rpm,postgresql-server-8.3.11-0.1.i586.rpm..
I want to installed postgresql 8.3 version based on above packages..but when i installed with this command .it shows an error.
opnsu121:/ # rpm -Uvh postgresql-server-8.3.11-0.1.i586.rpm
error: Failed dependencies:
postgresql = 8.3 is needed by postgresql-server-8.3.11-0.1.i586
Even i am not able to find postgresql 8.3 base version as i think the above one is update.i have gone throgh the download.openSUSE.orf,ftp.openSUSE.org..
http://download.opensuse.org/update/11.0/rpm/i586/..
but not able to find what i need..so please help on this,
If at all possible, use YaST or whatever package manager SuSE uses to install the current version of PostgreSQL. From the repository it looks like that's 9.1.1.
If you specifically need PostgreSQL 8.3, I'd recommend using the distro-independent installer from EnterpriseDB. That should work fine on SuSE 12.2. If your organisation has particularly restrictive and unsafe version policies that force you to use old versions with known bugs, you can get 8.3.14 for 32-bit Linux here and 8.3.11 for 32-bit Linux here.
If you have issues with using the well-tested and known-to-work EnterpriseDB binary installer versions of PostgreSQL, your other option (and a good one) is to install from source code. Download the PostgreSQL 8.3.18 sources from the FTP site, then:
sudo mkdir -p /opt/postgresql93
sudo chown `id -un` /opt/postgresql93
./configure --prefix=/opt/postgresql93
make
make install
after which you can use /opt/postgresql93/bin/initdb (see initdb manual) to create a database and /opt/postgresql93/bin/pg_ctl (see pg_ctl manual) to start/stop it, as per the PostgreSQL documentation.
Don't try to force packages from an old version of SuSE to install on your new version. It'll probably result in an increasing tree of dependencies and end in pain.
If at all possible, try to convince your company that their policy of requiring a specific minor version (eg 8.4.14 not just "8.4.x") of PostgreSQL is unsafe and counterproductive. They're forcing you to do dirty hacks or hand-compile unique, custom installs just for your setup in order to avoid using well tested builds that contain extra bug fixes. Requiring approval before upgrading from 8.3 to 8.4/9.0/9.1/etc makes sense as there are feature and backward compatibility changes that require careful testing, but requiring approval before upgrading from 8.3.14 to 8.3.18 is counterproductive. Minor version upgrades of PostgreSQL are very conservative; you should stay up to date with the latest minor release.
hurray...I got the answer..
I have got the package below:
postgresql-contrib-8.3.11-0.1.i586.rpm, postgresql-devel-8.3.11-0.1.i586.rpm,postgresql-docs-8.3.11-0.1.i586.rpm,postgresql-libs-8.3.11-0.1.i586.rpm,postgresql-server-8.3.11-0.1.i586.rpm from the below link:
http://download.opensuse.org/update/12.1/i586/
and the one more package which i have struggled to get is:
postgresql-8.3.11-0.1.i586.rpm with the following link:
http://rpm.pbone.net/index.php3/stat/4/idpl/17194424/dir/opensuse_11.x/com/postgresql-8.3.11-0.1.i586.rpm.html
with all above packages i have installed using..
rpm -ivh packagename
if there is a dependency then rpm -ivh --nodeps packagename
great..its done..

Resources