Bug 1597664 - %undefine __brp_python_bytecompile has no effect
Summary: %undefine __brp_python_bytecompile has no effect
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Fedora
Classification: Fedora
Component: redhat-rpm-config
Version: 29
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Florian Festi
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-07-03 11:48 UTC by Miro Hrončok
Modified: 2019-01-10 12:52 UTC (History)
16 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-01-10 12:52:09 UTC
Type: Bug


Attachments (Terms of Use)

Description Miro Hrončok 2018-07-03 11:48:39 UTC
take this reproducer:

Name:           reproducer
Version:        2.0.0
Release:        1%{?dist}
Summary:        Reproducer for a bytecompile script issue
License:        MIT

%undefine __brp_python_bytecompile

%description
...

%prep

%build

%install
echo "%__brp_python_bytecompile"

%files





Expected:
...
+ echo %__brp_python_bytecompile
%__brp_python_bytecompile

...
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-mangle-shebangs


Got:
...
+ echo '/usr/lib/rpm/brp-python-bytecompile  1 1'
/usr/lib/rpm/brp-python-bytecompile  1 1
...
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip /usr/bin/strip
+ /usr/lib/rpm/brp-strip-comment-note /usr/bin/strip /usr/bin/objdump
+ /usr/lib/rpm/brp-strip-static-archive /usr/bin/strip
+ /usr/lib/rpm/brp-python-bytecompile '' 1 1
+ /usr/lib/rpm/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-mangle-shebangs



This is the upgrade that introduced the regression:

New:

annobin-8.0-1.fc29.x86_64
bash-4.4.23-2.fc29.x86_64
ca-certificates-2018.2.24-5.fc29.noarch
cpp-8.1.1-4.fc29.x86_64
elfutils-default-yama-scope-0.173-1.fc29.noarch
elfutils-libelf-0.173-1.fc29.x86_64
elfutils-libs-0.173-1.fc29.x86_64
elfutils-0.173-1.fc29.x86_64
gcc-c++-8.1.1-4.fc29.x86_64
gcc-8.1.1-4.fc29.x86_64
gdb-headless-8.1.50.20180629-26.fc29.x86_64
glibc-all-langpacks-2.27.9000-28.fc29.x86_64
glibc-common-2.27.9000-28.fc29.x86_64
glibc-devel-2.27.9000-28.fc29.x86_64
glibc-headers-2.27.9000-28.fc29.x86_64
glibc-2.27.9000-28.fc29.x86_64
kernel-headers-4.18.0-0.rc2.git4.1.fc29.x86_64
libgcc-8.1.1-4.fc29.x86_64
libgomp-8.1.1-4.fc29.x86_64
libpkgconf-1.5.1-2.fc29.x86_64
libstdc++-devel-8.1.1-4.fc29.x86_64
libstdc++-8.1.1-4.fc29.x86_64
libxcrypt-devel-4.0.1-2.fc29.x86_64
libxcrypt-4.0.1-2.fc29.x86_64
libzstd-1.3.5-1.fc29.x86_64
pcre2-10.31-5.fc29.x86_64
pcre-8.42-2.fc29.x86_64
pkgconf-m4-1.5.1-2.fc29.noarch
pkgconf-pkg-config-1.5.1-2.fc29.x86_64
pkgconf-1.5.1-2.fc29.x86_64
qt5-srpm-macros-5.11.1-2.fc29.noarch
redhat-rpm-config-114-1.fc29.noarch
rpm-build-libs-4.14.2-0.rc1.1.fc29.x86_64
rpm-build-4.14.2-0.rc1.1.fc29.x86_64
rpm-libs-4.14.2-0.rc1.1.fc29.x86_64
rpm-plugin-selinux-4.14.2-0.rc1.1.fc29.x86_64
rpm-4.14.2-0.rc1.1.fc29.x86_64
zstd-1.3.5-1.fc29.x86_64


Old:

annobin-6.6-1.fc29.x86_64
bash-4.4.23-1.fc29.x86_64
ca-certificates-2018.2.24-4.fc29.noarch
cpp-8.1.1-1.fc29.x86_64
elfutils-default-yama-scope-0.172-2.fc29.noarch
elfutils-libelf-0.172-2.fc29.x86_64
elfutils-libs-0.172-2.fc29.x86_64
elfutils-0.172-2.fc29.x86_64
gcc-c++-8.1.1-1.fc29.x86_64
gcc-8.1.1-1.fc29.x86_64
gdb-headless-8.1.50.20180618-24.fc29.x86_64
glibc-all-langpacks-2.27.9000-27.fc29.x86_64
glibc-common-2.27.9000-27.fc29.x86_64
glibc-devel-2.27.9000-27.fc29.x86_64
glibc-headers-2.27.9000-27.fc29.x86_64
glibc-2.27.9000-27.fc29.x86_64
kernel-headers-4.18.0-0.rc1.git2.1.fc29.x86_64
libgcc-8.1.1-1.fc29.x86_64
libgomp-8.1.1-1.fc29.x86_64
libpkgconf-1.4.2-1.fc29.x86_64
libstdc++-devel-8.1.1-1.fc29.x86_64
libstdc++-8.1.1-1.fc29.x86_64
libxcrypt-devel-4.0.1-1.fc29.x86_64
libxcrypt-4.0.1-1.fc29.x86_64
libzstd-1.3.4-1.fc29.x86_64
pcre2-10.31-4.fc29.x86_64
pcre-8.42-1.fc29.x86_64
pkgconf-m4-1.4.2-1.fc29.noarch
pkgconf-pkg-config-1.4.2-1.fc29.x86_64
pkgconf-1.4.2-1.fc29.x86_64
qt5-srpm-macros-5.11.1-1.fc29.noarch
redhat-rpm-config-113-1.fc29.noarch
rpm-build-libs-4.14.1-10.fc29.x86_64
rpm-build-4.14.1-10.fc29.x86_64
rpm-libs-4.14.1-10.fc29.x86_64
rpm-plugin-selinux-4.14.1-10.fc29.x86_64
rpm-4.14.1-10.fc29.x86_64
zstd-1.3.4-1.fc29.x86_64

