Skip to content

[fix(builder): pre-import PKGBUILD validpgpkeys before build - #362

Open
Aroy-Art wants to merge 2 commits into
Lukas-Heiligenbrunner:masterfrom
Aroy-Art:fix/pgp-key-import
Open

[fix(builder): pre-import PKGBUILD validpgpkeys before build#362
Aroy-Art wants to merge 2 commits into
Lukas-Heiligenbrunner:masterfrom
Aroy-Art:fix/pgp-key-import

Conversation

@Aroy-Art

Copy link
Copy Markdown

Keyserver connectivity inside Docker containers causes --pgpfetch to silently fail for packages with validpgpkeys (e.g. zfs-utils key 6AD860EED4598027), breaking source verification.

Sources PKGBUILD after paru -Ga to extract validpgpkeys, then tries three keyservers (Ubuntu → OpenPGP → MIT) before paru runs. Never fails the build; --pgpfetch remains as secondary fallback.

Partially closes #64 (Manual import is not handeld)

Aroy-Art added 2 commits May 16, 2026 01:34
Keyserver connectivity inside Docker containers causes --pgpfetch
to silently fail for packages with validpgpkeys (e.g. zfs-utils
key 6AD860EED4598027), breaking source verification.

Sources PKGBUILD after paru -Ga to extract validpgpkeys, then
tries three keyservers (Ubuntu → OpenPGP → MIT) before paru runs.
Never fails the build; --pgpfetch remains as secondary fallback.

Partially closes Lukas-Heiligenbrunner#64 (Manual import is not handeld)
// (--pgpfetch will still attempt to fetch during build as a secondary attempt).
let import_pgp_keys = |pkgbuild_dir: &str| {
format!(
r#"(bash -c 'cd {pkgbuild_dir} && source PKGBUILD 2>/dev/null; for k in "${{validpgpkeys[@]:-}}"; do [ -z "$k" ] && continue; gpg --keyserver hkps://keyserver.ubuntu.com --recv-keys "$k" 2>/dev/null || gpg --keyserver hkps://keys.openpgp.org --recv-keys "$k" 2>/dev/null || gpg --keyserver hkp://pgp.mit.edu --recv-keys "$k" 2>/dev/null || echo "Warning: failed to import PGP key $k"; done' || true)"#

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Thanks for the PR. I think source PKGBUILD is not a very good idea to run manually since it can be an arbitrary shell script.
Doing makepkg --printsrcinfo should be a better option since its run in an controlled way.

PR #360 moves from using paru to doing our own dependency resolution and added already something similar than you here:
https://github.com/Lukas-Heiligenbrunner/AURCache/pull/360/changes#diff-9824f463ed3db347394cc2d3267d13ed1349c9412eeb7de66503066486f4878bR5

We still need to review and pollish this pr until it gets to master.
Do you allign with the approach taken there?
Its not a very clean way to pass such a large shell script to the docker containers CMD tho.
Feel free to comment on PR #360 if you have improvement suggestions / input.
Thanks!

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good point — source PKGBUILD executing arbitrary shell is a valid concern. Agree that makepkg --printsrcinfo (or reading .SRCINFO if already present) is cleaner and safer.

The approach in #360 looks right: prefer .SRCINFO when it exists, fall back to makepkg --printsrcinfo, parse validpgpkeys lines with sed. Happy to update this PR to use that pattern instead of source PKGBUILD if it's useful as a quick fix on master while #360 is still being polished — otherwise happy to close this in favor of #360 since it handles the problem more comprehensively. Let me know which you prefer.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Hi @Aroy-Art I think it still makes sense to polish and merge this PR since #360 will probably take a while until RTM.
Maybe you can have a look at the relevant bits from #360 and port them over. When merged I can bump out a new release with this one and the new settings page too. :)

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.

Allow pgp key import - [ERROR: One or more PGP signatures could not be verified!]

2 participants