[scl.org] scl bin path into package

Petr Pisar ppisar at redhat.com
Mon Oct 18 12:52:38 UTC 2021


V Fri, Oct 15, 2021 at 05:36:19PM +0300, Alexander Chernovich napsal(a):
> Hi all, I am trying to import net-snmp into rh-perl524 SCL(RHEL-7), I need
> perl SNMP module into SCL, but it need snmp-package recompilation, so I am
> trying to rewrite spec file, all seems to be OK, but no scl-based path both
> to bin and lib are used(only system path).
> 
> I was trying to get path via `%{?scl:PREFIX=%{_scl_root}}`? but it is emty,
> what I am doing wrong? spec-file in attachment
> 
Have you read
<https://www.softwarecollections.org/en/docs/guide/#sect-Extending_the_perl_Software_Collection>?
It describes how to create a new collection with depends on rh-perl524
collection. It's maybe too complicated for your use case, but it explains all
the macros and dependencies.

If you only want to add net-snmp package into rh-perl524 collection, then
I would recommend you first to find any existing source package from the
collection and then get your system to a state in which rebuilding that source
package will produce the same binary packages as provided by the collection.
Achieving that state usually means installing rh-perl524-build package
which you first need to build from rh-perl524 source package. Finally you can
edit net-snmp pakage in a similar way as the collection package you chose at
the beginning.

> %{?scl:Requires: %{scl}-runtime}
> %{?scl:BuildRequires: %{scl}-runtime}
> BuildRequires: openssl-devel, bzip2-devel, elfutils-devel
> BuildRequires: libselinux-devel, elfutils-libelf-devel, rpm-devel
> BuildRequires: %{?scl_prefix}perl-devel, perl(ExtUtils::Embed)%{?scl_prefix}, gawk, procps

perl(ExtUtils::Embed) has bad prefix.

> %build
> %{?scl:scl enable %{scl} - << \EOF}
> %{?scl:PREFIX=%{_scl_root}}
> set -e
> MIBS="host agentx smux \
>      ucd-snmp/diskio tcp-mib udp-mib mibII/mta_sendmail \
>      ip-mib/ipv4InterfaceTable ip-mib/ipv6InterfaceTable \
>      ip-mib/ipAddressPrefixTable/ipAddressPrefixTable \
>      ip-mib/ipDefaultRouterTable/ipDefaultRouterTable \
>      ip-mib/ipv6ScopeZoneIndexTable ip-mib/ipIfStatsTable \
>      sctp-mib rmon-mib etherlike-mib"
> 
> %ifnarch s390 s390x
> # there are no lm_sensors on s390
> MIBS="$MIBS ucd-snmp/lmsensorsMib"
> %endif
> 
> 
> %configure \
>     --prefix="$PREFIX"

You don't need to change --prefix=%{__prefix}. %{__prefix} will be
automatically redefined if rh-perl524-build is installed.

However, if your goal is to build net-snmp while keeping it installed into
/usr prefix and only use rh-perl524 Perl for linking and installing its Perl
modules, then basically you need to prepend rh-perl524 to Perl dependencies,
change %files entries for Perl modules to point deep into /opt/rh/perl524/...,
do "scl enable rh-perl524", and then build the package. Crafting the spec file
have half of files and dependencies from system, and another half from
collection is possible, but requires a high level of knowledge of build
process of the given software (net-snmp) and I'm not going to explain it here.
I'd recommend you simply building the package as part of the collection.

-- Petr
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://listman.redhat.com/archives/sclorg/attachments/20211018/91bc7f16/attachment.sig>


More information about the SCLorg mailing list