diff options
author | Sheng Yu <syu.os@protonmail.com> | 2022-09-14 06:01:02 -0400 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2022-09-20 04:39:23 +0100 |
commit | 57ec5fc566a8e47fefad628fc61aa9a575341ff2 (patch) | |
tree | 03daf2ff335bee7bf01647875f1857460c2d2f7c | |
parent | Fix wrong creation of empty binpkg from binhost (diff) | |
download | portage-57ec5fc566a8e47fefad628fc61aa9a575341ff2.tar.gz portage-57ec5fc566a8e47fefad628fc61aa9a575341ff2.tar.bz2 portage-57ec5fc566a8e47fefad628fc61aa9a575341ff2.zip |
gpkg-sign: add gpg configuration check
Bug: https://bugs.gentoo.org/869470
Signed-off-by: Sheng Yu <syu.os@protonmail.com>
Closes: https://github.com/gentoo/portage/pull/899
Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-x | bin/gpkg-sign | 9 | ||||
-rw-r--r-- | lib/_emerge/actions.py | 16 |
2 files changed, 25 insertions, 0 deletions
diff --git a/bin/gpkg-sign b/bin/gpkg-sign index 57fc6ce98..0aa6483e7 100755 --- a/bin/gpkg-sign +++ b/bin/gpkg-sign @@ -16,6 +16,15 @@ def main( gpkg_file, keep_current_signature=False, allow_unsigned=False, skip_signed=False ): eout = portage.output.EOutput() + + if not portage.settings.get("BINPKG_GPG_SIGNING_GPG_HOME"): + eout.eerror("BINPKG_GPG_SIGNING_GPG_HOME is not set") + exit(1) + + if not portage.settings.get("BINPKG_GPG_SIGNING_KEY"): + eout.eerror("BINPKG_GPG_SIGNING_KEY is not set") + exit(1) + try: package = gpkg.gpkg(settings=portage.settings, gpkg_file=gpkg_file) if allow_unsigned: diff --git a/lib/_emerge/actions.py b/lib/_emerge/actions.py index e79bb30c0..26120ad6d 100644 --- a/lib/_emerge/actions.py +++ b/lib/_emerge/actions.py @@ -614,6 +614,22 @@ def action_build( in trees[eroot]["root_config"].settings.features ) ): + for binpkg_gpg_config in ( + "BINPKG_GPG_SIGNING_GPG_HOME", + "BINPKG_GPG_SIGNING_KEY", + ): + if not trees[eroot]["root_config"].settings.get( + binpkg_gpg_config + ): + writemsg_level( + colorize( + "BAD", f"!!! {binpkg_gpg_config} is not set\n" + ), + level=logging.ERROR, + noiselevel=-1, + ) + return 1 + portage.writemsg_stdout(">>> Unlocking GPG... ") sys.stdout.flush() gpg = GPG(trees[eroot]["root_config"].settings) |