[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: [PATCH 2/2] scripts/package/builddeb: split generating packaging and build



Hi Riku


2017-09-20 19:35 GMT+09:00 Riku Voipio <riku.voipio@linaro.org>:

>>>  bindeb-pkg: FORCE
>>> -       $(MAKE) KBUILD_SRC=
>>> -       +$(call cmd,builddeb)
>>> +       $(call cmd,updateversion)
>>> +       $(CONFIG_SHELL) $(srctree)/scripts/package/mkdebian
>>> +       dpkg-buildpackage -r"fakeroot -u" -a$$(cat debian/arch) -b
>>
>> IIUC, the whole of dpkg-buildpackage process is run under "fakeroot -u".
>> Correct?
>
> No, dpkg-buildpackage will call -rfakeroot only for binary-arch targets


You are right.
I tested this and seems to work so.


>> It will internally invokes "make intdeb-pkg",
>> then $(call cmd,builddeb) calls "fakeroot -u" recursively,
>> this seems redundant to me.
>
> it wont, since it's checks if if = 0 - which will be true under. But
> all this can be indeed removed
> if we can call builddeb directly as discussed below.


Right.
I missed that id -u is already 0 in this case.



>> Maybe,
>>
>>      dpkg-buildpackage -r"$(KBUILD_PKG_ROOTCMD)" -a$$(cat debian/arch) -b
>>
>> makes more sense?
>
>>> +
>>> +cat <<EOF > debian/rules
>>> +#!/usr/bin/make -f
>>> +
>>> +ifneq (,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
>>> +    NUMJOBS = \$(patsubst parallel=%,%,\$(filter parallel=%,\$(DEB_BUILD_OPTIONS)))
>>> +    MAKEFLAGS += -j\$(NUMJOBS)
>>> +endif
>>> +
>>> +build:
>>> +       \$(MAKE) ARCH=${ARCH}
>>> +
>>> +binary-arch:
>>> +       \$(MAKE) KDEB_VERSION=${version} ARCH=${ARCH} intdeb-pkg
>>
>>
>> Hmm, instead of recursive make,
>> is it possible to run scripts/package/debuild directly here?
>
> I though it's not possible because I need variables from kernel make.
> Now that I check, I see only  $KCONFIG_CONFIG which I think we can
> assume to be .config. Also some ARCH and SRCARCH variables which are
> hardcoded anyways in mkdebian. I'll try.


Most of the variables are exported from the top-level Makefile.

KCONFIG_CONFIG  ?= .config
export KCONFIG_CONFIG

....

export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC


So, I think you can refer $KCONFIG_CONFIG from scripts/package/debuild.
(I have not tested it, though...)




-- 
Best Regards
Masahiro Yamada


Reply to: