public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade
@ 2019-01-17 13:03 Henning Schild
  2019-01-23 17:23 ` Henning Schild
  2019-01-28 11:51 ` [PATCHv2] " Henning Schild
  0 siblings, 2 replies; 10+ messages in thread
From: Henning Schild @ 2019-01-17 13:03 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

From: Henning Schild <henning.schild@siemens.com>

A custom kernel usually deploys linux-libc-dev in the kernels version.
But some packages in the distribution depend on >= expected upstream
version of that package. If we deploy a linux-libc-dev in a lower
version, installing packages like build-essential will not be possible
anymore.
That is especially problematic since incremental builds will pull that
into our buildchroot and break package installation in there.

If detecting a downgrade, do not deploy the package and issue a warning.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/recipes-kernel/linux/files/build-kernel.sh | 7 +++++++
 meta/recipes-kernel/linux/linux-custom.inc      | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
index dbd6162..e4a5d30 100644
--- a/meta/recipes-kernel/linux/files/build-kernel.sh
+++ b/meta/recipes-kernel/linux/files/build-kernel.sh
@@ -122,3 +122,10 @@ rm -f linux-image-${PV}_${PV}-1_*.deb
 fakeroot dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \
 	linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
 rm -f linux-headers-${PV}_${PV}-1_*.deb
+
+# linux-libc-dev causes dependency problems if we downgrade
+# remove it after the build so the downgraded version does not get deployed
+LINUX_LIBC_DEV_V=`dpkg-query --show --showformat '${Version}' linux-libc-dev`
+if dpkg --compare-versions $LINUX_LIBC_DEV_V gt $PV; then
+	rm -f linux-libc-dev_${PV}*.deb
+fi
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index f33bb9d..ac37412 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -62,4 +62,7 @@ dpkg_runbuild() {
 	export KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
 
 	sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH}
+	if [ ! -f ${WORKDIR}/linux-libc-dev_${PV}*.deb ]; then
+		bbwarn "Kernel downgrade detected, not deploying linux-libc-dev"
+	fi
 }
