#10 Cleanup for %build and %install
Merged 6 years ago by pviktori. Opened 6 years ago by pviktori.
rpms/ pviktori/python3 build-cleanup  into  master

file modified
+197 -251
@@ -149,6 +149,17 @@ 

  # on files that test invalid syntax.

  %undefine py_auto_byte_compile

  

+ # For multilib support, files that are different between 32- and 64-bit arches

+ # need different filenames. Use "64" or "32" according to the word size.

+ # Currently, the best way to determine an architecture's word size happens to

+ # be checking %%{_lib}.

+ %if "%{_lib}" == "lib64"

+ %global wordsize 64

+ %else

+ %global wordsize 32

+ %endif

+ 

+ 

  # =======================

  # Build-time requirements

  # =======================
@@ -427,14 +438,15 @@ 

  Requires: python3-pip

  %endif

  

+ # The description used both for the SRPM and the main `python3` subpackage:

  %description

  Python is an accessible, high-level, dynamically typed, interpreted programming

  language, designed with an emphasis on code readibility.

  It includes an extensive standard library, and has a vast ecosystem of

  third-party libraries.

  

- This package provides the "python3" executable: the reference interpreter for

- the Python language, version 3.

+ The ${name} package provides the "python3" executable: the reference

+ interpreter for the Python language, version 3.

  The majority of its standard library is provided in the %{name}-libs package,

  which should be installed automatically along with %{name}.

  The remaining parts of the Python standard library are broken out into the
@@ -644,42 +656,50 @@ 

  autoconf

  autoheader

  

+ # Remember the current directory (which has sources and the configure script),

+ # so we can refer to it after we "cd" elsewhere.

  topdir=$(pwd)

+ 

+ # Get proper option names from bconds

+ %if %{with computed_gotos}

+ %global computed_gotos_flag yes

+ %else

+ %global computed_gotos_flag no

+ %endif

+ 

+ %if %{with optimizations}

+ %global optimizations_flag "--enable-optimizations"

+ %else

+ %global optimizations_flag "--disable-optimizations"

+ %endif

+ 

+ # Set common compiler/linker flags

  export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"

  export CXXFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"

- export CPPFLAGS="`pkg-config --cflags-only-I libffi`"

+ export CPPFLAGS="$(pkg-config --cflags-only-I libffi)"

  export OPT="$RPM_OPT_FLAGS -D_GNU_SOURCE -fPIC -fwrapv"

  export LINKCC="gcc"

- export CFLAGS="$CFLAGS `pkg-config --cflags openssl`"

- export LDFLAGS="$RPM_LD_FLAGS `pkg-config --libs-only-L openssl`"

+ export CFLAGS="$CFLAGS $(pkg-config --cflags openssl)"

+ export LDFLAGS="$RPM_LD_FLAGS $(pkg-config --libs-only-L openssl)"

  

- 

- # Define a function, for how to perform a "build" of python for a given

- # configuration:

+ # We can build several different configurations of Python: regular and debug.

+ # Define a common function that does one build:

  BuildPython() {

    ConfName=$1

-   BinaryName=$2

-   SymlinkName=$3

-   ExtraConfigArgs=$4

-   PathFixWithThisBinary=$5

-   MoreCFlags=$6

+   ExtraConfigArgs=$2

+   MoreCFlags=$3

  

+   # Each build is done in its own directory

    ConfDir=build/$ConfName

- 

-   echo STARTING: BUILD OF PYTHON FOR CONFIGURATION: $ConfName - %{_bindir}/$BinaryName

+   echo STARTING: BUILD OF PYTHON FOR CONFIGURATION: $ConfName

    mkdir -p $ConfDir

- 

    pushd $ConfDir

  

-   # Use the freshly created "configure" script, but in the directory two above:

+   # Normally, %%configure looks for the "configure" script in the current

+   # directory.

+   # Since we changed directories, we need to tell %%configure where to look.

    %global _configure $topdir/configure

  

-   %if %{with computed_gotos}

-   %global computed_gotos_flag yes

-   %else

-   %global computed_gotos_flag no

-   %endif

- 

  %configure \

    --enable-ipv6 \

    --enable-shared \
@@ -699,140 +719,180 @@ 

    $ExtraConfigArgs \

    %{nil}

  

-   # Set EXTRA_CFLAGS to our CFLAGS (rather than overriding OPT, as we've done

-   # in the past).

-   # This should fix a problem with --with-valgrind where it adds

-   #   -DDYNAMIC_ANNOTATIONS_ENABLED=1

-   # to OPT which must be passed to all compilation units in the build,

-   # otherwise leading to linker errors, e.g.

-   #    missing symbol AnnotateRWLockDestroy

-   #

-   # Invoke the build:

+   # Invoke the build

    make EXTRA_CFLAGS="$CFLAGS $MoreCFlags" %{?_smp_mflags}

  

    popd

-   echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfDir

+   echo FINISHED: BUILD OF PYTHON FOR CONFIGURATION: $ConfName

  }

  

