@@ -4,7 +4,6 @@
import oe.path
import oe.types
-import subprocess
class NotFoundError(bb.BBHandledException):
def __init__(self, path):
@@ -26,6 +25,7 @@ class CmdError(bb.BBHandledException):
def runcmd(args, dir = None):
import pipes
+ import subprocess
if dir:
olddir = os.path.abspath(os.curdir)
@@ -56,7 +56,6 @@ def runcmd(args, dir = None):
if dir:
os.chdir(olddir)
-
class PatchError(Exception):
def __init__(self, msg):
self.msg = msg
@@ -299,19 +298,6 @@ class GitApplyTree(PatchTree):
PatchTree.__init__(self, dir, d)
self.commituser = d.getVar('PATCH_GIT_USER_NAME')
self.commitemail = d.getVar('PATCH_GIT_USER_EMAIL')
- if not self._isInitialized():
- self._initRepo()
-
- def _isInitialized(self):
- cmd = "git rev-parse --show-toplevel"
- (status, output) = subprocess.getstatusoutput(cmd.split())
- ## Make sure repo is in builddir to not break top-level git repos
- return status == 0 and os.path.samedir(output, self.dir)
-
- def _initRepo(self):
- runcmd("git init".split(), self.dir)
- runcmd("git add .".split(), self.dir)
- runcmd("git commit -a --allow-empty -m Patching_started".split(), self.dir)
@staticmethod
def extractPatchHeader(patchfile):
@@ -298,21 +298,6 @@ INHERIT:remove = \"report-error\"
test_recipe_summary_after = get_bb_var('SUMMARY', test_recipe)
self.assertEqual(expected_recipe_summary, test_recipe_summary_after)
- def test_git_patchtool(self):
- """ PATCHTOOL=git should work with non-git sources like tarballs
- test recipe for the test must NOT containt git:// repository in SRC_URI
- """
- test_recipe = "man-db"
- self.write_recipeinc(test_recipe, 'PATCHTOOL=\"git\"')
- src = get_bb_var("SRC_URI",test_recipe)
- gitscm = re.search("git://", src)
- self.assertFalse(gitscm, "test_git_patchtool pre-condition failed: {} test recipe contains git repo!".format(test_recipe))
- result = bitbake('man-db -c patch', ignore_status=False)
- fatal = re.search("fatal: not a git repository (or any of the parent directories)", result.output)
- self.assertFalse(fatal, "Failed to patch using PATCHTOOL=\"git\"")
- self.delete_recipeinc(test_recipe)
- bitbake('-cclean man-db')
-
def test_git_unpack_nonetwork(self):
"""
Test that a recipe with a floating tag that needs to be resolved upstream doesn't
This reverts commit 6184b56a7a0fc6f5d19fdfb81e7453667f7da940. The above commit breaks building of recipes where sources are checked out from Git and PATCHTOOL = "git". The do_patch tasks fails before applying the first patch without any helpful error messages. GitApplyTree::_isInitialized(): + cmd = "git rev-parse --show-toplevel" + (status, output) = subprocess.getstatusoutput(cmd.split()) The cmd.split() expression effectively runs GIT without any arguments. Using `subprocess.getstatusoutput(cmd)` seems to work. + ## Make sure repo is in builddir to not break top-level git repos + return status == 0 and os.path.samedir(output, self.dir) Exception: AttributeError: module 'posixpath' has no attribute 'samedir' GitApplyTree::_initRepo(): + runcmd("git init".split(), self.dir) + runcmd("git add .".split(), self.dir) + runcmd("git commit -a --allow-empty -m Patching_started".split(), self.dir) If _isInitialized() returned false although there is actually an initialized GIT repo, the last command fails with 128. Signed-off-by: Christian Eggers <ceggers@arri.de> --- The "git commit" command fails only on my CI machine but not on my dev system (couldn't figure out why). This means that on both systems the existing GIT respository is erroneously reinitialized, but on the CI this breaks the build while on the dev machine the error is not noticeable. meta/lib/oe/patch.py | 16 +--------------- meta/lib/oeqa/selftest/cases/bbtests.py | 15 --------------- 2 files changed, 1 insertion(+), 30 deletions(-)