From patchwork Thu Jan 29 18:35:17 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 434623 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 228EF14027F for ; Fri, 30 Jan 2015 05:35:31 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3B4664B813; Thu, 29 Jan 2015 19:35:29 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yOn8Pxn4e7St; Thu, 29 Jan 2015 19:35:29 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C4CEE4B804; Thu, 29 Jan 2015 19:35:28 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DD7304B811 for ; Thu, 29 Jan 2015 19:35:24 +0100 (CET) Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Rav9Cg4N83DO for ; Thu, 29 Jan 2015 19:35:24 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-yk0-f201.google.com (mail-yk0-f201.google.com [209.85.160.201]) by theia.denx.de (Postfix) with ESMTPS id 4F4364B804 for ; Thu, 29 Jan 2015 19:35:22 +0100 (CET) Received: by mail-yk0-f201.google.com with SMTP id q9so3585395ykb.0 for ; Thu, 29 Jan 2015 10:35:20 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=siVrz/G3soF2B9Djs/jiRc/kGcSNfXOcS/qsdImDBOU=; b=g1NTd2sXmr2oVIw/PlnTXDlKkT6JRXZrD2k7KZRN/DrlHSyxr3WXt0C8rnISXHlNzw bKbfQRC1fPrQPFObC+aPWE8/kVq3m6fefS/P13OENk2D075S753LJIIsob9lef1ZBaTr QpoQGIbZ6voCI37FMa9I11G3zcCV494bngUw+nok5eLDgHQSxmQp6jGuCcMKUCXTkHAS sI33ijeBicXrkr0Xr0ywOiAu2x/+2A1XWb8YQqcLbu2TSZjy55iRMt3GiLebXSii+K/O h6uLN4yTc+aLu04yT1gKnVpEKQ1L7+HYQhXS2BgA6prm/n88qmmmSdROXnteQVCC+rpF SSLA== X-Gm-Message-State: ALoCoQnyjMEK1ofsbM6aWF/d/0ocGkS+okegt7/NmM1S1z/qrG8d7me5sUJL01PWCmnJWnCGTXNd X-Received: by 10.236.19.18 with SMTP id m18mr1621261yhm.0.1422556520863; Thu, 29 Jan 2015 10:35:20 -0800 (PST) Received: from corpmail-nozzle1-2.hot.corp.google.com ([100.108.1.103]) by gmr-mx.google.com with ESMTPS id q2si1327576qcn.2.2015.01.29.10.35.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 29 Jan 2015 10:35:20 -0800 (PST) Received: from kaki.bld.corp.google.com ([172.29.216.32]) by corpmail-nozzle1-2.hot.corp.google.com with ESMTP id 9E1x42OW.1; Thu, 29 Jan 2015 10:35:20 -0800 Received: by kaki.bld.corp.google.com (Postfix, from userid 121222) id 316552206CE; Thu, 29 Jan 2015 11:35:20 -0700 (MST) From: Simon Glass To: U-Boot Mailing List Date: Thu, 29 Jan 2015 11:35:17 -0700 Message-Id: <1422556517-17239-2-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1422556517-17239-1-git-send-email-sjg@chromium.org> References: <1422556517-17239-1-git-send-email-sjg@chromium.org> Subject: [U-Boot] [PATCH 2/2] patman: Read in the git-mailrc alias file X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" We should read this file to obtain a set of aliases. This reduces the need to create them in the ~/.patman file. This feature did exist in some version of patman, and is mentioned in the help but it did not find its way upstream. Reported-by: Graeme Russ Signed-off-by: Simon Glass --- tools/patman/settings.py | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 122e8fd..ba2a68f 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -235,6 +235,31 @@ def _UpdateDefaults(parser, config): else: print "WARNING: Unknown setting %s" % name +def _ReadAliasFile(fname): + """Read in the U-Boot git alias file if it exists. + + Args: + fname: Filename to read. + """ + if os.path.exists(fname): + bad_line = None + with open(fname) as fd: + linenum = 0 + for line in fd: + linenum += 1 + line = line.strip() + if not line or line.startswith('#'): + continue + words = line.split(' ', 2) + if len(words) < 3 or words[0] != 'alias': + if not bad_line: + bad_line = "%s:%d:Invalid line '%s'" % (fname, linenum, + line) + continue + alias[words[1]] = [s.strip() for s in words[2].split(',')] + if bad_line: + print bad_line + def Setup(parser, project_name, config_fname=''): """Set up the settings module by reading config files. @@ -244,6 +269,8 @@ def Setup(parser, project_name, config_fname=''): for sections named "project_section" as well. config_fname: Config filename to read ('' for default) """ + # First read the git alias file if available + _ReadAliasFile('doc/git-mailrc') config = _ProjectConfigParser(project_name) if config_fname == '': config_fname = '%s/.patman' % os.getenv('HOME')