#9 TIME-SENSITIVE: Add envvar that will be present during RPM build
Merged 2 years ago by ffesti. Opened 2 years ago by torsava.
rpms/ torsava/rpm avoid-usr-bin-python  into  master

@@ -0,0 +1,28 @@ 

+ From bf636421120aa2c97f9e0fdcee3c211b4241bd86 Mon Sep 17 00:00:00 2001

+ From: Tomas Orsava <torsava@redhat.com>

+ Date: Mon, 29 Jan 2018 16:13:18 +0100

+ Subject: [PATCH] Add envvar that will be present during RPM build

+ 

+ Part of a Fedora Change for F28:

+ "Avoid /usr/bin/python in RPM build"

+ https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build

+ ---

+  macros.in | 2 ++

+  1 file changed, 2 insertions(+)

+ 

+ diff --git a/macros.in b/macros.in

+ index dd6ef67..68449e3 100644

+ --- a/macros.in

+ +++ b/macros.in

+ @@ -804,6 +804,8 @@ package or when debugging this package.\

+    export PKG_CONFIG_PATH\

+    CONFIG_SITE=${CONFIG_SITE:-NONE}\

+    export CONFIG_SITE\

+ +  PYTHON_DISALLOW_AMBIGUOUS_VERSION=warn\

+ +  export PYTHON_DISALLOW_AMBIGUOUS_VERSION\

+    \

+    %{verbose:set -x}%{!verbose:exec > /dev/null}\

+    umask 022\

+ -- 

+ 2.13.6

+ 

file modified
+13 -1

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

  

  %global rpmver 4.14.1

  #global snapver rc2

- %global rel 4

+ %global rel 5

  

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

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

@@ -60,6 +60,13 @@ 

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

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

  

+ # Downstream-only patch:

+ # Add envvar that will be present during RPM build

+ # - Part of a Fedora Change for F28:

+ # - "Avoid /usr/bin/python in RPM build"

+ # - https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build

+ Patch6: rpm-4.14.1-Add-envvar-that-will-be-present-during-RPM-build.patch

+ 

  # Patches already upstream:

  

  # These are not yet upstream

@@ -578,6 +585,11 @@ 

  %doc doc/librpm/html/*

  

  %changelog

+ * Tue Jan 30 2018 Tomas Orsava <torsava@redhat.com> - 4.14.1-4

+ - Add envvar that will be present during RPM build,

+   Part of a Fedora Change for F28: "Avoid /usr/bin/python in RPM build"

+   https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build

+ 

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

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

  

TIME-SENSITIVE: This is in preparation for the F28 mass rebuild in a few days. Apologies for the late date.

Part of a Fedora Change for F28: Avoid /usr/bin/python in RPM build
https://fedoraproject.org/wiki/Changes/Avoid_usr_bin_python_in_RPM_Build

Description:
We need to add an envvar (PYTHON_DISALLOW_AMBIGUOUS_VERSION=warn) that will be present during RPM build. I put it inside /usr/lib/rpm/macros{.in} into the difinition of the %___build_pre macro, as other envvars are also defined here (RPM_BUILD_ROOT, RPM_OPT_FLAGS, etc.)

I wonder if it would not be better to do it in redhat-rpm-config.

RPM currently FTBFS in rawhide (nothing provides gcc(major) = 7 needed by libtool-2.4.6-20.fc27.x86_64) so I can't provide a scratch build.

@ignatenkobrain I've tried redefining %__build_pre in redhat-rpm-config (/usr/lib/rpm/redhat/macros) to include the variable, however, it doesn't work. The variable is not present in the environment during RPM build.

We sat down on it with @ignatenkobrain and it looks that indeed you cannot redefine %__build_pre in /usr/lib/rpm/redhat/macros. Even though it shows correctly using rpm --eval "%__build_pre", it does not get evaluated properly during an actual rpm build.

rebased onto 40077f6

2 years ago

I updated the patch to also export the new envvar (it works without the export, but it breaks consistency).

rebased onto 0670d68

2 years ago

Pull-Request has been merged by ffesti

2 years ago

Just noting that it's patently stupid that we need to patch rpm for something like this. We might want to consider something like /usr/lib/rpm/buildenv.d/ where packages could drop in their own things as needed, but of course nothing like that exists ATM so...