Patchwork [1/1] classes/buildhistory: do not save old packagehistory files by default

login
register
mail settings
Submitter Paul Eggleton
Date Dec. 5, 2011, 6:28 p.m.
Message ID <8651be5fb600a2d20acaf3c7b6848f7855bd2b75.1323109431.git.paul.eggleton@linux.intel.com>
Download mbox | patch
Permalink /patch/16165/
State Accepted
Commit fd2581770b8e4c42aa88f244daca58e27e11dff9
Headers show

Comments

Paul Eggleton - Dec. 5, 2011, 6:28 p.m.
Disable storing package history as version named files unless
BUILDHISTORY_KEEP_VERSIONS is set to 1; otherwise the adds of these
files that duplicate what is already in git anyway is just noise in the
git log.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 meta/classes/buildhistory.bbclass |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
Richard Purdie - Dec. 5, 2011, 10:48 p.m.
On Mon, 2011-12-05 at 18:28 +0000, Paul Eggleton wrote:
> Disable storing package history as version named files unless
> BUILDHISTORY_KEEP_VERSIONS is set to 1; otherwise the adds of these
> files that duplicate what is already in git anyway is just noise in the
> git log.
> 
> Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
> ---
>  meta/classes/buildhistory.bbclass |    9 +++++++--
>  1 files changed, 7 insertions(+), 2 deletions(-)

Merged to master, thanks.

Richard

Patch

diff --git a/meta/classes/buildhistory.bbclass b/meta/classes/buildhistory.bbclass
index 1859961..e4534e9 100644
--- a/meta/classes/buildhistory.bbclass
+++ b/meta/classes/buildhistory.bbclass
@@ -258,8 +258,13 @@  def write_latestlink(pkg, pe, pv, pr, d):
 		filedir = os.path.join(pkghistdir, pkg)
 	else:
 		filedir = pkghistdir
-	rm_link(os.path.join(filedir, "latest"))
-	shutil.copy(os.path.join(filedir, "%s:%s-%s" % (pe, pv, pr)), os.path.join(filedir, "latest"))
+	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() {