[Buildroot] [PATCH vRFC 2/3] package/depot-tools: new package

Adam Duskett adam.duskett at amarulasolutions.com
Thu Jul 20 23:36:28 UTC 2023


Chromium and Chromium OS use a package of scripts called
depot_tools to manage checkouts and code reviews. This package
also includes the gclient utility.

gclient is a Python script to manage a workspace of modular dependencies that
are each checked out independently from different subversion or git
repositories. Features include:

  - Dependencies can be specified on a per-OS basis.
  - Dependencies can be specified relative to their parent dependency.
  - Variables can be used to abstract concepts.
  - Hooks can be specified to be run after a checkout.
  - .gclient and DEPS are Python scripts. You can hack in easily or add
     additional configuration data.

.gclient file: It's the primary file. It is, in fact, a Python script. It
specifies the following variables:

  - solutions: an array of dictionaries specifying the projects that will be
               fetched.
  - hooks: additional hooks to be run when this meta checkout is synced.
  - target_os: an optional array of (target) operating systems to fetch
               OS-specific dependencies for.
  - cache_dir: Primarily for bots, multiple working sets use a single git
               cache.

gclient is necessary for checking out the flutter-engine source code, as the
release tarballs provided on the flutter-engine github are in no state to
compile. Google expects the use of gclient to download a source directory
structure suitable to build the Flutter engine.

Signed-off-by: Adam Duskett <adam.duskett at amarulasolutions.com>
---
 DEVELOPERS                                    |  3 ++
 package/Config.in.host                        |  1 +
 .../0001-Disable-ninjalog-upload.patch        | 35 +++++++++++++++++++
 package/depot-tools/Config.in.host            | 10 ++++++
 package/depot-tools/depot-tools.hash          |  3 ++
 package/depot-tools/depot-tools.mk            | 33 +++++++++++++++++
 6 files changed, 85 insertions(+)
 create mode 100644 package/depot-tools/0001-Disable-ninjalog-upload.patch
 create mode 100644 package/depot-tools/Config.in.host
 create mode 100644 package/depot-tools/depot-tools.hash
 create mode 100644 package/depot-tools/depot-tools.mk

diff --git a/DEVELOPERS b/DEVELOPERS
index 43058cedf9..38db2dd345 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -26,6 +26,9 @@
 #   infrastructure, and will be CC'ed on all patches that add or
 #   modify packages that use this infrastructure.
 
+N:	Adam Duskett <adam.duskett at amarulasolutions.com>
+F:	package/depot-tools
+
 N:	Adam Heinrich <adam at adamh.cz>
 F:	package/jack1/
 
diff --git a/package/Config.in.host b/package/Config.in.host
index 9addc88522..6eb5d5be1d 100644
--- a/package/Config.in.host
+++ b/package/Config.in.host
@@ -18,6 +18,7 @@ menu "Host utilities"
 	source "package/cryptsetup/Config.in.host"
 	source "package/dbus-python/Config.in.host"
 	source "package/delve/Config.in.host"
+	source "package/depot-tools/Config.in.host"
 	source "package/dfu-util/Config.in.host"
 	source "package/dos2unix/Config.in.host"
 	source "package/dosfstools/Config.in.host"
