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

Optionally don't copy sources around #765

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

lnussel
Copy link
Member

@lnussel lnussel commented Jan 20, 2022

make VM builds mount the original source directory using 9pfs. This avoids copying files around which is handy for large files and also development from a git tree in combination with --rpm-build-in-place. As compilation takes place in the current directory, this allows fast edit/compile cycles through the build script.

@lnussel
Copy link
Member Author

lnussel commented Jan 20, 2022

works with eg https://github.com/openSUSE/aaa_base/ but also yast packages

@lnussel
Copy link
Member Author

lnussel commented Jan 20, 2022

The overlayfs might turn out to be cumbersome. The other alternative might be bind mount and creating the abuild user with matching uid of the calling user. So object files etc don't remain in the chroot.

@lnussel lnussel force-pushed the awesome branch 2 times, most recently from c91a5d6 to 53295b0 Compare January 20, 2022 17:32
@adrianschroeter
Copy link
Member

interesting, but what is actually the use case here?

For local development purposes the bind mount might be indeed the better way (to get changes from the build root back).

For simple build tasks one should not use chroot anymore. (It is our goal to go away from chroot by default, so I wonder if it is useful to merge chroot specific functionality atm.)

@lnussel
Copy link
Member Author

lnussel commented Jan 24, 2022

I want to build packages directly from git. Without having to install the build deps in my system and without the time consuming repacking of sources. Yes, ideally a chroot into the build env and editing the sources there should modify the checkout. Have to figure out whether there's a solution as mentioned.
Also I actually started with qemu full unprivileged build (pr pending to make that work) but I didn't find a good solution to solve the original problem with qemu. The fat emulation doesn't sound right and virtiofsd has to run as root. Suggestions welcome.

Anyway one has to pick the poison. It's fine to build normal packages with qemu by default but if certain features are important and only chroot can provide that so it be IMO. I mean I'm exactly in the same situation. Forced to chroot with this :-)

@adrianschroeter
Copy link
Member

adrianschroeter commented Jan 24, 2022 via email

@lnussel
Copy link
Member Author

lnussel commented Jan 24, 2022

This is for local development, doesn't follow a bigger plan. And yes, it works only for packages that are 100% in git without extra tarballs etc. Like eg aaa_base.

@lnussel
Copy link
Member Author

lnussel commented Jan 26, 2022

using 9pfs for kvm build to get access to calling user's source dir seems to work. need to include 9p and 9pnet_virtio in kernel-obs-build though

@lnussel lnussel force-pushed the awesome branch 3 times, most recently from 75a5086 to 2992f80 Compare January 31, 2022 13:52
@lnussel
Copy link
Member Author

lnussel commented Jan 31, 2022

added --rpmbopts to avoid spec specific options. Not sure it's pretty though. Requires something like
--rpmbopts build-in-place,noprep

@lnussel
Copy link
Member Author

lnussel commented Jan 31, 2022

@lnussel
Copy link
Member Author

lnussel commented Jul 20, 2022

I've rebased and checked this one again. Basically works. A minor issue is that qemu_fw_cfg is now apparently a module, so needs to be listed in kernel-obs-build to be able to update certain settings when reusing a build root. Will file pr for that.

@lnussel
Copy link
Member Author

lnussel commented Jul 20, 2022

Apply build time modifications to the spec file in a separate file.
Allows to link original sources.
Don't re-create fs image when building as user
Don't re-create swap
Use bind mount resp qemu 9p support to directly mount the source
directory into the build environment. This allows for faster
turnaround times for interactive buildling.
With --no-init the disk image won't be changed, ie build.data can't be
updated either. Means it's not possible to eg change --stage for quick
development cycles either. So additionally pass build.data via
qemu_fwcfg and prefer that one if it exists.
mkfs needs to see the files it copies into the fs as owned by root.
Otherwise the whole fs tree would be owned by the calling user. Doesn't
matter too much when setting up the build root initially as rpm is
called inside anyway to fix everything. However, when reusing an image
suddenly all ownerships would change.
@lnussel lnussel force-pushed the awesome branch 2 times, most recently from 1275793 to db0bf8d Compare September 20, 2022 15:31
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

Successfully merging this pull request may close these issues.

2 participants