-- 
2.19.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-17 13:03 [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade Henning Schild
@ 2019-01-23 17:23 ` Henning Schild
  2019-01-23 17:26   ` Jan Kiszka
  2019-01-28 11:51 ` [PATCHv2] " Henning Schild
  1 sibling, 1 reply; 10+ messages in thread
From: Henning Schild @ 2019-01-23 17:23 UTC (permalink / raw)
  To: isar-users

Ping

Am Thu, 17 Jan 2019 14:03:42 +0100
schrieb Henning Schild <henning.schild@siemens.com>:

> From: Henning Schild <henning.schild@siemens.com>
> 
> A custom kernel usually deploys linux-libc-dev in the kernels version.
> But some packages in the distribution depend on >= expected upstream
> version of that package. If we deploy a linux-libc-dev in a lower
> version, installing packages like build-essential will not be possible
> anymore.
> That is especially problematic since incremental builds will pull that
> into our buildchroot and break package installation in there.
> 
> If detecting a downgrade, do not deploy the package and issue a
> warning.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>  meta/recipes-kernel/linux/files/build-kernel.sh | 7 +++++++
>  meta/recipes-kernel/linux/linux-custom.inc      | 3 +++
>  2 files changed, 10 insertions(+)
> 
> diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh
> b/meta/recipes-kernel/linux/files/build-kernel.sh index
> dbd6162..e4a5d30 100644 ---
> a/meta/recipes-kernel/linux/files/build-kernel.sh +++
> b/meta/recipes-kernel/linux/files/build-kernel.sh @@ -122,3 +122,10
> @@ rm -f linux-image-${PV}_${PV}-1_*.deb fakeroot dpkg-deb -b
> ${REPACK_LINUX_HEADERS_DIR} \
> linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb rm -f
> linux-headers-${PV}_${PV}-1_*.deb +
> +# linux-libc-dev causes dependency problems if we downgrade
> +# remove it after the build so the downgraded version does not get
> deployed +LINUX_LIBC_DEV_V=`dpkg-query --show --showformat
> '${Version}' linux-libc-dev` +if dpkg --compare-versions
> $LINUX_LIBC_DEV_V gt $PV; then
> +	rm -f linux-libc-dev_${PV}*.deb
> +fi
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc
> b/meta/recipes-kernel/linux/linux-custom.inc index f33bb9d..ac37412
> 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -62,4 +62,7 @@ dpkg_runbuild() {
>  	export
> KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}" 
>  	sudo -E chroot --userspec=$( id -u ):$( id -g )
> ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH}
> +	if [ ! -f ${WORKDIR}/linux-libc-dev_${PV}*.deb ]; then
> +		bbwarn "Kernel downgrade detected, not deploying
> linux-libc-dev"
> +	fi
>  }


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-23 17:23 ` Henning Schild
@ 2019-01-23 17:26   ` Jan Kiszka
  2019-01-23 17:30     ` Henning Schild
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2019-01-23 17:26 UTC (permalink / raw)
  To: [ext] Henning Schild, isar-users

On 23.01.19 18:23, [ext] Henning Schild wrote:
> Ping
> 

Looks good to me - what scenarios did you test?

Jan

> Am Thu, 17 Jan 2019 14:03:42 +0100
> schrieb Henning Schild <henning.schild@siemens.com>:
> 
>> From: Henning Schild <henning.schild@siemens.com>
>>
>> A custom kernel usually deploys linux-libc-dev in the kernels version.
>> But some packages in the distribution depend on >= expected upstream
>> version of that package. If we deploy a linux-libc-dev in a lower
>> version, installing packages like build-essential will not be possible
>> anymore.
>> That is especially problematic since incremental builds will pull that
>> into our buildchroot and break package installation in there.
>>
>> If detecting a downgrade, do not deploy the package and issue a
>> warning.
>>
>> Signed-off-by: Henning Schild <henning.schild@siemens.com>
>> ---
>>   meta/recipes-kernel/linux/files/build-kernel.sh | 7 +++++++
>>   meta/recipes-kernel/linux/linux-custom.inc      | 3 +++
>>   2 files changed, 10 insertions(+)
>>
>> diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh
>> b/meta/recipes-kernel/linux/files/build-kernel.sh index
>> dbd6162..e4a5d30 100644 ---
>> a/meta/recipes-kernel/linux/files/build-kernel.sh +++
>> b/meta/recipes-kernel/linux/files/build-kernel.sh @@ -122,3 +122,10
>> @@ rm -f linux-image-${PV}_${PV}-1_*.deb fakeroot dpkg-deb -b
>> ${REPACK_LINUX_HEADERS_DIR} \
>> linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb rm -f
>> linux-headers-${PV}_${PV}-1_*.deb +
>> +# linux-libc-dev causes dependency problems if we downgrade
>> +# remove it after the build so the downgraded version does not get
>> deployed +LINUX_LIBC_DEV_V=`dpkg-query --show --showformat
>> '${Version}' linux-libc-dev` +if dpkg --compare-versions
>> $LINUX_LIBC_DEV_V gt $PV; then
>> +	rm -f linux-libc-dev_${PV}*.deb
>> +fi
>> diff --git a/meta/recipes-kernel/linux/linux-custom.inc
>> b/meta/recipes-kernel/linux/linux-custom.inc index f33bb9d..ac37412
>> 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc
>> +++ b/meta/recipes-kernel/linux/linux-custom.inc
>> @@ -62,4 +62,7 @@ dpkg_runbuild() {
>>   	export
>> KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
>>   	sudo -E chroot --userspec=$( id -u ):$( id -g )
>> ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH}
>> +	if [ ! -f ${WORKDIR}/linux-libc-dev_${PV}*.deb ]; then
>> +		bbwarn "Kernel downgrade detected, not deploying
>> linux-libc-dev"
>> +	fi
>>   }
> 

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-23 17:26   ` Jan Kiszka
@ 2019-01-23 17:30     ` Henning Schild
  2019-01-23 17:43       ` Jan Kiszka
  0 siblings, 1 reply; 10+ messages in thread
From: Henning Schild @ 2019-01-23 17:30 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: isar-users

Am Wed, 23 Jan 2019 18:26:08 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> On 23.01.19 18:23, [ext] Henning Schild wrote:
> > Ping
> >   
> 
> Looks good to me - what scenarios did you test?

I know the breakages of buildchroot from layers, and the not deploying
the kernel downgrade helped fix the issues.
In this repo i honestly only tested the logic and whether the warning
will pop up. Tested a qemuamd64 with the cip kernel inside Isar.

Henning

> Jan
> 
> > Am Thu, 17 Jan 2019 14:03:42 +0100
> > schrieb Henning Schild <henning.schild@siemens.com>:
> >   
> >> From: Henning Schild <henning.schild@siemens.com>
> >>
> >> A custom kernel usually deploys linux-libc-dev in the kernels
> >> version. But some packages in the distribution depend on >=
> >> expected upstream version of that package. If we deploy a
> >> linux-libc-dev in a lower version, installing packages like
> >> build-essential will not be possible anymore.
> >> That is especially problematic since incremental builds will pull
> >> that into our buildchroot and break package installation in there.
> >>
> >> If detecting a downgrade, do not deploy the package and issue a
> >> warning.
> >>
> >> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> >> ---
> >>   meta/recipes-kernel/linux/files/build-kernel.sh | 7 +++++++
> >>   meta/recipes-kernel/linux/linux-custom.inc      | 3 +++
> >>   2 files changed, 10 insertions(+)
> >>
> >> diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh
> >> b/meta/recipes-kernel/linux/files/build-kernel.sh index
> >> dbd6162..e4a5d30 100644 ---
> >> a/meta/recipes-kernel/linux/files/build-kernel.sh +++
> >> b/meta/recipes-kernel/linux/files/build-kernel.sh @@ -122,3 +122,10
> >> @@ rm -f linux-image-${PV}_${PV}-1_*.deb fakeroot dpkg-deb -b
> >> ${REPACK_LINUX_HEADERS_DIR} \
> >> linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb rm -f
> >> linux-headers-${PV}_${PV}-1_*.deb +
> >> +# linux-libc-dev causes dependency problems if we downgrade
> >> +# remove it after the build so the downgraded version does not get
> >> deployed +LINUX_LIBC_DEV_V=`dpkg-query --show --showformat
> >> '${Version}' linux-libc-dev` +if dpkg --compare-versions
> >> $LINUX_LIBC_DEV_V gt $PV; then
> >> +	rm -f linux-libc-dev_${PV}*.deb
> >> +fi
> >> diff --git a/meta/recipes-kernel/linux/linux-custom.inc
> >> b/meta/recipes-kernel/linux/linux-custom.inc index f33bb9d..ac37412
> >> 100644 --- a/meta/recipes-kernel/linux/linux-custom.inc
> >> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> >> @@ -62,4 +62,7 @@ dpkg_runbuild() {
> >>   	export
> >> KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
> >>   	sudo -E chroot --userspec=$( id -u ):$( id -g )
> >> ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS}
> >> ${DISTRO_ARCH}
> >> +	if [ ! -f ${WORKDIR}/linux-libc-dev_${PV}*.deb ]; then
> >> +		bbwarn "Kernel downgrade detected, not deploying
> >> linux-libc-dev"
> >> +	fi
> >>   }  
> >   
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-23 17:30     ` Henning Schild
@ 2019-01-23 17:43       ` Jan Kiszka
  2019-01-23 18:03         ` Henning Schild
  0 siblings, 1 reply; 10+ messages in thread
