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

[RFE] Add option to exclude subpackages from building #2555

Open
rguenth opened this issue Jun 27, 2023 · 4 comments
Open

[RFE] Add option to exclude subpackages from building #2555

rguenth opened this issue Jun 27, 2023 · 4 comments
Labels

Comments

@rguenth
Copy link

rguenth commented Jun 27, 2023

Please add a way to mark a %files list as listing files to be ignored, aka not complained about not belonging to any package.
This should be a convenient way to exclude sub-packages from packaging without the need to explicitly rm the not packaged
files. Example

%if ...
%define without_foo -i
%endif

%package foo
...

%files foo %{?without_foo}
%dir /baz
/baz/bar

Implementation-wise the easiest thing is to treat -i as overriding the sub-package name the %files list belongs to,
assigning a special (empty?) name and later make sure to not emit the "empty" package. Otherwise full processing
of the files should happen, so they are all expected to exist.

The actual use case is packaging of the GNU GCC compiler in openSUSE where shared library sub-packages are
provided from the newest compiler version but multiple actual compilers are co-installable. For technical reasons
having multiple source packages building same named sub-packages such as libstdc++6 isn't possible. The current
workaround suffixes those so we have libstdc++6-gccN in addition to the main libstdc++6 package, but those suffixed
packages have to be manually "removed" (or hidden) through special casing.

Explicitely rm-ing the files in those packages and not packaging the sub-packages would be an option but would
also make the spec file even more difficult to follow, so a less intrusive way to make rpmbuild not build a sub-package
is required.

@kloczek
Copy link
Contributor

kloczek commented Jun 27, 2023

During almost +20 years of using rpm I've never had such needs.
%exclude so far was enough.

👎

@rguenth
Copy link
Author

rguenth commented Jul 21, 2023

But I don't really want to rely on this bug in %exclude - see #994 which is acknowledged as a bug (but appearently hard to fix because of Fedora relying on this).

@dmnks
Copy link
Contributor

dmnks commented Oct 18, 2023

This sounds like a problem of package distribution, not package building.

As I understand it, your actual goal here is to avoid shipping a subpackage in the repositories. The current "workaround" as you described it therefore is the proper solution to this.

The contents of the buildroot is supposed to reflect what's being packaged one way or another. What follows from that is, any SPEC construct that would allow for excluding an already installed file would make no sense. The existence of the %exclude directive really is just to allow for cherry-picking the individual files into subpackages, not to exclude them altogether, as discussed in #994 that you linked.

If you wish to avoid packaging certain files, then don't install them in the first place. Similarly, if you wish to avoid shipping a built package, then don't ship it.

Theoretically, if RPM supported this, treating an empty filelist as "don't build this subpackage" would be better as one could then reuse the existing -f option to supply an empty file (through a filename stored in a macro). But like said, I don't see us adding what looks like a workaround for the limitations of a package distribution mechanism.

@dmnks
Copy link
Contributor

dmnks commented Oct 25, 2023

After discussing this with the team, we agreed that the idea behind this (to exclude certain (sub)packages from the build) is actually quite reasonable. It's just that the proposed way of abusing %files for this isn't right. We'd rather have a preamble item (i.e. alongside Name:, Version: and the likes) that controls this.

I've moved this to our backlog so that somebody can actually pick this up later and have a closer look at how it could be implemented.

@dmnks dmnks changed the title [RFE] Add option to %files to ignore listed files (suggest: -i) [RFE] Add option to exclude subpackages from building Oct 25, 2023
@dmnks dmnks removed their assignment Nov 2, 2023
@pmatilai pmatilai removed the triaged label Nov 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Backlog
Development

No branches or pull requests

4 participants