- # Use "BuildPython" to support building with different configurations:

+ # Call the above to build each configuration.

  

  %if %{with debug_build}

  BuildPython debug \

-   python-debug \

-   python%{pybasever}-debug \

- %ifarch %{ix86} x86_64 ppc %{power64}

-   "--with-pydebug --without-ensurepip" \

- %else

-   "--with-pydebug --without-ensurepip" \

- %endif

-   false \

-   -O0

+   "--without-ensurepip --with-pydebug" \

+   "-O0"

  %endif # with debug_build

  

  BuildPython optimized \

-   python \

-   python%{pybasever} \

- %if %{with optimizations}

-   "--without-ensurepip --enable-optimizations" \

- %else

-   "--without-ensurepip --disable-optimizations" \

- %endif  # with optimizations

-   true

+   "--without-ensurepip %{optimizations_flag}" \

+   ""

  

  # ======================================================

  # Installing the built code:

  # ======================================================

  

  %install

+ 

+ # As in %%build, remember the current directory

  topdir=$(pwd)

- rm -fr %{buildroot}

- mkdir -p %{buildroot}%{_prefix} %{buildroot}%{_mandir}

  

+ # We install a collection of hooks for gdb that make it easier to debug

+ # executables linked against libpython3* (such as /usr/bin/python3 itself)

+ #

+ # These hooks are implemented in Python itself (though they are for the version

+ # of python that gdb is linked with)

+ #

+ # gdb-archer looks for them in the same path as the ELF file or its .debug

+ # file, with a -gdb.py suffix.

+ # We put them next to the debug file, because ldconfig would complain if

+ # it found non-library files directly in /usr/lib/

+ # (see https://bugzilla.redhat.com/show_bug.cgi?id=562980)

+ #

+ # We'll put these files in the debuginfo package by installing them to e.g.:

+ #  /usr/lib/debug/usr/lib/libpython3.2.so.1.0.debug-gdb.py

+ # (note that the debug path is /usr/lib/debug for both 32/64 bit)

+ #

+ # See https://fedoraproject.org/wiki/Features/EasierPythonDebugging for more

+ # information

+ 

+ %if %{with gdb_hooks}

+ DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir}

+ mkdir -p %{buildroot}$DirHoldingGdbPy

+ %endif # with gdb_hooks

+ 

+ # Multilib support for pyconfig.h

+ # 32- and 64-bit versions of pyconfig.h are different. For multilib support

+ # (making it possible to install 32- and 64-bit versions simultaneously),

+ # we need to install them under different filenames, and to make the common

+ # "pyconfig.h" include the right file based on architecture.

+ # See https://bugzilla.redhat.com/show_bug.cgi?id=192747

+ # Filanames are defined here:

+ %global _pyconfig32_h pyconfig-32.h

+ %global _pyconfig64_h pyconfig-64.h

+ %global _pyconfig_h pyconfig-%{wordsize}.h

+ 

+ # Use a common function to do an install for all our configurations:

  InstallPython() {

  

    ConfName=$1

    PyInstSoName=$2

    MoreCFlags=$3

+   LDVersion=$4

+   Postfix=$5

  

+   # Switch to the directory with this configuration's built files

    ConfDir=build/$ConfName

- 

    echo STARTING: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName

    mkdir -p $ConfDir

- 

    pushd $ConfDir

  

- make install DESTDIR=%{buildroot} INSTALL="install -p" EXTRA_CFLAGS="$MoreCFlags"

+   make \

+     DESTDIR=%{buildroot} \

+     INSTALL="install -p" \

+     EXTRA_CFLAGS="$MoreCFlags" \

+     install

  

    popd

  

-   # We install a collection of hooks for gdb that make it easier to debug

-   # executables linked against libpython3* (such as /usr/bin/python3 itself)

-   #

-   # These hooks are implemented in Python itself (though they are for the version

-   # of python that gdb is linked with, in this case Python 2.7)

-   #

-   # gdb-archer looks for them in the same path as the ELF file, with a -gdb.py suffix.

-   # We put them in the debuginfo package by installing them to e.g.:

-   #  /usr/lib/debug/usr/lib/libpython3.2.so.1.0.debug-gdb.py

-   #

-   # See https://fedoraproject.org/wiki/Features/EasierPythonDebugging for more

-   # information

-   #

-   # Copy up the gdb hooks into place; the python file will be autoloaded by gdb

-   # when visiting libpython.so, provided that the python file is installed to the

-   # same path as the library (or its .debug file) plus a "-gdb.py" suffix, e.g:

-   #  /usr/lib/debug/usr/lib64/libpython3.2.so.1.0.debug-gdb.py

-   # (note that the debug path is /usr/lib/debug for both 32/64 bit)

-   #

-   # Initially I tried:

-   #  /usr/lib/libpython3.1.so.1.0-gdb.py

-   # but doing so generated noise when ldconfig was rerun

-   # (see https://bugzilla.redhat.com/show_bug.cgi?id=562980)

-   #

  %if %{with gdb_hooks}

-   DirHoldingGdbPy=%{_prefix}/lib/debug/%{_libdir}

+   # See comment on $DirHoldingGdbPy above

    PathOfGdbPy=$DirHoldingGdbPy/$PyInstSoName-%{version}-%{release}.%{_arch}.debug-gdb.py

- 

-   mkdir -p %{buildroot}$DirHoldingGdbPy

    cp Tools/gdb/libpython.py %{buildroot}$PathOfGdbPy

  %endif # with gdb_hooks

  

+   # Rename the -devel script that differs on different arches to arch specific name

+   mv %{buildroot}%{_bindir}/python${LDVersion}-{,`uname -m`-}config

+   echo -e '#!/bin/sh\nexec `dirname $0`/python'${LDVersion}'-`uname -m`-config "$@"' > \

+     %{buildroot}%{_bindir}/python${LDVersion}-config

+   echo '[ $? -eq 127 ] && echo "Could not find python'${LDVersion}'-`uname -m`-config. Look around to see available arches." >&2' >> \

+     %{buildroot}%{_bindir}/python${LDVersion}-config

+     chmod +x %{buildroot}%{_bindir}/python${LDVersion}-config

+ 

+   # Make python3-devel multilib-ready

+   mv %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h \

+      %{buildroot}%{_includedir}/python${LDVersion}/%{_pyconfig_h}

+   cat > %{buildroot}%{_includedir}/python${LDVersion}/pyconfig.h << EOF

+ #include <bits/wordsize.h>

+ 

+ #if __WORDSIZE == 32

+ #include "%{_pyconfig32_h}"

+ #elif __WORDSIZE == 64

+ #include "%{_pyconfig64_h}"

+ #else

+ #error "Unknown word size"

+ #endif

+ EOF

+ 

+   # Systemtap hooks

+ %if %{with systemtap}

+   mkdir -p %{buildroot}%{tapsetdir}

+   sed \

+      -e "s|LIBRARY_PATH|%{_libdir}/${PyInstSoName}|" \

+      -e 's|"python3"|"python3${Postfix}"|' \

+      %{_sourcedir}/libpython.stp \

+      > %{buildroot}%{tapsetdir}/libpython%{pybasever}${Postfix}-%{wordsize}.stp

+ %endif # with systemtap

+ 

    echo FINISHED: INSTALL OF PYTHON FOR CONFIGURATION: $ConfName

  }

  

- # Use "InstallPython" to support building with different configurations:

- 

- # Install the "debug" build first, so that we can move some files aside

+ # Install the "debug" build first; any common files will be overridden with

+ # later builds

  %if %{with debug_build}

  InstallPython debug \

    %{py_INSTSONAME_debug} \

-   -O0

+   -O0 \

+   %{LDVERSION_debug} \

