Blame SPECS/rh-python36.spec

454e4b
%global scl_name_prefix rh-
454e4b
%global scl_name_base python
454e4b
%global scl_name_version 36
454e4b
%global scl %{scl_name_prefix}%{scl_name_base}%{scl_name_version}
454e4b
454e4b
## General notes about python36 SCL packaging
454e4b
# - the names of packages are NOT prefixed with 'python3-' (e.g. are the same as in Fedora)
454e4b
# - the names of binaries of Python 3 itself are both python{-debug,...} and python3{-debug,...}
454e4b
#   so both are usable in shebangs, the non-versioned binaries are preferred.
454e4b
# - the names of other binaries are NOT prefixed with 'python3-'.
454e4b
# - there are both macros in '3' variant and non-versioned variant, e.g. both %%{__python}
454e4b
#   and %%{__python3} are available
454e4b
454e4b
%global nfsmountable 1
454e4b
454e4b
%scl_package %scl
454e4b
%global _turn_off_bytecompile 1
454e4b
454e4b
%global install_scl 1
454e4b
454e4b
# do not produce empty debuginfo package
454e4b
%global debug_package %{nil}
454e4b
454e4b
Summary: Package that installs %scl
454e4b
Name: %scl_name
454e4b
Version: 2.0
454e4b
Release: 1%{?dist}
454e4b
License: GPLv2+
454e4b
Source0: macros.additional.%{scl}
454e4b
Source1: README
454e4b
Source2: LICENSE
454e4b
BuildRequires: help2man
454e4b
# workaround for https://bugzilla.redhat.com/show_bug.cgi?id=857354
454e4b
BuildRequires: iso-codes
454e4b
BuildRequires: scl-utils-build
454e4b
%if 0%{?install_scl}
454e4b
Requires: %{scl_prefix}python
454e4b
Requires: %{scl_prefix}python-pip
454e4b
Requires: %{scl_prefix}python-setuptools
454e4b
Requires: %{scl_prefix}python-virtualenv
454e4b
%endif
454e4b
454e4b
%description
454e4b
This is the main package for %scl Software Collection.
454e4b
454e4b
%package runtime
454e4b
Summary: Package that handles %scl Software Collection.
454e4b
Requires: scl-utils
454e4b
454e4b
%description runtime
454e4b
Package shipping essential scripts to work with %scl Software Collection.
454e4b
454e4b
%package build
454e4b
Summary: Package shipping basic build configuration
454e4b
Requires: scl-utils-build
454e4b
454e4b
%description build
454e4b
Package shipping essential configuration macros to build %scl Software Collection.
454e4b
454e4b
%package scldevel
454e4b
Summary: Package shipping development files for %scl
454e4b
454e4b
%description scldevel
454e4b
Package shipping development files, especially usefull for development of
454e4b
packages depending on %scl Software Collection.
454e4b
454e4b
%prep
454e4b
%setup -T -c
454e4b
454e4b
# This section generates README file from a template and creates man page
454e4b
# from that file, expanding RPM macros in the template file.
454e4b
cat >README <<'EOF'
454e4b
%{expand:%(cat %{SOURCE1})}
454e4b
EOF
454e4b
454e4b
# copy the license file so %%files section sees it
454e4b
cp %{SOURCE2} .
454e4b
454e4b
%build
454e4b
# generate a helper script that will be used by help2man
454e4b
cat >h2m_helper <<'EOF'
454e4b
#!/bin/bash
454e4b
[ "$1" == "--version" ] && echo "%{scl_name} %{version} Software Collection" || cat README
454e4b
EOF
454e4b
chmod a+x h2m_helper
454e4b
454e4b
# generate the man page
454e4b
help2man -N --section 7 ./h2m_helper -o %{scl_name}.7
454e4b
# Fix single quotes in man page. See RHBZ#1219531
454e4b
#
454e4b
# http://lists.gnu.org/archive/html/groff/2008-06/msg00001.html suggests that
454e4b
# using "'" for quotes is correct, but the current implementation of man in 6
454e4b
# mangles it when rendering.
454e4b
sed -i "s/'/\\\\(aq/g" %{scl_name}.7
454e4b
454e4b
%install
454e4b
%scl_install
454e4b
454e4b
cat >> %{buildroot}%{_scl_scripts}/enable << EOF
454e4b
export PATH=%{_bindir}\${PATH:+:\${PATH}}
454e4b
export LD_LIBRARY_PATH=%{_libdir}\${LD_LIBRARY_PATH:+:\${LD_LIBRARY_PATH}}
454e4b
export MANPATH=%{_mandir}:\$MANPATH
454e4b
export PKG_CONFIG_PATH=%{_libdir}/pkgconfig\${PKG_CONFIG_PATH:+:\${PKG_CONFIG_PATH}}
454e4b
export XDG_DATA_DIRS="%{_datadir}:\${XDG_DATA_DIRS:-/usr/local/share:/usr/share}"
454e4b
EOF
454e4b
454e4b
# Add the aditional macros to macros.%%{scl}-config
454e4b
cat %{SOURCE0} >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config
454e4b
# instead of replacing @scl@ with %%{scl} macro we replace it with scl_name_base and scl_name_version
454e4b
# because scl macro contains vendor prefix rh- and this leads to wrong macro names
454e4b
# (macro can't contain -) and erros like %rh has illegal name
454e4b
sed -i 's|@scl@|%{scl_name_base}%{scl_name_version}|g' %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl}-config
454e4b
454e4b
# Create the scldevel subpackage macros
454e4b
cat >> %{buildroot}%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel << EOF
454e4b
%%scl_%{scl_name_base} %{scl}
454e4b
%%scl_prefix_%{scl_name_base} %{scl_prefix}
454e4b
EOF
454e4b
454e4b
# install generated man page
454e4b
mkdir -p %{buildroot}%{_mandir}/man7/
454e4b
install -m 644 %{scl_name}.7 %{buildroot}%{_mandir}/man7/%{scl_name}.7
454e4b
454e4b
%files
454e4b
454e4b
%files runtime -f filelist
454e4b
%doc README LICENSE
454e4b
%scl_files
454e4b
%{_mandir}/man7/%{scl_name}.*
454e4b
454e4b
%files build
454e4b
%{_root_sysconfdir}/rpm/macros.%{scl}-config
454e4b
454e4b
%files scldevel
454e4b
%{_root_sysconfdir}/rpm/macros.%{scl_name_base}-scldevel
454e4b
454e4b
%changelog
454e4b
* Wed May 31 2017 Tomas Orsava <torsava@redhat.com> - 2.0-1
454e4b
- Created the rh-python36 metapackage by importing rh-python35, applying the
454e4b
  following patch and modifying the version to 36
454e4b
- Moved pythondeps-scl-35.sh and 2 macro definitions from the -build subpackage
454e4b
  to the rh-python35-python-devel subpackage where it should be for dependant
454e4b
  collections to build properly
454e4b
Resolves: rhbz#1422346