diff options
author | Mikko Rapeli <mikko.rapeli@bmw.de> | 2021-05-10 04:15:17 -1000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2021-05-13 13:12:00 +0100 |
commit | 7cfa913ca1e1ac332cbccf7e9ac1bba372c58b3d (patch) | |
tree | 6db3a32e7562875bf35b98e544268a247ad81c2a /bitbake | |
parent | ea63f713b3def2f3fa5da83ee39794fed3b2366c (diff) | |
download | poky-7cfa913ca1e1ac332cbccf7e9ac1bba372c58b3d.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: 1fae1c812138f35c35ea4c0586e21f022524c5f1)
Signed-off-by: Mikko Rapeli <mikko.rapeli@bmw.de>
Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/tests/fetch.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/bitbake/lib/bb/tests/fetch.py b/bitbake/lib/bb/tests/fetch.py index 9a4f5f11e2..6300f563f2 100644 --- a/bitbake/lib/bb/tests/fetch.py +++ b/bitbake/lib/bb/tests/fetch.py | |||
@@ -371,6 +371,7 @@ class FetcherTest(unittest.TestCase): | |||
371 | if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": | 371 | if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": |
372 | print("Not cleaning up %s. Please remove manually." % self.tempdir) | 372 | print("Not cleaning up %s. Please remove manually." % self.tempdir) |
373 | else: | 373 | else: |
374 | bb.process.run('chmod u+rw -R %s' % self.tempdir) | ||
374 | bb.utils.prunedir(self.tempdir) | 375 | bb.utils.prunedir(self.tempdir) |
375 | 376 | ||
376 | class MirrorUriTest(FetcherTest): | 377 | class MirrorUriTest(FetcherTest): |
@@ -1538,6 +1539,7 @@ class GitShallowTest(FetcherTest): | |||
1538 | 1539 | ||
1539 | # fetch and unpack, from the shallow tarball | 1540 | # fetch and unpack, from the shallow tarball |
1540 | bb.utils.remove(self.gitdir, recurse=True) | 1541 | bb.utils.remove(self.gitdir, recurse=True) |
1542 | bb.process.run('chmod u+w -R "%s"' % ud.clonedir) | ||
1541 | bb.utils.remove(ud.clonedir, recurse=True) | 1543 | bb.utils.remove(ud.clonedir, recurse=True) |
1542 | bb.utils.remove(ud.clonedir.replace('gitsource', 'gitsubmodule'), recurse=True) | 1544 | bb.utils.remove(ud.clonedir.replace('gitsource', 'gitsubmodule'), recurse=True) |
1543 | 1545 | ||
@@ -1767,7 +1769,7 @@ class GitShallowTest(FetcherTest): | |||
1767 | open(os.path.join(self.srcdir, 'c'), 'w').close() | 1769 | open(os.path.join(self.srcdir, 'c'), 'w').close() |
1768 | self.git('annex add c', cwd=self.srcdir) | 1770 | self.git('annex add c', cwd=self.srcdir) |
1769 | self.git('commit --author "Foo Bar <foo@bar>" -m annex-c -a', cwd=self.srcdir) | 1771 | self.git('commit --author "Foo Bar <foo@bar>" -m annex-c -a', cwd=self.srcdir) |
1770 | bb.process.run('chmod u+w -R %s' % os.path.join(self.srcdir, '.git', 'annex')) | 1772 | bb.process.run('chmod u+w -R %s' % self.srcdir) |
1771 | 1773 | ||
1772 | uri = 'gitannex://%s;protocol=file;subdir=${S}' % self.srcdir | 1774 | uri = 'gitannex://%s;protocol=file;subdir=${S}' % self.srcdir |
1773 | fetcher, ud = self.fetch_shallow(uri) | 1775 | fetcher, ud = self.fetch_shallow(uri) |