Patching file contained in downloaded recipe
I have a recipe that has a .service file in one of its files directories that I need to patch.
I haven't been able to figure out how to specify the directory of the file that needs to be patched. I can't seem to get the patch to apply to the files directory, do I need to specify the /lib/systemd/system directory into the PATCHDIR option or is there another way that would work better?
Regards
Greg
Quoted 10 lines · Greg Wilson-Lindberg
I have a recipe that has a .service file in one of its files directories that I need to patch.
I haven’t been able to figure out how to specify the directory of the file that needs to be patched. I can’t seem to get the patch to apply to the files directory, do I need to specify the
/lib/systemd/systemdirectory into the PATCHDIR option or is there another way that would work better?
Are you patching an existing upstream recipe? Or your own recipe? In the former case, you would use a .bbappend recipe.
In either case, it all depends on how the service file is generated. If it is part of the source code, then you just create a patch against the source tree and reference that patch in a recipe as a SRC_URI_append. If you generate it as part of a build, then you would either patch the build product (less desirable), or patch the code that generates the service file (more desirable).
..Ch:W..
Signature · 2 lines
*"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire*
Hi Chuck,
From: Chuck Wolber <[email protected]>
Sent: Monday, September 14, 2020 12:48 PM
To: Greg Wilson-Lindberg <[email protected]>
Cc: Yocto list discussion <[email protected]>
Subject: Re: [yocto] Patching file contained in downloaded recipe
On Mon, Sep 14, 2020 at 10:50 AM Greg Wilson-Lindberg <[email protected]<mailto:[email protected]>> wrote:
I have a recipe that has a .service file in one of its files directories that I need to patch.
I haven’t been able to figure out how to specify the directory of the file that needs to be patched. I can’t seem to get the patch to apply to the files directory, do I need to specify the /lib/systemd/system directory into the PATCHDIR option or is there another way that would work better?
Are you patching an existing upstream recipe? Or your own recipe? In the former case, you would use a .bbappend recipe.
<reply>
I am patching a recipe that is included with the Yocto system that I download. The .system file that I need to modify is in one of the file directories that are part of the recipe.
I have a .bbappend recipe that is being picked up, but because the file that I want to patch is part of the recipe and not part of what a recipe would download if it were building something from source, the patch system is not finding it.
<reply/>
In either case, it all depends on how the service file is generated. If it is part of the source code, then you just create a patch against the source tree and reference that patch in a recipe as a SRC_URI_append. If you generate it as part of a build, then you would either patch the build product (less desirable), or patch the code that generates the service file (more desirable).
<reply>
Part of my question was, could I use the PATCHDIR option to specify the /lib/systemd/system/file.service file to get the patch to run against the ‘copied’ version of the file?
Sorry for the weird “<reply>…<reply\>” blocks, I’m stuck with Outlook for email and I can’t figure out how to get it to indent the email I’m replying to and let me comment in line without indenting my replies also.
Regards, Greg
<reply\>
..Ch:W..
--
"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire
Quoted 10 lines · Greg Wilson-Lindberg
Hi Chuck,
I am patching a recipe that is included with the Yocto system that I download. The .system file that I need to modify is in one of the file directories that are part of the recipe.
Quoted 5 lines
I have a .bbappend recipe that is being picked up, but because the file that I want to patch is part of the recipe and not part of what a recipe would download if it were building something from source, the patch system is not finding it.
In that case, your best bet is to probably write a do_*_append() function into the bbappend recipe so you can jump in after one of the build steps and apply your patch during the appropriate stage. Refer to section 28.1 of the Mega Manual for all of the build tasks, and pick one that seems sensible. For example, you can write a do_install_append() function, and then prepend ${B} to the path that the service file typically shows up at to access it. From there, it is a simple matter of using typical commands to apply whatever patch you want.
I have no doubt that other, more experienced people on the Yocto project, may suggest a better target than do_install, so listen to them if any should jump in and offer sensible correction to what I am saying.
Part of my question was, could I use the PATCHDIR option to specify the
Quoted 3 lines
/lib/systemd/system/file.servicefile to get the patch to run against the ‘copied’ version of the file?
Given the example above, you would simply use ${B}/lib/systemd/system/file.service and use garden variety command line tools to apply the patch.
Quoted 4 lines
Sorry for the weird “<reply>…<reply\>” blocks, I’m stuck with Outlook for email and I can’t figure out how to get it to indent the email I’m replying to and let me comment in line without indenting my replies also.
No worries. I used to use mutt and pine, which were really good at inline posting. Alas, I have moved on to gmail, which is not so good, and comes into conflict in places such as this. We make-do of course...
..Ch:W..
Signature · 2 lines
*"Perfection must be reached by degrees; she requires the slow hand of time." - Voltaire*