summaryrefslogtreecommitdiffstats
path: root/scripts/lib/devtool/standard.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2016-12-13 20:09:38 +1300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-12-14 12:30:49 +0000
commit45adbe370908901d0d2e94b3c4daea821772e2ff (patch)
treeb4f7018bab13b4051618622934f4e2e21f5d71c7 /scripts/lib/devtool/standard.py
parent5942a8dc7c0a7f157e4023201c66c0cf7f91550b (diff)
downloadpoky-45adbe370908901d0d2e94b3c4daea821772e2ff.tar.gz
classes/patch: move in logic to commit for additional tasks
If PATCHTOOL is "git", and PATCH_COMMIT_FUNCTIONS is set to "1", for additional tasks between do_unpack and do_patch, make a git commit. This logic was previously implemented in devtool itself, but it makes more sense for it to be implemented in the patch class since that's where the rest of the logic is for this (or in lib/oe/patch.py). It also makes it possible for this to work with tinfoil2. (From OE-Core rev: f24f59ea1d8bc335ea8576f6a346d0935f4a3548) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/devtool/standard.py')
-rw-r--r--scripts/lib/devtool/standard.py37
1 files changed, 1 insertions, 36 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 87d3f5dc04..06c508c838 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -442,41 +442,6 @@ class BbTaskExecutor(object):
442 self.executed.append(func) 442 self.executed.append(func)
443 443
444 444
445class PatchTaskExecutor(BbTaskExecutor):
446 def __init__(self, rdata):
447 import oe.patch
448 self.check_git = False
449 self.useroptions = []
450 oe.patch.GitApplyTree.gitCommandUserOptions(self.useroptions, d=rdata)
451 super(PatchTaskExecutor, self).__init__(rdata)
452
453 def exec_func(self, func, report):
454 from oe.patch import GitApplyTree
455 srcsubdir = self.rdata.getVar('S', True)
456 haspatches = False
457 if func == 'do_patch':
458 patchdir = os.path.join(srcsubdir, 'patches')
459 if os.path.exists(patchdir):
460 if os.listdir(patchdir):
461 haspatches = True
462 else:
463 os.rmdir(patchdir)
464
465 super(PatchTaskExecutor, self).exec_func(func, report)
466 if self.check_git and os.path.exists(srcsubdir):
467 if func == 'do_patch':
468 if os.path.exists(patchdir):
469 shutil.rmtree(patchdir)
470 if haspatches:
471 stdout, _ = bb.process.run('git status --porcelain patches', cwd=srcsubdir)
472 if stdout:
473 bb.process.run('git checkout patches', cwd=srcsubdir)
474
475 stdout, _ = bb.process.run('git status --porcelain', cwd=srcsubdir)
476 if stdout:
477 bb.process.run('git add .; git %s commit -a -m "Committing changes from %s\n\n%s"' % (' '.join(self.useroptions), func, GitApplyTree.ignore_commit_prefix + ' - from %s' % func), cwd=srcsubdir)
478
479
480def _prep_extract_operation(config, basepath, recipename, tinfoil=None): 445def _prep_extract_operation(config, basepath, recipename, tinfoil=None):
481 """HACK: Ugly workaround for making sure that requirements are met when 446 """HACK: Ugly workaround for making sure that requirements are met when
482 trying to extract a package. Returns the tinfoil instance to be used.""" 447 trying to extract a package. Returns the tinfoil instance to be used."""
@@ -563,7 +528,7 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d):
563 # We don't want to move the source to STAGING_KERNEL_DIR here 528 # We don't want to move the source to STAGING_KERNEL_DIR here
564 crd.setVar('STAGING_KERNEL_DIR', '${S}') 529 crd.setVar('STAGING_KERNEL_DIR', '${S}')
565 530
566 task_executor = PatchTaskExecutor(crd) 531 task_executor = BbTaskExecutor(crd)
567 532
568 crd.setVar('EXTERNALSRC_forcevariable', '') 533 crd.setVar('EXTERNALSRC_forcevariable', '')
569 534