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

[buildstream] branch jonathan/ostree-fix-no-upstream created (now 1908747)

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

root pushed a change to branch jonathan/ostree-fix-no-upstream
in repository https://gitbox.apache.org/repos/asf/buildstream.git.


      at 1908747  Fix ostree source failing to fetch when upstream is absent

This branch includes the following new commits:

     new 7befbca  tests: Test that fetching passes when upstream is absent
     new 1908747  Fix ostree source failing to fetch when upstream is absent

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] 02/02: Fix ostree source failing to fetch when upstream is absent

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

root pushed a commit to branch jonathan/ostree-fix-no-upstream
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 1908747cd18c79606d7c34d5ff7dfd8176de3928
Author: Jonathan Maw <jo...@codethink.co.uk>
AuthorDate: Wed Aug 8 14:20:12 2018 +0100

    Fix ostree source failing to fetch when upstream is absent
---
 buildstream/_ostree.py                | 8 +++++++-
 buildstream/plugins/sources/ostree.py | 2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/buildstream/_ostree.py b/buildstream/_ostree.py
index 5a4039f..8e55590 100644
--- a/buildstream/_ostree.py
+++ b/buildstream/_ostree.py
@@ -258,7 +258,13 @@ def configure_remote(repo, remote, url, key_url=None):
 
     try:
         repo.remote_change(None,      # Optional OSTree.Sysroot
-                           OSTree.RepoRemoteChange.ADD_IF_NOT_EXISTS,
+                           OSTree.RepoRemoteChange.DELETE_IF_EXISTS,
+                           remote,    # Remote name
+                           url,       # Remote url
+                           options,   # Remote options
+                           None)      # Optional Gio.Cancellable
+        repo.remote_change(None,      # Optional OSTree.Sysroot
+                           OSTree.RepoRemoteChange.ADD,
                            remote,    # Remote name
                            url,       # Remote url
                            options,   # Remote options
diff --git a/buildstream/plugins/sources/ostree.py b/buildstream/plugins/sources/ostree.py
index 3a841c4..0285c6f 100644
--- a/buildstream/plugins/sources/ostree.py
+++ b/buildstream/plugins/sources/ostree.py
@@ -71,7 +71,7 @@ class OSTreeSource(Source):
         self.ref = self.node_get_member(node, str, 'ref', None)
         self.tracking = self.node_get_member(node, str, 'track', None)
         self.mirror = os.path.join(self.get_mirror_directory(),
-                                   utils.url_directory_name(self.url))
+                                   utils.url_directory_name(self.original_url))
 
         # (optional) Not all repos are signed. But if they are, get the gpg key
         self.gpg_key_path = None


[buildstream] 01/02: tests: Test that fetching passes when upstream is absent

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

root pushed a commit to branch jonathan/ostree-fix-no-upstream
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 7befbcadbb6bf042135d2a8b28ad2a7994b6a738
Author: Jonathan Maw <jo...@codethink.co.uk>
AuthorDate: Mon Aug 6 13:31:50 2018 +0100

    tests: Test that fetching passes when upstream is absent
---
 tests/frontend/mirror.py | 57 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)

diff --git a/tests/frontend/mirror.py b/tests/frontend/mirror.py
index f37cc18..f658283 100644
--- a/tests/frontend/mirror.py
+++ b/tests/frontend/mirror.py
@@ -140,6 +140,63 @@ def test_mirror_fetch(cli, tmpdir, datafiles, kind):
 
 
 @pytest.mark.datafiles(DATA_DIR)
+@pytest.mark.parametrize("kind", [(kind) for kind in ALL_REPO_KINDS])
+def test_mirror_fetch_upstream_absent(cli, tmpdir, datafiles, kind):
+    bin_files_path = os.path.join(str(datafiles), 'files', 'bin-files', 'usr')
+    dev_files_path = os.path.join(str(datafiles), 'files', 'dev-files', 'usr')
+    upstream_repodir = os.path.join(str(tmpdir), 'upstream')
+    mirror_repodir = os.path.join(str(tmpdir), 'mirror')
+    project_dir = os.path.join(str(tmpdir), 'project')
+    os.makedirs(project_dir)
+    element_dir = os.path.join(project_dir, 'elements')
+
+    # Create repo objects of the upstream and mirror
+    upstream_repo = create_repo(kind, upstream_repodir)
+    ref = upstream_repo.create(dev_files_path)
+    mirror_repo = upstream_repo.copy(mirror_repodir)
+
+    element = {
+        'kind': 'import',
+        'sources': [
+            upstream_repo.source_config(ref=ref)
+        ]
+    }
+
+    element_name = 'test.bst'
+    element_path = os.path.join(element_dir, element_name)
+    full_repo = element['sources'][0]['url']
+    upstream_map, repo_name = os.path.split(full_repo)
+    alias = 'foo-' + kind
+    aliased_repo = alias + ':' + repo_name
+    element['sources'][0]['url'] = aliased_repo
+    full_mirror = mirror_repo.source_config()['url']
+    mirror_map, _ = os.path.split(full_mirror)
+    os.makedirs(element_dir)
+    _yaml.dump(element, element_path)
+
+    project = {
+        'name': 'test',
+        'element-path': 'elements',
+        'aliases': {
+            alias: 'http://www.example.com/'
+        },
+        'mirrors': [
+            {
+                'name': 'middle-earth',
+                'aliases': {
+                    alias: [mirror_map + "/"],
+                },
+            },
+        ]
+    }
+    project_file = os.path.join(project_dir, 'project.conf')
+    _yaml.dump(project, project_file)
+
+    result = cli.run(project=project_dir, args=['fetch', element_name])
+    result.assert_success()
+
+
+@pytest.mark.datafiles(DATA_DIR)
 def test_mirror_fetch_multi(cli, tmpdir, datafiles):
     output_file = os.path.join(str(tmpdir), "output.txt")
     project_dir = str(tmpdir)