[1/3] dpkg: adjust task order to allow using "git" for patching

Message ID 20210122084241.10573-2-henning.schild@siemens.com
State Accepted, archived
Headers show
Series allow do_patch to use the "git" tool | expand

Commit Message

Henning Schild Jan. 21, 2021, 10:42 p.m. UTC
From: Henning Schild <henning.schild@siemens.com>

The adjust_git task breaks the git tree for use outside the buildchroot.
And our patch implementation supports using "git am" when setting
PATCHTOOL = "git". In order to actually apply git patches we have to
adjust after patching.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/classes/dpkg-base.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jan Kiszka Jan. 22, 2021, 12:53 a.m. UTC | #1
On 22.01.21 09:42, [ext] Henning Schild wrote:
> From: Henning Schild <henning.schild@siemens.com>
> 
> The adjust_git task breaks the git tree for use outside the buildchroot.
> And our patch implementation supports using "git am" when setting
> PATCHTOOL = "git". In order to actually apply git patches we have to
> adjust after patching.

That will likely not work as is when rerunning the job for a partial
rebuild, e.g. after adding a patch and not changing the git URL. We now
need a "restore_git" prior to patch, no?

Jan

> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  meta/classes/dpkg-base.bbclass | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
> index 01c6eb658e..5c7bddc9ba 100644
> --- a/meta/classes/dpkg-base.bbclass
> +++ b/meta/classes/dpkg-base.bbclass
> @@ -47,10 +47,10 @@ python do_adjust_git() {
>              bb.fatal(str(e))
>  }
>  
> -addtask adjust_git after do_unpack before do_patch
> +addtask adjust_git before do_dpkg_build
>  
>  inherit patch
> -addtask patch after do_adjust_git before do_dpkg_build
> +addtask patch before do_adjust_git
>  
>  SRC_APT ?= ""
>  
>
Henning Schild Jan. 22, 2021, 3:40 a.m. UTC | #2
Am Fri, 22 Jan 2021 11:53:58 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> On 22.01.21 09:42, [ext] Henning Schild wrote:
> > From: Henning Schild <henning.schild@siemens.com>
> > 
> > The adjust_git task breaks the git tree for use outside the
> > buildchroot. And our patch implementation supports using "git am"
> > when setting PATCHTOOL = "git". In order to actually apply git
> > patches we have to adjust after patching.  
> 
> That will likely not work as is when rerunning the job for a partial
> rebuild, e.g. after adding a patch and not changing the git URL. We
> now need a "restore_git" prior to patch, no?

I was also afraid of that. So i tried modifying a patch, which triggerd
a new fetch/unpack cycle and was fine. I guess adding a patch will do
the same.
Changing the patch function would become problematic, but that is a
task for isar developers.

So i am almost certain that will not cause fun on partial rebuilds.

Henning

> Jan
> 
> > 
> > Signed-off-by: Henning Schild <henning.schild@siemens.com>
> > ---
> >  meta/classes/dpkg-base.bbclass | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/meta/classes/dpkg-base.bbclass
> > b/meta/classes/dpkg-base.bbclass index 01c6eb658e..5c7bddc9ba 100644
> > --- a/meta/classes/dpkg-base.bbclass
> > +++ b/meta/classes/dpkg-base.bbclass
> > @@ -47,10 +47,10 @@ python do_adjust_git() {
> >              bb.fatal(str(e))
> >  }
> >  
> > -addtask adjust_git after do_unpack before do_patch
> > +addtask adjust_git before do_dpkg_build
> >  
> >  inherit patch
> > -addtask patch after do_adjust_git before do_dpkg_build
> > +addtask patch before do_adjust_git
> >  
> >  SRC_APT ?= ""
> >  
> >   
>
Anton Mikanovich Feb. 8, 2021, 6:06 a.m. UTC | #3
22.01.2021 16:40, Henning Schild wrote:
> Am Fri, 22 Jan 2021 11:53:58 +0100
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
>
>> On 22.01.21 09:42, [ext] Henning Schild wrote:
>>> From: Henning Schild <henning.schild@siemens.com>
>>>
>>> The adjust_git task breaks the git tree for use outside the
>>> buildchroot. And our patch implementation supports using "git am"
>>> when setting PATCHTOOL = "git". In order to actually apply git
>>> patches we have to adjust after patching.
>> That will likely not work as is when rerunning the job for a partial
>> rebuild, e.g. after adding a patch and not changing the git URL. We
>> now need a "restore_git" prior to patch, no?
> I was also afraid of that. So i tried modifying a patch, which triggerd
> a new fetch/unpack cycle and was fine. I guess adding a patch will do
> the same.
> Changing the patch function would become problematic, but that is a
> task for isar developers.
>
> So i am almost certain that will not cause fun on partial rebuilds.
>
> Henning
>
If you've already tested partial rebuild and there is no issues can we 
proceed with apply?
Henning Schild Feb. 8, 2021, 6:16 a.m. UTC | #4
Am Mon, 8 Feb 2021 19:06:56 +0300
schrieb Anton Mikanovich <amikan@ilbers.de>:

> 22.01.2021 16:40, Henning Schild wrote:
> > Am Fri, 22 Jan 2021 11:53:58 +0100
> > schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> >  
> >> On 22.01.21 09:42, [ext] Henning Schild wrote:  
> >>> From: Henning Schild <henning.schild@siemens.com>
> >>>
> >>> The adjust_git task breaks the git tree for use outside the
> >>> buildchroot. And our patch implementation supports using "git am"
> >>> when setting PATCHTOOL = "git". In order to actually apply git
> >>> patches we have to adjust after patching.  
> >> That will likely not work as is when rerunning the job for a
> >> partial rebuild, e.g. after adding a patch and not changing the
> >> git URL. We now need a "restore_git" prior to patch, no?  
> > I was also afraid of that. So i tried modifying a patch, which
> > triggerd a new fetch/unpack cycle and was fine. I guess adding a
> > patch will do the same.
> > Changing the patch function would become problematic, but that is a
> > task for isar developers.
> >
> > So i am almost certain that will not cause fun on partial rebuilds.
> >
> > Henning
> >  
> If you've already tested partial rebuild and there is no issues can
> we proceed with apply?

I think so. In fact just backported this to a layer where at again
performed as expected.

Henning

Patch

diff --git a/meta/classes/dpkg-base.bbclass b/meta/classes/dpkg-base.bbclass
index 01c6eb658e..5c7bddc9ba 100644
--- a/meta/classes/dpkg-base.bbclass
+++ b/meta/classes/dpkg-base.bbclass
@@ -47,10 +47,10 @@  python do_adjust_git() {
             bb.fatal(str(e))
 }
 
-addtask adjust_git after do_unpack before do_patch
+addtask adjust_git before do_dpkg_build
 
 inherit patch
-addtask patch after do_adjust_git before do_dpkg_build
+addtask patch before do_adjust_git
 
 SRC_APT ?= ""