[L/unstable 06/13] UBUNTU: [Packaging] simplify custom_override

Masahiro Yamada masahiro.yamada at canonical.com
Thu Dec 8 01:01:21 UTC 2022


On Wed, Dec 7, 2022 at 10:50 PM Juerg Haefliger
<juerg.haefliger at canonical.com> wrote:
>
> On Wed, 7 Dec 2022 18:10:41 +0900
> Masahiro Yamada <masahiro.yamada at canonical.com> wrote:
>
> > On Wed, Dec 7, 2022 at 3:54 PM Juerg Haefliger
> > <juerg.haefliger at canonical.com> wrote:
> > >
> > > On Mon,  5 Dec 2022 17:56:12 +0900
> > > Masahiro Yamada <masahiro.yamada at canonical.com> wrote:
> > >
> > > > You do not need to invoke the shell for if/else choice.
> > > >
> > > > You can do it by using the $(if ...) built-in function.
> > > >
> > > >   $(if $($(1)_$(2)),$($(1)_$(2)),$($(1)))
> > > >
> > > > GNU Make >= 3.81 supports $(or ...), so the code can be even simpler:
> > > >
> > > >   $(or $($(1)_$(2)),$($(1)))
> > > >
> > > > No functional change is intended.
> > > >
> > > > Signed-off-by: Masahiro Yamada <masahiro.yamada at canonical.com>
> > > > ---
> > > >  debian/rules.d/0-common-vars.mk | 3 +--
> > > >  1 file changed, 1 insertion(+), 2 deletions(-)
> > > >
> > > > diff --git a/debian/rules.d/0-common-vars.mk b/debian/rules.d/0-common-vars.mk
> > > > index a54b83dd943b..ec9c5680493b 100644
> > > > --- a/debian/rules.d/0-common-vars.mk
> > > > +++ b/debian/rules.d/0-common-vars.mk
> > > > @@ -278,8 +278,7 @@ LN = ln -sf
> > > >
> > > >  # Checks if a var is overriden by the custom rules. Called with var and
> > > >  # flavour as arguments.
> > > > -custom_override = \
> > > > - $(shell if [ -n "$($(1)_$(2))" ]; then echo "$($(1)_$(2))"; else echo "$($(1))"; fi)
> > > > +custom_override = $(or $($(1)_$(2)),$($(1)))
> > >
> > > Maybe add a note/comment what this is doing.
> >
> >
> >
> >
> > I do not know your expectations.
>
> That this $(or ...) is equivalent to an if..then..else. It's not obvious to
> me, but maybe that's just me. Just a suggestion.
>
> ...Juerg
>





I do not think we need comments for builtin functions
because they are explained in the manual.


FWIW, here is the explanation of $(or ...) function.

https://www.gnu.org/software/make/manual/make.html#Conditional-Functions











> >
> > It is already commented as
> >
> > # Checks if a var is overriden by the custom rules. Called with var and
> > # flavour as arguments.
> >
> >
> >
> >
> >
> >
> > > ...Juerg
> > >
> > >
> > > >  # selftests that Ubuntu cares about
> > > >  ubuntu_selftests = breakpoints cpu-hotplug efivarfs memfd memory-hotplug mount net ptrace seccomp timers powerpc user ftrace
> > >
>



More information about the kernel-team mailing list