#10 Skip automatic Python byte-compilation if *.py files are not present
Merged 2 years ago by churchyard. Opened 2 years ago by pviktori.
rpms/ pviktori/rpm skip-auto-py-comile  into  master

@@ -0,0 +1,15 @@ 

+ diff --git a/scripts/brp-python-bytecompile b/scripts/brp-python-bytecompile

+ index 894fa3459..47776215a 100644

+ --- a/scripts/brp-python-bytecompile

+ +++ b/scripts/brp-python-bytecompile

+ @@ -87,6 +87,10 @@ if [ ! -x "$default_python" ]; then

+  	exit 0

+  fi

+  

+ +# Figure out if there are files to be bytecompiled with the default_python at all

+ +# this prevents unnecessary default_python invocation

+ +find "$RPM_BUILD_ROOT" -type f -name "*.py" | grep -Ev "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" || exit 0

+ +

+  # Generate normal (.pyc) byte-compiled files.

+  python_bytecompile "" $default_python "/bin/|/sbin/|/usr/lib(64)?/python[0-9]\.[0-9]|/usr/share/doc" "$RPM_BUILD_ROOT" "$depth" "/"

+  if [ $? -ne 0 -a 0$errors_terminate -ne 0 ]; then

file modified
+7 -1

@@ -23,7 +23,7 @@ 

  

  %global rpmver 4.14.1

  #global snapver rc2

- %global rel 3

+ %global rel 4

  

  %global srcver %{version}%{?snapver:-%{snapver}}

  %global srcdir %{?snapver:testing}%{!?snapver:%{name}-%(echo %{version} | cut -d'.' -f1-2).x}

@@ -56,6 +56,9 @@ 

  Patch4: rpm-4.8.1-use-gpg2.patch

  # Temporary band-aid for rpm2cpio whining on payload size mismatch (#1142949)

  Patch5: rpm-4.12.0-rpm2cpio-hack.patch

+ # Skip automatic Python byte-compilation if *.py files are not present

+ # Upstream pull request: https://github.com/rpm-software-management/rpm/pull/383

+ Patch6: rpm-4.14.1-python-brp-bytecompile.patch

  

  # Patches already upstream:

  

@@ -575,6 +578,9 @@ 

  %doc doc/librpm/html/*

  

  %changelog

+ * Tue Jan 30 2018 Petr Viktorin <pviktori@redhat.com> - 4.14.1-4

+ - Skip automatic Python byte-compilation if *.py files are not present

+ 

  * Thu Jan 25 2018 Florian Weimer <fweimer@redhat.com> - 4.14.1-3

  - Rebuild to work around gcc bug leading to librpm miscompilation (#1538648)

  

This will skip unnecessary attempts at byte-compilation of Python files outside Python-specific directories.

We would like to have this in to help with the "Avoid /usr/bin/python in RPM Build" change. Currently, automatic byte compilation calls /usr/bin/python for all packages.

Change: https://fedoraproject.org/w/index.php?title=Changes/Avoid_usr_bin_python_in_RPM_Build&rd=User%3APviktori%2FAvoid_usr_bin_python_in_RPM_Build
Upstream pull request: https://github.com/rpm-software-management/rpm/pull/383

I'm using my proven packager powers to merge this because it is time sensitive and we need this before the mass rebuild. If there are any issues, please direct them to us, we'll fix them.

Pull-Request has been merged by churchyard

2 years ago