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

compose-rootfs: Fix gpgkey= with Fedora examples #5293

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

cgwalters
Copy link
Member

When I added the gpgkey= rewriting, I tested it when using Fedora as a buildroot, targeting CentOS Stream. The relevant thing here is parsing the CS .repo files, which just have e.g.

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256

But Fedora actually uses basearch and releasever repo variables: gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch

Now there aren't actually per architecture keys so this never made sense but let's move on.

It turns out...it's even harder than that, the rawhide repo file (only) actually uses multiple keys:
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-rawhide-$basearch file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-44-$basearch

In order to handle transitory state.

Anyways, so the fix here is to:

  • If we see a $ in the gpgkey, always rewrite it to reference the source root
  • Handle multiple keys

This fixes doing a build of rawhide, using C10S as the buildroot.

When I added the gpgkey= rewriting, I tested it when using
Fedora as a buildroot, targeting CentOS Stream. The relevant thing
here is parsing the CS `.repo` files, which just have e.g.

`gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial-SHA256`

But Fedora actually uses basearch *and* releasever repo variables:
`gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$releasever-$basearch`

Now there aren't actually *per architecture* keys so this never
made sense but let's move on.

It turns out...it's even harder than that, the rawhide repo file (only)
actually uses multiple keys:
`gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-rawhide-$basearch file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-44-$basearch`

In order to handle transitory state.

Anyways, so the fix here is to:

- If we see a `$` in the gpgkey, always rewrite it to
  reference the source root
- Handle multiple keys

This fixes doing a build of rawhide, using C10S as the buildroot.
Copy link
Member

@jmarrero jmarrero left a comment

Choose a reason for hiding this comment

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

lgtm

@cgwalters cgwalters merged commit e1d43ae into coreos:main Feb 11, 2025
18 checks passed
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