From 43593de8225589fcd5c0d07ce70f45dfbe11bba9 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sun, 4 Mar 2012 16:48:41 -0800 Subject: repoman: say Git >=1.7.9 needed for signed commit --- bin/repoman | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'bin/repoman') diff --git a/bin/repoman b/bin/repoman index bcb48e464..3f16603f8 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1,5 +1,5 @@ #!/usr/bin/python -O -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2012 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # Next to do: dep syntax checking in mask files @@ -936,6 +936,20 @@ def vcs_files_to_cps(vcs_file_iter): return frozenset(modified_cps) +def git_supports_gpg_sign(): + status, cmd_output = \ + subprocess_getstatusoutput("git --version") + cmd_output = cmd_output.split() + if cmd_output: + version = re.match(r'^(\d+)\.(\d+)\.(\d+)', cmd_output[-1]) + if version is not None: + version = [int(x) for x in version.groups()[1:]] + if version[0] > 1 or \ + (version[0] == 1 and version[1] > 7) or \ + (version[0] == 1 and version[1] == 7 and version[2] >= 9): + return True + return False + def dev_keywords(profiles): """ Create a set of KEYWORDS values that exist in 'dev' @@ -2772,6 +2786,13 @@ else: else: retval = spawn(commit_cmd, env=os.environ) if retval != os.EX_OK: + + if repo_config.sign_commit and vcs == 'git' and \ + not git_supports_gpg_sign(): + # Inform user that newer git is needed (bug #403323). + logging.error( + "Git >=1.7.9 is required for signed commits!") + writemsg_level(("!!! Exiting on %s (shell) " + \ "error code: %s\n") % (vcs, retval), level=logging.ERROR, noiselevel=-1) -- cgit v1.2.3-1-g7c22