[scl.org] rh-python36-build alternative in rhel

Jiri Novak jiri.novak at ghorland.net
Tue Nov 28 12:47:29 UTC 2017


Hi,

according to this (
https://developers.redhat.com/blog/2014/12/04/add-packages-to-python-2-7-software-collection/
), I'm trying to create my own extension of the rh-python36, though
doesn't build:

+ '[' '%{buildarch}' = noarch ']'
+ QA_CHECK_RPATHS=1
+ case "${QA_CHECK_RPATHS:-}" in
+ /usr/lib/rpm/check-rpaths
+ /usr/lib/rpm/check-buildroot
+ '%{rh-python36_os_install_post}'
/var/tmp/rpm-tmp.k3bzOV: line 316: fg: no job control
error: Bad exit status from /var/tmp/rpm-tmp.k3bzOV (%install)

most probably because the variables are not expanded?
What did I miss? Specfile for refenrence in attachement.

also, just to confirm, is this the right way to create those packages
and make the applications depend on this scl, right?

Thanks in advance,
Gh.


Jiri Novak wrote:
> Hi, I've narrowed it down to what I need to place the packages in
> /opt/rh instead if the /usr/lib/python2.7
>
> %define scl rh-python36
> %define scl_package_override()
> %{expand:%{?python36_os_install_post:%global __os_install_post
> %python36_os_install_post}
> %global __python_requires %python36_python_requires
> %global __python_provides %python36_python_provides
> %global __python3 %python36__python3
> %global __python %python36__python3
> }
>
> as for what you say, for example, if I have a python library, that needs
> to be accessible when using rh-python36, it should be some
> xxx-python36-libname and activated at the same time? or how this should
> be handled?
> the next is the application itself, using rh-python36 and the
> xxx-python36-libname, that for sure can be separately and run with just
> scl enable rh-python36 python3 somepath, so maybe using two scls instead
> of one?
>
> Thanks,
> Gh.
>
>
> Marek Skalický wrote:
>> Packages in collections with rh- prefix are part of RHSCL product and
>> developed by RedHat. So no modification (adding new packages) should be
>> done to these collections - it could cause confusion.
>>
>> So solution to your problem is to create new collection. And -build
>> package of this your new collection will set env right that new
>> packages you want to build will have right %scl macro,... and will use
>> right python and so on.
>>
>> Jiri Novak píše v St 22. 11. 2017 v 16:07 +0100:
>>> Hi,
>>>
>>> the issue is that I don't have the rh-python36-build in rhel
>>> (satellite)
>>> and I didn't manage to find it on rhel site, so I assume it doesn't
>>> exist and should be replaced somehow.
>>> It doesn't sound right to install it via wget && rpm -i from centos.
>>> Or am I wrong and it is somewhere? if yes, which repo?
>>>
>>> Dependence only on rh-python36 is not enough as it is built for
>>> python
>>> 2.7 instead, the scl related macros are not working without
>>> rh-python36-build
>>>
>>> Thanks,
>>> Gh.
>>>
>>>
>>> Stefan Ring wrote:
>>>> On Wed, Nov 22, 2017 at 2:45 PM, Jiri Novak <jiri.novak at ghorland.ne
>>>> t> wrote:
>>>>> Hello,
>>>>>
>>>>> I'm currently trying to port python app to use rh-python36 SCL
>>>>> (built
>>>>> using mock+rpmbuild), I've managed to make it build correctly in
>>>>> the scl
>>>>> paths (and using python3 for the packages that need it during
>>>>> build) if
>>>>> I install rh-python36-build from centos to the mock root.
>>>>> Is there a way to do this with rhel packages too?
>>>> Do what?
>>>>
>>>>> The issue is that
>>>>> without it,
>>>> Without what?
>>>>
>>>>> %{scl} in specfile is not populated, with it, it's properly
>>>>> set to rh-python36. Should I pass the value in different manner
>>>>> than in
>>>>> centos? or what might I be doing wrong?
>>>> I have no idea what you are trying to achieve.
>>> _______________________________________________
>>> SCLorg mailing list
>>> SCLorg at redhat.com
>>> https://www.redhat.com/mailman/listinfo/sclorg
>

