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

Add support for building an overlay RPM #414

Merged
merged 1 commit into from
Mar 20, 2019

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented Mar 15, 2019

This patch adds support for an overlay RPM defined by a rootfs in the
source repo at overlay/. Unlike FAH, FCOS is much more opinionated
about various things. And these opinions express themselves through e.g.
config file overlays, systemd units, Ignition base configs, etc... These
files don't clearly belong in any particular "component" package, but
rather provide the glue that makes FCOS feel like FCOS. This is similar
to CL's init package.

Right now, a lot of these files are just written out as part of the
postprocess script in the treefile. Splitting them out has the major
benefit of being able to track them in the rpmdb so one actually knows
where they come from. It'd also mean a cleaner manifest and easier
hacking on those files and tracking in git.

We can probably teach rpm-ostree to do this directly later on and
deprecate/automatically translate add-files along with it.

@jlebon jlebon changed the title WIP: Add support for building an overlay RPM WIP/RFC: Add support for building an overlay RPM Mar 15, 2019
@jlebon
Copy link
Member Author

jlebon commented Mar 15, 2019

Used by: coreos/fedora-coreos-config#66
Related: coreos/rpm-ostree#1788

@cgwalters
Copy link
Member

This is OK by me and makes sense to do now, but I also think the (inherent, not your fault!) ugliness of building RPMs is a strong argument for 1788.

src/build_rpm_from_dir Outdated Show resolved Hide resolved
@ajeddeloh
Copy link
Contributor

What's the plan for handling setting permissions? It probably makes sense to allow relaxed privilege on the files themselves (so you don't need root to edit) but changing them when building the rpm to what they should be on the system.

@cgwalters
Copy link
Member

changing them when building the rpm to what they should be on the system.

rpm defaults to files being owned by root, even when building as a non-root user.

@jlebon jlebon force-pushed the pr/support-overlay branch from 764d92e to 024d0ac Compare March 19, 2019 20:25
@jlebon jlebon changed the title WIP/RFC: Add support for building an overlay RPM Add support for building an overlay RPM Mar 19, 2019
@ajeddeloh
Copy link
Contributor

rpm defaults to files being owned by root, even when building as a non-root user.

What about mode?

This patch adds support for an overlay RPM defined by a rootfs in the
source repo at `overlay/`. Unlike FAH, FCOS is much more opinionated
about various things. And these opinions express themselves through e.g.
config file overlays, systemd units, Ignition base configs, etc... These
files don't clearly belong in any particular "component" package, but
rather provide the glue that makes FCOS feel like FCOS. This is similar
to CL's [init](https://github.com/coreos/init) package.

Right now, a lot of these files are just written out as part of the
postprocess script in the treefile. Splitting them out has the major
benefit of being able to track them in the rpmdb so one actually knows
where they come from. It'd also mean a cleaner manifest and easier
hacking on those files and tracking in git.

We can probably teach rpm-ostree to do this directly later on and
deprecate/automatically translate `add-files` along with it.
@jlebon jlebon force-pushed the pr/support-overlay branch from 024d0ac to 81895fd Compare March 19, 2019 20:28
@jlebon
Copy link
Member Author

jlebon commented Mar 19, 2019

OK, dropped WIP on this!

What about mode?

git records file mode. The only bits that we'd need manual intervention for are non-root file ownership or file caps. I don't think it's likely we'll hit these for the targeted use case, but if we do we can specify them in the %files section.

@jlebon
Copy link
Member Author

jlebon commented Mar 19, 2019

What about mode?

git records file mode

OK, that's not entirely correct. It looks like it only records the owner executable bit on files:

$ ls -ld CONTRIBUTING.md src/
-rw-rw-r--. 1 jlebon jlebon 3863 Mar  6 09:56 CONTRIBUTING.md
drwxrwxr-x. 3 jlebon jlebon 4096 Mar 19 16:28 src/
$ chmod 777 src CONTRIBUTING.md
$ git diff
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
old mode 100644
new mode 100755

So I guess any other mode bits we'd have to record through %attr as well.

@cgwalters
Copy link
Member

One thing this will likely trip is the "all rpms in rpmdb are signed" thing but...eh, we can change that to lie later 😉

LGTM!

@jlebon
Copy link
Member Author

jlebon commented Mar 20, 2019

Thanks! Any other comments on this one?

@cgwalters cgwalters merged commit 32c4d94 into coreos:master Mar 20, 2019
jlebon added a commit to jlebon/coreos-assembler that referenced this pull request Mar 21, 2019
Otherwise we'll error out if the user has no overrides.
Regression from coreos#414.
@jlebon
Copy link
Member Author

jlebon commented Jun 13, 2019

Follow-up in #555 to switch to use an OSTree layer.

@jlebon jlebon deleted the pr/support-overlay branch July 6, 2020 20:33
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.

4 participants