[oe-commits] Paul Eggleton : classes/buildhistory: remove obsolete flat package history feature

git at git.openembedded.org git at git.openembedded.org
Mon Aug 6 14:33:51 UTC 2012


Module: openembedded-core.git
Branch: master
Commit: ccedfd250620fc562988ba730ad5717b107a9d3e
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=ccedfd250620fc562988ba730ad5717b107a9d3e

Author: Paul Eggleton <paul.eggleton at linux.intel.com>
Date:   Thu Aug  2 10:23:01 2012 +0100

classes/buildhistory: remove obsolete flat package history feature

Remove the ability to set BUILDHISTORY_KEEP_VERSIONS = "1" to save the
package history as flat versioned files rather than relying on git to
keep previous versions of the package information. git has proven to
work quite well in this capacity.

Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>

---

 meta/classes/buildhistory.bbclass |   43 +++++++------------------------------
 1 files changed, 8 insertions(+), 35 deletions(-)

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index ddb76e8..f5494cd 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -156,7 +156,6 @@ python buildhistory_emit_pkghistory() {
     rcpinfo.depends = sortlist(squashspaces(d.getVar('DEPENDS', True) or ""))
     rcpinfo.packages = packages
     write_recipehistory(rcpinfo, d)
-    write_latestlink(None, pe, pv, pr, d)
 
     # Apparently the version can be different on a per-package basis (see Python)
     pkgdest = d.getVar('PKGDEST', True)
@@ -199,8 +198,6 @@ python buildhistory_emit_pkghistory() {
         pkginfo.filelist = " ".join(filelist)
 
         write_pkghistory(pkginfo, d)
-
-        write_latestlink(pkg, pe, pv, pr, d)
 }
 
 
@@ -212,8 +209,8 @@ def write_recipehistory(rcpinfo, d):
     if not os.path.exists(pkghistdir):
         os.makedirs(pkghistdir)
 
-    verfile = os.path.join(pkghistdir, "%s:%s-%s" % (rcpinfo.pe, rcpinfo.pv, rcpinfo.pr))
-    f = open(verfile, "w")
+    infofile = os.path.join(pkghistdir, "latest")
+    f = open(infofile, "w")
     try:
         if rcpinfo.pe != "0":
             f.write("PE = %s\n" %  rcpinfo.pe)
@@ -226,16 +223,16 @@ def write_recipehistory(rcpinfo, d):
 
 
 def write_pkghistory(pkginfo, d):
-    bb.debug(2, "Writing package history")
+    bb.debug(2, "Writing package history for package %s" % pkginfo.name)
 
     pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
 
-    verpath = os.path.join(pkghistdir, pkginfo.name)
-    if not os.path.exists(verpath):
-        os.makedirs(verpath)
+    pkgpath = os.path.join(pkghistdir, pkginfo.name)
+    if not os.path.exists(pkgpath):
+        os.makedirs(pkgpath)
 
-    verfile = os.path.join(verpath, "%s:%s-%s" % (pkginfo.pe, pkginfo.pv, pkginfo.pr))
-    f = open(verfile, "w")
+    infofile = os.path.join(pkgpath, "latest")
+    f = open(infofile, "w")
     try:
         if pkginfo.pe != "0":
             f.write("PE = %s\n" %  pkginfo.pe)
@@ -250,30 +247,6 @@ def write_pkghistory(pkginfo, d):
         f.close()
 
 
-def write_latestlink(pkg, pe, pv, pr, d):
-    import shutil
-
-    pkghistdir = d.getVar('BUILDHISTORY_DIR_PACKAGE', True)
-
-    def rm_link(path):
-        try:
-            os.unlink(path)
-        except OSError:
-            return
-
-    if pkg:
-        filedir = os.path.join(pkghistdir, pkg)
-    else:
-        filedir = pkghistdir
-    latest_file = os.path.join(filedir, "latest")
-    ver_file = os.path.join(filedir, "%s:%s-%s" % (pe, pv, pr))
-    rm_link(latest_file)
-    if d.getVar('BUILDHISTORY_KEEP_VERSIONS', True) == '1':
-        shutil.copy(ver_file, latest_file)
-    else:
-        shutil.move(ver_file, latest_file)
-
-
 buildhistory_get_image_installed() {
 	# Anything requiring the use of the packaging system should be done in here
 	# in case the packaging files are going to be removed for this image





More information about the Openembedded-commits mailing list