forked from pool/python-dulwich
Accepting request 998217 from home:mcepl:branches:devel:tools:scm
- Add rmtree-ignore-errors.patch to make shutil.rmtree to be more callous (gh#jelmer/dulwich#1000) and prevent thus the race condition in cleaning up after the tests. OBS-URL: https://build.opensuse.org/request/show/998217 OBS-URL: https://build.opensuse.org/package/show/devel:tools:scm/python-dulwich?expand=0&rev=10
This commit is contained in:
parent
950338bfc7
commit
8a3e73d5b7
@ -1,3 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 19 16:17:05 UTC 2022 - Matej Cepl <mcepl@suse.com>
|
||||
|
||||
- Add rmtree-ignore-errors.patch to make shutil.rmtree to be more
|
||||
callous (gh#jelmer/dulwich#1000) and prevent thus the race
|
||||
condition in cleaning up after the tests.
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Mon Jul 25 20:57:16 UTC 2022 - Dirk Müller <dmueller@suse.com>
|
||||
|
||||
|
@ -27,6 +27,9 @@ License: Apache-2.0 OR GPL-2.0-or-later
|
||||
Group: Development/Languages/Python
|
||||
URL: https://www.dulwich.io
|
||||
Source0: https://files.pythonhosted.org/packages/source/d/dulwich/dulwich-%{version}.tar.gz
|
||||
# PATCH-FIX-UPSTREAM rmtree-ignore-errors.patch gh#jelmer/dulwich#1000 mcepl@suse.com
|
||||
# shutil.rmtree should be more callous
|
||||
Patch0: rmtree-ignore-errors.patch
|
||||
BuildRequires: %{python_module certifi}
|
||||
BuildRequires: %{python_module devel}
|
||||
BuildRequires: %{python_module fastimport}
|
||||
|
183
rmtree-ignore-errors.patch
Normal file
183
rmtree-ignore-errors.patch
Normal file
@ -0,0 +1,183 @@
|
||||
---
|
||||
dulwich/tests/test_porcelain.py | 40 ++++++++++++++++++++--------------------
|
||||
1 file changed, 20 insertions(+), 20 deletions(-)
|
||||
|
||||
--- a/dulwich/tests/test_porcelain.py
|
||||
+++ b/dulwich/tests/test_porcelain.py
|
||||
@@ -83,7 +83,7 @@ class PorcelainTestCase(TestCase):
|
||||
def setUp(self):
|
||||
super(PorcelainTestCase, self).setUp()
|
||||
self.test_dir = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, self.test_dir)
|
||||
+ self.addCleanup(shutil.rmtree, self.test_dir, ignore_errors=True)
|
||||
self.repo_path = os.path.join(self.test_dir, "repo")
|
||||
self.repo = Repo.init(self.repo_path, mkdir=True)
|
||||
self.addCleanup(self.repo.close)
|
||||
@@ -271,7 +271,7 @@ ya6JVZCRbMXfdCy8lVPgtNQ6VlHaj8Wvnn2FLbWW
|
||||
super(PorcelainGpgTestCase, self).setUp()
|
||||
self.gpg_dir = os.path.join(self.test_dir, "gpg")
|
||||
os.mkdir(self.gpg_dir, mode=0o700)
|
||||
- self.addCleanup(shutil.rmtree, self.gpg_dir)
|
||||
+ self.addCleanup(shutil.rmtree, self.gpg_dir, ignore_errors=True)
|
||||
self._old_gnupghome = os.environ.get("GNUPGHOME")
|
||||
os.environ["GNUPGHOME"] = self.gpg_dir
|
||||
if self._old_gnupghome is None:
|
||||
@@ -365,7 +365,7 @@ class CommitTests(PorcelainTestCase):
|
||||
|
||||
hooks_dir = os.path.join(self.repo.controldir(), "hooks")
|
||||
os.makedirs(hooks_dir, exist_ok=True)
|
||||
- self.addCleanup(shutil.rmtree, hooks_dir)
|
||||
+ self.addCleanup(shutil.rmtree, hooks_dir, ignore_errors=True)
|
||||
|
||||
c1, c2, c3 = build_commit_graph(
|
||||
self.repo.object_store, [[1], [2, 1], [3, 1, 2]]
|
||||
@@ -524,7 +524,7 @@ class CloneTests(PorcelainTestCase):
|
||||
self.repo.refs[b"refs/tags/foo"] = c3.id
|
||||
target_path = tempfile.mkdtemp()
|
||||
errstream = BytesIO()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
r = porcelain.clone(
|
||||
self.repo.path, target_path, checkout=False, errstream=errstream
|
||||
)
|
||||
@@ -558,7 +558,7 @@ class CloneTests(PorcelainTestCase):
|
||||
self.repo.refs[b"refs/heads/master"] = c3.id
|
||||
target_path = tempfile.mkdtemp()
|
||||
errstream = BytesIO()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
with porcelain.clone(
|
||||
self.repo.path, target_path, checkout=True, errstream=errstream
|
||||
) as r:
|
||||
@@ -581,7 +581,7 @@ class CloneTests(PorcelainTestCase):
|
||||
self.repo.refs[b"refs/heads/master"] = c3.id
|
||||
target_path = tempfile.mkdtemp()
|
||||
errstream = BytesIO()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
with porcelain.clone(
|
||||
self.repo.path, target_path, bare=True, errstream=errstream
|
||||
) as r:
|
||||
@@ -602,7 +602,7 @@ class CloneTests(PorcelainTestCase):
|
||||
self.repo.refs[b"HEAD"] = c1.id
|
||||
target_path = tempfile.mkdtemp()
|
||||
errstream = BytesIO()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
self.assertRaises(
|
||||
porcelain.Error,
|
||||
porcelain.clone,
|
||||
@@ -621,7 +621,7 @@ class CloneTests(PorcelainTestCase):
|
||||
(c1,) = build_commit_graph(self.repo.object_store, commit_spec, trees)
|
||||
self.repo.refs[b"refs/heads/master"] = c1.id
|
||||
target_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
errstream = BytesIO()
|
||||
r = porcelain.clone(
|
||||
self.repo.path, target_path, checkout=True, errstream=errstream
|
||||
@@ -636,7 +636,7 @@ class CloneTests(PorcelainTestCase):
|
||||
(c1,) = build_commit_graph(self.repo.object_store, commit_spec, trees)
|
||||
self.repo.refs[b"refs/heads/master"] = c1.id
|
||||
target_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
errstream = porcelain.NoneStream()
|
||||
r = porcelain.clone(
|
||||
self.repo.path, target_path, checkout=True, errstream=errstream
|
||||
@@ -659,7 +659,7 @@ class CloneTests(PorcelainTestCase):
|
||||
self.repo.refs[b"refs/heads/else"] = c1.id
|
||||
target_path = tempfile.mkdtemp()
|
||||
errstream = BytesIO()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
r = porcelain.clone(
|
||||
self.repo.path, target_path, checkout=False, errstream=errstream
|
||||
)
|
||||
@@ -678,12 +678,12 @@ class CloneTests(PorcelainTestCase):
|
||||
class InitTests(TestCase):
|
||||
def test_non_bare(self):
|
||||
repo_dir = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, repo_dir)
|
||||
+ self.addCleanup(shutil.rmtree, repo_dir, ignore_errors=True)
|
||||
porcelain.init(repo_dir)
|
||||
|
||||
def test_bare(self):
|
||||
repo_dir = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, repo_dir)
|
||||
+ self.addCleanup(shutil.rmtree, repo_dir, ignore_errors=True)
|
||||
porcelain.init(repo_dir, bare=True)
|
||||
|
||||
|
||||
@@ -1449,7 +1449,7 @@ class PushTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo cloned from temp test repo
|
||||
clone_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, clone_path)
|
||||
+ self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True)
|
||||
target_repo = porcelain.clone(
|
||||
self.repo.path, target=clone_path, errstream=errstream
|
||||
)
|
||||
@@ -1521,7 +1521,7 @@ class PushTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo cloned from temp test repo
|
||||
clone_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, clone_path)
|
||||
+ self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True)
|
||||
target_repo = porcelain.init(clone_path)
|
||||
target_repo.close()
|
||||
|
||||
@@ -1542,7 +1542,7 @@ class PushTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo cloned from temp test repo
|
||||
clone_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, clone_path)
|
||||
+ self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True)
|
||||
target_repo = porcelain.init(clone_path)
|
||||
target_repo.close()
|
||||
|
||||
@@ -1589,7 +1589,7 @@ class PushTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo cloned from temp test repo
|
||||
clone_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, clone_path)
|
||||
+ self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True)
|
||||
target_repo = porcelain.clone(
|
||||
self.repo.path, target=clone_path, errstream=errstream
|
||||
)
|
||||
@@ -1631,7 +1631,7 @@ class PushTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo cloned from temp test repo
|
||||
clone_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, clone_path)
|
||||
+ self.addCleanup(shutil.rmtree, clone_path, ignore_errors=True)
|
||||
target_repo = porcelain.clone(
|
||||
self.repo.path, target=clone_path, errstream=errstream
|
||||
)
|
||||
@@ -1717,7 +1717,7 @@ class PullTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo
|
||||
self.target_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, self.target_path)
|
||||
+ self.addCleanup(shutil.rmtree, self.target_path, ignore_errors=True)
|
||||
target_repo = porcelain.clone(
|
||||
self.repo.path, target=self.target_path, errstream=BytesIO()
|
||||
)
|
||||
@@ -2344,7 +2344,7 @@ class FetchTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo
|
||||
target_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
target_repo = porcelain.clone(
|
||||
self.repo.path, target=target_path, errstream=errstream
|
||||
)
|
||||
@@ -2391,7 +2391,7 @@ class FetchTests(PorcelainTestCase):
|
||||
|
||||
# Setup target repo
|
||||
target_path = tempfile.mkdtemp()
|
||||
- self.addCleanup(shutil.rmtree, target_path)
|
||||
+ self.addCleanup(shutil.rmtree, target_path, ignore_errors=True)
|
||||
target_repo = porcelain.clone(
|
||||
self.repo.path, target=target_path, errstream=errstream
|
||||
)
|
Loading…
Reference in New Issue
Block a user