From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f41.google.com (mail-wr1-f41.google.com [209.85.221.41]) by mx.groups.io with SMTP id smtpd.web10.3599.1588761113020911704 for ; Wed, 06 May 2020 03:31:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=qyZkzpz8; spf=pass (domain: nuviainc.com, ip: 209.85.221.41, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f41.google.com with SMTP id w7so728966wre.13 for ; Wed, 06 May 2020 03:31:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=J2zNKWBjvCXRwzMnx7JaUNBzjWnyLgUj2wLB9z8/mTE=; b=qyZkzpz8n0gzzMjO9fXz9MIjNQWTP9wKNVEyiLHRbyNDGLsL2sqRNrwdWHUKlHnZyO MBHIvvx+Y/IXwFRCjyhtRiweAd9DRefRin24zjLqymhGyyjsEj2Bxis11IZcVLMatTJJ b7qNcIKylsaOcV4246eivFs2Ey+K0OLIdmnsNbxpdf7ba0424gSBgSHDa9RlBS/BH0TT jVSbpfDbgTY3QdXVUeIJtxNifSlM1Qainy2GtGymqdzeNEPbtyi7LNPXMbSa9iMX7KXX OQ0bfPmnIOkfwsKhZkny0WYL5GfSfFKnckmqGMqAOXEeXA0oajUUogoJ99j+wW48aB1Z SwLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=J2zNKWBjvCXRwzMnx7JaUNBzjWnyLgUj2wLB9z8/mTE=; b=jnkBZAzOtJZ3mlF2bWxJIMFUbbsF1kiQVUE6q7F8B0zppxvUULcJMnY2v8o76nKi+c k3j9sjuKeYgc19+ZaMadu873s6p0PUWxnQ4iNQu+iQIFNQkUBHZ4Ic7oxOq5S20mXQfE KMxLlLwJipnw18iUb3jJMfMSrPHvAZPVBHu2dv5oZ1rKlpgjQ727yGPP82aHU0Jbkjci jh+MQtwVKhhAxtCxuZ3HfvD8E2Yu9ARDjWMINUBus4h/8RORci67X9F4VRy05szVm2oH 9ente5ld0zJKE/7nLM37JzoT3jUFDUjMi+2JzvMfSPNsbEXie8s2gKennQ4cGZhsUFEI RPQg== X-Gm-Message-State: AGi0PuZfNVzQJfI+1catov/bFaZhToJi6RelqwCEiIE3h04LnZqn6Nef lLUZdVmiH5ump+KzM1dq64r05iFJn0hlvGV4m8wny7FEndbreWGC+nU+tVuZqgBlMX667jntU7O AiGTQv5BbpcW9ANE4IguryJPZPPK6nHMlL66BSz48WwRWOkX7U7GQUwTRZN4+ZHE= X-Google-Smtp-Source: APiQypIckccNrz5ww2pI7S4rATUSlnSarPMSvc+EEpLwzjF2rSrH+vda6vXytetVt3tbap0eyCRsYA== X-Received: by 2002:a5d:650b:: with SMTP id x11mr8620918wru.405.1588761111338; Wed, 06 May 2020 03:31:51 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id i25sm2223379wml.43.2020.05.06.03.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 May 2020 03:31:50 -0700 (PDT) Date: Wed, 6 May 2020 11:31:48 +0100 From: "Leif Lindholm" To: devel@edk2.groups.io, lersek@redhat.com Cc: rebecca@bsdio.com, Bob Feng , Liming Gao Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py Message-ID: <20200506103148.GK21486@vanye> References: <20200501200044.16648-1-rebecca@bsdio.com> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Tue, May 05, 2020 at 17:40:35 +0200, Laszlo Ersek wrote: > CC Leif > > On 05/01/20 22:00, 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 I did consider this scenario when writing the code, but couldn't decide on a method for overriding, and wasn't 100% it wasn't just a theoretical issue. This solution looks sensible. Reviewed-by: Leif Lindholm As a sidenote - now this exists, it could make sense to also add options for overriding 'list' and 'prefix'. / Leif > > --- > > 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'], > > + 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) > > > > > >