You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by no...@apache.org on 2020/12/29 12:39:33 UTC

[buildstream] 07/18: testutils: Make tar and zip sources copy successfully

This is an automated email from the ASF dual-hosted git repository.

not-in-ldap pushed a commit to branch jonathan/mirror-client-sourcedownloader
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 007d9c6e04a2afb6b2d8ac57e43653baa310262e
Author: Jonathan Maw <jo...@codethink.co.uk>
AuthorDate: Mon Jun 11 12:46:19 2018 +0100

    testutils: Make tar and zip sources copy successfully
    
    Unlike other sources, the directory that holds files is not the source.
    The file within that directory is the source.
    Removing subdir by default prevents extraneous "repo" subdirs being
    created.
---
 tests/testutils/repo/tar.py | 4 ++++
 tests/testutils/repo/zip.py | 4 ++++
 2 files changed, 8 insertions(+)

diff --git a/tests/testutils/repo/tar.py b/tests/testutils/repo/tar.py
index ee6cb77..9882d6b 100644
--- a/tests/testutils/repo/tar.py
+++ b/tests/testutils/repo/tar.py
@@ -8,6 +8,10 @@ from .repo import Repo
 
 class Tar(Repo):
 
+    def __init__(self, directory, subdir):
+        # the repo is the file, not the dir it's in, so subdir is removed.
+        super().__init__(directory, '')
+
     def create(self, directory):
         tarball = os.path.join(self.repo, 'file.tar.gz')
 
diff --git a/tests/testutils/repo/zip.py b/tests/testutils/repo/zip.py
index 32a4698..bcacaf3 100644
--- a/tests/testutils/repo/zip.py
+++ b/tests/testutils/repo/zip.py
@@ -8,6 +8,10 @@ from .repo import Repo
 
 class Zip(Repo):
 
+    def __init__(self, directory, subdir):
+        # the repo is the file, not the dir it's in, so subdir is removed.
+        super().__init__(directory, '')
+
     def create(self, directory):
         archive = os.path.join(self.repo, 'file.zip')