Patch idea - fetcher for gerrit patches
Hello,
As it is my first message here allow me to introduce myself. I'm Adrian Ambrożewicz and I work at Intel Technology Poland. I love flexibility and features of Bitbake and I would like to propose new feature which will solve our problem.
I would like to propose extension to already supported fetcher library - gerrit. Idea is to be able to apply gerrit patches by simply specifying: "SRC_URI += gerrit://[gerrit_server];change=[change_id]". Fetcher would then take care of downloading most recent patchset from given review. Further extensiosn of that fetcher could include ability to specify:
- revision (get given revision instead of top)
- topic (get all patches from given topic)
- project (to be used in conjunction with 'topic' parameter)
etc...
I've prepared minimal PoC implementation without any error handling. It works just fine and is basing on wget command. Gerrit REST API is used to obtain base64-encoded patch which is then decoded to file with name [change_id].patch . I'm very interested in polishing that and upstreaming it for everyone to use.
The question I have for you is the following: does this fetcher have a chance to be accepted upstream?
Regards,
Adrian
Do we actually need separate fetcher for gerrit?
We're using gerrit for everything @LGE and to fetch from open reviews instead of merged commits I'm just setting the gerrit reference in SRCREV (e.g. refs/changes/61/252561/44) and normal git fetcher does the right think and fetches it correctly.
Advantage of using the same fetcher is to easily switch between tag/git ref/gerrit ref just by small SRC_URI modification instead of replacing whole repository (starting from fetcher change from git:// to gerrit://).
Adding optional parameter for git:// fetcher to make it easier to specify which review to pull seems easier to use and less error prone (as you probably never want to use e.g. review from glib gerrit project in dbus recipe, so always including the project name and showing error when the referenced review in change parameter doesn't point to the right project is IMHO better then fetching something completely different).
For topic parameter I don't understand how would you fetch the reviews if there are more then one with the same topic? Would you fetch multiple repositories in some automatically generated destdir directories? Or fetch just the patches and apply them on top of some other SRC_URI entry?
Regards,
Quoted 34 lines · Adrian Ambrożewicz
Hello,
As it is my first message here allow me to introduce myself. I'm Adrian Ambrożewicz and I work at Intel Technology Poland. I love flexibility and features of Bitbake and I would like to propose new feature which will solve our problem.
I would like to propose extension to already supported fetcher library - gerrit. Idea is to be able to apply gerrit patches by simply specifying:
"SRC_URI+= gerrit://[gerrit_server];change=[change_id]". Fetcher would then take care of downloading most recent patchset from given review. Further extensiosn of that fetcher could include ability to specify:
- revision (get given revision instead of top)
- topic (get all patches from given topic)
- project (to be used in conjunction with 'topic' parameter) etc...I've prepared minimal PoC implementation without any error handling. It works just fine and is basing on wget command. Gerrit REST API is used to obtain base64-encoded patch which is then decoded to file with name [change_id].patch . I'm very interested in polishing that and upstreaming it for everyone to use.
The question I have for you is the following: does this fetcher have a chance to be accepted upstream?
Regards,
Adrian
--
_______________________________________________
bitbake-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/bitbake-devel
Hi,
Interesting idea.
We use gerrit but don't neeed to expose gerrit details to bitbake fetcher.
Instead, we use gerrit changes to fetch meta layer changes using a separate checkout script. It handles gerrit topics, e.g. same topic name is used to bundle changes from multiple meta layer git trees. This enables large transitions and updates as single topic.
In our case it's a grave bug to use SRC_URIs in bitbake recipes without referring to proper branch and commit id. There have been cases where a commit-id from an open gerrit review got integrated which is bad, bad. I can only imagine that testing could be easier if bitbake recipes were to support gerrit directly, e.g. to trigger a bitbake test build for an open gerrit review change. But there are other ways to script that without exposing gerrit details to bitbake.
So I'm not sure if this gerrit fetcher is easier. At least I would like to disable it, or add a custom QA check which forbids its use in release build recipes.
Cheers,
-Mikko
Quoted 7 lines · On Mon, 2019-11-11 at 07:58 +0000, [email protected] wrote:
Hi,
Interesting idea.
We use gerrit but don't neeed to expose gerrit details to bitbake fetcher.
Quoted 7 lines
Instead, we use gerrit changes to fetch meta layer changes using a separate checkout
script. It handles gerrit topics, e.g. same topic name is used to bundle changes
from multiple meta layer git trees. This enables large transitions and updates as single
topic.
There is a similar setup we have for CI using gerrit, but once you start playing with fetchers, bitbake is not happy and the build consistency is jeopardized as well, e.g. new QA checks etc, come in way in other words you have to maintain this additional CI fetch method and it grows cruft. So I would think if we were to do some additional work in fetchers to achieve this, that would be long term sustainable, and perhaps useful for other gerrit users or other SCMs
Quoted 21 lines
In our case it's a grave bug to use
SRC_URIsin bitbake recipes without referring
to proper branch and commit id. There have been cases where a commit- id from an open
gerrit review got integrated which is bad, bad. I can only imagine that testing
could be easier if bitbake recipes were to support gerrit directly, e.g. to trigger
a bitbake test build for an open gerrit review change. But there are other ways
to script that without exposing gerrit details to bitbake.So I'm not sure if this gerrit fetcher is easier. At least I would like to disable it,
or add a custom QA check which forbids its use in release build recipes.Cheers,
-Mikko
W dniu 11/11/2019 o 16:24, Khem Raj pisze:
Quoted 8 lines · On Mon, 2019-11-11 at 07:58 +0000, [email protected] wrote:
Quoted 7 lines
Hi,
Interesting idea.
We use gerrit but don't neeed to expose gerrit details to bitbake fetcher.
Quoted 7 lines
Quoted 7 lines
Instead, we use gerrit changes to fetch meta layer changes using a separate checkout
script. It handles gerrit topics, e.g. same topic name is used to bundle changes
from multiple meta layer git trees. This enables large transitions and updates as single
topic.
We've tried approach with separate script. It's just ankward to use separate checkout script for fetching and patching sources, when in fact bitbake provides those utilities, just isn't compatible directly with that SCM yet.
Idea is to have separate layer combining WIP/reviewed commits submitted to different repositories as our 'baseline'. Gerrit fetcher would take care of that.
Quoted 21 lines
There is a similar setup we have for CI using gerrit, but once you start playing with fetchers, bitbake is not happy and the build consistency is jeopardized as well, e.g. new QA checks etc, come in way in other words you have to maintain this additional CI fetch method and it grows cruft. So I would think if we were to do some additional work in fetchers to achieve this, that would be long term sustainable, and perhaps useful for other gerrit users or other SCMs
Quoted 12 lines
In our case it's a grave bug to use
SRC_URIsin bitbake recipes without referring
to proper branch and commit id. There have been cases where a commit- id from an open
gerrit review got integrated which is bad, bad. I can only imagine that testing
could be easier if bitbake recipes were to support gerrit directly, e.g. to trigger
a bitbake test build for an open gerrit review change. But there are other ways
to script that without exposing gerrit details to bitbake.
I agree, it would be easier and much more logical to integrate patches in my layers just by specifying ongoing reviews. Why forcing user to write his own external scripts to do that when proper patches might be fetched and applied natively. We've tried that and failed miserably.
Quoted 5 lines
Quoted 5 lines
So I'm not sure if this gerrit fetcher is easier. At least I would like to disable it,
or add a custom QA check which forbids its use in release build recipes.
In 'my' use case gerrit fetcher is aimed directly to ease development for large features scattered among many repos. Opt-in for enabling that and big warning in build log could be reasonable solution.
Quoted 5 lines
Quoted 4 lines
Cheers,
-Mikko
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
it looks the same as any other recipe fetching from normal git repository (not managed by gerrit), e.g.:
SRC_URI = "git://gerrit/projectA;name=A \
git://gerrit/projectB;name=B \"SRCREV_FORMAT = "A_B"SRCREV_A = "refs/changes/61/252561/44"SRCREV_B = "refs/changes/62/252562/1"
In regular case SRCREV_A and SRCREV_B will be set to some git SHA, but to build from some open reviews we just set the refs/changes/*/*/* in the SRCREV variables (without changing SRC_URI except adding ;nobranch=1 which is added through another variable - our exact case is a bit more complicated, see:
https://github.com/webosose/meta-webosose/blob/master/meta-webos/conf/distro/include/webos-repositories.inc
)
recipes then use e.g. WEBOSOSE_GIT_REPO_COMPLETE variable (there are more variables like this in internal builds for different gerrit servers and projects there), so the CI can just set WEBOS_GIT_BRANCH = ";nobranch=".
In regular builds this triggers QA error to prevent anyone merging change like this by accident, because all our regular builds fetch from annotated tags (the SRCREV is set to matching SHA and bbclass checks that the SHA is matching with the corresponding submissions/N where N is part of the component version), that's implemented as do_fetch[prefuncs] here:
https://github.com/webosose/meta-webosose/blob/master/meta-webos/classes/webos_enhanced_submissions.bbclass
Most our recipes use just one repository, so 99,9% cases is even simpler than this.
Regards,
Quoted 88 lines · Adrian Ambrożewicz
W dniu 11/8/2019 o 15:58, Martin Jansa pisze:
Quoted 11 lines
Do we actually need separate fetcher for gerrit?
We're using gerrit for everything @LGE and to fetch from open reviews instead of merged commits I'm just setting the gerrit reference in SRCREV (e.g. refs/changes/61/252561/44) and normal git fetcher does the right think and fetches it correctly.
Advantage of using the same fetcher is to easily switch between tag/git ref/gerrit ref just by small
SRC_URImodification instead of replacing whole repository (starting from fetcher change fromgit://to gerrit://).That is very good suggestion and should work in simplest cases. How does
SRC_URIand SRCREV look in your case?I see some limitations of that solution, but correct me if I'm wrong as my experience with bitbake is quite limited.. how about multiple patchse? How
SRC_URIand SRCREV would look like then?Quoted 6 lines
Adding optional parameter for
git://fetcher to make it easier to specify which review to pull seems easier to use and less error prone (as you probably never want to use e.g. review from glib gerrit project in dbus recipe, so always including the project name and showing error when the referenced review in change parameter doesn't point to the right project is IMHO better then fetching something completelydifferent).
Quoted 5 lines
For topic parameter I don't understand how would you fetch the reviews if there are more then one with the same topic? Would you fetch multiple repositories in some automatically generated destdir directories? Or fetch just the patches and apply them on top of some other
SRC_URIentry?The latter. Our use case is contribution to many existing subrepos. We have a bunch of reviews to manage which combined on top of existing recipe builds our features. Gerrit fetcher in our case is aimed to address applying many patches of ongoing reviews until they are integrated.
Quoted 10 lines
Regards,
On Fri, Nov 8, 2019 at 3:08 PM Adrian Ambrożewicz <[email protected] <mailto:[email protected]>> wrote:
Hello,
As it is my first message here allow me to introduce myself. I'm
Adrian
Quoted 9 lines
Ambrożewicz and I work at Intel Technology Poland. I love flexibility and features of Bitbake and I would like to propose new feature which will solve our problem.
I would like to propose extension to already supported fetcher library -
gerrit. Idea is to be able to apply gerrit patches by simply specifying:
"SRC_URI+= gerrit://[gerrit_server];change=[change_id]". Fetcherwould
Quoted 8 lines
then take care of downloading most recent patchset from given review. Further extensiosn of that fetcher could include ability to specify:
- revision (get given revision instead of top)
- topic (get all patches from given topic)
- project (to be used in conjunction with 'topic' parameter) etc...I've prepared minimal PoC implementation without any error handling.
It
Quoted 1 line
works just fine and is basing on wget command. Gerrit REST API is
used
Quoted 1 line
to obtain base64-encoded patch which is then decoded to file with
name
Quoted 4 lines
[change_id].patch . I'm very interested in polishing that and upstreaming it for everyone to use.
The question I have for you is the following: does this fetcher have
a
Quoted 11 lines
chance to be accepted upstream?
Regards,
Adrian
--
_______________________________________________
bitbake-devel mailing list
[email protected]
<mailto:[email protected]>
http://lists.openembedded.org/mailman/listinfo/bitbake-devel