NACK/Cmnt: [linux-uc20-efi][FOCAL][PATCH 2/2] UBUNTU: [Packaging] automatically detect flavours from build-deps

Dimitri John Ledkov dimitri.ledkov at canonical.com
Thu Jun 10 09:25:10 UTC 2021


On Thu, Jun 10, 2021 at 10:05 AM Stefan Bader
<stefan.bader at canonical.com> wrote:
>
> On 10.06.21 10:56, Dimitri John Ledkov wrote:
> > On Wed, Jun 9, 2021 at 9:03 AM Stefan Bader <stefan.bader at canonical.com> wrote:
> >>
> >> On 08.06.21 13:56, Dimitri John Ledkov wrote:
> >>> Automatically detected from build-deps which flavours to build
> >>> kernel.efi apps for. This means that suffixes of
> >>> linux-image-unsigned-$(ABI)-* are used to determine the desired
> >>> flavours.
> >>>
> >>> If this parsing becomes insufficient, it might need to be updated to
> >>> use python-apt in the future, or encode flavours in
> >>> $(debian)/flavors.mk or some such.
> >>>
> >>> This makes it trivial to build derivative kernel.efi apps, by simply
> >>> adjusting appropriate control.stub with the desired flavour
> >>> build-deps.
> >>>
> >>> BugLink: https://bugs.launchpad.net/bugs/1931242
> >>> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
> >>> ---
> >>>    debian/rules | 2 +-
> >>>    1 file changed, 1 insertion(+), 1 deletion(-)
> >>>
> >>> diff --git a/debian/rules b/debian/rules
> >>> index f6e6ec0..18adb20 100755
> >>> --- a/debian/rules
> >>> +++ b/debian/rules
> >>> @@ -12,7 +12,7 @@ KERNEL_ABI_VERSION=$(shell echo "$(VERSION)" | sed -ne 's/\([0-9]*\.[0-9]*\.[0-9
> >>>
> >>>    DEB_HOST_ARCH=$(shell dpkg-architecture -qDEB_HOST_ARCH)
> >>>
> >>> -FLAVOURS=generic lowlatency
> >>> +FLAVOURS=$(shell sed -n 's/linux-image-unsigned-$(KERNEL_ABI_VERSION)-//p' debian/control | sed 's/[ ,]//g')
> >>
> >> debian/control is a generated file. This will cause errors running clean after
> >> git clean -d -x -f and potentially could pick up the wrong flavours if there is
> >> a left over conrol. The latter might only be relevant once there are multiple
> >> efi intermediates since switching between normal kernels and those requires a
> >> git clean -d -x -f.
> >>
> >
> > In Makefiles '=' is a lazy evaluated assignment, meaning it is only
> > evaluated and called when used.
> > clean target does not use the FLAVOURS variable, and I am not
> > anticipating it will be in the future.
> > Therefore there are no errors running clean after `git clean -d -x -f`.
> > FLAVOURS is only used during the build stage, that must be done after
> > invoking the clean target (as per debian policy)
> > Meaning wrong flavour will not be picked up from a stale control file
> > at build time.
> >
> > $ git clean -d -x -f
> > Removing debian/changelog
> > Removing debian/control
> >
> > $ fakeroot ./debian/rules clean
> > sed <debian.uc20-efi/control.stub >debian/control \
> > -e 's/@SERIES@/focal/g' \
> > -e 's/@KERNEL_ABI_VERSION@/5.4.0-74/g' \
> > -e 's/@SRCPKGNAME@/linux-uc20-efi/g'
> > cp debian.uc20-efi/changelog debian/changelog
> > dh_testdir
> > dh_testroot
> > rm -rf debian/tmp SIGNING
> > dh_clean
> > dh_clean: warning: Compatibility levels before 10 are deprecated
> > (level 9 in use)
> >
> > Which errors are you seeing that I am not able to reproduce?
> >
> I did not see the error but expected it from reading the code. And from your
> explanation this sounds like too much hackery to maintainable. Why not
> evaluating the input stub?

Because it contains pre-substitution strings. which debian/rules
substitutes during clean. So you would accept the below instead?

FLAVOURS=$(shell sed -n
's/linux-image-unsigned- at KERNEL_ABI_VERSION@-//p'
$(DEBIAN)/control.stub | sed 's/[ ,]//g')

It still feels a bit odd that one has to specify the two flavours five
times to build it right in the control.stub:

 linux-image-unsigned- at KERNEL_ABI_VERSION@-generic,
 linux-modules- at KERNEL_ABI_VERSION@-generic,
 linux-modules-extra- at KERNEL_ABI_VERSION@-generic,
 linux-image-unsigned- at KERNEL_ABI_VERSION@-lowlatency,
 linux-modules- at KERNEL_ABI_VERSION@-lowlatency,

I.e. it would be nice if we could generate the above from just
$(DEBIAN)/flavours.mk file or some such.
Also, I am not too sure why we build-depend on the modules-extra given
that I would have expected everything that ends up in the core-initrd
is in just regular modules.
Refactoring that will have to be done another time.

-- 
Regards,

Dimitri.



More information about the kernel-team mailing list