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

%build -a and %install -a overwrite build/installation instructions from %buildsystem_*_* #3024

Closed
berolinux opened this issue Apr 7, 2024 · 1 comment · Fixed by #3047
Closed
Assignees
Labels
Milestone

Comments

@berolinux
Copy link
Contributor

Describe the bug
I've just updated my rpm to 4.19.90, and tried out the declarative build bits. Overall, they're working nicely, but %build -a doesn't seem to work as documented - instead of adding to %buildsystem_*_build, it is treated as the only build/install script present.

To Reproduce
Steps to reproduce the behavior:
Simplified version of the macros I've been playing with (simplified to not call any other macros etc. for easier reproducibility etc.):

%buildsystem_autotools_conf() \
    ./configure --prefix=/usr %*
%buildsystem_autotools_build() \
    make %*
%buildsystem_autotools_install() \
    make install %*

Everything works as expected if I don't have any %build section in the spec - but if I add

%build -a
echo test

in the spec, only echo test is executed, not make.

Expected behavior
The code is built (make), and afterwards test is printed.

Output
test is printed, without any signs of running make.

Environment

  • OS / Distribution: OpenMandriva Cooker
  • Version rpm-4.19.90

Additional context
There's no funky stuff like macros redefining %build or something (that actually used to be present in older Mandriva versions).

$ rpmbuild --eval '%{build}'
%{build}

Simplified spec that works:

Summary:        A utility for determining file types
Name:           file
Version:        5.45
Release:        1
License:        BSD
Url:            https://www.darwinsys.com/file/
Source0:        ftp://ftp.astron.com/pub/file/%{name}-%{version}.tar.gz
BuildSystem: autotools
BuildOption: --enable-static

%description
A utility for determining file types

%files
/usr

Modified version of the spec that shows the problem:

Summary:        A utility for determining file types
Name:           file
Version:        5.45
Release:        1
License:        BSD
Url:            https://www.darwinsys.com/file/
Source0:        ftp://ftp.astron.com/pub/file/%{name}-%{version}.tar.gz
BuildSystem: autotools
BuildOption: --enable-static

%description
A utility for determining file types

%build -a
echo test

%install -a
echo test

%files
/usr
@pmatilai
Copy link
Member

pmatilai commented Apr 9, 2024

Hmm, ugh. We have a test for this very scenario (%build -a) in the test-suite, but looking closer indeed the buildsystem %build is lost. It's just that autotools "make install" masks the issue by building automatically since not already done. We also have bunch of other tests for -a/-p modes, so this is just a bad interaction between the buildsystem stuff and append/prepend. Which does mean the buildsystem thing is rather broken in the alpha then 😒

Thanks for the report!

Another buildsystem related breakage spotted while looking at this is that on Fedora there's this old hack around %install which breaks with -a and -p:

%install %{?_enable_debug_packages:%{?buildsubdir:%{debug_package}}}\
%%install\
%{nil}

It's going to need an expedited fix for #2204

@pmatilai pmatilai added the bug label Apr 9, 2024
@pmatilai pmatilai self-assigned this Apr 10, 2024
@pmatilai pmatilai added this to the 4.20.0 milestone Apr 11, 2024
pmatilai added a commit to pmatilai/rpm that referenced this issue Apr 18, 2024
The append and prepend modes got added before the declarative
Buildsystem, and did not get thoroughly tested with it. The existing
%build -a test didn't actually work but automake handling the build
in %install masked the issue embarrasingly. As the Buildsystem is parsed
after everything else, there's no way the previous append/prepend
implementation could work correctly with it.

Do what we should've done from the start: collect any prepend/append
stuff into separate data structures and apply them after everything
else has been parsed. This also lifts the artificial sounding
restriction wrt the corresponding main section:it's really the right
thing to do, even if it's a bit more code.

Make the tests wrt buildsystem much more thorough to ensure it all
really works, blush.

Fixes: rpm-software-management#3024
pmatilai added a commit to pmatilai/rpm that referenced this issue Apr 18, 2024
The append and prepend modes got added before the declarative
Buildsystem, and did not get thoroughly tested with it. The existing
%build -a test didn't actually work but automake handling the build
in %install masked the issue embarrasingly. As the Buildsystem is parsed
after everything else, there's no way the previous append/prepend
implementation could work correctly with it.

Do what we should've done from the start: collect any prepend/append
stuff into separate data structures and apply them after everything
else has been parsed. This also lifts the artificial sounding
restriction wrt the corresponding main section:it's really the right
thing to do, even if it's a bit more code.

Make the tests wrt buildsystem much more thorough to ensure it all
really works, blush.

Fixes: rpm-software-management#3024
pmatilai added a commit to pmatilai/rpm that referenced this issue Apr 18, 2024
The append and prepend modes got added before the declarative
Buildsystem, and did not get thoroughly tested with it. The existing
%build -a test didn't actually work but automake handling the build
in %install masked the issue embarrasingly. As the Buildsystem is parsed
after everything else, there's no way the previous append/prepend
implementation could work correctly with it.

Do what we should've done from the start: collect any prepend/append
stuff into separate data structures and apply them after everything
else has been parsed. This also lifts the artificial sounding
restriction wrt the corresponding main section:it's really the right
thing to do, even if it's a bit more code.

Make the tests wrt buildsystem much more thorough to ensure it all
really works, blush.

Fixes: rpm-software-management#3024
pmatilai added a commit that referenced this issue Apr 23, 2024
The append and prepend modes got added before the declarative
Buildsystem, and did not get thoroughly tested with it. The existing
%build -a test didn't actually work but automake handling the build
in %install masked the issue embarrasingly. As the Buildsystem is parsed
after everything else, there's no way the previous append/prepend
implementation could work correctly with it.

Do what we should've done from the start: collect any prepend/append
stuff into separate data structures and apply them after everything
else has been parsed. This also lifts the artificial sounding
restriction wrt the corresponding main section:it's really the right
thing to do, even if it's a bit more code.

Make the tests wrt buildsystem much more thorough to ensure it all
really works, blush.

Fixes: #3024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants