From: Zac Medico Date: Mon, 5 Mar 2012 00:48:41 +0000 (-0800) Subject: repoman: say Git >=1.7.9 needed for signed commit X-Git-Tag: v2.2.0_alpha90~1 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=43593de8225589fcd5c0d07ce70f45dfbe11bba9;p=portage.git repoman: say Git >=1.7.9 needed for signed commit --- 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)