You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by GitBox <gi...@apache.org> on 2022/08/16 21:56:56 UTC

[GitHub] [buildstream] cs-shadow commented on a diff in pull request #1714: Draft: Build and release wheel packages

cs-shadow commented on code in PR #1714:
URL: https://github.com/apache/buildstream/pull/1714#discussion_r947275564


##########
.github/wheel-helpers/fetch-latest-buildbox-release.sh:
##########
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Download latest release binaries of BuildBox. These are statically linked
+# binaries produced by the buildbox-integration GitLab project, which we
+# bundle into BuildStream wheel packages.
+
+set -eux
+
+wget https://gitlab.com/buildgrid/buildbox/buildbox-integration/-/releases/permalink/latest/downloads/binaries.tgz
+
+mkdir -p src/buildstream/subprojects/buildbox

Review Comment:
   minor: I wonder if `_vendor` would be a better name for what this directory is actually doing. 



##########
.github/wheel-helpers/fetch-latest-buildbox-release.sh:
##########
@@ -0,0 +1,16 @@
+#!/bin/bash
+
+# Download latest release binaries of BuildBox. These are statically linked
+# binaries produced by the buildbox-integration GitLab project, which we
+# bundle into BuildStream wheel packages.
+
+set -eux
+
+wget https://gitlab.com/buildgrid/buildbox/buildbox-integration/-/releases/permalink/latest/downloads/binaries.tgz

Review Comment:
   ```suggestion
   curl  -O https://gitlab.com/buildgrid/buildbox/buildbox-integration/-/releases/permalink/latest/downloads/binaries.tgz
   ```
   
   minor: curl may be slightly more ubiquitous



##########
src/buildstream/utils.py:
##########
@@ -575,20 +576,27 @@ def link_files(
     return result
 
 
-def get_host_tool(name: str) -> str:
+def get_host_tool(
+    name: str,
+    search_subprojects_dir: Optional[str] = None,

Review Comment:
   I suppose the `search_subprojects_dir` argument (along with the line in the docstring below) should be removed now



##########
setup.py:
##########
@@ -64,6 +104,59 @@
     sys.exit(1)
 
 
+############################################################
+# List the BuildBox binaries to ship in the wheel packages #
+############################################################
+#
+# BuildBox isn't widely available in OS distributions. To enable a "one click"
+# install for BuildStream, we bundle prebuilt BuildBox binaries in our binary
+# wheel packages.
+#
+# The binaries are provided by the buildbox-integration Gitlab project:
+# https://gitlab.com/BuildGrid/buildbox/buildbox-integration
+#
+# If you want to build a wheel with the BuildBox binaries included, set the
+# env var "BST_BUNDLE_BUILDBOX=1" when running setup.py.
+
+try:
+    BUNDLE_BUILDBOX = int(os.environ.get("BST_BUNDLE_BUILDBOX", "0"))
+except ValueError:
+    print("BST_BUNDLE_BUILDBOX must be an integer. Please set it to '1' to enable, '0' to disable", file=sys.stderr)
+    raise SystemExit(1)
+
+
+def list_buildbox_binaries():
+    expected_binaries = [
+        "buildbox-casd",
+        "buildbox-fuse",
+        "buildbox-run",
+    ]
+
+    if BUNDLE_BUILDBOX:
+        bst_package_dir = Path(__file__).parent.joinpath("src/buildstream")
+        buildbox_dir = bst_package_dir.joinpath("subprojects", "buildbox")
+        buildbox_binaries = [buildbox_dir.joinpath(name) for name in expected_binaries]
+
+        missing_binaries = [path for path in buildbox_binaries if not path.is_file()]
+        if missing_binaries:
+            paths_text = "\n".join(["  * {}".format(path) for path in missing_binaries])
+            print(
+                "Expected BuildBox binaries were not found. "
+                "Set BST_BUNDLE_BUILDBOX=0 or provide:\n\n"
+                "{}\n".format(paths_text)

Review Comment:
   ```suggestion
                   "{}\n".format(paths_text),
                   file=sys.stderr,
   ```



##########
setup.py:
##########
@@ -64,6 +104,59 @@
     sys.exit(1)
 
 
+############################################################
+# List the BuildBox binaries to ship in the wheel packages #
+############################################################
+#
+# BuildBox isn't widely available in OS distributions. To enable a "one click"
+# install for BuildStream, we bundle prebuilt BuildBox binaries in our binary
+# wheel packages.
+#
+# The binaries are provided by the buildbox-integration Gitlab project:
+# https://gitlab.com/BuildGrid/buildbox/buildbox-integration
+#
+# If you want to build a wheel with the BuildBox binaries included, set the
+# env var "BST_BUNDLE_BUILDBOX=1" when running setup.py.
+
+try:
+    BUNDLE_BUILDBOX = int(os.environ.get("BST_BUNDLE_BUILDBOX", "0"))
+except ValueError:
+    print("BST_BUNDLE_BUILDBOX must be an integer. Please set it to '1' to enable, '0' to disable", file=sys.stderr)
+    raise SystemExit(1)
+
+
+def list_buildbox_binaries():
+    expected_binaries = [
+        "buildbox-casd",
+        "buildbox-fuse",
+        "buildbox-run",
+    ]
+
+    if BUNDLE_BUILDBOX:
+        bst_package_dir = Path(__file__).parent.joinpath("src/buildstream")
+        buildbox_dir = bst_package_dir.joinpath("subprojects", "buildbox")
+        buildbox_binaries = [buildbox_dir.joinpath(name) for name in expected_binaries]
+
+        missing_binaries = [path for path in buildbox_binaries if not path.is_file()]
+        if missing_binaries:
+            paths_text = "\n".join(["  * {}".format(path) for path in missing_binaries])
+            print(
+                "Expected BuildBox binaries were not found. "
+                "Set BST_BUNDLE_BUILDBOX=0 or provide:\n\n"
+                "{}\n".format(paths_text)
+            )
+            raise SystemExit(1)
+
+        for path in buildbox_binaries:
+            if path.is_symlink():
+                print("Bundled BuildBox binaries must not be symlinks. Please fix {}".format(path))

Review Comment:
   ```suggestion
                   print("Bundled BuildBox binaries must not be symlinks. Please fix {}".format(path), file=sys.stderr)
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@buildstream.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org