diff --git a/package/depot-tools/0001-Disable-ninjalog-upload.patch b/package/depot-tools/0001-Disable-ninjalog-upload.patch
new file mode 100644
index 0000000000..55fd78247f
--- /dev/null
+++ b/package/depot-tools/0001-Disable-ninjalog-upload.patch
@@ -0,0 +1,35 @@
+From eeea6ad620b88a81a4b05d49f32a375b4bbcef36 Mon Sep 17 00:00:00 2001
+From: Adam Duskett <aduskett at gmail.com>
+Date: Thu, 13 Jul 2023 15:50:25 -0700
+Subject: [PATCH] Disable ninjalog upload
+
+Google doesn't need the ninja logs.
+
+Upstream: buildroot-specific.
+Signed-off-by: Adam Duskett <aduskett at gmail.com>
+---
+ autoninja | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/autoninja b/autoninja
+index 06d45d1..354a2f1 100755
+--- a/autoninja
++++ b/autoninja
+@@ -30,12 +30,12 @@ if eval "$command"; then
+   fi
+ 
+   # Collect ninjalog from googler.
+-  python3 "$(dirname -- "$0")/ninjalog_uploader_wrapper.py" --cmd $command
++  # python3 "$(dirname -- "$0")/ninjalog_uploader_wrapper.py" --cmd $command
+   exit
+ fi
+ 
+ # Collect ninjalog from googler.
+-python3 "$(dirname -- "$0")/ninjalog_uploader_wrapper.py" --cmd $command
++# python3 "$(dirname -- "$0")/ninjalog_uploader_wrapper.py" --cmd $command
+ 
+ # Return an error code of 1 so that if a developer types:
+ # "autoninja chrome && chrome" then chrome won't run if the build fails.
+-- 
+2.41.0
+
diff --git a/package/depot-tools/Config.in.host b/package/depot-tools/Config.in.host
new file mode 100644
index 0000000000..935331dedb
--- /dev/null
+++ b/package/depot-tools/Config.in.host
@@ -0,0 +1,10 @@
+config BR2_PACKAGE_HOST_DEPOT_TOOLS
+	bool "host depot-tools"
+	select BR2_PACKAGE_HOST_PYTHON3
+	select BR2_PACKAGE_HOST_PYTHON3_SSL
+	select BR2_PACKAGE_HOST_PYTHON_SIX
+	help
+	  Chromium and Chromium OS use a package of scripts called
+	  depot_tools to manage checkouts and code reviews.
+
+	  https://www.chromium.org/developers/how-tos/install-depot-tools/
diff --git a/package/depot-tools/depot-tools.hash b/package/depot-tools/depot-tools.hash
new file mode 100644
index 0000000000..2109096901
--- /dev/null
+++ b/package/depot-tools/depot-tools.hash
@@ -0,0 +1,3 @@
+# Locally calculated
+sha256  8e0bccdd6b1231f58d5453dc14a5e1d195295ac8d466dec34961e951e946b50b  depot-tools-4e87f5bfe244e903f712408ea68dc3c3a6fe2d00-br1.tar.gz
+sha256  984523ee987f4e8b72d61df37d8f1189a7077cd4b77e41a397e35593b297a29d  LICENSE
diff --git a/package/depot-tools/depot-tools.mk b/package/depot-tools/depot-tools.mk
new file mode 100644
index 0000000000..906340016c
--- /dev/null
+++ b/package/depot-tools/depot-tools.mk
@@ -0,0 +1,33 @@
+################################################################################
+#
+# depot-tools
+#
+################################################################################
+
+DEPOT_TOOLS_VERSION = 4e87f5bfe244e903f712408ea68dc3c3a6fe2d00
+DEPOT_TOOLS_SITE = https://chromium.googlesource.com/chromium/tools/depot_tools
+DEPOT_TOOLS_SITE_METHOD = git
+DEPOT_TOOLS_LICENSE = Chromium
+DEPOT_TOOLS_LICENSE_FILES = LICENSE
+DEPOT_TOOLS_CPE_ID_VENDOR = google
+HOST_DEPOT_TOOLS_DEPENDENCIES = \
+	host-python3 \
+	host-python-httplib2 \
+	host-python-pyparsing \
+	host-python-six
+
+define HOST_DEPOT_TOOLS_INSTALL_CMDS
+	mkdir -p $(HOST_DIR)/share/depot_tools
+	cp -dprf $(@D)/* $(HOST_DIR)/share/depot_tools/
+endef
+
+# Helper wrapper to make using gclient easier.
+DEPOT_TOOLS_GCLIENT=\
+	PATH=$(BR_PATH):$(HOST_DIR)/share/depot_tools \
+	LD_LIBRARY_PATH=$(HOST_DIR)/lib \
+	PYTHONPATH=$(HOST_DIR)/lib/python$(PYTHON3_VERSION_MAJOR) \
+	DEPOT_TOOLS_UPDATE=0 \
+	PYTHONDONTWRITEBYTECODE=1 \
+	$(HOST_DIR)/share/depot_tools/gclient.py
+
+$(eval $(host-generic-package))
-- 
2.41.0




More information about the buildroot mailing list