From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by mx.groups.io with SMTP id smtpd.web10.1871.1588837377444621287 for ; Thu, 07 May 2020 00:42:58 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aaS/z1zi; spf=pass (domain: redhat.com, ip: 205.139.110.61, mailfrom: philmd@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1588837376; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ZHitBbouTvvyq6A7my86oIRol/sX3Hu1IVBYsmAvzQE=; b=aaS/z1zi88iD7wAvAqb7yWk+wYxu/AvLjCDe8/asmX8KIH9L3iNx0ziRB6d8Y1N3a+X00g nBM7+CCeLNhLYg9yOW75Pb1SE2BkOh2NeJF3PAB7WLhC94Mh5EvfCMWQIR7pxhrim6+rZw ABsvbWXMIlyyTOOhey0BB0nLi1e5Eg8= Received: from mail-wm1-f71.google.com (mail-wm1-f71.google.com [209.85.128.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-12-UhNbJ2SlP5uTyzTNEv855g-1; Thu, 07 May 2020 03:42:52 -0400 X-MC-Unique: UhNbJ2SlP5uTyzTNEv855g-1 Received: by mail-wm1-f71.google.com with SMTP id l21so2852496wmh.2 for ; Thu, 07 May 2020 00:42:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZHitBbouTvvyq6A7my86oIRol/sX3Hu1IVBYsmAvzQE=; b=RsdB+7jlkREw4YSloraTajZq7NfiG8IgrJmN6djiMJtD0OdLMSuPE1rEchunaPfhkV vFWKYsxtbFTw06DjQ21VGbSbg5tBW/0t0JB/Sao6OrRxnaogpHAEH+n8kOhSwQPubrPX fOuO86lYErWkbh2RKnffFX4AGRJXh4CYvVg/6FTzPLUHKAOYEGnD/2m9+5Skqsmw2XuK agBB2zLi785lD2Qgz5AnaO/h1myTA3NsymlIQO18fSGoWqC1GD1HHVsU7Svdy8wRMqz4 isF5DOskz1BfFhJXG4/WvY9PSL1GFXGBVek5hWRK0iag8rbbqnZuKPlAkQ2qxbuBevSn UR8Q== X-Gm-Message-State: AGi0PubFyLdP63D9BqkYo/k42Ma2SjjQi1ZbI0CtTf2xB7nPi0P5iL96 QUm5oNjqWxjzVXBkJ1zoj6wW5PqNmA9h0Scl6QFQ8A6tm5CxfiAJrgq6EJQDH8dHM2KPfI4oemj bcVZknhvpJI2OTw== X-Received: by 2002:adf:decb:: with SMTP id i11mr13760974wrn.172.1588837371558; Thu, 07 May 2020 00:42:51 -0700 (PDT) X-Google-Smtp-Source: APiQypIGcqXK4pxYoWFfF+4DXk3crhm8xmeXE1uUcAY8I70Ms7iuwF2k3OyD7pnnK8tB5o4VPsKHVA== X-Received: by 2002:adf:decb:: with SMTP id i11mr13760945wrn.172.1588837371278; Thu, 07 May 2020 00:42:51 -0700 (PDT) Return-Path: Received: from [192.168.1.39] (248.red-88-21-203.staticip.rima-tde.net. [88.21.203.248]) by smtp.gmail.com with ESMTPSA id h137sm14955289wme.0.2020.05.07.00.42.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 May 2020 00:42:50 -0700 (PDT) Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py To: devel@edk2.groups.io, rebecca@bsdio.com Cc: Bob Feng , Liming Gao References: <20200501200044.16648-1-rebecca@bsdio.com> From: =?UTF-8?B?UGhpbGlwcGUgTWF0aGlldS1EYXVkw6k=?= Message-ID: Date: Thu, 7 May 2020 09:42:49 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <20200501200044.16648-1-rebecca@bsdio.com> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit On 5/1/20 10:00 PM, Rebecca Cran wrote: > Allow users who didn't clone one of the TianoCore repos from a > canonical URL to specify the name of the repo (edk2, edk2-platforms > or edk2-non-osi) when running SetupGit.py to allow them to configure > their repo properly. > > The new option is: > > -n repo, --name repo set the repo name to configure for, if not > detected automatically > > Signed-off-by: Rebecca Cran > Cc: Bob Feng > Cc: Liming Gao > --- > Tested with: > pylama : no new issues detected > Option tested: > -n : correctly said a parameter was needed > -n edk2 : configured the repo for edk2 > -n edk2-foo : errored out with a list of repo names > -n edk2-platforms : updated the configuration for edk2-platforms > > Note the error block in __main__ if the upstream isn't found is > redundant, since it already errors out and exits in get_upstream. > > BaseTools/Scripts/SetupGit.py | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/BaseTools/Scripts/SetupGit.py b/BaseTools/Scripts/SetupGit.py > index e320ba2f887e..4416111ac0a5 100644 > --- a/BaseTools/Scripts/SetupGit.py > +++ b/BaseTools/Scripts/SetupGit.py > @@ -106,10 +106,11 @@ def fuzzy_match_repo_url(one, other): > return False > > > -def get_upstream(url): > +def get_upstream(url, name): > """Extracts the dict for the current repo origin.""" > for upstream in UPSTREAMS: > - if fuzzy_match_repo_url(upstream['repo'], url): > + if (fuzzy_match_repo_url(upstream['repo'], url) or > + upstream['name'] == name): > return upstream > print("Unknown upstream '%s' - aborting!" % url) > sys.exit(3) > @@ -143,6 +144,11 @@ if __name__ == '__main__': > help='overwrite existing settings conflicting with program defaults', > action='store_true', > required=False) > + PARSER.add_argument('-n', '--name', type=str, metavar='repo', > + choices=['edk2', 'edk2-platforms', 'edk2-non-osi'], Reviewed-by: Philippe Mathieu-Daude > + help='set the repo name to configure for, if not ' > + 'detected automatically', > + required=False) > PARSER.add_argument('-v', '--verbose', > help='enable more detailed output', > action='store_true', > @@ -156,7 +162,7 @@ if __name__ == '__main__': > > URL = REPO.remotes.origin.url > > - UPSTREAM = get_upstream(URL) > + UPSTREAM = get_upstream(URL, ARGS.name) > if not UPSTREAM: > print("Upstream '%s' unknown, aborting!" % URL) > sys.exit(7) >