From: Jan Kiszka @ 2019-01-23 17:43 UTC (permalink / raw)
  To: Henning Schild; +Cc: isar-users

On 23.01.19 18:30, Henning Schild wrote:
> Am Wed, 23 Jan 2019 18:26:08 +0100
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> 
>> On 23.01.19 18:23, [ext] Henning Schild wrote:
>>> Ping
>>>    
>>
>> Looks good to me - what scenarios did you test?
> 
> I know the breakages of buildchroot from layers, and the not deploying
> the kernel downgrade helped fix the issues.
> In this repo i honestly only tested the logic and whether the warning
> will pop up. Tested a qemuamd64 with the cip kernel inside Isar.
> 

OK, but we also have a "should upgrade" kernel recipe in Isar: 
linux-mainline_4.19.0.

One question on second thought:

> +
> +# linux-libc-dev causes dependency problems if we downgrade
> +# remove it after the build so the downgraded version does not get deployed
> +LINUX_LIBC_DEV_V=`dpkg-query --show --showformat '${Version}' linux-libc-dev`
> +if dpkg --compare-versions $LINUX_LIBC_DEV_V gt $PV; then
> +	rm -f linux-libc-dev_${PV}*.deb
> +fi

Isn't this assuming we have linux-libc-dev from Debian installed? Is that always 
valid? Wouldn't it be better to query the Debian repo specifically?

