diff mbox

[LEDE-DEV,v2] package-ipkg: Do not fail build without base-files

Message ID 20161210000449.28830-1-f.fainelli@gmail.com
State Accepted
Headers show

Commit Message

Florian Fainelli Dec. 10, 2016, 12:04 a.m. UTC
If the base-files package is not selected, we will fail executing the
very first postinst script:

make[3]: Leaving directory `/local/users/fainelli/openwrt/trunk'
cp -fpR
/local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion
/local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root.orig-orion
./usr/lib/opkg/info/busybox.postinst: line 3:
/local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion/lib/functions.sh:
No such file or directory
./usr/lib/opkg/info/busybox.postinst: line 4: default_postinst: command
not found
postinst script ./usr/lib/opkg/info/busybox.postinst has failed with
exit code 127
make[2]: *** [package/install] Error 1

Check for the existence of lib/functions.sh, and if it does not exist,
just bail out gracefully.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
Changes in v2:

- be less intrusive, just bail out if function.sh cannot be found/executed

 include/package-ipkg.mk | 2 ++
 1 file changed, 2 insertions(+)

Comments

Florian Fainelli Dec. 18, 2016, 6:40 p.m. UTC | #1
On 12/09/2016 04:04 PM, Florian Fainelli wrote:
> If the base-files package is not selected, we will fail executing the
> very first postinst script:
> 
> make[3]: Leaving directory `/local/users/fainelli/openwrt/trunk'
> cp -fpR
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root.orig-orion
> ./usr/lib/opkg/info/busybox.postinst: line 3:
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion/lib/functions.sh:
> No such file or directory
> ./usr/lib/opkg/info/busybox.postinst: line 4: default_postinst: command
> not found
> postinst script ./usr/lib/opkg/info/busybox.postinst has failed with
> exit code 127
> make[2]: *** [package/install] Error 1
> 
> Check for the existence of lib/functions.sh, and if it does not exist,
> just bail out gracefully.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

This was marked as accepted in patchwork, but I don't see it in either
John's staging tree or Felix's, do you need me to resubmit?

Thanks!
Florian Fainelli Dec. 26, 2016, 7:53 p.m. UTC | #2
Le 12/09/16 à 16:04, Florian Fainelli a écrit :
> If the base-files package is not selected, we will fail executing the
> very first postinst script:
> 
> make[3]: Leaving directory `/local/users/fainelli/openwrt/trunk'
> cp -fpR
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root.orig-orion
> ./usr/lib/opkg/info/busybox.postinst: line 3:
> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion/lib/functions.sh:
> No such file or directory
> ./usr/lib/opkg/info/busybox.postinst: line 4: default_postinst: command
> not found
> postinst script ./usr/lib/opkg/info/busybox.postinst has failed with
> exit code 127
> make[2]: *** [package/install] Error 1
> 
> Check for the existence of lib/functions.sh, and if it does not exist,
> just bail out gracefully.
> 
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

John, can you take this through your tree? Thanks!
Christian Schoenebeck Dec. 27, 2016, 7:32 p.m. UTC | #3
Do you really think this is a good idea ?
If base-files package is not selected, the postinst-pkg and prerm-pkg of none of the other selected packages will be called.
It's nice to suppress error messages but to switch off all postinst and prerm defined inside Makefile of any selected package in not really a good idea.



Am 26.12.2016 um 20:53 schrieb Florian Fainelli:
> Le 12/09/16 à 16:04, Florian Fainelli a écrit :
>> If the base-files package is not selected, we will fail executing the
>> very first postinst script:
>>
>> make[3]: Leaving directory `/local/users/fainelli/openwrt/trunk'
>> cp -fpR
>> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion
>> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root.orig-orion
>> ./usr/lib/opkg/info/busybox.postinst: line 3:
>> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion/lib/functions.sh:
>> No such file or directory
>> ./usr/lib/opkg/info/busybox.postinst: line 4: default_postinst: command
>> not found
>> postinst script ./usr/lib/opkg/info/busybox.postinst has failed with
>> exit code 127
>> make[2]: *** [package/install] Error 1
>>
>> Check for the existence of lib/functions.sh, and if it does not exist,
>> just bail out gracefully.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> John, can you take this through your tree? Thanks!
>
Christian Schoenebeck Dec. 27, 2016, 7:43 p.m. UTC | #4
Also keep in mind my pull https://github.com/lede-project/source/pull/618

Am 26.12.2016 um 20:53 schrieb Florian Fainelli:
> Le 12/09/16 à 16:04, Florian Fainelli a écrit :
>> If the base-files package is not selected, we will fail executing the
>> very first postinst script:
>>
>> make[3]: Leaving directory `/local/users/fainelli/openwrt/trunk'
>> cp -fpR
>> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion
>> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root.orig-orion
>> ./usr/lib/opkg/info/busybox.postinst: line 3:
>> /local/users/fainelli/openwrt/trunk/build_dir/target-arm_xscale_musl-1.1.15_eabi/root-orion/lib/functions.sh:
>> No such file or directory
>> ./usr/lib/opkg/info/busybox.postinst: line 4: default_postinst: command
>> not found
>> postinst script ./usr/lib/opkg/info/busybox.postinst has failed with
>> exit code 127
>> make[2]: *** [package/install] Error 1
>>
>> Check for the existence of lib/functions.sh, and if it does not exist,
>> just bail out gracefully.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> John, can you take this through your tree? Thanks!
>
Florian Fainelli Dec. 27, 2016, 8 p.m. UTC | #5
On 12/27/2016 11:32 AM, Christian Schoenebeck wrote:
> Do you really think this is a good idea ?
> If base-files package is not selected, the postinst-pkg and prerm-pkg of none of the other selected packages will be called.
> It's nice to suppress error messages but to switch off all postinst and prerm defined inside Makefile of any selected package in not really a good idea.

base-files can be deselected (and it should remain that way), in which
case you cannot complete an OpenWrt build because we stop with the
errors mentioned below, fixing that alone has value IMHO.

It seems reasonable to expect that nothing in your system that relies on
base-files can be working, the use case for a system without base-files
can be: a) replacement of the full OpenWrt/LEDE user-space with
something custom, b) build testing/combination coverage (how this was
caught here), c) minimal system getting you to a prompt without starting
anything.
Christian Schoenebeck Dec. 27, 2016, 8:07 p.m. UTC | #6
In general that's right, but disabling all postinst(-pkg) and prerm(-pkg) is more than awful.
If base-files not selected you should nevertheless call postinst-/prerm-pkg.
Otherwise their is no real chance to work without base-files whatever you do in package Makefile.

Am 27.12.2016 um 21:00 schrieb Florian Fainelli:
> base-files can be deselected (and it should remain that way), in which
> case you cannot complete an OpenWrt build because we stop with the
> errors mentioned below, fixing that alone has value IMHO.
> 
> It seems reasonable to expect that nothing in your system that relies on
> base-files can be working, the use case for a system without base-files
> can be: a) replacement of the full OpenWrt/LEDE user-space with
> something custom, b) build testing/combination coverage (how this was
> caught here), c) minimal system getting you to a prompt without starting
> anything.
>
Florian Fainelli Dec. 27, 2016, 8:15 p.m. UTC | #7
(please stop top-posting).

On 12/27/2016 12:07 PM, Christian Schoenebeck wrote:
> In general that's right, but disabling all postinst(-pkg) and prerm(-pkg) is more than awful.
> If base-files not selected you should nevertheless call postinst-/prerm-pkg.

To what purpose is that helpful? base-files is deselected, not much is
going to work anyway.

What do you suggest as a change we make to keep builds working even if
base-files is deselected and satisfy running scripts at the same time?

> Otherwise their is no real chance to work without base-files whatever you do in package Makefile.
> 
> Am 27.12.2016 um 21:00 schrieb Florian Fainelli:
>> base-files can be deselected (and it should remain that way), in which
>> case you cannot complete an OpenWrt build because we stop with the
>> errors mentioned below, fixing that alone has value IMHO.
>>
>> It seems reasonable to expect that nothing in your system that relies on
>> base-files can be working, the use case for a system without base-files
>> can be: a) replacement of the full OpenWrt/LEDE user-space with
>> something custom, b) build testing/combination coverage (how this was
>> caught here), c) minimal system getting you to a prompt without starting
>> anything.
>>
Christian Schoenebeck Dec. 27, 2016, 10:13 p.m. UTC | #8
Am 27.12.2016 um 21:15 schrieb Florian Fainelli:
> 
> On 12/27/2016 12:07 PM, Christian Schoenebeck wrote:
>> In general that's right, but disabling all postinst(-pkg) and prerm(-pkg) is more than awful.
>> If base-files not selected you should nevertheless call postinst-/prerm-pkg.
> 
> To what purpose is that helpful? base-files is deselected, not much is
> going to work anyway.
> 
> What do you suggest as a change we make to keep builds working even if
> base-files is deselected and satisfy running scripts at the same time?
> 

If it's not planned to disable base-files then it should be a NOT de-selectable package.
So the whole build should depend on base-files i.e. as part of PKG_DEFAULT_DEPENDS or similar or as a "hidden" package.
But never suppress error messages.
In my opinion OpenWRT/LEDE needs base-files otherwise the build system became inconsistent.

If it's really planned to still allow to disable base-files then I do not see any reason why my pull request at
https://github.com/lede-project/source/pull/618 was disagreed because it might produce inconsistency.
During build it should already help to disable default_postinst/_prerm and dependency of /lib/functions.sh
So you can disable base-files without errors during install but still running postinst-/prerm-pkg.

I don't know if this pull/option helps in your use cases.

>> Otherwise their is no real chance to work without base-files whatever you do in package Makefile.
>>
>> Am 27.12.2016 um 21:00 schrieb Florian Fainelli:
>>> base-files can be deselected (and it should remain that way), in which
>>> case you cannot complete an OpenWrt build because we stop with the
>>> errors mentioned below, fixing that alone has value IMHO.
>>>
>>> It seems reasonable to expect that nothing in your system that relies on
>>> base-files can be working, the use case for a system without base-files
>>> can be: a) replacement of the full OpenWrt/LEDE user-space with
>>> something custom, b) build testing/combination coverage (how this was
>>> caught here), c) minimal system getting you to a prompt without starting
>>> anything.
>>>
> 
>
Florian Fainelli Dec. 27, 2016, 10:45 p.m. UTC | #9
On 12/27/2016 02:13 PM, Christian Schoenebeck wrote:
> Am 27.12.2016 um 21:15 schrieb Florian Fainelli:
>>
>> On 12/27/2016 12:07 PM, Christian Schoenebeck wrote:
>>> In general that's right, but disabling all postinst(-pkg) and prerm(-pkg) is more than awful.
>>> If base-files not selected you should nevertheless call postinst-/prerm-pkg.
>>
>> To what purpose is that helpful? base-files is deselected, not much is
>> going to work anyway.
>>
>> What do you suggest as a change we make to keep builds working even if
>> base-files is deselected and satisfy running scripts at the same time?
>>
> 
> If it's not planned to disable base-files then it should be a NOT de-selectable package.
> So the whole build should depend on base-files i.e. as part of PKG_DEFAULT_DEPENDS or similar or as a "hidden" package.
> But never suppress error messages.

This is not a great idea IMHO, the default should of course include
base-files, but it should be possible (for the reasons outlined before)
to not have base-files selected all, yet benefit from OpenWrt to have
built you a toolchain, kernel, applications, etc. you might not just
want the whole Linux distribution from it for a specific test.

> In my opinion OpenWRT/LEDE needs base-files otherwise the build system became inconsistent.

It's not the build system per-se that becomes inconsistent, it's the
user experience as a consequence of utilizing packages that becomes such.

> 
> If it's really planned to still allow to disable base-files then I do not see any reason why my pull request at
> https://github.com/lede-project/source/pull/618 was disagreed because it might produce inconsistency.
> During build it should already help to disable default_postinst/_prerm and dependency of /lib/functions.sh
> So you can disable base-files without errors during install but still running postinst-/prerm-pkg.

I don't disagree with what you are saying, and I don't think your
changes are irrelevant nor anything, but I am trying to fix a build
error that I met while purposely disabling base-files, whereas your goal
is entirely different it seems.

Anyway, I don't have energy to argue about whether this patch should be
accepted or not, so it can rejected, all I ask is to have patchwork and
the git repository be in sync about the decision being made...


> 
> I don't know if this pull/option helps in your use cases.
> 
>>> Otherwise their is no real chance to work without base-files whatever you do in package Makefile.
>>>
>>> Am 27.12.2016 um 21:00 schrieb Florian Fainelli:
>>>> base-files can be deselected (and it should remain that way), in which
>>>> case you cannot complete an OpenWrt build because we stop with the
>>>> errors mentioned below, fixing that alone has value IMHO.
>>>>
>>>> It seems reasonable to expect that nothing in your system that relies on
>>>> base-files can be working, the use case for a system without base-files
>>>> can be: a) replacement of the full OpenWrt/LEDE user-space with
>>>> something custom, b) build testing/combination coverage (how this was
>>>> caught here), c) minimal system getting you to a prompt without starting
>>>> anything.
>>>>
>>
>>
Jo-Philipp Wich Jan. 2, 2017, 10:21 a.m. UTC | #10
Hi Florian,

ACK from me on this one. I think it makes sense.

~ Jo
diff mbox

Patch

diff --git a/include/package-ipkg.mk b/include/package-ipkg.mk
index afd2d4ef7a21..a8871ec71620 100644
--- a/include/package-ipkg.mk
+++ b/include/package-ipkg.mk
@@ -200,11 +200,13 @@  $(_endef)
 		( \
 			echo "#!/bin/sh"; \
 			echo "[ \"\$$$${IPKG_NO_SCRIPT}\" = \"1\" ] && exit 0"; \
+			echo "[ -x "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
 			echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
 			echo "default_postinst \$$$$0 \$$$$@"; \
 		) > postinst; \
 		( \
 			echo "#!/bin/sh"; \
+			echo "[ -x "\$$$${IPKG_INSTROOT}/lib/functions.sh" ] || exit 0"; \
 			echo ". \$$$${IPKG_INSTROOT}/lib/functions.sh"; \
 			echo "default_prerm \$$$$0 \$$$$@"; \
 		) > prerm; \