commit: 57ec5fc566a8e47fefad628fc61aa9a575341ff2 Author: Sheng Yu <syu.os <AT> protonmail <DOT> com> AuthorDate: Wed Sep 14 10:01:02 2022 +0000 Commit: Sam James <sam <AT> gentoo <DOT> org> CommitDate: Tue Sep 20 03:39:23 2022 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=57ec5fc5
gpkg-sign: add gpg configuration check Bug: https://bugs.gentoo.org/869470 Signed-off-by: Sheng Yu <syu.os <AT> protonmail.com> Closes: https://github.com/gentoo/portage/pull/899 Signed-off-by: Sam James <sam <AT> gentoo.org> bin/gpkg-sign | 9 +++++++++ lib/_emerge/actions.py | 16 ++++++++++++++++ 2 files changed, 25 insertions(+) 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)
