package.bbclass: Split into two tasks, one which prepares the packages and then packa...
authorRichard Purdie <rpurdie@rpsys.net>
Fri, 20 Oct 2006 16:09:20 +0000 (16:09 +0000)
committerRichard Purdie <rpurdie@rpsys.net>
Fri, 20 Oct 2006 16:09:20 +0000 (16:09 +0000)
classes/base.bbclass
classes/debian.bbclass
classes/package.bbclass
classes/package_ipk.bbclass
classes/package_rpm.bbclass
classes/package_tar.bbclass

index 6c158e9..7022236 100644 (file)
@@ -575,7 +575,7 @@ do_populate_staging[dirs] = "${STAGING_DIR}/${TARGET_SYS}/bin ${STAGING_DIR}/${T
                             ${STAGING_DATADIR} \
                             ${S} ${B}"
 
-addtask populate_staging after do_package
+addtask populate_staging after do_package_write
 
 python do_populate_staging () {
        bb.build.exec_func('do_stage', d)
index 698d917..7ffa6c1 100644 (file)
@@ -8,7 +8,7 @@ BUILD_ALL_DEPS = "1"
 
 # Better expressed as ensure all RDEPENDS package before we package
 # This means we can't have circular RDEPENDS/RRECOMMENDS
-do_package[rdeptask] = "do_package"
+do_package_write[rdeptask] = "do_package"
 
 python debian_package_name_hook () {
        import glob, copy, stat, errno, re
index 1fa65f0..c70f08e 100644 (file)
@@ -458,7 +458,10 @@ python populate_packages () {
                        if found == False:
                                bb.note("%s contains dangling symlink to %s" % (pkg, l))
                bb.data.setVar('RDEPENDS_' + pkg, " " + " ".join(rdepends), d)
+}
+populate_packages[dirs] = "${D}"
 
+python emit_pkgdata() {
        def write_if_exists(f, pkg, var):
                def encode(str):
                        import codecs
@@ -469,17 +472,26 @@ python populate_packages () {
                if val:
                        f.write('%s_%s: %s\n' % (var, pkg, encode(val)))
 
+       packages = bb.data.getVar('PACKAGES', d, 1)
+       if not packages:
+               return
+
        data_file = bb.data.expand("${STAGING_DIR}/pkgdata/${PN}", d)
        f = open(data_file, 'w')
        f.write("PACKAGES: %s\n" % packages)
        f.close()
 
-       for pkg in package_list:
+       for pkg in packages.split():
                subdata_file = bb.data.expand("${STAGING_DIR}/pkgdata/runtime/%s" % pkg, d)
                sf = open(subdata_file, 'w')
                write_if_exists(sf, pkg, 'DESCRIPTION')
                write_if_exists(sf, pkg, 'RDEPENDS')
                write_if_exists(sf, pkg, 'RPROVIDES')
+               write_if_exists(sf, pkg, 'RRECOMMENDS')
+               write_if_exists(sf, pkg, 'RSUGGESTS')
+               write_if_exists(sf, pkg, 'RPROVIDES')
+               write_if_exists(sf, pkg, 'RREPLACES')
+               write_if_exists(sf, pkg, 'RCONFLICTS')
                write_if_exists(sf, pkg, 'PKG')
                write_if_exists(sf, pkg, 'ALLOW_EMPTY')
                write_if_exists(sf, pkg, 'FILES')
@@ -488,9 +500,8 @@ python populate_packages () {
                write_if_exists(sf, pkg, 'pkg_preinst')
                write_if_exists(sf, pkg, 'pkg_prerm')
                sf.close()
-       bb.build.exec_func("read_subpackage_metadata", d)
 }
-populate_packages[dirs] = "${STAGING_DIR}/pkgdata/runtime ${D}"
+emit_pkgdata[dirs] = "${STAGING_DIR}/pkgdata/runtime"
 
 ldconfig_postinst_fragment() {
 if [ x"$D" = "x" ]; then
@@ -791,8 +802,7 @@ python package_depchains() {
                        name = split_depend[0].strip()
                        func(rreclist, name)
 
-               oldrrec = bb.data.getVar('RRECOMMENDS_%s', d) or ''
-               bb.data.setVar('RRECOMMENDS_%s' % pkg, oldrrec + ' '.join(rreclist), d)
+               bb.data.setVar('RRECOMMENDS_%s' % pkg, ' '.join(rreclist), d)
 
        def packaged(pkg, d):
                return os.access(bb.data.expand('${STAGING_DIR}/pkgdata/runtime/%s.packaged' % pkg, d), os.R_OK)
@@ -826,24 +836,42 @@ PACKAGEFUNCS ?= "package_do_split_locales \
                package_do_shlibs \
                package_do_pkgconfig \
                read_shlibdeps \
-               package_depchains"
+               package_depchains \
+               emit_pkgdata"
 
 python package_do_package () {
        for f in (bb.data.getVar('PACKAGEFUNCS', d, 1) or '').split():
                bb.build.exec_func(f, d)
 }
-
-do_package[dirs] = "${D}"
 # shlibs requires any DEPENDS to have already packaged for the *.list files
 do_package[deptask] = "do_package"
-EXPORT_FUNCTIONS do_package
+do_package[dirs] = "${D}"
 addtask package before do_build after do_install
 
+
+
+PACKAGE_WRITE_FUNCS ?= "read_subpackage_metadata"
+
+python package_do_package_write () {
+       for f in (bb.data.getVar('PACKAGE_WRITE_FUNCS', d, 1) or '').split():
+               bb.build.exec_func(f, d)
+}
+do_package_write[dirs] = "${D}"
+addtask package_write before do_build after do_package
+
+
+EXPORT_FUNCTIONS do_package do_package_write
+
+
 #
 # Helper functions for the package writing classes
 #
 
 python package_mapping_rename_hook () {
+       """
+       Rewrite variables to account for package renaming in things
+       like debian.bbclass or manual PKG variable name changes
+       """
        runtime_mapping_rename("RDEPENDS", d)
        runtime_mapping_rename("RRECOMMENDS", d)
        runtime_mapping_rename("RSUGGESTS", d)
index af6d905..47cff1d 100644 (file)
@@ -1,7 +1,7 @@
 inherit package
 DEPENDS_prepend="${@["ipkg-utils-native ", ""][(bb.data.getVar('PACKAGES', d, 1) == '')]}"
 BOOTSTRAP_EXTRA_RDEPENDS += "ipkg-collateral ipkg"
-PACKAGEFUNCS += "do_package_ipk"
+PACKAGE_WRITE_FUNCS += "do_package_ipk"
 
 python package_ipk_fn () {
        from bb import data
index c29ab5f..d5a1c8b 100644 (file)
@@ -2,7 +2,7 @@ inherit package
 inherit rpm_core
 
 RPMBUILD="rpmbuild --short-circuit ${RPMOPTS}"
-PACKAGEFUNCS += "do_package_rpm"
+PACKAGE_WRITE_FUNCS += "do_package_rpm"
 
 python write_specfile() {
        from bb import data, build
index 63e82f7..9217811 100644 (file)
@@ -1,6 +1,6 @@
 inherit package
 
-PACKAGEFUNCS += "do_package_tar"
+PACKAGE_WRITE_FUNCS += "do_package_tar"
 
 python package_tar_fn () {
        import os