+   -debug

  %endif # with debug_build

  

  # Now the optimized build:

  InstallPython optimized \

-   %{py_INSTSONAME_optimized}

+   %{py_INSTSONAME_optimized} \

+   "" \

+   %{LDVERSION_optimized} \

+   ""

  

- install -d -m 0755 ${RPM_BUILD_ROOT}%{pylibdir}/site-packages/__pycache__

+ # Install directories for additional packages

+ install -d -m 0755 %{buildroot}%{pylibdir}/site-packages/__pycache__

+ %if "%{_lib}" == "lib64"

+ # The 64-bit version needs to create "site-packages" in /usr/lib/ (for

+ # pure-Python modules) as well as in /usr/lib64/ (for packages with extension

+ # modules).

+ # Note that rpmlint will complain about hardcoded library path;

+ # this is intentional.

+ install -d -m 0755 %{buildroot}%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__

+ %endif

  

  # add idle3 to menu

- install -D -m 0644 Lib/idlelib/Icons/idle_16.png ${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/16x16/apps/idle3.png

- install -D -m 0644 Lib/idlelib/Icons/idle_32.png ${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/32x32/apps/idle3.png

- install -D -m 0644 Lib/idlelib/Icons/idle_48.png ${RPM_BUILD_ROOT}%{_datadir}/icons/hicolor/48x48/apps/idle3.png

- desktop-file-install --dir=${RPM_BUILD_ROOT}%{_datadir}/applications %{SOURCE10}

+ install -D -m 0644 Lib/idlelib/Icons/idle_16.png %{buildroot}%{_datadir}/icons/hicolor/16x16/apps/idle3.png

+ install -D -m 0644 Lib/idlelib/Icons/idle_32.png %{buildroot}%{_datadir}/icons/hicolor/32x32/apps/idle3.png

+ install -D -m 0644 Lib/idlelib/Icons/idle_48.png %{buildroot}%{_datadir}/icons/hicolor/48x48/apps/idle3.png

+ desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE10}

  

  # Install and validate appdata file

- mkdir -p ${RPM_BUILD_ROOT}%{_datadir}/appdata

- cp -a %{SOURCE11} ${RPM_BUILD_ROOT}%{_datadir}/appdata

- appstream-util validate-relax --nonet ${RPM_BUILD_ROOT}%{_datadir}/appdata/idle3.appdata.xml

+ mkdir -p %{buildroot}%{_datadir}/appdata

+ cp -a %{SOURCE11} %{buildroot}%{_datadir}/appdata

+ appstream-util validate-relax --nonet %{buildroot}%{_datadir}/appdata/idle3.appdata.xml

  

  # Development tools

- install -m755 -d ${RPM_BUILD_ROOT}%{pylibdir}/Tools

- install Tools/README ${RPM_BUILD_ROOT}%{pylibdir}/Tools/

- cp -ar Tools/freeze ${RPM_BUILD_ROOT}%{pylibdir}/Tools/

- cp -ar Tools/i18n ${RPM_BUILD_ROOT}%{pylibdir}/Tools/

- cp -ar Tools/pynche ${RPM_BUILD_ROOT}%{pylibdir}/Tools/

- cp -ar Tools/scripts ${RPM_BUILD_ROOT}%{pylibdir}/Tools/

+ install -m755 -d %{buildroot}%{pylibdir}/Tools

+ install Tools/README %{buildroot}%{pylibdir}/Tools/

+ cp -ar Tools/freeze %{buildroot}%{pylibdir}/Tools/

+ cp -ar Tools/i18n %{buildroot}%{pylibdir}/Tools/

+ cp -ar Tools/pynche %{buildroot}%{pylibdir}/Tools/

+ cp -ar Tools/scripts %{buildroot}%{pylibdir}/Tools/

  

  # Documentation tools

  install -m755 -d %{buildroot}%{pylibdir}/Doc
@@ -841,50 +901,11 @@ 

  # Demo scripts

  cp -ar Tools/demo %{buildroot}%{pylibdir}/Tools/

  

- # Fix for bug #136654

- rm -f %{buildroot}%{pylibdir}/email/test/data/audiotest.au %{buildroot}%{pylibdir}/test/audiotest.au

- 

- %if "%{_lib}" == "lib64"

- install -d -m 0755 %{buildroot}/%{_prefix}/lib/python%{pybasever}/site-packages/__pycache__

- %endif

- 

- # Make python3-devel multilib-ready (bug #192747, #139911)

- %global _pyconfig32_h pyconfig-32.h

- %global _pyconfig64_h pyconfig-64.h

- 

- %ifarch %{power64} s390x x86_64 ia64 alpha sparc64 aarch64 %{mips64} riscv64

- %global _pyconfig_h %{_pyconfig64_h}

- %else

- %global _pyconfig_h %{_pyconfig32_h}

- %endif

- 

- %if %{with debug_build}

- %global PyIncludeDirs python%{LDVERSION_optimized} python%{LDVERSION_debug}

- 

- %else

- %global PyIncludeDirs python%{LDVERSION_optimized}

- %endif

- 

- for PyIncludeDir in %{PyIncludeDirs} ; do

-   mv %{buildroot}%{_includedir}/$PyIncludeDir/pyconfig.h \

-      %{buildroot}%{_includedir}/$PyIncludeDir/%{_pyconfig_h}

-   cat > %{buildroot}%{_includedir}/$PyIncludeDir/pyconfig.h << EOF

- #include <bits/wordsize.h>

- 

- #if __WORDSIZE == 32

- #include "%{_pyconfig32_h}"

- #elif __WORDSIZE == 64

- #include "%{_pyconfig64_h}"

- #else

- #error "Unknown word size"

- #endif

- EOF

- done

- 

- # Fix for bug 201434: make sure distutils looks at the right pyconfig.h file

+ # Make sure distutils looks at the right pyconfig.h file

+ # See https://bugzilla.redhat.com/show_bug.cgi?id=201434

  # Similar for sysconfig: sysconfig.get_config_h_filename tries to locate

  # pyconfig.h so it can be parsed, and needs to do this at runtime in site.py

- # when python starts up (bug 653058)

+ # when python starts up (see https://bugzilla.redhat.com/show_bug.cgi?id=653058)

  #

  # Split this out so it goes directly to the pyconfig-32.h/pyconfig-64.h

  # variants:
@@ -910,14 +931,8 @@ 

    -perm /u+x,g+x,o+x ! -exec grep -m 1 -q '^#!' {} \; \

    -exec chmod a-x {} \; \) \)

  

