From: "Brian Dolbec" <dolsen@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/
Date: Thu, 17 Sep 2015 04:51:39 +0000 (UTC) [thread overview]
Message-ID: <1442464888.1b2e25d7d5d283962b257f9d9c645650de037cc0.dolsen@gentoo> (raw)
commit: 1b2e25d7d5d283962b257f9d9c645650de037cc0
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 17 00:13:13 2015 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Sep 17 04:41:28 2015 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=1b2e25d7
repoman/main.py: Move some functions out of the main code definition
Move gpgsign and need_signature to their own file: gpg.py
Move sort_key() to the main body ahead of the main code.
Signed-off-by: Brian Dolbec <dolsen <AT> gentoo.org>
pym/repoman/main.py | 78 +++++------------------------------------------------
1 file changed, 7 insertions(+), 71 deletions(-)
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index 4dbc09e..e276aba 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -38,7 +38,6 @@ import portage.repository.config
from portage import cvstree, normalize_path
from portage import util
from portage.dep import Atom
-from portage.exception import MissingParameter
from portage.process import find_binary, spawn
from portage.output import (
bold, create_color_func, green, nocolor, red)
@@ -67,6 +66,7 @@ from repoman.checks.ebuilds.variables.license import LicenseChecks
from repoman.checks.ebuilds.variables.restrict import RestrictChecks
from repoman.ebuild import Ebuild
from repoman.errors import err
+from repoman.gpg import gpgsign, need_signature
from repoman.modules.commit import repochecks
from repoman.profile import check_profiles, dev_keywords, setup_profile
from repoman.qa_data import (
@@ -97,6 +97,11 @@ non_ascii_re = re.compile(r'[^\x00-\x7f]')
# A sane umask is needed for files that portage creates.
os.umask(0o22)
+
+def sort_key(item):
+ return item[2].sub_path
+
+
# Repoman sets it's own ACCEPT_KEYWORDS and we don't want it to
# behave incrementally.
repoman_incrementals = tuple(
@@ -673,9 +678,6 @@ for xpkg in effective_scanlist:
relevant_profiles.extend(
(keyword, groups, prof) for prof in profiles[arch])
- def sort_key(item):
- return item[2].sub_path
-
relevant_profiles.sort(key=sort_key)
for keyword, groups, prof in relevant_profiles:
@@ -1441,72 +1443,6 @@ else:
except OSError:
pass
- # Setup the GPG commands
- def gpgsign(filename):
- gpgcmd = repoman_settings.get("PORTAGE_GPG_SIGNING_COMMAND")
- if gpgcmd in [None, '']:
- raise MissingParameter("PORTAGE_GPG_SIGNING_COMMAND is unset!"
- " Is make.globals missing?")
- if "${PORTAGE_GPG_KEY}" in gpgcmd and \
- "PORTAGE_GPG_KEY" not in repoman_settings:
- raise MissingParameter("PORTAGE_GPG_KEY is unset!")
- if "${PORTAGE_GPG_DIR}" in gpgcmd:
- if "PORTAGE_GPG_DIR" not in repoman_settings:
- repoman_settings["PORTAGE_GPG_DIR"] = \
- os.path.expanduser("~/.gnupg")
- logging.info(
- "Automatically setting PORTAGE_GPG_DIR to '%s'" %
- repoman_settings["PORTAGE_GPG_DIR"])
- else:
- repoman_settings["PORTAGE_GPG_DIR"] = \
- os.path.expanduser(repoman_settings["PORTAGE_GPG_DIR"])
- if not os.access(repoman_settings["PORTAGE_GPG_DIR"], os.X_OK):
- raise portage.exception.InvalidLocation(
- "Unable to access directory: PORTAGE_GPG_DIR='%s'" %
- repoman_settings["PORTAGE_GPG_DIR"])
- gpgvars = {"FILE": filename}
- for k in ("PORTAGE_GPG_DIR", "PORTAGE_GPG_KEY"):
- v = repoman_settings.get(k)
- if v is not None:
- gpgvars[k] = v
- gpgcmd = portage.util.varexpand(gpgcmd, mydict=gpgvars)
- if options.pretend:
- print("(" + gpgcmd + ")")
- else:
- # Encode unicode manually for bug #310789.
- gpgcmd = portage.util.shlex_split(gpgcmd)
-
- if sys.hexversion < 0x3020000 and sys.hexversion >= 0x3000000 and \
- not os.path.isabs(gpgcmd[0]):
- # Python 3.1 _execvp throws TypeError for non-absolute executable
- # path passed as bytes (see http://bugs.python.org/issue8513).
- fullname = find_binary(gpgcmd[0])
- if fullname is None:
- raise portage.exception.CommandNotFound(gpgcmd[0])
- gpgcmd[0] = fullname
-
- gpgcmd = [
- _unicode_encode(arg, encoding=_encodings['fs'], errors='strict')
- for arg in gpgcmd]
- rValue = subprocess.call(gpgcmd)
- if rValue == os.EX_OK:
- os.rename(filename + ".asc", filename)
- else:
- raise portage.exception.PortageException(
- "!!! gpg exited with '" + str(rValue) + "' status")
-
- def need_signature(filename):
- try:
- with open(
- _unicode_encode(
- filename, encoding=_encodings['fs'], errors='strict'),
- 'rb') as f:
- return b"BEGIN PGP SIGNED MESSAGE" not in f.readline()
- except IOError as e:
- if e.errno in (errno.ENOENT, errno.ESTALE):
- return False
- raise
-
# When files are removed and re-added, the cvs server will put /Attic/
# inside the $Header path. This code detects the problem and corrects it
# so that the Manifest will generate correctly. See bug #169500.
@@ -1557,7 +1493,7 @@ else:
manifest_path = os.path.join(repoman_settings["O"], "Manifest")
if not need_signature(manifest_path):
continue
- gpgsign(manifest_path)
+ gpgsign(manifest_path, repoman_settings, options)
except portage.exception.PortageException as e:
portage.writemsg("!!! %s\n" % str(e))
portage.writemsg("!!! Disabled FEATURES='sign'\n")
next reply other threads:[~2015-09-17 4:52 UTC|newest]
Thread overview: 216+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-17 4:51 Brian Dolbec [this message]
-- strict thread matches above, loose matches on Subject: below --
2016-05-03 9:33 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/ Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-28 15:05 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-29 17:24 [gentoo-commits] proj/portage:master " Brian Dolbec
2016-04-26 14:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2016-04-28 15:05 Brian Dolbec
2016-04-27 5:22 Brian Dolbec
2016-04-27 5:22 Brian Dolbec
2016-04-27 5:22 Brian Dolbec
2016-04-26 18:08 Zac Medico
2016-04-25 15:32 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-04-25 15:32 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-21 16:54 Brian Dolbec
2016-04-17 15:42 Brian Dolbec
2016-04-16 20:00 Zac Medico
2016-03-15 19:00 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-12 18:10 Brian Dolbec
2016-03-11 0:41 Brian Dolbec
2016-03-11 0:41 Brian Dolbec
2016-03-11 0:41 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-03-07 21:53 Brian Dolbec
2016-02-01 7:55 Zac Medico
2016-02-01 7:21 Zac Medico
2016-01-31 20:03 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-31 20:03 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-30 8:00 Brian Dolbec
2016-01-30 6:58 Brian Dolbec
2016-01-30 6:58 Brian Dolbec
2016-01-30 6:58 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-29 5:01 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-27 23:15 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-23 1:42 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-22 20:55 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
2016-01-21 19:42 Brian Dolbec
2016-01-21 19:15 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-21 18:30 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-18 19:23 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 8:01 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-11 6:31 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 20:17 Brian Dolbec
2016-01-10 3:26 Brian Dolbec
2016-01-10 3:26 Brian Dolbec
2016-01-10 3:26 Brian Dolbec
2016-01-06 4:21 Brian Dolbec
2016-01-06 4:21 Brian Dolbec
2015-12-30 23:38 Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:51 [gentoo-commits] proj/portage:master " Brian Dolbec
2015-09-21 23:47 ` [gentoo-commits] proj/portage:repoman " Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-21 23:47 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 2:06 Brian Dolbec
2015-09-20 0:20 Brian Dolbec
2015-09-19 17:32 Brian Dolbec
2015-09-19 16:48 Brian Dolbec
2015-09-19 16:28 Brian Dolbec
2015-09-19 16:28 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 4:36 Brian Dolbec
2015-09-19 1:22 Brian Dolbec
2015-09-19 1:22 Brian Dolbec
2015-09-17 18:58 Brian Dolbec
2015-09-17 18:58 Brian Dolbec
2015-09-17 15:32 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 4:51 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 3:08 Brian Dolbec
2015-09-17 2:45 Brian Dolbec
2015-09-17 2:45 Brian Dolbec
2015-09-17 2:45 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:48 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-09-05 21:27 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-11 23:54 Brian Dolbec
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 14:45 Michał Górny
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2015-08-10 13:44 Brian Dolbec
2014-11-17 2:08 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-11-17 0:55 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:46 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-10-01 23:02 Brian Dolbec
2014-06-03 19:33 Brian Dolbec
2014-06-03 18:15 Brian Dolbec
2014-06-03 18:15 Brian Dolbec
2014-06-03 11:29 Tom Wijsman
2014-06-02 17:01 Tom Wijsman
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:44 Brian Dolbec
2014-06-02 15:01 Tom Wijsman
2014-06-02 14:24 Brian Dolbec
2014-06-02 14:11 Tom Wijsman
2014-06-02 1:10 Brian Dolbec
2014-06-02 1:10 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-30 13:03 Brian Dolbec
2014-05-27 6:04 Brian Dolbec
2014-05-27 6:04 Brian Dolbec
2014-05-27 6:04 Brian Dolbec
2014-05-27 6:04 Brian Dolbec
2014-05-27 5:04 Brian Dolbec
2014-05-27 5:04 Brian Dolbec
2014-05-27 5:04 Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1442464888.1b2e25d7d5d283962b257f9d9c645650de037cc0.dolsen@gentoo \
--to=dolsen@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox