Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

4.15.1: Version field in subpackage redefines all sections %{version} #1140

Closed
kloczek opened this issue Mar 27, 2020 · 1 comment
Closed

Comments

@kloczek
Copy link
Contributor

kloczek commented Mar 27, 2020

Very simple test unit

Summary:        Test case for redefine Version
Name:           test-version
Version:        1.0
Release:        1
License:        GPL

%description
Test case for redefine Version

%package sub
Summary:        sunbackage
Version:        2.0

%description sub
sunbackage.

%prep
echo %{version}

%prep
echo %{version}

%build
echo %{version}

%install
echo %{version}

%check
echo %{version}

%files

%files sub

And build:

$ rpmbuild -ba test-version.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.kRXDb2
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 2.0                          <<== HERE
2.0                                      <<== HERE
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.oepEB4
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 2.0                          <<== HERE
2.0                                      <<== HERE
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.oReKi0
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ '[' /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64 '!=' / ']'
+ /usr/bin/rm -rf /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
+ /usr/bin/mkdir /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
+ echo 2.0                          <<== HERE
2.0                                      <<== HERE
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /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 /usr/bin/python 1 0
+ /usr/lib/rpm/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
Processing files: test-version-1.0-1.x86_64
Processing files: test-version-sub-2.0-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
Wrote: /home/tkloczko/rpmbuild/SRPMS/test-version-1.0-1.src.rpm
Wrote: /home/tkloczko/rpmbuild/RPMS/test-version-1.0-1.x86_64.rpm
Wrote: /home/tkloczko/rpmbuild/RPMS/test-version-sub-2.0-1.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.ZAPou4
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ /usr/bin/rm -rf /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
+ RPM_EC=0
++ jobs -p
+ exit 0
[tkloczko@barrel SPECS]$ rpmbuild -ba test-version.spec
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.ULcCYb
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 2.0                          <<== HERE
2.0                                      <<== HERE
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.M79PGc
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 2.0
2.0
+ RPM_EC=0
++ jobs -p
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.rHL97c
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ '[' /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64 '!=' / ']'
+ /usr/bin/rm -rf /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
+ /usr/bin/mkdir /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
+ echo 2.0
2.0
+ /usr/lib/rpm/check-buildroot
+ /usr/lib/rpm/redhat/brp-ldconfig
+ /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 /usr/bin/python 1 0
+ /usr/lib/rpm/brp-python-hardlink
+ /usr/lib/rpm/redhat/brp-mangle-shebangs
Executing(%check): /bin/sh -e /var/tmp/rpm-tmp.TaX1L9
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ echo 2.0                          <<== HERE
2.0                                      <<== HERE
+ RPM_EC=0
++ jobs -p
+ exit 0
Processing files: test-version-1.0-1.x86_64
Processing files: test-version-sub-2.0-1.x86_64
Checking for unpackaged file(s): /usr/lib/rpm/check-files /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
Wrote: /home/tkloczko/rpmbuild/SRPMS/test-version-1.0-1.src.rpm
Wrote: /home/tkloczko/rpmbuild/RPMS/test-version-1.0-1.x86_64.rpm
Wrote: /home/tkloczko/rpmbuild/RPMS/test-version-sub-2.0-1.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.9pcPQa
+ umask 022
+ cd /home/tkloczko/rpmbuild/BUILD
+ /usr/bin/rm -rf /home/tkloczko/rpmbuild/BUILDROOT/test-version-1.0-1.x86_64
+ RPM_EC=0
++ jobs -p
+ exit 0

Despite above looks like version of the generated main package and subpackages are OK.

@kloczek kloczek changed the title 4.15.1: Version field in subpackage redefines all section %{version} 4.15.1: Version field in subpackage redefines all sections %{version} Mar 27, 2020
@pmatilai
Copy link
Member

Yes, this is expected spec crazy behavior, and can't be changed because all sorts of constructs have been built around this behavior: in some cases you need the sub-package version, in some cases you need the main package version.

In rpm >= 4.14 you can use uppercase macro names to refer to the main package fields, which is the best we can do about this ancient mess. Closed by commit ccdb1aa.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants