You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:12:12 UTC

[buildstream] 14/15: _ostree.py: Adhere to private symbol policy

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

tvb pushed a commit to branch jennis/136-clean-remote-cache
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 05e239572782aa9286e5c41df0adc38867849973
Author: James Ennis <ja...@codethink.com>
AuthorDate: Tue May 22 10:19:43 2018 +0100

    _ostree.py: Adhere to private symbol policy
---
 buildstream/_ostree.py | 60 +++++++++++++++++++++++++-------------------------
 1 file changed, 30 insertions(+), 30 deletions(-)

diff --git a/buildstream/_ostree.py b/buildstream/_ostree.py
index 080447b..93fad13 100644
--- a/buildstream/_ostree.py
+++ b/buildstream/_ostree.py
@@ -554,7 +554,33 @@ def configure_remote(repo, remote, url, key_url=None):
             raise OSTreeError("Failed to add gpg key from url '{}': {}".format(key_url, e.message)) from e
 
 
-# list_all_refs():
+# list_artifacts():
+#
+# List cached artifacts in Least Recently Modified (LRM) order.
+#
+# Returns:
+#     (list) - A list of refs in LRM order
+#
+def list_artifacts(repo):
+    # string of: /path/to/repo/refs/heads
+    ref_heads = os.path.join(repo.get_path().get_path(), 'refs', 'heads')
+
+    # obtain list of <project>/<element>/<key>
+    refs = __list_all_refs(repo).keys()
+
+    mtimes = []
+    for ref in refs:
+        ref_path = os.path.join(ref_heads, ref)
+        if os.path.exists(ref_path):
+            # Obtain the mtime (the time a file was last modified)
+            mtimes.append(os.path.getmtime(ref_path))
+
+    # NOTE: Sorted will sort from earliest to latest, thus the
+    # first element of this list will be the file modified earliest.
+    return [ref for _, ref in sorted(zip(mtimes, refs))]
+
+
+# __list_all_refs():
 #
 # Create a list of all refs.
 #
@@ -564,7 +590,7 @@ def configure_remote(repo, remote, url, key_url=None):
 # Returns:
 #    (dict): A dict of refs to checksums.
 #
-def list_all_refs(repo):
+def __list_all_refs(repo):
     try:
         _, refs = repo.list_refs(None)
         return refs
@@ -572,7 +598,7 @@ def list_all_refs(repo):
         raise OSTreeError(message=e.message) from e
 
 
-# list_remote_refs():
+# __list_remote_refs():
 #
 # Fetch list of refs from a remote.
 #
@@ -583,36 +609,10 @@ def list_all_refs(repo):
 # Returns:
 #    (dict): A dict of refs to checksums.
 #
-def list_remote_refs(repo, remote="origin"):
+def __list_remote_refs(repo, remote="origin"):
     try:
         _, refs = repo.remote_list_refs(remote)
         return refs
     except GLib.GError as e:
         (_, remote_url) = repo.remote_get_url(remote)
         raise OSTreeError(message="{} when attempting to fetch from {}".format(e.message, remote_url)) from e
-
-
-# list_artifacts():
-#
-# List cached artifacts in Least Recently Modified (LRM) order.
-#
-# Returns:
-#     (list) - A list of refs in LRM order
-#
-def list_artifacts(repo):
-    # string of: /path/to/repo/refs/heads
-    ref_heads = os.path.join(repo.get_path().get_path(), 'refs', 'heads')
-
-    # obtain list of <project>/<element>/<key>
-    refs = list_all_refs(repo).keys()
-
-    mtimes = []
-    for ref in refs:
-        ref_path = os.path.join(ref_heads, ref)
-        if os.path.exists(ref_path):
-            # Obtain the mtime (the time a file was last modified)
-            mtimes.append(os.path.getmtime(ref_path))
-
-    # NOTE: Sorted will sort from earliest to latest, thus the
-    # first element of this list will be the file modified earliest.
-    return [ref for _, ref in sorted(zip(mtimes, refs))]