-------------- next part --------------
#define name of the scl
%global scl test-python36
%scl_package %scl
 
# Defaults for the values for the python27 Software Collection. These
# will be used when python27-scldevel is not in the buildroot
%{!?scl_python:%global scl_python rh-python36}
%{!?scl_prefix_python:%global scl_prefix_python %{scl_python}-}
 
# Only for this build, we need to override default __os_install_post, because
# the default one would find /opt/.../lib/python2.7/ and rpmbuild would
# try to bytecompile with the system /usr/bin/python2.7 (which doesn't exist)
%global __os_install_post %{%{scl_python}_os_install_post}
# Similarly, override __python_requires for automatic dependency generator
%global __python_requires %{%{scl_python}_python_requires}
 
# The directory for site packages for this Software Collection
%global test_python36_sitelib %(echo %{python36python_sitelib} | sed 's|%{scl_python}|%{scl}|')
 
Summary: Package that installs %scl
Name: %scl_name
Version: 1
Release: 1%{?dist}
License: GPLv2+
BuildRequires: scl-utils-build
# Always make sure that there is the rh-python36-sclbuild
# package in the buildroot
BuildRequires: %{scl_prefix_python}scldevel
# Require rh-python36-python-devel, we will need macros from that package
BuildRequires: %{scl_prefix_python}python-devel
Requires: %{scl_prefix}python-versiontools
 
%description
This is the main package for %scl Software Collection.
 
%package runtime
Summary: Package that handles %scl Software Collection.
Requires: scl-utils
Requires: %{scl_prefix_python}runtime
 
%description runtime
Package shipping essential scripts to work with %scl Software Collection.
 
%package build
Summary: Package shipping basic build configuration
Requires: scl-utils-build
# Require rh-python36-scldevel so that there is always access
# to the %%scl_python and %%scl_prefix_python macros in builds for this Software
# Collection
Requires: %{scl_prefix_python}scldevel
 
%description build
Package shipping essential configuration macros to build %scl Software Collection.
 
%prep
%setup -c -T
 
%install
%scl_install
 
# Create the enable scriptlet that:
# - Adds an additional load path for the Python interpreter.
# - Runs scl_source so that you can run:
# scl enable test-python36 "bash"
# instead of:
# scl enable rh-python36 test-python36 "bash"
 
cat >> %{buildroot}%{_scl_scripts}/enable << EOF
. scl_source enable %{scl_python}
export PYTHONPATH=%{test_python36_sitelib}${PYTHONPATH:+:${PYTHONPATH}}
EOF
 
mkdir -p %{buildroot}%{test_python36_sitelib}
 
# - Enable Software Collection-specific bytecompilation macros from
# the rh-python36-python-devel package.
# - Also override the %%python_sitelib macro to point to the test-python36 Software
# Collection.
# - If you plan to add some architecture-dependent packages, you will also need to override
# the %%python_sitearch macro.
 
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config << EOF
%%scl_package_override() %%{expand:%{?python36_os_install_post:%%global __os_install_post %%python36_os_install_post}
%%global __python_requires %%python36_python_requires
%%global __python_provides %%python36_python_provides
%%global __python %python36__python3
%%global __python3 %python36__python3
%%global python_sitelib %test_python36_sitelib
%%global python3_sitelib %test_python36_sitelib
}
EOF
 
%files
 
%files runtime
%scl_files
 
%scl_files
%test_python36_sitelib
 
%files build
%{_root_sysconfdir}/rpm/macros.%{scl}-config
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 866 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/sclorg/attachments/20171128/0106e270/attachment.sig>


More information about the SCLorg mailing list