Merge branch 'org.openembedded.dev' of git://git.openembedded.net/openembedded into...
[vuplus_openembedded] / classes / packaged-staging.bbclass
index 5de5970..bd7b9ea 100644 (file)
 # 
 PSTAGE_PKGVERSION = "${PV}-${PR}"
 PSTAGE_PKGARCH    = "${BUILD_SYS}"
-PSTAGE_EXTRAPATH  ?= ""
+PSTAGE_EXTRAPATH  ?= "/${OELAYOUT_ABI}/${DISTRO_PR}/"
 PSTAGE_PKGPATH    = "${DISTRO}${PSTAGE_EXTRAPATH}"
 PSTAGE_PKGPN      = "${@bb.data.expand('staging-${PN}-${MULTIMACH_ARCH}${TARGET_VENDOR}-${TARGET_OS}', d).replace('_', '-')}"
 PSTAGE_PKGNAME    = "${PSTAGE_PKGPN}_${PSTAGE_PKGVERSION}_${PSTAGE_PKGARCH}.ipk"
 PSTAGE_PKG        = "${DEPLOY_DIR_PSTAGE}/${PSTAGE_PKGPATH}/${PSTAGE_PKGNAME}"
 
-# multimachine.bbclass will override this but add a default in case we're not using it
-MULTIMACH_ARCH ?= "${PACKAGE_ARCH}"
-
 PSTAGE_NATIVEDEPENDS = "\
     shasum-native \
     stagemanager-native \
@@ -70,7 +67,7 @@ python () {
         bb.data.setVar("PSTAGING_ACTIVE", "0", d)
 }
 
-DEPLOY_DIR_PSTAGE   = "${DEPLOY_DIR}/pstage"
+DEPLOY_DIR_PSTAGE   ?= "${DEPLOY_DIR}/pstage"
 PSTAGE_MACHCONFIG   = "${DEPLOY_DIR_PSTAGE}/opkg.conf"
 
 PSTAGE_PKGMANAGER = "stage-manager-ipkg"
@@ -112,17 +109,17 @@ def pstage_cleanpackage(pkgname, d):
        pstage_set_pkgmanager(d)
        list_cmd = bb.data.getVar("PSTAGE_LIST_CMD", d, True)
 
-       bb.note("Checking if staging package installed")
+       bb.debug(2, "Checking if staging package installed")
        lf = bb.utils.lockfile(bb.data.expand("${STAGING_DIR}/staging.lock", d))
        ret = os.system("PATH=\"%s\" %s | grep %s" % (path, list_cmd, pkgname))
        if ret == 0:
-               bb.note("Yes. Uninstalling package from staging...")
+               bb.debug(1, "Uninstalling package from staging...")
                removecmd = bb.data.getVar("PSTAGE_REMOVE_CMD", d, 1)
                ret = os.system("PATH=\"%s\" %s %s" % (path, removecmd, pkgname))
                if ret != 0:
                        bb.note("Failure removing staging package")
        else:
-               bb.note("No. Manually removing any installed files")
+               bb.debug(1, "Manually removing any installed files from staging...")
                pstage_manualclean("staging", "STAGING_DIR", d)
                pstage_manualclean("cross", "CROSS_DIR", d)
                pstage_manualclean("deploy", "DEPLOY_DIR", d)
@@ -138,7 +135,7 @@ do_clean_prepend() {
        pstage_cleanpackage(removepkg, d)
 
        stagepkg = bb.data.expand("${PSTAGE_PKG}", d)
-       bb.note("Removing staging package %s" % stagepkg)
+       bb.note("Removing staging package %s" % base_path_out(stagepkg, d))
        os.system('rm -rf ' + stagepkg)
 }
 
@@ -160,7 +157,7 @@ staging_helper () {
        fi
        if [ ! -e ${TMPDIR}${layout_libdir}/ipkg/ ]; then
                cd ${TMPDIR}${layout_libdir}/
-               ln -s opkg/ ipkg
+               ln -sf opkg/ ipkg
        fi
 }
 
@@ -364,6 +361,8 @@ python do_package_stage () {
             ipkpath = bb.data.getVar('DEPLOY_DIR_IPK', d, True).replace(tmpdir, stagepath)
         if bb.data.inherits_class('package_deb', d):
             debpath = bb.data.getVar('DEPLOY_DIR_DEB', d, True).replace(tmpdir, stagepath)
+        if bb.data.inherits_class('package_rpm', d):
+            rpmpath = bb.data.getVar('DEPLOY_DIR_RPM', d, True).replace(tmpdir, stagepath)
 
         for pkg in packages:
             pkgname = bb.data.getVar('PKG_%s' % pkg, d, 1)
@@ -396,6 +395,18 @@ python do_package_stage () {
                     bb.mkdirhier(destpath)
                     bb.copyfile(srcfile, destpath + srcname)
 
+            if bb.data.inherits_class('package_rpm', d):
+               version = bb.data.getVar('PV', d, 1)
+               version = version.replace('-', '+')
+               bb.data.setVar('RPMPV', version, d)
+                srcname = bb.data.expand(pkgname + "-${RPMPV}-" + pr + ".${TARGET_ARCH}.rpm", d)
+                srcfile = bb.data.expand("${DEPLOY_DIR_RPM}/" + arch + "/" + srcname, d)
+                if os.path.exists(srcfile):
+                    destpath = rpmpath + "/" + arch + "/" 
+                    bb.mkdirhier(destpath)
+                    bb.copyfile(srcfile, destpath + srcname)
+
+
     #
     # Handle stamps/ files
     #