Also: $(...) - `...` is old-style.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-23 17:43       ` Jan Kiszka
@ 2019-01-23 18:03         ` Henning Schild
  2019-01-23 18:13           ` Henning Schild
  0 siblings, 1 reply; 10+ messages in thread
From: Henning Schild @ 2019-01-23 18:03 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: isar-users

Am Wed, 23 Jan 2019 18:43:08 +0100
schrieb Jan Kiszka <jan.kiszka@siemens.com>:

> On 23.01.19 18:30, Henning Schild wrote:
> > Am Wed, 23 Jan 2019 18:26:08 +0100
> > schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> >   
> >> On 23.01.19 18:23, [ext] Henning Schild wrote:  
> >>> Ping
> >>>      
> >>
> >> Looks good to me - what scenarios did you test?  
> > 
> > I know the breakages of buildchroot from layers, and the not
> > deploying the kernel downgrade helped fix the issues.
> > In this repo i honestly only tested the logic and whether the
> > warning will pop up. Tested a qemuamd64 with the cip kernel inside
> > Isar. 
> 
> OK, but we also have a "should upgrade" kernel recipe in Isar: 
> linux-mainline_4.19.0.

I just tested the "gt" operator of the comparator against the 4.9 that
we get in debian 9. It worked there so there is no reason to think it
will not work for 4.19.

> 
> One question on second thought:
> 
> > +
> > +# linux-libc-dev causes dependency problems if we downgrade
> > +# remove it after the build so the downgraded version does not get
> > deployed +LINUX_LIBC_DEV_V=`dpkg-query --show --showformat
> > '${Version}' linux-libc-dev` +if dpkg --compare-versions
> > $LINUX_LIBC_DEV_V gt $PV; then
> > +	rm -f linux-libc-dev_${PV}*.deb
> > +fi  
> 
> Isn't this assuming we have linux-libc-dev from Debian installed? Is
> that always valid? Wouldn't it be better to query the Debian repo
> specifically?

Assuming you are installing only one kernel in your image, the command
will operate on linux-libc-dev from all repos but ours ... debian.
I guess if we are looking at images with multiple kernels, or
incremental builds that downgrade against their own upgrade ... things
could get tricky. Or actually not, in this case we want to get notified
about the downgrade in our repo.

Say your debian official kernel is 4.9, your layer adds 4.14.42 and you
go back to 4.14.40 in an incremental build step. The upgrade from 4.9
to 4.14.42 will be done as usual, and you should now receive the
warning about a downgrade that will not be performed. ... Not
tested ...

So i am guessing the logic is correct. For the multiple kernel case
(does that even exist?) one might have to ignore the warning or enforce
an install order with artificial dependencies.

> Also: $(...) - `...` is old-style.

Ok will fix.

Henning

> Jan
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-23 18:03         ` Henning Schild
@ 2019-01-23 18:13           ` Henning Schild
  0 siblings, 0 replies; 10+ messages in thread
From: Henning Schild @ 2019-01-23 18:13 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: isar-users

Am Wed, 23 Jan 2019 19:03:23 +0100
schrieb "[ext] Henning Schild" <henning.schild@siemens.com>:

> Am Wed, 23 Jan 2019 18:43:08 +0100
> schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> 
> > On 23.01.19 18:30, Henning Schild wrote:  
> > > Am Wed, 23 Jan 2019 18:26:08 +0100
> > > schrieb Jan Kiszka <jan.kiszka@siemens.com>:
> > >     
> > >> On 23.01.19 18:23, [ext] Henning Schild wrote:    
> > >>> Ping
> > >>>        
> > >>
> > >> Looks good to me - what scenarios did you test?    
> > > 
> > > I know the breakages of buildchroot from layers, and the not
> > > deploying the kernel downgrade helped fix the issues.
> > > In this repo i honestly only tested the logic and whether the
> > > warning will pop up. Tested a qemuamd64 with the cip kernel inside
> > > Isar.   
> > 
> > OK, but we also have a "should upgrade" kernel recipe in Isar: 
> > linux-mainline_4.19.0.  
> 
> I just tested the "gt" operator of the comparator against the 4.9 that
> we get in debian 9. It worked there so there is no reason to think it
> will not work for 4.19.
> 
> > 
> > One question on second thought:
> >   
> > > +
> > > +# linux-libc-dev causes dependency problems if we downgrade
> > > +# remove it after the build so the downgraded version does not
> > > get deployed +LINUX_LIBC_DEV_V=`dpkg-query --show --showformat
> > > '${Version}' linux-libc-dev` +if dpkg --compare-versions
> > > $LINUX_LIBC_DEV_V gt $PV; then
> > > +	rm -f linux-libc-dev_${PV}*.deb
> > > +fi    
> > 
> > Isn't this assuming we have linux-libc-dev from Debian installed? Is
> > that always valid? Wouldn't it be better to query the Debian repo
> > specifically?  
> 
> Assuming you are installing only one kernel in your image, the command
> will operate on linux-libc-dev from all repos but ours ... debian.
> I guess if we are looking at images with multiple kernels, or
> incremental builds that downgrade against their own upgrade ... things
> could get tricky. Or actually not, in this case we want to get
> notified about the downgrade in our repo.
> 
> Say your debian official kernel is 4.9, your layer adds 4.14.42 and
> you go back to 4.14.40 in an incremental build step. The upgrade from
> 4.9 to 4.14.42 will be done as usual, and you should now receive the
> warning about a downgrade that will not be performed. ... Not
> tested ...

In fact that might not be true. reprepro will probably drop the 4.14.42
so it will not be seen at install time of 4.14.40. But still we will
always detect if we fall below the greatest version coming from a repo
we do not manage ... the debian default or your other mirror.

Henning

> So i am guessing the logic is correct. For the multiple kernel case
> (does that even exist?) one might have to ignore the warning or
> enforce an install order with artificial dependencies.
> 
> > Also: $(...) - `...` is old-style.  
> 
> Ok will fix.
> 
> Henning
> 
> > Jan
> >   
> 


^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCHv2] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-17 13:03 [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade Henning Schild
  2019-01-23 17:23 ` Henning Schild
