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

treefile: Drop override-replace-local-rpms and support install and overrides by URL in container path #3670

Merged
merged 6 commits into from
May 25, 2022

Conversation

jlebon
Copy link
Member

@jlebon jlebon commented May 10, 2022

The addition of override-replace-local-rpms was a hack to bridge the
gap between the container and client-side flow where only the latter has
access to a pkgcache repo.

This patch enhances the existing override-replace-local key to work in
the container flow: we stage RPMs in a directory in /run, and the core
knows to look there for them.

This then allows us to remove the override-replace-local-rpms key and
clean up a bunch of things related to it.

To be nice, we might have to in the future expose the staging logic as a
separate command which outputs on stdout the digest and NEVRA so that
users can include them in their YAML dropins.

This is prep also for supporting local RPMs, which will work a similar
way.

@openshift-ci
Copy link

openshift-ci bot commented May 10, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@jlebon
Copy link
Member Author

jlebon commented May 10, 2022

Keeping this as draft; trying to oxidize stage_container_rpms.

@jlebon
Copy link
Member Author

jlebon commented May 10, 2022

Split out prep patches in #3671.

@cgwalters
Copy link
Member

client-side flow where only the latter has access to a pkgcache repo.

Well, we can start making use of e.g. ostreedev/ostree#2532

@jlebon
Copy link
Member Author

jlebon commented May 11, 2022

client-side flow where only the latter has access to a pkgcache repo.

Well, we can start making use of e.g. ostreedev/ostree#2532

We need write support too. Unless you're suggesting doing that through ostree-rs-ext, but I'm not sure it's worth the complexity.

@cgwalters
Copy link
Member

I think we should add write support to ostree-rs-ext. But this is a larger topic.

@jlebon jlebon force-pushed the pr/rework-local-overrides branch 2 times, most recently from a0c7533 to 783c2c4 Compare May 19, 2022 20:48
@jlebon
Copy link
Member Author

jlebon commented May 19, 2022

OK latest commits add:

Though one thing missing is inactive override detection like we have in the client-side. I think we need to lower that logic from the upgrader to the core.

Will split this up into multiple commits/PRs.

@jlebon jlebon force-pushed the pr/rework-local-overrides branch 2 times, most recently from 8f94699 to 4411d91 Compare May 20, 2022 14:34
Copy link
Member

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall direction LGTM!

rust/src/core.rs Outdated Show resolved Hide resolved
rust/src/core.rs Outdated Show resolved Hide resolved
let mut pkg = unsafe {
libdnf_sys::dnf_package_from_ptr(&mut pkg.0 as *mut _ as *mut libdnf_sys::FFIDnfPackage)
};
let name = pkg.pin_mut().get_name();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it'd be a bit cleaner to do:

let mut pkg = ...;
let pkg = pkg.pin_mut();
let name = pkg.get_name()
let evr = pkg.get_evr()

etc.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heh, I initially did that, but it complains about the value being moved on the first call. TBH, I don't quite understand the pinning stuff, so just went with this.

Instead of having individual separate functions acting on a pointer to a
libdnf object, bundle them up into proper classes instead. This not only
makes it feel cleaner on the Rust side, but also has the major advantage
of being able to hold a reference to an object. This means that it's
easier to wrap libdnf functions that return new references for use on
the Rust side, which is something we'll do in an upcoming patch.
Prep for next patch.
The addition of `override-replace-local-rpms` was a hack to bridge the
gap between the container and client-side flow where only the latter has
access to a pkgcache repo.

This patch enhances the existing `override-replace-local` key to work in
the container flow: we stage RPMs in a directory in `/run`, and the core
knows to look there for them.

This then allows us to remove the `override-replace-local-rpms` key and
clean up a bunch of things related to it.

To be nice, we might have to in the future expose the staging logic as a
separate command which outputs on stdout the digest and NEVRA so that
users can include them in their YAML dropins.

This is prep also for supporting local RPMs, which will work a similar
way.
Use the same `client_handle_fd_argument` function which knows how to
handle Bodhi/Koji URLs and regular RPM filenames and URLs in the
container handling paths for `install` and `override replace`.

This also allows us to drop another treefile mutator that's no longer
necessary (`set_packages`).

Closes: coreos#3560
@jlebon jlebon force-pushed the pr/rework-local-overrides branch from 4411d91 to 7355631 Compare May 24, 2022 20:34
@jlebon jlebon marked this pull request as ready for review May 24, 2022 20:34
@jlebon
Copy link
Member Author

jlebon commented May 24, 2022

OK cleaned this up and made separate commits now!

dnf_package_get_arch (DnfPackage &pkg)
{
return rust::String (::dnf_package_get_arch (&pkg));
return std::make_unique<DnfPackage> (g_object_ref (pkg));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downside is we're double boxing. But, eh.

@@ -224,6 +229,45 @@ pub(crate) fn verify_kernel_hmac(rootfs: i32, moddir: &str) -> CxxResult<()> {
verify_kernel_hmac_impl(&moddir).map_err(Into::into)
}

pub(crate) fn stage_container_rpms(rpms: Vec<String>) -> CxxResult<Vec<String>> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this as is, but: why not switch to doing this in the daemon path too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe.

The idea with this is that it acts like the pkgcache repo in the container case where we don't have one. So we could use this client-side too, but then turn around and immediately import them into the pkgcache? I could see some utility to that. But I was actually thinking of going the other way and eventually drop this once we can use bare-split-xattrs more easily. That opens the door to using the full core assembly code. So then e.g. things like kernel replacement would re-use the same path.

@jlebon
Copy link
Member Author

jlebon commented May 25, 2022

OK, merging this!

@jlebon jlebon merged commit 9b3ca74 into coreos:main May 25, 2022
@jlebon jlebon deleted the pr/rework-local-overrides branch May 25, 2022 13:54
@jlebon jlebon changed the title treefile: Drop override-replace-local-rpms treefile: Drop override-replace-local-rpms and support install and overrides by URL in container path May 25, 2022
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.

None yet

2 participants