classes/package*.bbclass: Remove the build_package_revision function
authorRichard Purdie <rpurdie@linux.intel.com>
Mon, 27 Oct 2008 19:00:27 +0000 (19:00 +0000)
committerRichard Purdie <rpurdie@linux.intel.com>
Mon, 27 Oct 2008 19:28:26 +0000 (19:28 +0000)
Based on experience, this function is going to cause massive code readability
issues. We can actually clean up the code more without it so do this instead.

classes/package.bbclass
classes/package_deb.bbclass
classes/package_ipk.bbclass
classes/package_rpm.bbclass
classes/package_tar.bbclass

index 1dc26fd..4dfd5f0 100644 (file)
@@ -4,13 +4,6 @@
 
 PKGDEST = "${WORKDIR}/install"
 
-def build_package_revision(d):
-       import bb
-       file_pr = bb.data.getVar('PR', d, True)
-       distro_pr = bb.data.getVar('DISTRO_PR', d, True) or ""
-       return "%s%s" % (file_pr, distro_pr)
-
-
 def legitimize_package_name(s):
        """
        Make sure package names are legitimate strings
index 64d8d4e..6d4abaf 100644 (file)
@@ -131,7 +131,7 @@ python do_package_deb () {
             pass
         if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
             from bb import note
-            note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), build_package_revision(localdata)))
+            note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', localdata, True)))
             bb.utils.unlockfile(lf)
             continue
 
index e0636ee..29ee327 100644 (file)
@@ -178,7 +178,7 @@ python do_package_ipk () {
                        pass
                if not g and bb.data.getVar('ALLOW_EMPTY', localdata) != "1":
                        from bb import note
-                       note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), build_package_revision(localdata)))
+                       note("Not creating empty archive for %s-%s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', localdata, True)))
                        bb.utils.unlockfile(lf)
                        continue
 
index e10ad90..f0055a1 100644 (file)
@@ -40,7 +40,7 @@ python write_specfile() {
                        pass
        if not files:
                from bb import note
-               note("Not creating empty archive for %s-%s-%s" % (bb.data.getVar('PKG',d, 1), bb.data.getVar('PV', d, 1), build_package_revision(d)))
+               note("Not creating empty archive for %s" % (bb.data.expand('${PKG}-${PV}-${PR}${DISTRO_PR}', d, True))
                return
 
        # output .spec using this metadata store
@@ -57,7 +57,7 @@ python write_specfile() {
                if out_vartranslate[var][0] == "%":
                        continue
                fd.write("%s\t: %s\n" % (out_vartranslate[var], bb.data.getVar(var, d)))
-        fd.write("Release\t: %s\n" % build_package_revision(d))
+        fd.write("Release\t: %s\n" % bb.data.expand('${PR}${DISTRO_PR}', d, True)
        fd.write("Summary\t: .\n")
 
        for var in out_vartranslate.keys():
index 9ce0c98..e5d3f74 100644 (file)
@@ -5,8 +5,7 @@ IMAGE_PKGTYPE ?= "tar"
 python package_tar_fn () {
        import os
        from bb import data
-       fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d), "%s-%s-%s.tar.gz" % (bb.data.getVar('PKG', d), bb.data.getVar('PV', d), build_package_revision(d)))
-       fn = bb.data.expand(fn, d)
+       fn = os.path.join(bb.data.getVar('DEPLOY_DIR_TAR', d, True), bb.data.expand('${PKG}-${PV}-${PR}${DISTRO_PR}.tar.gz', d, True))
        bb.data.setVar('PKGFN', fn, d)
 }
 
@@ -86,7 +85,7 @@ python do_package_tar () {
                os.chdir(root)
                from glob import glob
                if not glob('*'):
-                       bb.note("Not creating empty archive for %s-%s-%s" % (pkg, bb.data.getVar('PV', localdata, 1), build_package_revision(localdata)))
+                       bb.note("Not creating empty archive for %s" % (pkg, bb.data.expand('${PV}-${PR}${DISTRO_PR}', d, True)))
                        continue
                ret = os.system("tar -czf %s %s" % (tarfn, '.'))
                if ret != 0: