* [PATCH 1/1] BaseTools: add repo name option to SetupGit.py
@ 2020-05-01 20:00 Rebecca Cran
2020-05-05 15:40 ` [edk2-devel] " Laszlo Ersek
2020-05-07 7:42 ` Philippe Mathieu-Daudé
0 siblings, 2 replies; 6+ messages in thread
From: Rebecca Cran @ 2020-05-01 20:00 UTC (permalink / raw)
To: devel; +Cc: Rebecca Cran, Bob Feng, Liming Gao
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 <rebecca@bsdio.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
---
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)
--
2.25.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py
2020-05-01 20:00 [PATCH 1/1] BaseTools: add repo name option to SetupGit.py Rebecca Cran
@ 2020-05-05 15:40 ` Laszlo Ersek
2020-05-06 10:31 ` Leif Lindholm
2020-05-07 7:42 ` Philippe Mathieu-Daudé
1 sibling, 1 reply; 6+ messages in thread
From: Laszlo Ersek @ 2020-05-05 15:40 UTC (permalink / raw)
To: devel, rebecca; +Cc: Bob Feng, Liming Gao, Leif Lindholm (Nuvia address)
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 <rebecca@bsdio.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> ---
> 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)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py
2020-05-05 15:40 ` [edk2-devel] " Laszlo Ersek
@ 2020-05-06 10:31 ` Leif Lindholm
2020-05-06 16:36 ` Laszlo Ersek
0 siblings, 1 reply; 6+ messages in thread
From: Leif Lindholm @ 2020-05-06 10:31 UTC (permalink / raw)
To: devel, lersek; +Cc: rebecca, Bob Feng, Liming Gao
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 <rebecca@bsdio.com>
> > Cc: Bob Feng <bob.c.feng@intel.com>
> > Cc: Liming Gao <liming.gao@intel.com>
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 <leif@nuviainc.com>
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)
> >
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py
2020-05-06 10:31 ` Leif Lindholm
@ 2020-05-06 16:36 ` Laszlo Ersek
2020-05-07 2:11 ` Bob Feng
0 siblings, 1 reply; 6+ messages in thread
From: Laszlo Ersek @ 2020-05-06 16:36 UTC (permalink / raw)
To: Bob Feng, Liming Gao; +Cc: devel, leif, rebecca
On 05/06/20 12:31, Leif Lindholm wrote:
> 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 <rebecca@bsdio.com>
>>> Cc: Bob Feng <bob.c.feng@intel.com>
>>> Cc: Liming Gao <liming.gao@intel.com>
>
> 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 <leif@nuviainc.com>
Thanks!
Bob, Liming, can one of you please ACK and also merge this patch?
Thanks,
Laszlo
>
> 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)
>>>
>>
>>
>>
>>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py
2020-05-06 16:36 ` Laszlo Ersek
@ 2020-05-07 2:11 ` Bob Feng
0 siblings, 0 replies; 6+ messages in thread
From: Bob Feng @ 2020-05-07 2:11 UTC (permalink / raw)
To: devel@edk2.groups.io, lersek@redhat.com, Gao, Liming
Cc: leif@nuviainc.com, rebecca@bsdio.com
This patch looks good for me.
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Laszlo Ersek
Sent: Thursday, May 7, 2020 12:36 AM
To: Feng, Bob C <bob.c.feng@intel.com>; Gao, Liming <liming.gao@intel.com>
Cc: devel@edk2.groups.io; leif@nuviainc.com; rebecca@bsdio.com
Subject: Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py
On 05/06/20 12:31, Leif Lindholm wrote:
> 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 <rebecca@bsdio.com>
>>> Cc: Bob Feng <bob.c.feng@intel.com>
>>> Cc: Liming Gao <liming.gao@intel.com>
>
> 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 <leif@nuviainc.com>
Thanks!
Bob, Liming, can one of you please ACK and also merge this patch?
Thanks,
Laszlo
>
> 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)
>>>
>>
>>
>>
>>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH 1/1] BaseTools: add repo name option to SetupGit.py
2020-05-01 20:00 [PATCH 1/1] BaseTools: add repo name option to SetupGit.py Rebecca Cran
2020-05-05 15:40 ` [edk2-devel] " Laszlo Ersek
@ 2020-05-07 7:42 ` Philippe Mathieu-Daudé
1 sibling, 0 replies; 6+ messages in thread
From: Philippe Mathieu-Daudé @ 2020-05-07 7:42 UTC (permalink / raw)
To: devel, rebecca; +Cc: Bob Feng, Liming Gao
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 <rebecca@bsdio.com>
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> ---
> 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 <philmd@redhat.com>
> + 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)
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-05-07 7:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-01 20:00 [PATCH 1/1] BaseTools: add repo name option to SetupGit.py Rebecca Cran
2020-05-05 15:40 ` [edk2-devel] " Laszlo Ersek
2020-05-06 10:31 ` Leif Lindholm
2020-05-06 16:36 ` Laszlo Ersek
2020-05-07 2:11 ` Bob Feng
2020-05-07 7:42 ` Philippe Mathieu-Daudé
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox