summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorMikko Rapeli <mikko.rapeli@bmw.de>2021-04-26 11:27:50 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-04-27 15:22:58 +0100
commit464472d851d3e36334f3f2c39e6f62952eae7326 (patch)
tree442bd73b31bedf9d437231b4ada9f243ff7bdc57 /bitbake
parent2742e7376015a5ef4d84f29cfbd70b9474f2389c (diff)
downloadpoky-464472d851d3e36334f3f2c39e6f62952eae7326.tar.gz
bitbake: bitbake: tests/fetch: remove write protected files too
For some reason several git-annex files in Debian 10 buster are read-only and removing them with "rm -rf" fails. Fixes test failures like: $ bitbake-selftest ... rm: cannot remove '/tmp/tmpwmfn4w64/download/git2/tmp.tmpwmfn4w64.gitsource/annex/objects/f87/4d5/SHA256E-s0--e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/SHA256E-s0--e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855': Permission denied rm: cannot remove '/tmp/tmpwmfn4w64/download/git2/tmp.tmpwmfn4w64.gitsource/annex/objects/f87/4d5/SHA256E-s0--e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855/SHA256E-s0--e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855': Permission denied EE..................................ssss.sssssssssssssss.sssss....................................................................................................... ====================================================================== ERROR: test_shallow_annex (bb.tests.fetch.GitShallowTest) ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/builder/src/base/poky/bitbake/lib/bb/tests/fetch.py", line 1773, in test_shallow_annex fetcher, ud = self.fetch_shallow(uri) File "/home/builder/src/base/poky/bitbake/lib/bb/tests/fetch.py", line 1541, in fetch_shallow bb.utils.remove(ud.clonedir, recurse=True) File "/home/builder/src/base/poky/bitbake/lib/bb/utils.py", line 700, in remove subprocess.check_call(cmd + ['rm', '-rf'] + glob.glob(path)) File "/usr/lib/python3.7/subprocess.py", line 347, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['rm', '-rf', '/tmp/tmpwmfn4w64/download/git2/tmp.tmpwmfn4w64.gitsource']' returned non-zero exit status 1. Also, one "chmod" call was failing since the .git/annex subdirectory doesn't exist so just chmod the whole temporary directory which should cover any directory name differences between different git-annex versions. Fixes tests failing after chmod call: Running 'export PSEUDO_DISABLED=1; unset _PYTHON_SYSCONFIGDATA_NAME; chmod u+w -R /tmp/tmpwmfn4w64/git//.git/annex' in /tmp/tmpwmfn4w64/git/ (Bitbake rev: 14c5f0735947307b9d69c57f7334fefaea7311b3) Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org> (cherry picked from commit 7729ef2983c72867e99fad82d671069ba5cb32b2) Signed-off-by: Anuj Mittal <anuj.mittal@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/tests/fetch.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py
index c156168151..b921a952e4 100644
--- a/bitbake/lib/bb/tests/fetch.py
+++ b/bitbake/lib/bb/tests/fetch.py
@@ -390,6 +390,7 @@ class FetcherTest(unittest.TestCase):
390 if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": 390 if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes":
391 print("Not cleaning up %s. Please remove manually." % self.tempdir) 391 print("Not cleaning up %s. Please remove manually." % self.tempdir)
392 else: 392 else:
393 bb.process.run('chmod u+rw -R %s' % self.tempdir)
393 bb.utils.prunedir(self.tempdir) 394 bb.utils.prunedir(self.tempdir)
394 395
395class MirrorUriTest(FetcherTest): 396class MirrorUriTest(FetcherTest):
@@ -1602,6 +1603,7 @@ class GitShallowTest(FetcherTest):
1602 1603
1603 # fetch and unpack, from the shallow tarball 1604 # fetch and unpack, from the shallow tarball
1604 bb.utils.remove(self.gitdir, recurse=True) 1605 bb.utils.remove(self.gitdir, recurse=True)
1606 bb.process.run('chmod u+w -R "%s"' % ud.clonedir)
1605 bb.utils.remove(ud.clonedir, recurse=True) 1607 bb.utils.remove(ud.clonedir, recurse=True)
1606 bb.utils.remove(ud.clonedir.replace('gitsource', 'gitsubmodule'), recurse=True) 1608 bb.utils.remove(ud.clonedir.replace('gitsource', 'gitsubmodule'), recurse=True)
1607 1609
@@ -1831,7 +1833,7 @@ class GitShallowTest(FetcherTest):
1831 open(os.path.join(self.srcdir, 'c'), 'w').close() 1833 open(os.path.join(self.srcdir, 'c'), 'w').close()
1832 self.git('annex add c', cwd=self.srcdir) 1834 self.git('annex add c', cwd=self.srcdir)
1833 self.git('commit --author "Foo Bar <foo@bar>" -m annex-c -a', cwd=self.srcdir) 1835 self.git('commit --author "Foo Bar <foo@bar>" -m annex-c -a', cwd=self.srcdir)
1834 bb.process.run('chmod u+w -R %s' % os.path.join(self.srcdir, '.git', 'annex')) 1836 bb.process.run('chmod u+w -R %s' % self.srcdir)
1835 1837
1836 uri = 'gitannex://%s;protocol=file;subdir=${S}' % self.srcdir 1838 uri = 'gitannex://%s;protocol=file;subdir=${S}' % self.srcdir
1837 fetcher, ud = self.fetch_shallow(uri) 1839 fetcher, ud = self.fetch_shallow(uri)