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

[buildstream] branch jennis/read_only_dir_in_tarball created (now 66e5535)

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

github-bot pushed a change to branch jennis/read_only_dir_in_tarball
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 66e5535  tar.py: Add test for a tarball containing a read-only dir

This branch includes the following new commits:

     new f2bb00c  tar tests: Add tarball which contains a read-only dir
     new 66e5535  tar.py: Add test for a tarball containing a read-only dir

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[buildstream] 01/02: tar tests: Add tarball which contains a read-only dir

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch jennis/read_only_dir_in_tarball
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit f2bb00c69e0e71791c61098da312ce5e2ad143f0
Author: James Ennis <ja...@codethink.co.uk>
AuthorDate: Thu Aug 23 13:33:36 2018 +0100

    tar tests: Add tarball which contains a read-only dir
---
 tests/sources/tar/read-only/content/a.tar.gz | Bin 0 -> 10240 bytes
 tests/sources/tar/read-only/target-lz.bst    |   6 ++++++
 tests/sources/tar/read-only/target.bst       |   6 ++++++
 3 files changed, 12 insertions(+)

diff --git a/tests/sources/tar/read-only/content/a.tar.gz b/tests/sources/tar/read-only/content/a.tar.gz
new file mode 100644
index 0000000..7092262
Binary files /dev/null and b/tests/sources/tar/read-only/content/a.tar.gz differ
diff --git a/tests/sources/tar/read-only/target-lz.bst b/tests/sources/tar/read-only/target-lz.bst
new file mode 100644
index 0000000..b056912
--- /dev/null
+++ b/tests/sources/tar/read-only/target-lz.bst
@@ -0,0 +1,6 @@
+kind: import
+description: The kind of this element is irrelevant.
+sources:
+- kind: tar
+  url: tmpdir:/a.tar.lz
+  ref: foo
diff --git a/tests/sources/tar/read-only/target.bst b/tests/sources/tar/read-only/target.bst
new file mode 100644
index 0000000..ad413a2
--- /dev/null
+++ b/tests/sources/tar/read-only/target.bst
@@ -0,0 +1,6 @@
+kind: import
+description: The kind of this element is irrelevant.
+sources:
+- kind: tar
+  url: tmpdir:/a.tar.gz
+  ref: foo


[buildstream] 02/02: tar.py: Add test for a tarball containing a read-only dir

Posted by gi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch jennis/read_only_dir_in_tarball
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 66e5535eb5b9684832e0497e315ba915a10a973b
Author: James Ennis <ja...@codethink.co.uk>
AuthorDate: Thu Aug 23 13:34:32 2018 +0100

    tar.py: Add test for a tarball containing a read-only dir
---
 tests/sources/tar.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/tests/sources/tar.py b/tests/sources/tar.py
index fb02de3..687bd67 100644
--- a/tests/sources/tar.py
+++ b/tests/sources/tar.py
@@ -3,6 +3,7 @@ import pytest
 import tarfile
 import tempfile
 import subprocess
+from shutil import copyfile
 
 from buildstream._exceptions import ErrorDomain
 from buildstream import _yaml
@@ -257,3 +258,27 @@ def test_stage_default_basedir_lzip(cli, tmpdir, datafiles, srcdir):
     original_contents = list_dir_contents(original_dir)
     checkout_contents = list_dir_contents(checkoutdir)
     assert(checkout_contents == original_contents)
+
+
+# Test that a tarball that contains a read only dir breaks
+@pytest.mark.datafiles(os.path.join(DATA_DIR, 'read-only'))
+def test_read_only_dir(cli, tmpdir, datafiles, srcdir):
+    project = os.path.join(datafiles.dirname, datafiles.basename)
+    generate_project(project, tmpdir)
+
+    # Get the tarball in tests/sources/tar/read-only/content
+    #
+    # NOTE that we need to do this because tarfile.open and tar.add()
+    # are packing the tar up with writeable files and dirs
+    tarball = os.path.join(str(datafiles), 'content', 'a.tar.gz')
+    if not os.path.exists(tarball):
+        raise FileNotFoundError('{} does not exist'.format(tarball))
+    copyfile(tarball, os.path.join(tmpdir, 'a.tar.gz'))
+
+    # Track, fetch, build, checkout
+    result = cli.run(project=project, args=['track', 'target.bst'])
+    result.assert_success()
+    result = cli.run(project=project, args=['fetch', 'target.bst'])
+    result.assert_success()
+    result = cli.run(project=project, args=['build', 'target.bst'])
+    result.assert_success()