buildhistory: simplify the handling of
PATCH 1/1 buildhistory: simplify the handling of
The module was doing a lot of things, none of which are necessary:
- setting up a separate buildhistory repo for each recipe
- running cleansstate before doing initial build
- messing about with buildhisory revisions
Instead just run buildhistory-diff on the defaults right after building the first target. This should also address the various buildhistory problems seen on the AB.
Signed-off-by Alexander Kanavin <[email protected]>
--- modules/buildhistory.py | 25 ++----------------------- modules/steps.py | 13 +++---------- 2 files changed, 5 insertions(+), 33 deletions(-)
modules/buildhistory.py +2 -23
@@ -37,42 +37,21 @@ class BuildHistory(object): self.bb = bb self.pn = pn self.workdir = workdir - self.revs = [] - - self.buildhistory_dir = os.path.join(self.workdir, 'buildhistory') - if not os.path.exists(self.buildhistory_dir): - os.mkdir(self.buildhistory_dir) - - self.git = Git(self.buildhistory_dir) - - os.environ['BB_ENV_EXTRAWHITE'] = os.environ['BB_ENV_EXTRAWHITE'] + \ - " BUILDHISTORY_DIR" - os.environ["BUILDHISTORY_DIR"] = self.buildhistory_dir def init(self, machines): - self.bb.cleansstate(self.pn) for machine in machines: self.bb.complete(self.pn, machine) - self.revs.append(self.git.last_commit("master")) - - def add(self): - self.revs.append(self.git.last_commit("master")) def diff(self): - rev_initial = self.revs[0] - rev_final = self.revs[-1] - try: - cmd = "buildhistory-diff -p %s %s %s" % (self.buildhistory_dir, - rev_initial, rev_final) + cmd = "buildhistory-diff" 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) + cmd_full = "buildhistory-diff -a" 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"),
modules/steps.py +3 -10
@@ -126,15 +126,9 @@ def compile(devtool, bb, git, opts, pkg_ctx): for machine in opts['machines']: I(" %s: compiling upgraded version for %s ..." % (pkg_ctx['PN'], machine)) _compile(bb, pkg_ctx['PN'], machine, pkg_ctx['workdir']) - if opts['buildhistory']: - pkg_ctx['buildhistory'].add() - -def buildhistory_diff(devtool, bb, git, opts, pkg_ctx): - if not opts['buildhistory']: - return - - I(" %s: Checking buildhistory ..." % pkg_ctx['PN']) - pkg_ctx['buildhistory'].diff() + if opts['buildhistory'] and machine == opts['machines'][0]: + I(" %s: Checking buildhistory ..." % pkg_ctx['PN']) + pkg_ctx['buildhistory'].diff() def _rm_source_tree(devtool_output): for line in devtool_output.split("\n"):
@@ -161,5 +155,4 @@ upgrade_steps = [ (devtool_upgrade, "Running 'devtool upgrade' ..."), (devtool_finish, "Running 'devtool finish' ..."), (compile, None), - (buildhistory_diff, None), ]
Signature · 1 line
2.28.0