Bug 9863

Summary: Changing files in packages-split with populate_packages_prepend does not impact rpm packages, while it does for deb and ipk
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Diego <diego.ml>
Component: Scripts and ToolsAssignee: Ed Bartosh <eduard.bartosh>
Status: RESOLVED NOTABUG QA Contact:
Severity: normal    
Priority: Medium+ CC: jose.perez.carranza, richard.purdie, ross.burton, sgw
Version: unspecified   
Target Milestone: 2.2 M3   
Hardware: All   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Diego 2016-07-01 09:16:59 UTC
The reference thread is:
https://lists.yoctoproject.org/pipermail/yocto/2016-May/030351.html

How to trigger the issue is detailed here:
https://lists.yoctoproject.org/pipermail/yocto/2016-June/030375.html
and the problem is discussed here:
https://lists.yoctoproject.org/pipermail/yocto/2016-June/030395.html
https://lists.yoctoproject.org/pipermail/yocto/2016-June/030400.html

With my tests I confirm that the rpm package is unchanged, not respecting what is under packages-split, while both deb and ipk packages are correct.

To have an example that reproduces this problem create a base-files_%.bbappend with the following contents:
FILESEXTRAPATHS_append := "${THISDIR}/${PN}"

SRC_URI += "file://fstab-flash \
        file://fstab-regular \
        "

PACKAGES += " ${PN}-flash ${PN}-regular"
CONFFILES_${PN}-flash = "${CONFFILES_${PN}}"
CONFFILES_${PN}-regular = "${CONFFILES_${PN}}"

pkg_preinst_${PN}-flash = "${pkg_preinst_${PN}}"
pkg_preinst_${PN}-regular = "${pkg_preinst_${PN}}"

RREPLACES_${PN}-flash = "${PN}"
RPROVIDES_${PN}-flash = "${PN}"
RCONFLICTS_${PN}-flash = "${PN}"

RREPLACES_${PN}-regular = "${PN}"
RPROVIDES_${PN}-regular = "${PN}"
RCONFLICTS_${PN}-regular = "${PN}"

python populate_packages_prepend() {
    import shutil

    packages = ("${PN}-flash", "${PN}-regular")
    for package in packages:
        # copy ${PN} content to packages
        shutil.copytree("${PKGD}", "${PKGDEST}/%s" % package, symlinks=True)
        # replace fstab
        if package == "${PN}-flash":
            shutil.copy("${WORKDIR}/fstab-flash",
"${PKGDEST}/${PN}-flash/etc/fstab")
        else:
            shutil.copy("${WORKDIR}/fstab-regular",
"${PKGDEST}/${PN}-regular/etc/fstab")
}

and provide 2 different "fstab-regular" and "fstab-flash".
Comment 1 Richard Purdie 2016-07-28 12:46:21 UTC
I know Ed has looked into this. The issue is that deb/ipk use the packages-split directories in a particular way whilst rpm uses the packages-split directory to indicate how to split the packages but pulls the files from packages/, due to the way rpmbuild works.

The trouble is your code is breaking some of the assumptions that the packaging code makes.

The system doesn't support a few things:

a) You can't put the same file into multiple packages. If two packages need it, they should have some kind of dependency relationship on a separate package which contains that file or files.
b) You shouldn't bypass PACKAGES and FILES_<pkg>, these are used to build the different packages and used for a variety of checks. Effectively by copying files in populate_packages you're bypassing this. This isn't supported.
c) One recipe can't install different files into the same location. You need to use separate recipes for that.

So you really need to use a different approach to achieve this, sorry.