[oe-commits] [openembedded-core] 58/59: devtool: upgrade: check that user has configured git properly

git at git.openembedded.org git at git.openembedded.org
Mon Sep 11 16:31:49 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch master
in repository openembedded-core.

commit 802829f1c38d8c5eee11ba1d9ddd37cf02597f6e
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Thu Aug 31 11:54:07 2017 +1200

    devtool: upgrade: check that user has configured git properly
    
    If user.name or user.email haven't been set then git rebase can't really
    work properly. Check that the user has set these and error out if not.
    (Elsewhere we are relying on OE's git patch functionality which forces
    a dummy OE value - that's OK there as it's completely under OE's control
    and therefore it's OK for a dummy OE user to be the committer, but here
    the rebase may require intervention so it's reasonable to have the
    user's actual name and email on the operation.)
    
    Fixes [YOCTO #11947].
    
    (From OE-Core rev: 129a3be07e272013be2db17552c13b4d8cc2cf6e)
    
    Signed-off-by: paul <paul at peggleto-mobl.ger.corp.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 scripts/lib/devtool/upgrade.py | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)

diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 297d646..41bd34e 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -1,6 +1,6 @@
 # Development tool - upgrade command plugin
 #
-# Copyright (C) 2014-2015 Intel Corporation
+# Copyright (C) 2014-2017 Intel Corporation
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License version 2 as
@@ -355,6 +355,29 @@ def _create_new_recipe(newpv, md5, sha256, srcrev, srcbranch, workspace, tinfoil
 
     return fullpath, copied
 
+
+def _check_git_config():
+    def getconfig(name):
+        try:
+            value = bb.process.run('git config --global %s' % name)[0].strip()
+        except bb.process.ExecutionError as e:
+            if e.exitcode == 1:
+                value = None
+            else:
+                raise
+        return value
+
+    username = getconfig('user.name')
+    useremail = getconfig('user.email')
+    configerr = []
+    if not username:
+        configerr.append('Please set your name using:\n  git config --global user.name')
+    if not useremail:
+        configerr.append('Please set your email using:\n  git config --global user.email')
+    if configerr:
+        raise DevtoolError('Your git configuration is incomplete which will prevent rebases from working:\n' + '\n'.join(configerr))
+
+
 def upgrade(args, config, basepath, workspace):
     """Entry point for the devtool 'upgrade' subcommand"""
 
@@ -365,6 +388,8 @@ def upgrade(args, config, basepath, workspace):
     if args.srcbranch and not args.srcrev:
         raise DevtoolError("If you specify --srcbranch/-B then you must use --srcrev/-S to specify the revision" % args.recipename)
 
+    _check_git_config()
+
     tinfoil = setup_tinfoil(basepath=basepath, tracking=True)
     try:
         rd = parse_recipe(config, tinfoil, args.recipename, True)

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list