- # .xpm and .xbm files should not be executable:

- find %{buildroot} \

-   \( -name \*.xbm -o -name \*.xpm -o -name \*.xpm.1 \) \

-   -exec chmod a-x {} \;

- 

  # Remove executable flag from files that shouldn't have it:

  chmod a-x \

-   %{buildroot}%{pylibdir}/distutils/tests/Setup.sample \

    %{buildroot}%{pylibdir}/Tools/README

  

  # Get rid of DOS batch files:
@@ -926,24 +941,9 @@ 

  # Get rid of backup files:

  find %{buildroot}/ -name "*~" -exec rm -f {} \;

  find . -name "*~" -exec rm -f {} \;

- rm -f %{buildroot}%{pylibdir}/LICENSE.txt

- # Junk, no point in putting in -test sub-pkg

- rm -f ${RPM_BUILD_ROOT}/%{pylibdir}/idlelib/testcode.py*

  

- # Get rid of stray patch file from buildroot:

- rm -f %{buildroot}%{pylibdir}/test/test_imp.py.apply-our-changes-to-expected-shebang # from patch 4

- 

- # Fix end-of-line encodings:

- find %{buildroot}/ -name \*.py -exec sed -i 's/\r//' {} \;

- 

- # Fix an encoding:

- iconv -f iso8859-1 -t utf-8 %{buildroot}/%{pylibdir}/Demo/rpc/README > README.conv && mv -f README.conv %{buildroot}/%{pylibdir}/Demo/rpc/README

- 

- # Note that

- #  %{pylibdir}/Demo/distutils/test2to3/setup.py

- # is in iso-8859-1 encoding, and that this is deliberate; this is test data

- # for the 2to3 tool, and one of the functions of the 2to3 tool is to fixup

- # character encodings within python source code

+ # Get rid of a stray copy of the license:

+ rm %{buildroot}%{pylibdir}/LICENSE.txt

  

  # Do bytecompilation with the newly installed interpreter.

  # This is similar to the script in macros.pybytecompile
@@ -954,36 +954,13 @@ 

      xargs -0 %{buildroot}%{_bindir}/python%{pybasever} -O -c 'import py_compile, sys; [py_compile.compile(f, dfile=f.partition("%{buildroot}")[2], optimize=opt) for opt in range(3) for f in sys.argv[1:]]' || :

  

  # Fixup permissions for shared libraries from non-standard 555 to standard 755:

- find %{buildroot} \

-     -perm 555 -exec chmod 755 {} \;

+ find %{buildroot} -perm 555 -exec chmod 755 {} \;

  

  # Install macros for rpm:

  mkdir -p %{buildroot}/%{_rpmconfigdir}/macros.d/

  install -m 644 %{SOURCE3} %{buildroot}/%{_rpmconfigdir}/macros.d/

  install -m 644 %{SOURCE9} %{buildroot}/%{_rpmconfigdir}/macros.d/

  

- # Ensure that the curses module was linked against libncursesw.so, rather than

- # libncurses.so (bug 539917)

- ldd %{buildroot}/%{dynload_dir}/_curses*.so \

-     | grep curses \

-     | grep libncurses.so && (echo "_curses.so linked against libncurses.so" ; exit 1)

- 

- # Ensure that the debug modules are linked against the debug libpython, and

- # likewise for the optimized modules and libpython:

- for Module in %{buildroot}/%{dynload_dir}/*.so ; do

-     case $Module in

-     *.%{SOABI_debug})

-         ldd $Module | grep %{py_INSTSONAME_optimized} &&

-             (echo Debug module $Module linked against optimized %{py_INSTSONAME_optimized} ; exit 1)

- 

-         ;;

-     *.%{SOABI_optimized})

-         ldd $Module | grep %{py_INSTSONAME_debug} &&

-             (echo Optimized module $Module linked against debug %{py_INSTSONAME_debug} ; exit 1)

-         ;;

-     esac

- done

- 

  # Create "/usr/bin/python3-debug", a symlink to the python3 debug binary, to

  # avoid the user having to know the precise version and ABI flags.

  # See e.g. https://bugzilla.redhat.com/show_bug.cgi?id=676748
@@ -993,57 +970,6 @@ 

    %{buildroot}%{_bindir}/python3-debug

  %endif

  

- #

- # Systemtap hooks:

- #

- %if %{with systemtap}

- # Install a tapset for this libpython into tapsetdir, fixing up the path to the

- # library:

- mkdir -p %{buildroot}%{tapsetdir}

- %ifarch %{power64} s390x x86_64 ia64 alpha sparc64 aarch64 %{mips64}

- %global libpython_stp_optimized libpython%{pybasever}-64.stp

- %global libpython_stp_debug     libpython%{pybasever}-debug-64.stp

- %else

- %global libpython_stp_optimized libpython%{pybasever}-32.stp

- %global libpython_stp_debug     libpython%{pybasever}-debug-32.stp

- %endif

- 

- sed \

-    -e "s|LIBRARY_PATH|%{_libdir}/%{py_INSTSONAME_optimized}|" \

-    %{_sourcedir}/libpython.stp \

-    > %{buildroot}%{tapsetdir}/%{libpython_stp_optimized}

- 

- %if %{with debug_build}

- # In Python 3, python3 and python3-debug don't point to the same binary,

- # so we have to replace "python3" with "python3-debug" to get systemtap

- # working with debug build

- sed \

-    -e "s|LIBRARY_PATH|%{_libdir}/%{py_INSTSONAME_debug}|" \

-    -e 's|"python3"|"python3-debug"|' \

-    %{_sourcedir}/libpython.stp \

-    > %{buildroot}%{tapsetdir}/%{libpython_stp_debug}

- %endif # with debug_build

- 

- %endif # with systemtap

- 

- # Rename the -devel script that differs on different arches to arch specific name

- mv %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-{,`uname -m`-}config

- echo -e '#!/bin/sh\nexec `dirname $0`/python%{LDVERSION_optimized}-`uname -m`-config "$@"' > \

-   %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config

- echo '[ $? -eq 127 ] && echo "Could not find python%{LDVERSION_optimized}-`uname -m`-config. Look around to see available arches." >&2' >> \

-   %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config

-   chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_optimized}-config

- 

- %if %{with debug_build}

- # Rename the -debug script that differs on different arches to arch specific name

- mv %{buildroot}%{_bindir}/python%{LDVERSION_debug}-{,`uname -m`-}config

- echo -e '#!/bin/sh\nexec `dirname $0`/python%{LDVERSION_debug}-`uname -m`-config "$@"' > \

-   %{buildroot}%{_bindir}/python%{LDVERSION_debug}-config

- echo '[ $? -eq 127 ] && echo "Could not find python%{LDVERSION_debug}-`uname -m`-config. Look around to see available arches." >&2' >> \

-   %{buildroot}%{_bindir}/python%{LDVERSION_debug}-config

-   chmod +x %{buildroot}%{_bindir}/python%{LDVERSION_debug}-config

- %endif # with debug_build

- 

  # System Python: Link the executable to libexec

  # This is for backwards compatibility only and should be removed in Fedora 29

  mkdir -p %{buildroot}%{_libexecdir}
@@ -1051,7 +977,7 @@ 

  

  

  # ======================================================

- # Running the upstream test suite

+ # Checks for packaging issues

  # ======================================================

  

  %check
@@ -1062,6 +988,33 @@ 

      PYTHONPATH="%{buildroot}%{_libdir}/python%{pybasever} %{buildroot}%{_libdir}/python%{pybasever}/site-packages" \

      xargs -0 %{buildroot}%{_bindir}/python%{pybasever} %{SOURCE8}

  

+ # Ensure that the curses module was linked against libncursesw.so, rather than

+ # libncurses.so

+ # See https://bugzilla.redhat.com/show_bug.cgi?id=539917

+ ldd %{buildroot}/%{dynload_dir}/_curses*.so \

+     | grep curses \

+     | grep libncurses.so && (echo "_curses.so linked against libncurses.so" ; exit 1)

+ 

+ # Ensure that the debug modules are linked against the debug libpython, and

+ # likewise for the optimized modules and libpython:

+ for Module in %{buildroot}/%{dynload_dir}/*.so ; do

+     case $Module in

+     *.%{SOABI_debug})

+         ldd $Module | grep %{py_INSTSONAME_optimized} &&

+             (echo Debug module $Module linked against optimized %{py_INSTSONAME_optimized} ; exit 1)

+ 

+         ;;

+     *.%{SOABI_optimized})

+         ldd $Module | grep %{py_INSTSONAME_debug} &&

+             (echo Optimized module $Module linked against debug %{py_INSTSONAME_debug} ; exit 1)

+         ;;

+     esac

+ done

+ 

+ # ======================================================

+ # Running the upstream test suite

+ # ======================================================

+ 

  # For ppc64 we need a larger stack than default

  # See https://bugzilla.redhat.com/show_bug.cgi?id=1292462

  %ifarch %{power64}
@@ -1069,6 +1022,7 @@ 

    ulimit -s 16384

  %endif

  

+ 

  topdir=$(pwd)

  CheckPython() {

    ConfName=$1
@@ -1116,14 +1070,6 @@ 

  

  

  # ======================================================

- # Cleaning up

- # ======================================================

- 

- %clean

- rm -fr %{buildroot}

- 

- 

- # ======================================================

  # Scriptlets

  # ======================================================

  

Here is some more clean-up. Please see the individual commits.

Instead of hardcoding 64bit arches here (and be surprised when new 64bit arches are introduced), what if we check %if "%{_lib}" == "lib64" as somewhere else in the spec? Would that give us a different result? (I guess it shouldn't, unless there's a 64bit wordsize arch that does not have lib64.)

4 new commits added

  • Make the main description also applicable to the SRPM
  • Snipe a typo
  • Check %{_lib} rather than hardcode all 64-bit arches
  • Include audiotest.au again
6 years ago

The new commits address the issues you found, plus:
- include audiotest.au (since, in the meantime, I gained access to a private bug)
- adjust main description (a bit out of scope, but I had it ready)

New scratch build: https://koji.fedoraproject.org/koji/taskinfo?taskID=21658133

no further comments from me, feel free to merge

Pull-Request has been merged by pviktori

6 years ago

Thanks! Added a changelog and merged.

Metadata