Might have been introduced by new rpm-build and/or redhat-rpm-config.

Comment 1 Miro Hrončok 2018-07-03 11:52:43 UTC
This might be the cause:


$ cd /usr/lib/rpm
$ grep -r brp_python_bytecompile

Before:

redhat/macros:%__brp_python_bytecompile /usr/lib/rpm/brp-python-bytecompile %{__python} %{?_python_bytecompile_errors_terminate_build}
redhat/macros:    %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \

After:

platform/ppc64le-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/pentium4-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sparcv8-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sh-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/alphaev56-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/amd64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sparcv9v-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/i586-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/i386-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/x86_64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppciseries-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc64p7-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv7l-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/alphaev6-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/alphaev67-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc8560-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv5tl-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sparc64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc64iseries-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sparc64v-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv4b-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sh3-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv6hl-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sh4a-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv7hnl-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mips64r6-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mipsr6-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sh4-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mips64r6el-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/i686-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv4l-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/athlon-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/alphaev5-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ia32e-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mips-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mips64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/pentium3-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sparc-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc64pseries-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/alphapca56-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv7hl-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv6l-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc8260-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/noarch-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/i486-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ia64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mipsel-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppc32dy4-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mipsr6el-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/riscv64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/m68k-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/mips64el-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/s390x-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv5tel-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/aarch64-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv5tejl-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/s390-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/ppcpseries-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/sparcv9-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/geode-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/armv3l-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
platform/alpha-linux/macros:%__brp_python_bytecompile %{_rpmconfigdir}/brp-python-bytecompile "" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
redhat/macros:%__brp_python_bytecompile /usr/lib/rpm/brp-python-bytecompile "%{__python}" "%{?_python_bytecompile_errors_terminate_build}" "%{?_python_bytecompile_extra}"
redhat/macros:    %{?py_auto_byte_compile:%{?__brp_python_bytecompile}} \

Comment 2 Miro Hrončok 2018-07-03 12:04:08 UTC
The older way to disable this BRP script:

     %undefine py_auto_byte_compile 

Works as a workaround.

Comment 3 Florian Festi 2018-07-17 15:48:48 UTC
Well, this is most likely caused by https://github.com/rpm-software-management/rpm/commit/d5e599d6c9b2fc5c98cec1fccc46e2d365a06dbf which has your name in the Author field...

Note that /usr/lib/rpm/redhat/macros is from redhat-rpm-config while /usr/lib/rpm/platform/* is from the rpm package itself.

This raises the question where the this actually belongs. Obviously one of them has to go.

Comment 4 Miro Hrončok 2018-07-17 16:51:54 UTC
(In reply to Florian Festi from comment #3)
> Well, this is most likely caused by
> https://github.com/rpm-software-management/rpm/commit/
> d5e599d6c9b2fc5c98cec1fccc46e2d365a06dbf which has your name in the Author
> field...

I wonder how does this come form there. Even without my change, that would still be defined.

> Note that /usr/lib/rpm/redhat/macros is from redhat-rpm-config while
> /usr/lib/rpm/platform/* is from the rpm package itself.
> 
> This raises the question where the this actually belongs. Obviously one of
> them has to go.

Agreed. Yet I have no idea where it should belong to.

Comment 5 Panu Matilainen 2018-07-30 08:43:19 UTC
Yeah the actual cause is this commit introduced in 4.14.2: https://github.com/rpm-software-management/rpm/commit/60a6a802e7a17d1fb59462a70cff80285fb45c6a

I didn't think of the side-effect of doubly defined macros causing %undefine to no longer work for this purpose, I think we just need to remove the now double definitions from redhat-rpm-config, reassigning.

However this does point out a flaw in the disabling scheme as %undefine cannot be relied to completely undefine a macro, it just pops the topmost one. So a more reliable disabler would actually be defining the macro-to-disable to %nil, so instead of

%undefine __brp_python_bytecompile

...you'd use

%define __brp_python_bytecompile %{nil}

Comment 6 Miro Hrončok 2018-07-31 12:20:21 UTC
FPC ticket: https://pagure.io/packaging-committee/issue/786

Comment 8 Jan Kurik 2018-08-14 09:55:59 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 29 development cycle.
Changing version to '29'.

Comment 9 Panu Matilainen 2019-01-10 12:52:09 UTC
So actually there's nothing to fix here, except the documentation (which has been done): redefining to %{nil} is the right solution because that's the only *reliable* solution - even if the current double definitions were removed from redhat-rpm-config, there's no guarantee those macros aren't defined in some other place too (eg per-host or per-user settings).


Note You need to log in before you can comment on or make changes to this bug.