* [PATCH] fetch2/git: allow using 'HEAD' as a branch name
@ 2016-05-18 9:31 Markus Lehtonen
2016-06-22 9:55 ` Markus Lehtonen
0 siblings, 1 reply; 4+ messages in thread
From: Markus Lehtonen @ 2016-05-18 9:31 UTC (permalink / raw)
To: bitbake-devel
This change makes it possible to e.g. build a currently checked out
revision of a local Git repository and use AUTOREV. It will be possible
to build HEAD of remote repositories, too, of course, but this is
probably not that practical.
In order to use this one must also use the nobranch parameter, i.e. have
'branch=HEAD;nobranch=1' in the SRC_URI, because 'HEAD' is really not a
Git branch as such. The wording in "branch=HEAD;nobranch=1" is probably a
bit counter-intuitive and illogical but this seems to be the only easy
way to make this work without complicating the fetcher even further.
Another solution would be e.g. to introduce an alternative 'ref'
parameter which could be used in place of 'branch' to give any ref. The
effect would basically be the same (with better wording) with yet a bit
more complex fetcher code.
[YOCTO #9351]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
lib/bb/fetch2/git.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 526668b..99d7dc1 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -344,12 +344,15 @@ class Git(FetchMethod):
output = self._lsremote(ud, d, "")
# Tags of the form ^{} may not work, need to fallback to other form
if ud.unresolvedrev[name][:5] == "refs/":
- head = ud.unresolvedrev[name]
- tag = ud.unresolvedrev[name]
+ search_list = [ud.unresolvedrev[name],
+ ud.unresolvedrev[name] + "^{}"]
+ elif ud.unresolvedrev[name] == 'HEAD':
+ search_list = ['HEAD']
else:
head = "refs/heads/%s" % ud.unresolvedrev[name]
tag = "refs/tags/%s" % ud.unresolvedrev[name]
- for s in [head, tag + "^{}", tag]:
+ search_list = [head, tag + "^{}", tag]
+ for s in search_list:
for l in output.split('\n'):
if s in l:
return l.split()[0]
--
2.6.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fetch2/git: allow using 'HEAD' as a branch name
2016-05-18 9:31 [PATCH] fetch2/git: allow using 'HEAD' as a branch name Markus Lehtonen
@ 2016-06-22 9:55 ` Markus Lehtonen
2016-07-11 14:15 ` Cliff Brake
0 siblings, 1 reply; 4+ messages in thread
From: Markus Lehtonen @ 2016-06-22 9:55 UTC (permalink / raw)
To: bitbake-devel
Ping! I haven't seen any comments regarding this one, and, it hasn't
been merged, either.
- Markus
On Wed, 2016-05-18 at 12:31 +0300, Markus Lehtonen wrote:
> This change makes it possible to e.g. build a currently checked out
> revision of a local Git repository and use AUTOREV. It will be
> possible
> to build HEAD of remote repositories, too, of course, but this is
> probably not that practical.
>
> In order to use this one must also use the nobranch parameter, i.e.
> have
> 'branch=HEAD;nobranch=1' in the SRC_URI, because 'HEAD' is really not
> a
> Git branch as such. The wording in "branch=HEAD;nobranch=1" is
> probably a
> bit counter-intuitive and illogical but this seems to be the only
> easy
> way to make this work without complicating the fetcher even further.
> Another solution would be e.g. to introduce an alternative 'ref'
> parameter which could be used in place of 'branch' to give any ref.
> The
> effect would basically be the same (with better wording) with yet a
> bit
> more complex fetcher code.
>
> [YOCTO #9351]
>
> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
> ---
> lib/bb/fetch2/git.py | 9 ++++++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
> index 526668b..99d7dc1 100644
> --- a/lib/bb/fetch2/git.py
> +++ b/lib/bb/fetch2/git.py
> @@ -344,12 +344,15 @@ class Git(FetchMethod):
> output = self._lsremote(ud, d, "")
> # Tags of the form ^{} may not work, need to fallback to
> other form
> if ud.unresolvedrev[name][:5] == "refs/":
> - head = ud.unresolvedrev[name]
> - tag = ud.unresolvedrev[name]
> + search_list = [ud.unresolvedrev[name],
> + ud.unresolvedrev[name] + "^{}"]
> + elif ud.unresolvedrev[name] == 'HEAD':
> + search_list = ['HEAD']
> else:
> head = "refs/heads/%s" % ud.unresolvedrev[name]
> tag = "refs/tags/%s" % ud.unresolvedrev[name]
> - for s in [head, tag + "^{}", tag]:
> + search_list = [head, tag + "^{}", tag]
> + for s in search_list:
> for l in output.split('\n'):
> if s in l:
> return l.split()[0]
> --
> 2.6.6
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fetch2/git: allow using 'HEAD' as a branch name
2016-06-22 9:55 ` Markus Lehtonen
@ 2016-07-11 14:15 ` Cliff Brake
0 siblings, 0 replies; 4+ messages in thread
From: Cliff Brake @ 2016-07-11 14:15 UTC (permalink / raw)
To: Markus Lehtonen; +Cc: bitbake-devel
Markus,
Sorry I missed this email -- thanks for the patch. I'll test with my
use case and try to report back in a few days.
Thanks,
Cliff
On Wed, Jun 22, 2016 at 5:55 AM, Markus Lehtonen
<markus.lehtonen@linux.intel.com> wrote:
> Ping! I haven't seen any comments regarding this one, and, it hasn't
> been merged, either.
> - Markus
>
>
> On Wed, 2016-05-18 at 12:31 +0300, Markus Lehtonen wrote:
>> This change makes it possible to e.g. build a currently checked out
>> revision of a local Git repository and use AUTOREV. It will be
>> possible
>> to build HEAD of remote repositories, too, of course, but this is
>> probably not that practical.
>>
>> In order to use this one must also use the nobranch parameter, i.e.
>> have
>> 'branch=HEAD;nobranch=1' in the SRC_URI, because 'HEAD' is really not
>> a
>> Git branch as such. The wording in "branch=HEAD;nobranch=1" is
>> probably a
>> bit counter-intuitive and illogical but this seems to be the only
>> easy
>> way to make this work without complicating the fetcher even further.
>> Another solution would be e.g. to introduce an alternative 'ref'
>> parameter which could be used in place of 'branch' to give any ref.
>> The
>> effect would basically be the same (with better wording) with yet a
>> bit
>> more complex fetcher code.
>>
>> [YOCTO #9351]
>>
>> Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
>> ---
>> lib/bb/fetch2/git.py | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
>> index 526668b..99d7dc1 100644
>> --- a/lib/bb/fetch2/git.py
>> +++ b/lib/bb/fetch2/git.py
>> @@ -344,12 +344,15 @@ class Git(FetchMethod):
>> output = self._lsremote(ud, d, "")
>> # Tags of the form ^{} may not work, need to fallback to
>> other form
>> if ud.unresolvedrev[name][:5] == "refs/":
>> - head = ud.unresolvedrev[name]
>> - tag = ud.unresolvedrev[name]
>> + search_list = [ud.unresolvedrev[name],
>> + ud.unresolvedrev[name] + "^{}"]
>> + elif ud.unresolvedrev[name] == 'HEAD':
>> + search_list = ['HEAD']
>> else:
>> head = "refs/heads/%s" % ud.unresolvedrev[name]
>> tag = "refs/tags/%s" % ud.unresolvedrev[name]
>> - for s in [head, tag + "^{}", tag]:
>> + search_list = [head, tag + "^{}", tag]
>> + for s in search_list:
>> for l in output.split('\n'):
>> if s in l:
>> return l.split()[0]
>> --
>> 2.6.6
>>
>
> --
> _______________________________________________
> bitbake-devel mailing list
> bitbake-devel@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/bitbake-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] fetch2/git: allow using 'HEAD' as a branch name
@ 2016-08-03 14:06 Markus Lehtonen
0 siblings, 0 replies; 4+ messages in thread
From: Markus Lehtonen @ 2016-08-03 14:06 UTC (permalink / raw)
To: bitbake-devel
This change makes it possible to e.g. build a currently checked out
revision of a local Git repository and use AUTOREV. It will be possible
to build HEAD of remote repositories, too, of course, but this is
probably not that practical.
In order to use this one must also use the nobranch parameter, i.e. have
'branch=HEAD;nobranch=1' in the SRC_URI, because 'HEAD' is really not a
Git branch as such. The wording in "branch=HEAD;nobranch=1" is probably a
bit counter-intuitive and illogical but this seems to be the only easy
way to make this work without complicating the fetcher even further.
Another solution would be e.g. to introduce an alternative 'ref'
parameter which could be used in place of 'branch' to give any ref. The
effect would basically be the same (with better wording) with yet a bit
more complex fetcher code.
[YOCTO #9351]
Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
---
lib/bb/fetch2/git.py | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/lib/bb/fetch2/git.py b/lib/bb/fetch2/git.py
index 4e2dcec..0c07d64 100644
--- a/lib/bb/fetch2/git.py
+++ b/lib/bb/fetch2/git.py
@@ -388,12 +388,15 @@ class Git(FetchMethod):
output = self._lsremote(ud, d, "")
# Tags of the form ^{} may not work, need to fallback to other form
if ud.unresolvedrev[name][:5] == "refs/":
- head = ud.unresolvedrev[name]
- tag = ud.unresolvedrev[name]
+ search_list = [ud.unresolvedrev[name],
+ ud.unresolvedrev[name] + "^{}"]
+ elif ud.unresolvedrev[name] == 'HEAD':
+ search_list = ['HEAD']
else:
head = "refs/heads/%s" % ud.unresolvedrev[name]
tag = "refs/tags/%s" % ud.unresolvedrev[name]
- for s in [head, tag + "^{}", tag]:
+ search_list = [head, tag + "^{}", tag]
+ for s in search_list:
for l in output.strip().split('\n'):
sha1, ref = l.split()
if s == ref:
--
2.6.6
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-08-03 14:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 9:31 [PATCH] fetch2/git: allow using 'HEAD' as a branch name Markus Lehtonen
2016-06-22 9:55 ` Markus Lehtonen
2016-07-11 14:15 ` Cliff Brake
-- strict thread matches above, loose matches on Subject: below --
2016-08-03 14:06 Markus Lehtonen
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.