@ 2019-01-28 11:51 ` Henning Schild
  2019-01-28 11:54   ` Jan Kiszka
  2019-01-30 10:49   ` Maxim Yu. Osipov
  1 sibling, 2 replies; 10+ messages in thread
From: Henning Schild @ 2019-01-28 11:51 UTC (permalink / raw)
  To: isar-users; +Cc: Henning Schild

From: Henning Schild <henning.schild@siemens.com>

A custom kernel usually deploys linux-libc-dev in the kernels version.
But some packages in the distribution depend on >= expected upstream
version of that package. If we deploy a linux-libc-dev in a lower
version, installing packages like build-essential will not be possible
anymore.
That is especially problematic since incremental builds will pull that
into our buildchroot and break package installation in there.

If detecting a downgrade, do not deploy the package and issue a warning.

Signed-off-by: Henning Schild <henning.schild@siemens.com>
---
 meta/recipes-kernel/linux/files/build-kernel.sh | 7 +++++++
 meta/recipes-kernel/linux/linux-custom.inc      | 3 +++
 2 files changed, 10 insertions(+)

diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
index dbd6162..745c89a 100644
--- a/meta/recipes-kernel/linux/files/build-kernel.sh
+++ b/meta/recipes-kernel/linux/files/build-kernel.sh
@@ -122,3 +122,10 @@ rm -f linux-image-${PV}_${PV}-1_*.deb
 fakeroot dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \
 	linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
 rm -f linux-headers-${PV}_${PV}-1_*.deb
+
+# linux-libc-dev causes dependency problems if we downgrade
+# remove it after the build so the downgraded version does not get deployed
+LINUX_LIBC_DEV_V=$( dpkg-query --show --showformat '${Version}' linux-libc-dev )
+if dpkg --compare-versions $LINUX_LIBC_DEV_V gt $PV; then
+	rm -f linux-libc-dev_${PV}*.deb
+fi
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index f33bb9d..ac37412 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -62,4 +62,7 @@ dpkg_runbuild() {
 	export KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
 
 	sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH}
+	if [ ! -f ${WORKDIR}/linux-libc-dev_${PV}*.deb ]; then
+		bbwarn "Kernel downgrade detected, not deploying linux-libc-dev"
+	fi
 }
-- 
2.19.2


^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-28 11:51 ` [PATCHv2] " Henning Schild
@ 2019-01-28 11:54   ` Jan Kiszka
  2019-01-30 10:49   ` Maxim Yu. Osipov
  1 sibling, 0 replies; 10+ messages in thread
From: Jan Kiszka @ 2019-01-28 11:54 UTC (permalink / raw)
  To: [ext] Henning Schild, isar-users

On 28.01.19 12:51, [ext] Henning Schild wrote:
> From: Henning Schild <henning.schild@siemens.com>
> 
> A custom kernel usually deploys linux-libc-dev in the kernels version.
> But some packages in the distribution depend on >= expected upstream
> version of that package. If we deploy a linux-libc-dev in a lower
> version, installing packages like build-essential will not be possible
> anymore.
> That is especially problematic since incremental builds will pull that
> into our buildchroot and break package installation in there.
> 
> If detecting a downgrade, do not deploy the package and issue a warning.
> 
> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>   meta/recipes-kernel/linux/files/build-kernel.sh | 7 +++++++
>   meta/recipes-kernel/linux/linux-custom.inc      | 3 +++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
> index dbd6162..745c89a 100644
> --- a/meta/recipes-kernel/linux/files/build-kernel.sh
> +++ b/meta/recipes-kernel/linux/files/build-kernel.sh
> @@ -122,3 +122,10 @@ rm -f linux-image-${PV}_${PV}-1_*.deb
>   fakeroot dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \
>   	linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
>   rm -f linux-headers-${PV}_${PV}-1_*.deb
> +
> +# linux-libc-dev causes dependency problems if we downgrade
> +# remove it after the build so the downgraded version does not get deployed
> +LINUX_LIBC_DEV_V=$( dpkg-query --show --showformat '${Version}' linux-libc-dev )
> +if dpkg --compare-versions $LINUX_LIBC_DEV_V gt $PV; then
> +	rm -f linux-libc-dev_${PV}*.deb
> +fi
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> index f33bb9d..ac37412 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -62,4 +62,7 @@ dpkg_runbuild() {
>   	export KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
>   
>   	sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH}
> +	if [ ! -f ${WORKDIR}/linux-libc-dev_${PV}*.deb ]; then
> +		bbwarn "Kernel downgrade detected, not deploying linux-libc-dev"
> +	fi
>   }
> 

Thanks, looks good.

Jan

-- 
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCHv2] linux-custom: skip linux-libc-dev deployment on downgrade
  2019-01-28 11:51 ` [PATCHv2] " Henning Schild
  2019-01-28 11:54   ` Jan Kiszka
