You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ju...@apache.org on 2025/11/14 08:59:32 UTC

(buildstream) branch jbilleter/remoteasset created (now d3e884402)

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

juergbi pushed a change to branch jbilleter/remoteasset
in repository https://gitbox.apache.org/repos/asf/buildstream.git


      at d3e884402 _artifactcache.py: Push and fetch sources

This branch includes the following new commits:

     new 0cea83a8b _artifactcache.py: Fix presence checks of protobuf digest fields
     new 2013156c4 _artifactcache.py: Add `public_data` to list of referenced blobs
     new d3e884402 _artifactcache.py: Push and fetch sources

The 3 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/03: _artifactcache.py: Add `public_data` to list of referenced blobs

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

juergbi pushed a commit to branch jbilleter/remoteasset
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 2013156c4088462f60d35c1ad05b82b7f2607434
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Nov 14 09:48:09 2025 +0100

    _artifactcache.py: Add `public_data` to list of referenced blobs
---
 src/buildstream/_artifactcache.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index aef3f00dd..c08f9d1e4 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -373,6 +373,9 @@ class ArtifactCache(AssetCache):
             log_file.digest for log_file in artifact_proto.logs
         ]
 
+        if artifact_proto.HasField("public_data"):
+            referenced_blobs.append(artifact_proto.public_data)
+
         try:
             remote.push_blob(
                 uris,


(buildstream) 03/03: _artifactcache.py: Push and fetch sources

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

juergbi pushed a commit to branch jbilleter/remoteasset
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit d3e88440226382b2a16670e3ada392d69216469b
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Nov 14 09:54:34 2025 +0100

    _artifactcache.py: Push and fetch sources
    
    The source digest is already stored in the artifact proto and added to
    the list of referenced directories if the buildtree is cached, however,
    the actual push and fetch was missing.
---
 src/buildstream/_artifactcache.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index c08f9d1e4..c8328f109 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -297,6 +297,12 @@ class ArtifactCache(AssetCache):
                 except FileNotFoundError:
                     pass
 
+            if artifact_proto.HasField("sources"):
+                try:
+                    self.cas._send_directory(remote, artifact_proto.sources)
+                except FileNotFoundError:
+                    pass
+
             if artifact_proto.HasField("buildroot"):
                 try:
                     self.cas._send_directory(remote, artifact_proto.buildroot)
@@ -427,6 +433,8 @@ class ArtifactCache(AssetCache):
             if pull_buildtrees:
                 if artifact.HasField("buildtree"):
                     self.cas.fetch_directory(remote, artifact.buildtree)
+                if artifact.HasField("sources"):
+                    self.cas.fetch_directory(remote, artifact.sources)
                 if artifact.HasField("buildroot"):
                     self.cas.fetch_directory(remote, artifact.buildroot)
                 if artifact.HasField("buildsandbox"):


(buildstream) 01/03: _artifactcache.py: Fix presence checks of protobuf digest fields

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

juergbi pushed a commit to branch jbilleter/remoteasset
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit 0cea83a8b803ea062e16b2ae0ba95d581f534757
Author: Jürg Billeter <j...@bitron.ch>
AuthorDate: Fri Nov 14 09:41:19 2025 +0100

    _artifactcache.py: Fix presence checks of protobuf digest fields
    
    Python truth values can't be used for presence checks of embedded
    protobuf message fields. Use `HasField()` instead. This prevents passing
    invalid digests to the Remote Asset server.
    
    Fixes #2090.
---
 src/buildstream/_artifactcache.py | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/buildstream/_artifactcache.py b/src/buildstream/_artifactcache.py
index 9f4062449..aef3f00dd 100644
--- a/src/buildstream/_artifactcache.py
+++ b/src/buildstream/_artifactcache.py
@@ -288,28 +288,28 @@ class ArtifactCache(AssetCache):
         artifact_proto = artifact._get_proto()
 
         try:
-            if str(artifact_proto.files):
+            if artifact_proto.HasField("files"):
                 self.cas._send_directory(remote, artifact_proto.files)
 
-            if str(artifact_proto.buildtree):
+            if artifact_proto.HasField("buildtree"):
                 try:
                     self.cas._send_directory(remote, artifact_proto.buildtree)
                 except FileNotFoundError:
                     pass
 
-            if str(artifact_proto.buildroot):
+            if artifact_proto.HasField("buildroot"):
                 try:
                     self.cas._send_directory(remote, artifact_proto.buildroot)
                 except FileNotFoundError:
                     pass
 
-            if artifact_proto.buildsandbox:
+            if artifact_proto.HasField("buildsandbox"):
                 for subsandbox_digest in artifact_proto.buildsandbox.subsandbox_digests:
                     self.cas._send_directory(remote, subsandbox_digest)
 
             digests = [artifact_digest, artifact_proto.low_diversity_meta, artifact_proto.high_diversity_meta]
 
-            if str(artifact_proto.public_data):
+            if artifact_proto.HasField("public_data"):
                 digests.append(artifact_proto.public_data)
 
             for log_file in artifact_proto.logs:
@@ -357,15 +357,15 @@ class ArtifactCache(AssetCache):
             raise ArtifactError("{}".format(e), temporary=True) from e
 
         referenced_directories = []
-        if artifact_proto.files:
+        if artifact_proto.HasField("files"):
             referenced_directories.append(artifact_proto.files)
-        if artifact_proto.buildtree:
+        if artifact_proto.HasField("buildtree"):
             referenced_directories.append(artifact_proto.buildtree)
-        if artifact_proto.sources:
+        if artifact_proto.HasField("sources"):
             referenced_directories.append(artifact_proto.sources)
-        if artifact_proto.buildroot:
+        if artifact_proto.HasField("buildroot"):
             referenced_directories.append(artifact_proto.buildroot)
-        if artifact_proto.buildsandbox:
+        if artifact_proto.HasField("buildsandbox"):
             for subsandbox_digest in artifact_proto.buildsandbox.subsandbox_digests:
                 referenced_directories.append(subsandbox_digest)
 
@@ -418,20 +418,20 @@ class ArtifactCache(AssetCache):
             with utils.save_file_atomic(artifact_path, mode="wb") as f:
                 f.write(artifact.SerializeToString())
 
-            if str(artifact.files):
+            if artifact.HasField("files"):
                 self.cas.fetch_directory(remote, artifact.files)
 
             if pull_buildtrees:
-                if str(artifact.buildtree):
+                if artifact.HasField("buildtree"):
                     self.cas.fetch_directory(remote, artifact.buildtree)
-                if str(artifact.buildroot):
+                if artifact.HasField("buildroot"):
                     self.cas.fetch_directory(remote, artifact.buildroot)
-                if artifact.buildsandbox:
+                if artifact.HasField("buildsandbox"):
                     for subsandbox_digest in artifact.buildsandbox.subsandbox_digests:
                         self.cas.fetch_directory(remote, subsandbox_digest)
 
             digests = [artifact.low_diversity_meta, artifact.high_diversity_meta]
-            if str(artifact.public_data):
+            if artifact.HasField("public_data"):
                 digests.append(artifact.public_data)
 
             for log_digest in artifact.logs: