[OE-core] [PATCH] Better support for upgrading packages in opkg and update-rc.d.bbclass

Peter Urbanec openembedded-devel at urbanec.net
Wed Oct 22 14:42:12 UTC 2014


Sorry for being slow to respond, I've been snowed under and dealing with 
hardware failures :-(

I'll be brief...

On 17/10/14 07:55, Andreas Oberritter wrote:
> What happens when generating rpm (and since few days deb) packages is
> that code gets injected that makes these scripts exit with return code 0
> on upgrades. This may be just a workaround to emulate opkg's
> limitations, but it may also be by design. I guess this should be
> decided upon first. Whatever we'll agree on, the most important thing is
> that all three supported package formats should behave identically.

I don't think this is a good idea. Consider the case where a package is 
being upgraded and the old package was configured to run in runlevels 3 
and 4. The new package is configured to run in runlevels 2 and 3. You 
need to run the old prerm script so that you correctly remove the script 
from all old runlevels, then you need to run the new postinst script to 
add the script to the correct runlevels. If you prevent prerm from 
running on upgrade, you will never remove the script from runlevel 4.

>>> But, on the other hand, maybe package_rpm.bbclass is wrong... ;-)

I have not studied RPM packaging. Does it use the same scripts and more 
importantly does RPM expect the same install logic? Perhaps it's not 
possible to apply the same logic to all packaging and installation systems.

> I meant to say that if package_ipk wanted to behave like package_rpm
> (and package_deb since a few days), then it would inject '[ "$1" !=
> upgrade ] || exit 0' at the beginning of postrm.

See my two points above. Perhaps one size does not fit all in this case.


>>>> +updatercd_preinst() {
>>>>    updatercd_postrm() {
>>> The two functions above don't do anything, so they should be removed.
>>
>> They are used later by update_rcd_package().
>
> If they are empty, they should be removed from update_rcd_package(),
> too. There are many more places in OE-Core where postinst scripts are
> used, and the common policy is to implement only those snippets which
> are used. Otherwise it's just a waste of space on the target systems.

I guess the logic could be changed so that if the user does not provide 
their own implementation, then nothing is generated. I haven't studied 
the code in depth to establish whether this may have a cascading effect 
down the line. I opted for the option that is less likely to cause 
unintended breakage.

>> The patch I submitted uses the "-s" flag to update-rc.d to start the
>> service when it is installed, but as far as I can tell, there is no way
>> to just stop the service using update-rc.d and the restart case will not
>> work for scripts that don't support the "restart" argument (such as
>> urandom).
>
> Isn't restart required to be implemented by LSB? Maybe we could just fix
> urandom instead. Does urandom even use update-rc.d? I don't know which
> recipe actually installs a urandom init script, to be honest.

I'm not sure what the LSB requirements are, but I did take a quick look 
through a few (random) existing scripts to determine the state of 
affairs and concluded that one can not rely on a "restart" 
implementation. The comments in init-ifupdown/init actually say that 
"restart" is deprecated and should not be used.

>> The restart case is also predicated on a number of conditions
>> that will generally evaluate to false, since the old links would have
>> been removed in prerm.
>
> I don't understand which conditions you're referring to.

It's a bit confusing to follow, but have a look at the part of the code 
that checks the existence of the links in the context of the first point 
I made in this email. If you want to support the upgrade logic properly 
(at least as far as doing things like changing the runlevels), you 
should remove the old links in prerm, which will later cause the code to 
incorrectly assume that this was not an upgrade.

Cheers,
	Peter




More information about the Openembedded-core mailing list