@ 2019-01-30 10:49   ` Maxim Yu. Osipov
  1 sibling, 0 replies; 10+ messages in thread
From: Maxim Yu. Osipov @ 2019-01-30 10:49 UTC (permalink / raw)
  To: Henning Schild, isar-users

On 1/28/19 12:51 PM, Henning Schild wrote:
> From: Henning Schild <henning.schild@siemens.com>
> 
> A custom kernel usually deploys linux-libc-dev in the kernels version.
> But some packages in the distribution depend on >= expected upstream
> version of that package. If we deploy a linux-libc-dev in a lower
> version, installing packages like build-essential will not be possible
> anymore.
> That is especially problematic since incremental builds will pull that
> into our buildchroot and break package installation in there.
> 
> If detecting a downgrade, do not deploy the package and issue a warning.

Applied to the 'next',

Thanks,
Maxim.

> Signed-off-by: Henning Schild <henning.schild@siemens.com>
> ---
>   meta/recipes-kernel/linux/files/build-kernel.sh | 7 +++++++
>   meta/recipes-kernel/linux/linux-custom.inc      | 3 +++
>   2 files changed, 10 insertions(+)
> 
> diff --git a/meta/recipes-kernel/linux/files/build-kernel.sh b/meta/recipes-kernel/linux/files/build-kernel.sh
> index dbd6162..745c89a 100644
> --- a/meta/recipes-kernel/linux/files/build-kernel.sh
> +++ b/meta/recipes-kernel/linux/files/build-kernel.sh
> @@ -122,3 +122,10 @@ rm -f linux-image-${PV}_${PV}-1_*.deb
>   fakeroot dpkg-deb -b ${REPACK_LINUX_HEADERS_DIR} \
>   	linux-headers-${KERNEL_NAME}_${PV}-1_${KERNEL_NAME}.deb
>   rm -f linux-headers-${PV}_${PV}-1_*.deb
> +
> +# linux-libc-dev causes dependency problems if we downgrade
> +# remove it after the build so the downgraded version does not get deployed
> +LINUX_LIBC_DEV_V=$( dpkg-query --show --showformat '${Version}' linux-libc-dev )
> +if dpkg --compare-versions $LINUX_LIBC_DEV_V gt $PV; then
> +	rm -f linux-libc-dev_${PV}*.deb
> +fi
> diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
> index f33bb9d..ac37412 100644
> --- a/meta/recipes-kernel/linux/linux-custom.inc
> +++ b/meta/recipes-kernel/linux/linux-custom.inc
> @@ -62,4 +62,7 @@ dpkg_runbuild() {
>   	export KERNEL_HEADERS_DEBIAN_DEPENDS="${KERNEL_HEADERS_DEBIAN_DEPENDS}"
>   
>   	sudo -E chroot --userspec=$( id -u ):$( id -g ) ${BUILDCHROOT_DIR} ${PP}/build-kernel.sh ${PP}/${PPS} ${DISTRO_ARCH}
> +	if [ ! -f ${WORKDIR}/linux-libc-dev_${PV}*.deb ]; then
> +		bbwarn "Kernel downgrade detected, not deploying linux-libc-dev"
> +	fi
>   }
> 


-- 
Maxim Osipov
ilbers GmbH
Maria-Merian-Str. 8
85521 Ottobrunn
Germany
+49 (151) 6517 6917
mosipov@ilbers.de
http://ilbers.de/
Commercial register Munich, HRB 214197
General Manager: Baurzhan Ismagulov

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-01-30 10:49 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-17 13:03 [PATCH] linux-custom: skip linux-libc-dev deployment on downgrade Henning Schild
2019-01-23 17:23 ` Henning Schild
2019-01-23 17:26   ` Jan Kiszka
2019-01-23 17:30     ` Henning Schild
2019-01-23 17:43       ` Jan Kiszka
2019-01-23 18:03         ` Henning Schild
2019-01-23 18:13           ` Henning Schild
2019-01-28 11:51 ` [PATCHv2] " Henning Schild
2019-01-28 11:54   ` Jan Kiszka
2019-01-30 10:49   ` Maxim Yu. Osipov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox