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: introduce an rpm-controlled per-build directory to builds #2078

Closed
pmatilai opened this issue May 25, 2022 · 9 comments · Fixed by #2885
Closed

RFE: introduce an rpm-controlled per-build directory to builds #2078

pmatilai opened this issue May 25, 2022 · 9 comments · Fixed by #2885
Assignees
Labels
handsfree Packaging automation and convenience RFE
Milestone

Comments

@pmatilai
Copy link
Member

pmatilai commented May 25, 2022

The current build directory setup is suboptimal in many ways: %_builddir can be shared among multiple packages so there's a possibility for conflicts, cleanup is not straightforward, and OTOH %buildsubdir is dependent on %setup and so rpm cannot rely on it existing at all times.

We should introduce a fully rpm controlled intermediate directory between these two. This gives us a place to safely unpack multiple sources, put per-build temporary rpm-level data without disturbing the pristine sources in the build directory (there's a ticket on that somewhere), including but not limited to eg debuginfo file manifests, gemspec files, place spec parts (thinking dynamic spec generation) and whatnot other context, such as the buildroot directory. It's also trivial to clean up. It would be also easier to share for remote execution (cross-compilation etc), especially if we wrote the build scriptlets to the build directory instead of %_tmpddir.

I know I'm missing a known use-case or two in the above, will add when I remember. Easier to augment an existing ticket...

@voxik
Copy link
Contributor

voxik commented May 25, 2022

This ticket was triggered by the .gemspec file in #2076 and therefore I'd like to share here additional issues we typically face packaging rubygem- packages:

  1. Using %setup, we typically expand not just the "source" gem package, but also additional sources, such as test suite. We don't want to expand the sources into %buildsubdir for similar reasons as the .gemspec is not expanded there. On top of that, we don't want to mangle the source code in any way to be on the safe side, because sometimes the .gemspec might include files by wildcards and we want to prevent including random files.

  2. %build section is calling gem install command and that installs the sources under the %buildsubdir. This is again unfortunate, but we don't have better place. Ages ago, the gem install was called in %install section installing directly into %{buildroot}, but that was abandoned, because the installation can involve also building of sources, which would not be appropriate for %install section.

  3. I think that wherever feasible, the out-of-source build should be used, to keep the sources pristine. RPM provides little help to this. There is %{_vpath_builddir}, but it is subdirectory of %buildsubdir if I am not mistaken. IOW if the build output was split from the sources, that would be very nice.

@ffesti
Copy link
Contributor

ffesti commented May 25, 2022

The question here is whether we can just point %_builddir to this new directory during build or if we need a new name. The former will keep all spec files working unchanged and just move very package to a save place. Otoh specs relying on having a save name space might cause problems when being build with an older rpm version.

@pmatilai
Copy link
Member Author

This keeps coming up in various contexts. It's time we actually do it.

@Conan-Kudo
Copy link
Member

Conan-Kudo commented Nov 3, 2023

Couldn't we just make %setup -c the default behavior and then strip the top level directory automatically when extracting an archive? (Yes, I realize this is a variation of #2664, but it's a relevant solution!)

@ffesti
Copy link
Contributor

ffesti commented Nov 29, 2023

See also https://bugzilla.redhat.com/show_bug.cgi?id=1479198 which is a similar issue also including debuginfo not working outside of %buildsubdir

@pmatilai
Copy link
Member Author

Couldn't we just make %setup -c the default behavior and then strip the top level directory automatically when extracting an archive?

This directory needs to be set up regardless of whether a spec uses %setup or not. And, extracting the sources to the topmost directory would defeat some of the reasons we're doing this to begin with, as explained in the ticket description.

@pmatilai pmatilai self-assigned this Jan 16, 2024
@pmatilai
Copy link
Member Author

Added buildroot itself to the description, there's no reason whatsoever to scatter the built content around multiple directories if we have that one top-level directory to rule it all.

@pmatilai
Copy link
Member Author

pmatilai commented Feb 2, 2024

Vpath builds added...

@pmatilai
Copy link
Member Author

pmatilai commented Feb 6, 2024

Making remote execution (cross-compilation) easier added (inspired by #2884)

tdf-gerrit pushed a commit to LibreOffice/core that referenced this issue Sep 22, 2024
...which builds the spec file's code in a dedicated directory now, see
<rpm-software-management/rpm#2078> "RFE: introduce an
rpm-controlled per-build directory to builds", and no longer in the directory
from which rpm is invoked.  So invent some libo_start_dir parameter to
communicate that directory into the rpm build.

Change-Id: I28268837caafe3b892f76e936dfa747fe13fb9bd
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/173779
Reviewed-by: Stephan Bergmann <stephan.bergmann@allotropia.de>
Tested-by: Jenkins
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
handsfree Packaging automation and convenience RFE
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants