Skip to contentSkip to conversation

bitbake: git and patch problem

DISCUSSION EXTERNAL van Riel Rob (ENTER, BT-CO/ENG1.1) 3 participants 7 messages Mar 5, 2018 – Mar 6, 2018

lore
Share & tools
lore
#0 lore raw

I'm experiencing strange (at least to my eyes) behaviour from bitbake. My recipe specifies a git repository as the main SRC_URI, then, in a variant created using an append file adds a patch like this:

SRC_URI_append_mystuff += "file://mystuff.patch"

As expected, this grabs the sources from the git repository, and then applies the patch. Rather unexpectedly to me, and also rather inconveniently, it then adds and commits the changes to the local git clone.

Is this expected behaviour, and if so, is there any way to prevent it?

My environment is based on poky-fido-13.0.1.

Best regards,

Rob van Riel

#1 lore raw
Quoted 6 lines · On Mon, 5 Mar 2018, EXTERNAL van Riel Rob (ENTER, BT-CO/ENG1.1) wrote:

I'm experiencing strange (at least to my eyes) behaviour from bitbake. My recipe specifies a git repository as the main SRC_URI, then, in a variant created using an append file adds a patch like this:

SRC_URI_append_mystuff += "file://mystuff.patch"

pretty sure you don't need both "_append" and "+=" in the same
assignment.

rday

#2 lore raw
Quoted 6 lines

From: Robert P. J. Day [mailto:[email protected]]
Sent: maandag 5 maart 2018 12:13
Subject: Re: [yocto] bitbake: git and patch problem

On Mon, 5 Mar 2018, EXTERNAL van Riel Rob (ENTER, BT-CO/ENG1.1) wrote:

Quoted 8 lines
Quoted 6 lines

I'm experiencing strange (at least to my eyes) behaviour from bitbake. My recipe specifies a git repository as the main SRC_URI, then, in a variant created using an append file adds a patch like this:

SRC_URI_append_mystuff += "file://mystuff.patch"

pretty sure you don't need both "_append" and "+=" in the same assignment.

Agreed, but you know how it goes: you get handed a system with a long history, you need to expand it, so you follow whatever conventions are in place unless they bite you. I ran a test with the patch lumped directly into SRC_URI, and the result was identical with this:
SRC_URI += "file://mystuff.patch"

Rob

#3 lore raw
In reply to EXTERNAL van Riel Rob (ENTER, BT-CO/ENG1.1)
Quoted 5 lines · On 2018-03-05 5:33 AM, EXTERNAL van Riel Rob (ENTER, BT-CO/ENG1.1) wrote:

I'm experiencing strange (at least to my eyes) behaviour from bitbake. My recipe specifies a git repository as the main SRC_URI, then, in a variant created using an append file adds a patch like this:

SRC_URI_append_mystuff += "file://mystuff.patch"

As expected, this grabs the sources from the git repository, and then applies the patch. Rather unexpectedly to me, and also rather inconveniently, it then adds and commits the changes to the local git clone.

Out of curiosity .. why is that unexpected, or inconvenient ? I never want a git repository to have dirty/unchecked in files, so having the build system apply a patch, make sure it is a valid format, signed-off-by and then committed is a good thing.

Quoted 2 lines

Is this expected behaviour, and if so, is there any way to prevent it?

It is, but you can change what applies the patch.

Have a look at classes/patch.bbclass, and in particular the variable PATCHTOOL.

If yours is set to 'git', git will be used. But by default, it is typically set to 'quilt' .. so it has been changed from the default in your environment.

Bruce

Quoted 7 lines

My environment is based on poky-fido-13.0.1.

Best regards,

Rob van Riel

#4 lore raw
Quoted 9 lines

-----Original Message-----
From: Bruce Ashfield [mailto:[email protected]]
Sent: maandag 5 maart 2018 15:09
Subject: Re: [yocto] bitbake: git and patch problem

Out of curiosity .. why is that unexpected, or inconvenient ? I never want a git repository to have dirty/unchecked in files, so having the build system apply a patch, make sure it is a valid format, signed-off-by and then committed is a good thing.

Acually, I wouldn't even want to have the patch in my recipes, and simply commit the code myself, for pretty much the reasons you mention. However, this particular piece of source code is shared between several products, not all of which need the change. Permanently and universally making the relevant change is out, so patch it is (unless I can come up with a better way to force a single define into the build process; I tried adding to CFLAGS, but that wasn't picked up. Others have tangled with this for less trivial changes too). Added to that is that the yocto system is our de facto development environment, that is, development is typically done on whatever ends up in the tmp/work directories, and pushed to the various version control systems from there. I don't really believe this is the correct way to use yocto, but it's what I have to deal with.
Current behaviour is unexpected, because I would not expect yocto to be the medium for pushing changes back upstream. It is inconvenient, because those git clones are what we use to make changes in, some of which are for the global code base, and in that situation, I would not want to have to roll back an automatic, local change first before getting to work on the global part.

Quoted 8 lines
Quoted 1 line

Is this expected behaviour, and if so, is there any way to prevent it?

It is, but you can change what applies the patch.

Have a look at classes/patch.bbclass, and in particular the variable PATCHTOOL.

If yours is set to 'git', git will be used. But by default, it is typically set to 'quilt' .. so it has been changed from the default in your environment.

Thank you, this may well be just the hint I was looking for. I'll dig in, and see where the trail leads.

Rob

#5 lore raw
In reply to Bruce Ashfield
Quoted 10 lines

From: EXTERNAL van Riel Rob (ENTER, BT-CO/ENG1.1)
Sent: maandag 5 maart 2018 16:12
Subject: RE: [yocto] bitbake: git and patch problem

Quoted 6 lines

From: Bruce Ashfield [mailto:[email protected]]
Sent: maandag 5 maart 2018 15:09
Subject: Re: [yocto] bitbake: git and patch problem

It is, but you can change what applies the patch.

Quoted 8 lines
Quoted 1 line

Have a look at classes/patch.bbclass, and in particular the variable

PATCHTOOL.

Quoted 3 lines

If yours is set to 'git', git will be used. But by default, it is typically set to 'quilt' .. so it has been changed from the default in your environment.

Thank you, this may well be just the hint I was looking for. I'll dig in, and see where the trail leads.

The trail led me to discover I'd omitted a piece of information that I didn't know was relevant: the code I'm trying to patch is in the kernel. It turns out the kernel uses a dedicated patching mechanism, mostly unrelated to what everything else uses. On the brighter side, I now know what to look into.

Rob

#6 lore raw
In reply to Bruce Ashfield
Quoted 8 lines

From: EXTERNAL van Riel Rob (ENTER, BT-CO/ENG1.1)
Sent: dinsdag 6 maart 2018 09:51
Subject: RE: [yocto] bitbake: git and patch problem

The trail led me to discover I'd omitted a piece of information that I didn't know was relevant: the code I'm trying to patch is in the kernel. It turns out the kernel uses a dedicated patching mechanism, mostly unrelated to what everything else uses. On the brighter side, I now know what to look into.

Rather than try to dig my way through the patch process, I've decided to venture into the (thus far unexplored) territory of kernel configuration options, and do a neater though more invasive change that way. This proved easier than I feared, and as a result, the (kernel) patch issue is no longer relevant to the job at hand. Nevertheless, a big thank you to those who responded; the extra knowlegde gained will surely be useful at some point in the future.

Rob