Skip to contentSkip to conversation

1/2] buildhistory.py: Add the ability for generate full and simple output.

PATCH New Aníbal Limón 1 participant 2 messages Jan 13, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 1/2] buildhistory.py: Add the ability for generate full and simple output.

Now buildhistroy generate two diff files,

- buildhistory-diff.txt: Simple diff generated without -a option.
- buildhistory-diff-full.txt: Full diff generated contains all the packages including -dbg and -dev.

---
 modules/buildhistory.py | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
modules/buildhistory.py +10 -4
index d8ca46d..9085233 100644
@@ -61,15 +61,21 @@ class BuildHistory(object):
         rev_initial = self.revs[0]
         rev_final = self.revs[-1]
 
-        cmd = "buildhistory-diff -a -p %s %s %s"  % (self.buildhistory_dir, 
-                rev_initial, rev_final)
-
         try:
+            cmd = "buildhistory-diff -p %s %s %s"  % (self.buildhistory_dir, 
+                rev_initial, rev_final)
             stdout, stderr = bb.process.run(cmd)
-
             if stdout and os.path.exists(self.workdir):
                 with open(os.path.join(self.workdir, "buildhistory-diff.txt"),
                         "w+") as log:
                     log.write(stdout)
+
+            cmd_full = "buildhistory-diff -a -p %s %s %s"  % (self.buildhistory_dir, 
+                        rev_initial, rev_final)
+            stdout, stderr = bb.process.run(cmd_full)
+            if stdout and os.path.exists(self.workdir):
+                with open(os.path.join(self.workdir, "buildhistory-diff-full.txt"),
+                        "w+") as log:
+                    log.write(stdout)
         except bb.process.ExecutionError as e:
             W( "%s: Buildhistory checking fails\n%s" % (self.pn, e.stdout))
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/1 2/2] steps.py: Adds {pack, unpack}_original_workdir.

The original workdir directory is needed for make diff's for example when license change [1], in order to avoid deletion of original workdir when recipe is upgraded.

[1] https://lists.yoctoproject.org/pipermail/yocto/2016-January/028025.html

---
 modules/steps.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
modules/steps.py +25 -0
index 2685b80..0c527a4 100644
@@ -20,6 +20,7 @@
 
 import os
 import sys
+import subprocess
 
 from logging import debug as D
 from logging import info as I
@@ -99,6 +100,19 @@ def buildhistory_init(bb, git, opts, pkg_ctx):
 def unpack_original(bb, git, opts, pkg_ctx):
     pkg_ctx['recipe'].unpack()
 
+def pack_original_workdir(bb, git, opts, pkg_ctx):
+    recipe_workdir = os.path.dirname(pkg_ctx['env']['S'])
+    pkg_ctx['recipe_workdir_tarball'] = os.path.join(pkg_ctx['workdir'],
+            'original_workdir.tar.gz')
+
+    try:
+        subprocess.call(["tar", "-chzf", pkg_ctx['recipe_workdir_tarball'],
+                         recipe_workdir], stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE)
+    except:
+        W(" %s, Can't compress original workdir, if license diff" \
+          " is needed will show full file." % pkg_ctx['PN'])
+
 def rename(bb, git, opts, pkg_ctx):
     pkg_ctx['recipe'].rename()
 
@@ -112,6 +126,15 @@ def cleanall(bb, git, opts, pkg_ctx):
 def fetch(bb, git, opts, pkg_ctx):
     pkg_ctx['recipe'].fetch()
 
+def unpack_original_workdir(bb, git, opts, pkg_ctx):
+    try:
+        subprocess.call(["tar", "-xhzf", pkg_ctx['recipe_workdir_tarball'],
+                         "-C", "/"], stdout=subprocess.PIPE,
+                         stderr=subprocess.PIPE)
+        os.unlink(pkg_ctx['recipe_workdir_tarball'])
+    except:
+        pass
+
 def compile(bb, git, opts, pkg_ctx):
     if opts['skip_compilation']:
         W(" %s: Compilation was skipped by user choice!")
@@ -136,9 +159,11 @@ upgrade_steps = [
     (detect_recipe_type, None),
     (buildhistory_init, None),
     (unpack_original, "Fetch & unpack original version ..."),
+    (pack_original_workdir, None),
     (rename, "Renaming recipes, reset PR (if exists) ..."),
     (cleanall, "Clean all ..."),
     (fetch, "Fetch new version (old checksums) ..."),
+    (unpack_original_workdir, None),
     (compile, None),
     (buildhistory_diff, None)
 ]
Signature · 1 line
2.1.4