Bug 5395

Summary: Nativesdk postinstalls directory issues.
Product: [Build System, Metadata & Runtime] BitBake Reporter: David Nyström <david.nystrom>
Component: bitbakeAssignee: Richard Purdie <richard.purdie>
Status: NEW --- QA Contact:
Severity: normal    
Priority: Medium CC: david.nystrom, m.gwerder, poky.bs.watcher, poky.watcher, randy.macleod, richard.purdie, sgw
Version: 1.5   
Target Milestone: 6.99   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description David Nyström 2013-10-28 13:30:39 UTC
nativesdk packages can't be used outside of the bitbake/OE environment, since
postinstall paths are hardcoded to SDK NATIVE_SYSROOT.


----------------- nativesdk-shadow_4.1.4.3-r13_x86_64-nativesdk.ipk postinstall -----------------
	if [ "x$D" != "x" ]; then
	  rootarg="--root=$D"
	else
	  rootarg=""
	fi

	pwconv $rootarg
	grpconv $rootarg
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/passwd passwd /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/passwd.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/chfn chfn /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/chfn.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/newgrp newgrp /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/newgrp.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/chsh chsh /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/chsh.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/groups groups /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/bin/groups.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/sbin/chpasswd chpasswd /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/usr/sbin/chpasswd.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/bin/login login /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/bin/login.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/sbin/vipw vipw /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/sbin/vipw.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/sbin/vigr vigr /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/sbin/vigr.shadow 200
	update-alternatives --install /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/bin/su su /opt/poky/1.4+snapshot/sysroots/x86_64-pokysdk-linux/bin/su.shadow 200

----------------- shadow_4.1.4.3-r13_x86_64.ipk postinstall -----------------
        if [ "x$D" != "x" ]; then
          rootarg="--root=$D"
        else
          rootarg=""
        fi

        pwconv $rootarg
        grpconv $rootarg
        update-alternatives --install /usr/bin/passwd passwd /usr/bin/passwd.shadow 200
        update-alternatives --install /usr/bin/chfn chfn /usr/bin/chfn.shadow 200
        update-alternatives --install /usr/bin/newgrp newgrp /usr/bin/newgrp.shadow 200
        update-alternatives --install /usr/bin/chsh chsh /usr/bin/chsh.shadow 200
        update-alternatives --install /usr/bin/groups groups /usr/bin/groups.shadow 200
        update-alternatives --install /usr/sbin/chpasswd chpasswd /usr/sbin/chpasswd.shadow 200
        update-alternatives --install /bin/login login /bin/login.shadow 200
        update-alternatives --install /sbin/vipw vipw /sbin/vipw.shadow 200
        update-alternatives --install /sbin/vigr vigr /sbin/vigr.shadow 200
        update-alternatives --install /bin/su su /bin/su.shadow 200
Comment 1 Richard Purdie 2013-10-31 12:15:34 UTC
The issue is that the relocation code effectively changes the prefix that the packages were built with but this is not reflected in the postinstalls.

If you install into the default location you wouldn't hit this problem. Equally, if you install into a sysroot, then relocate the installation, you also wouldn't run into the issue.

We'll probably have to leave prefix/exec_prefix unexpanded as a parameter in the postinstalls for nativesdk, then have the package manager set this variable at installation time.
Comment 2 mgwerder 2014-04-02 14:42:07 UTC
Maybe related with this:

If the SDK is not installed to the default location, the native sysroot will be relocated during installation.
However, the /var/lib/opkg folder is left where it is and not relocated to the native sysroot. Therefore, the package manager does not work for nativesdk packages.

As a work-around, moving /var/lib/opkg manually into the relocated native sysroot brings package management back to live for the native sysroot.
Comment 3 Randy MacLeod 2023-10-24 14:24:27 UTC
Bulk move from 4.99 or 0.00 to 5.99