Fork tar module from fuchsia recipes.
The module was deleted from fuchsia but it is still required to run femu
tests in flutter.
Change-Id: I895f57745256273996e7da9532f48b87f29c946b
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/38223
Reviewed-by: Yusuf Mohsinally <mohsinally@google.com>
Commit-Queue: Godofredo Contreras <godofredoc@google.com>
(cherry picked from commit 0a85a396c1c9b3c77394f544078e66489327a539)
Reviewed-on: https://flutter-review.googlesource.com/c/recipes/+/38680
Reviewed-by: Xilai Zhang <xilaizhang@google.com>
diff --git a/infra/config/recipes.cfg b/infra/config/recipes.cfg
index 3cb9be5..10c1c49 100644
--- a/infra/config/recipes.cfg
+++ b/infra/config/recipes.cfg
@@ -23,17 +23,17 @@
"deps": {
"depot_tools": {
"branch": "refs/heads/main",
- "revision": "e38d195b635a0e73bf132d866fb659cec98492f5",
+ "revision": "00be3f079a1bd376c594d348ebf7d7021a9de245",
"url": "https://chromium.googlesource.com/chromium/tools/depot_tools.git"
},
"fuchsia": {
"branch": "refs/heads/main",
- "revision": "294f76d178456e59ba196970026a4a9800b8bebe",
+ "revision": "bf6fa721bb1dc139e13259a6c6270d66874f5692",
"url": "https://fuchsia.googlesource.com/infra/recipes.git"
},
"recipe_engine": {
"branch": "refs/heads/main",
- "revision": "573a3a6797dba8011d482e6756860bdb894339ba",
+ "revision": "45640f13ebe158fd8646163fed5d6c0c5238aa16",
"url": "https://chromium.googlesource.com/infra/luci/recipes-py.git"
}
},
diff --git a/recipe_modules/sdk/__init__.py b/recipe_modules/sdk/__init__.py
index 3addc15..9e90d46 100644
--- a/recipe_modules/sdk/__init__.py
+++ b/recipe_modules/sdk/__init__.py
@@ -4,7 +4,7 @@
DEPS = [
'fuchsia/gsutil',
- 'fuchsia/tar',
+ 'flutter/tar',
'recipe_engine/buildbucket',
'recipe_engine/context',
'recipe_engine/file',
diff --git a/recipe_modules/sdk/examples/full.expected/ensure_arm_sdk.json b/recipe_modules/sdk/examples/full.expected/ensure_arm_sdk.json
index c1c1875..eea19c6 100644
--- a/recipe_modules/sdk/examples/full.expected/ensure_arm_sdk.json
+++ b/recipe_modules/sdk/examples/full.expected/ensure_arm_sdk.json
@@ -155,7 +155,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"infra_step": true,
diff --git a/recipe_modules/sdk/examples/full.expected/ensure_intel_sdk.json b/recipe_modules/sdk/examples/full.expected/ensure_intel_sdk.json
index 01d32ef..27bb7a8 100644
--- a/recipe_modules/sdk/examples/full.expected/ensure_intel_sdk.json
+++ b/recipe_modules/sdk/examples/full.expected/ensure_intel_sdk.json
@@ -155,7 +155,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"infra_step": true,
diff --git a/recipe_modules/sdk/examples/full.expected/has_cache_sdk.json b/recipe_modules/sdk/examples/full.expected/has_cache_sdk.json
index 596f87f..82c0f98 100644
--- a/recipe_modules/sdk/examples/full.expected/has_cache_sdk.json
+++ b/recipe_modules/sdk/examples/full.expected/has_cache_sdk.json
@@ -221,7 +221,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"infra_step": true,
diff --git a/recipe_modules/sdk/examples/full.expected/missing_package_file.json b/recipe_modules/sdk/examples/full.expected/missing_package_file.json
index 24e4bb6..58855eb 100644
--- a/recipe_modules/sdk/examples/full.expected/missing_package_file.json
+++ b/recipe_modules/sdk/examples/full.expected/missing_package_file.json
@@ -221,7 +221,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"infra_step": true,
diff --git a/recipe_modules/shard_util_v2/examples/full.expected/presubmit_led.json b/recipe_modules/shard_util_v2/examples/full.expected/presubmit_led.json
index 7dd6834..002cf3b 100644
--- a/recipe_modules/shard_util_v2/examples/full.expected/presubmit_led.json
+++ b/recipe_modules/shard_util_v2/examples/full.expected/presubmit_led.json
@@ -1247,10 +1247,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"luci_context": {
diff --git a/recipe_modules/tar/__init__.py b/recipe_modules/tar/__init__.py
new file mode 100644
index 0000000..4174dac
--- /dev/null
+++ b/recipe_modules/tar/__init__.py
@@ -0,0 +1,10 @@
+# Copyright 2017 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+DEPS = [
+ "fuchsia/ensure_tool",
+ "recipe_engine/context",
+ "recipe_engine/path",
+ "recipe_engine/step",
+]
diff --git a/recipe_modules/tar/api.py b/recipe_modules/tar/api.py
new file mode 100644
index 0000000..d72f230
--- /dev/null
+++ b/recipe_modules/tar/api.py
@@ -0,0 +1,112 @@
+# Copyright 2017 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+from recipe_engine import recipe_api
+
+
+class TarApi(recipe_api.RecipeApi):
+ """Provides steps to tar and untar files."""
+
+ COMPRESSION_OPTS = ["gzip", "bzip2", "xz", "lzma"]
+
+ def __call__(self, step_name, cmd):
+ full_cmd = [self._bsdtar_path] + list(cmd)
+ return self.m.step(step_name, full_cmd)
+
+ @property
+ def _bsdtar_path(self):
+ """Ensures that bsdtar is installed."""
+ return self.m.ensure_tool("bsdtar", self.resource("tool_manifest.json"))
+
+ def create(self, path, compression=None):
+ """Returns TarArchive object that can be used to compress a set of files.
+
+ Args:
+ path: path of the archive file to be created.
+ compression: str, one of COMPRESSION_OPTS or None to disable compression.
+ """
+ assert not compression or compression in TarApi.COMPRESSION_OPTS, (
+ "compression must be one of %s",
+ TarApi.COMPRESSION_OPTS,
+ )
+ return TarArchive(self.m, path, compression)
+
+ def extract(self, step_name, path, directory=None, strip_components=None):
+ """Uncompress |archive| file.
+
+ Args:
+ step_name: name of the step.
+ path: absolute path to archive file.
+ directory: directory to extract the archive in.
+ strip_components: strip number of leading components from file names.
+ """
+ # We use long-form options whenever possible, but for options with
+ # arguments, we have to use the short form. The recipe engine tests require
+ # objects which might be placeholders (in this case |path|) to be their own
+ # argument, and the version of tar we're using doesn't support
+ # '--long-opt arg'. It only supports '--long-opt=arg' or short-form like
+ # '-s arg'.
+ cmd = [
+ "--extract",
+ "--verbose",
+ "-f",
+ path,
+ ]
+ if directory:
+ cmd.extend(["-C", directory])
+ if strip_components:
+ cmd.extend(["--strip-components", str(int(strip_components))])
+ return self(step_name, cmd)
+
+
+class TarArchive:
+ """Used to gather a list of files to tar."""
+
+ def __init__(self, api, path, compression):
+ self._api = api
+ self._path = path
+ self._compression = compression
+ self._entries = {}
+
+ @property
+ def path(self):
+ return self._path
+
+ def add(self, path, directory=None):
+ """Stages single file to be added to the package.
+
+ Args:
+ path: absolute path to a file, should be a child of |directory|.
+ directory: ancestor directory of |path|. The name of the file
+ inside the archive will not include |directory|. Defaults to $CWD.
+ """
+ if not directory:
+ directory = self._api.context.cwd
+ assert directory.is_parent_of(
+ path
+ ), "directory must be a parent of path. directory: %s.%s, path: %s.%s" % (
+ directory.base,
+ directory.pieces,
+ path.base,
+ path.pieces,
+ )
+ self._entries.setdefault(str(directory), []).append(str(path))
+
+ def tar(self, step_name):
+ """Step to tar all staged files."""
+ cmd = ["--create", "-f", self._path]
+ if self._compression:
+ cmd.append("--%s" % self._compression)
+ for directory in sorted(self._entries):
+ cmd.extend(
+ ["-C", directory]
+ + [
+ self._api.path.relpath(p, directory)
+ for p in self._entries[directory]
+ ]
+ )
+
+ step_result = self._api.tar(step_name, cmd)
+ self._api.path.mock_add_paths(self._path)
+ return step_result
diff --git a/recipe_modules/tar/resources/tool_manifest.json b/recipe_modules/tar/resources/tool_manifest.json
new file mode 100644
index 0000000..b935e19
--- /dev/null
+++ b/recipe_modules/tar/resources/tool_manifest.json
@@ -0,0 +1,4 @@
+{
+ "path": "fuchsia/tools/bsdtar/${platform}",
+ "version": "git_revision:6462ccda48c8f33dce4c80c2f1533263277d4da9"
+}
diff --git a/recipe_modules/tar/tests/full.expected/linux.json b/recipe_modules/tar/tests/full.expected/linux.json
new file mode 100644
index 0000000..1b79076
--- /dev/null
+++ b/recipe_modules/tar/tests/full.expected/linux.json
@@ -0,0 +1,180 @@
+[
+ {
+ "cmd": [
+ "touch",
+ "[CLEANUP]/tar-example_tmp_1/a"
+ ],
+ "name": "touch a"
+ },
+ {
+ "cmd": [
+ "touch",
+ "[CLEANUP]/tar-example_tmp_1/b"
+ ],
+ "name": "touch b"
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[CLEANUP]/tar-example_tmp_1/sub/dir"
+ ],
+ "infra_step": true,
+ "name": "mkdirs"
+ },
+ {
+ "cmd": [
+ "touch",
+ "[CLEANUP]/tar-example_tmp_1/sub/dir/c"
+ ],
+ "name": "touch c"
+ },
+ {
+ "cmd": [],
+ "name": "ensure bsdtar"
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "name": "ensure bsdtar.read manifest",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@ \"path\": \"path/to/bsdtar\",@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@ \"version\": \"version:pinned-version\"@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@}@@@",
+ "@@@STEP_LOG_END@tool_manifest.json@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "ensure bsdtar.install path/to/bsdtar",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version"
+ ],
+ "infra_step": true,
+ "name": "ensure bsdtar.install path/to/bsdtar.ensure package directory",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version",
+ "-ensure-file",
+ "path/to/bsdtar version:pinned-version",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "name": "ensure bsdtar.install path/to/bsdtar.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:pinned-v\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"path/to/bsdtar\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version/bsdtar",
+ "--create",
+ "-f",
+ "[CLEANUP]/tar-example_tmp_1/more.tar.gz",
+ "--gzip",
+ "-C",
+ "[CLEANUP]/tar-example_tmp_1",
+ "a",
+ "b",
+ "-C",
+ "[CLEANUP]/tar-example_tmp_1/sub",
+ "dir/c"
+ ],
+ "name": "taring more"
+ },
+ {
+ "cmd": [
+ "echo",
+ "[CLEANUP]/tar-example_tmp_1/more.tar.gz"
+ ],
+ "name": "report"
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version/bsdtar",
+ "--extract",
+ "--verbose",
+ "-f",
+ "[CLEANUP]/tar-example_tmp_1/output.tar",
+ "-C",
+ "[CLEANUP]/tar-example_tmp_1/output",
+ "--strip-components",
+ "1"
+ ],
+ "name": "untaring"
+ },
+ {
+ "cmd": [
+ "find"
+ ],
+ "cwd": "[CLEANUP]/tar-example_tmp_1/output",
+ "name": "listing"
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "rmtree",
+ "[CLEANUP]/tar-example_tmp_1"
+ ],
+ "infra_step": true,
+ "name": "rmtree [CLEANUP]/tar-example_tmp_1"
+ },
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipe_modules/tar/tests/full.expected/mac.json b/recipe_modules/tar/tests/full.expected/mac.json
new file mode 100644
index 0000000..1b79076
--- /dev/null
+++ b/recipe_modules/tar/tests/full.expected/mac.json
@@ -0,0 +1,180 @@
+[
+ {
+ "cmd": [
+ "touch",
+ "[CLEANUP]/tar-example_tmp_1/a"
+ ],
+ "name": "touch a"
+ },
+ {
+ "cmd": [
+ "touch",
+ "[CLEANUP]/tar-example_tmp_1/b"
+ ],
+ "name": "touch b"
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[CLEANUP]/tar-example_tmp_1/sub/dir"
+ ],
+ "infra_step": true,
+ "name": "mkdirs"
+ },
+ {
+ "cmd": [
+ "touch",
+ "[CLEANUP]/tar-example_tmp_1/sub/dir/c"
+ ],
+ "name": "touch c"
+ },
+ {
+ "cmd": [],
+ "name": "ensure bsdtar"
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "copy",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "name": "ensure bsdtar.read manifest",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@{@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@ \"path\": \"path/to/bsdtar\",@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@ \"version\": \"version:pinned-version\"@@@",
+ "@@@STEP_LOG_LINE@tool_manifest.json@}@@@",
+ "@@@STEP_LOG_END@tool_manifest.json@@@"
+ ]
+ },
+ {
+ "cmd": [],
+ "name": "ensure bsdtar.install path/to/bsdtar",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@1@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "ensure-directory",
+ "--mode",
+ "0777",
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version"
+ ],
+ "infra_step": true,
+ "name": "ensure bsdtar.install path/to/bsdtar.ensure package directory",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "cipd",
+ "ensure",
+ "-root",
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version",
+ "-ensure-file",
+ "path/to/bsdtar version:pinned-version",
+ "-max-threads",
+ "0",
+ "-json-output",
+ "/path/to/tmp/json"
+ ],
+ "infra_step": true,
+ "name": "ensure bsdtar.install path/to/bsdtar.ensure_installed",
+ "~followup_annotations": [
+ "@@@STEP_NEST_LEVEL@2@@@",
+ "@@@STEP_LOG_LINE@json.output@{@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"result\": {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"\": [@@@",
+ "@@@STEP_LOG_LINE@json.output@ {@@@",
+ "@@@STEP_LOG_LINE@json.output@ \"instance_id\": \"resolved-instance_id-of-version:pinned-v\", @@@",
+ "@@@STEP_LOG_LINE@json.output@ \"package\": \"path/to/bsdtar\"@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@ ]@@@",
+ "@@@STEP_LOG_LINE@json.output@ }@@@",
+ "@@@STEP_LOG_LINE@json.output@}@@@",
+ "@@@STEP_LOG_END@json.output@@@"
+ ]
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version/bsdtar",
+ "--create",
+ "-f",
+ "[CLEANUP]/tar-example_tmp_1/more.tar.gz",
+ "--gzip",
+ "-C",
+ "[CLEANUP]/tar-example_tmp_1",
+ "a",
+ "b",
+ "-C",
+ "[CLEANUP]/tar-example_tmp_1/sub",
+ "dir/c"
+ ],
+ "name": "taring more"
+ },
+ {
+ "cmd": [
+ "echo",
+ "[CLEANUP]/tar-example_tmp_1/more.tar.gz"
+ ],
+ "name": "report"
+ },
+ {
+ "cmd": [
+ "[START_DIR]/cipd_tool/path/to/bsdtar/version%3Apinned-version/bsdtar",
+ "--extract",
+ "--verbose",
+ "-f",
+ "[CLEANUP]/tar-example_tmp_1/output.tar",
+ "-C",
+ "[CLEANUP]/tar-example_tmp_1/output",
+ "--strip-components",
+ "1"
+ ],
+ "name": "untaring"
+ },
+ {
+ "cmd": [
+ "find"
+ ],
+ "cwd": "[CLEANUP]/tar-example_tmp_1/output",
+ "name": "listing"
+ },
+ {
+ "cmd": [
+ "vpython3",
+ "-u",
+ "RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
+ "--json-output",
+ "/path/to/tmp/json",
+ "rmtree",
+ "[CLEANUP]/tar-example_tmp_1"
+ ],
+ "infra_step": true,
+ "name": "rmtree [CLEANUP]/tar-example_tmp_1"
+ },
+ {
+ "name": "$result"
+ }
+]
\ No newline at end of file
diff --git a/recipe_modules/tar/tests/full.py b/recipe_modules/tar/tests/full.py
new file mode 100644
index 0000000..0b3d03a
--- /dev/null
+++ b/recipe_modules/tar/tests/full.py
@@ -0,0 +1,51 @@
+# Copyright 2017 The Fuchsia Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+DEPS = [
+ "flutter/tar",
+ "fuchsia/status_check",
+ "recipe_engine/context",
+ "recipe_engine/file",
+ "recipe_engine/path",
+ "recipe_engine/platform",
+ "recipe_engine/step",
+]
+
+
+def RunSteps(api):
+ # Prepare files.
+ temp = api.path.mkdtemp("tar-example")
+ api.step("touch a", ["touch", temp.join("a")])
+ api.step("touch b", ["touch", temp.join("b")])
+ api.file.ensure_directory("mkdirs", temp.join("sub", "dir"))
+ api.step("touch c", ["touch", temp.join("sub", "dir", "c")])
+
+ # Build a tar file.
+ archive = api.tar.create(temp.join("more.tar.gz"), compression="gzip")
+ archive.add(temp.join("a"), temp)
+ with api.context(cwd=temp):
+ archive.add(temp.join("b"))
+ archive.add(temp.join("sub", "dir", "c"), temp.join("sub"))
+ archive.tar("taring more")
+
+ # Coverage for 'output' property.
+ api.step("report", ["echo", archive.path])
+
+ # Extract the archive into a directory stripping one path component.
+ api.tar.extract(
+ "untaring",
+ temp.join("output.tar"),
+ directory=temp.join("output"),
+ strip_components=1,
+ )
+ # List untarped content.
+ with api.context(cwd=temp.join("output")):
+ api.step("listing", ["find"])
+ # Clean up.
+ api.file.rmtree("rmtree %s" % temp, temp)
+
+
+def GenTests(api):
+ for platform in ("linux", "mac"):
+ yield api.status_check.test(platform) + api.platform.name(platform)
diff --git a/recipe_modules/vdl/examples/full.expected/ensure_vdl.json b/recipe_modules/vdl/examples/full.expected/ensure_vdl.json
index b4f6efe..fa24d6f 100644
--- a/recipe_modules/vdl/examples/full.expected/ensure_vdl.json
+++ b/recipe_modules/vdl/examples/full.expected/ensure_vdl.json
@@ -328,7 +328,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"infra_step": true,
diff --git a/recipes/devicelab/devicelab_drone.expected/no-upload-metrics-linux-staging.json b/recipes/devicelab/devicelab_drone.expected/no-upload-metrics-linux-staging.json
index a70f09c..d2165ce 100644
--- a/recipes/devicelab/devicelab_drone.expected/no-upload-metrics-linux-staging.json
+++ b/recipes/devicelab/devicelab_drone.expected/no-upload-metrics-linux-staging.json
@@ -1132,8 +1132,8 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
- "-paths",
- "[CLEANUP]/results_tmp_1:results"
+ "-paths-json",
+ "[[\"[CLEANUP]/results_tmp_1\", \"results\"]]"
],
"cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk/dev/devicelab",
"env": {
diff --git a/recipes/devicelab/devicelab_drone.expected/suppress-logs.json b/recipes/devicelab/devicelab_drone.expected/suppress-logs.json
index 282acf9..31d9287 100644
--- a/recipes/devicelab/devicelab_drone.expected/suppress-logs.json
+++ b/recipes/devicelab/devicelab_drone.expected/suppress-logs.json
@@ -1142,8 +1142,8 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
- "-paths",
- "[CLEANUP]/results_tmp_1:results"
+ "-paths-json",
+ "[[\"[CLEANUP]/results_tmp_1\", \"results\"]]"
],
"cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk/dev/devicelab",
"env": {
diff --git a/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json b/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
index e37593e..1887e6d 100644
--- a/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
+++ b/recipes/devicelab/devicelab_drone.expected/upload-metrics-mac.json
@@ -1955,8 +1955,8 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
- "-paths",
- "[CLEANUP]/results_tmp_1:results"
+ "-paths-json",
+ "[[\"[CLEANUP]/results_tmp_1\", \"results\"]]"
],
"cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk/dev/devicelab",
"env": {
diff --git a/recipes/devicelab/devicelab_test_drone.expected/basic.json b/recipes/devicelab/devicelab_test_drone.expected/basic.json
index 3f94b94..f625ccc 100644
--- a/recipes/devicelab/devicelab_test_drone.expected/basic.json
+++ b/recipes/devicelab/devicelab_test_drone.expected/basic.json
@@ -1465,8 +1465,8 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
- "-paths",
- "[CLEANUP]/results_tmp_1:results"
+ "-paths-json",
+ "[[\"[CLEANUP]/results_tmp_1\", \"results\"]]"
],
"cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk/dev/devicelab",
"env": {
diff --git a/recipes/devicelab/devicelab_test_drone.expected/no-upload-metrics-linux-staging.json b/recipes/devicelab/devicelab_test_drone.expected/no-upload-metrics-linux-staging.json
index 2b8c982..d9d41f0 100644
--- a/recipes/devicelab/devicelab_test_drone.expected/no-upload-metrics-linux-staging.json
+++ b/recipes/devicelab/devicelab_test_drone.expected/no-upload-metrics-linux-staging.json
@@ -1165,8 +1165,8 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
- "-paths",
- "[CLEANUP]/results_tmp_1:results"
+ "-paths-json",
+ "[[\"[CLEANUP]/results_tmp_1\", \"results\"]]"
],
"cwd": "[CLEANUP]/tmp_tmp_1/flutter sdk/dev/devicelab",
"env": {
diff --git a/recipes/engine/engine_builder.expected/Schedule two builds one with goma and one without.json b/recipes/engine/engine_builder.expected/Schedule two builds one with goma and one without.json
index 61a7a29..5b33b04 100644
--- a/recipes/engine/engine_builder.expected/Schedule two builds one with goma and one without.json
+++ b/recipes/engine/engine_builder.expected/Schedule two builds one with goma and one without.json
@@ -1398,12 +1398,8 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
- "-paths",
- "[CACHE]/builder/src:out/android_debug_unopt/libflutter.so",
- "-paths",
- "[CACHE]/builder/src:out/host_debug_unopt/shell_unittests",
- "-paths",
- "[CACHE]/builder/src:out/android_debug_unopt/some_dir"
+ "-paths-json",
+ "[[\"[CACHE]/builder/src\", \"out/android_debug_unopt/libflutter.so\"], [\"[CACHE]/builder/src\", \"out/host_debug_unopt/shell_unittests\"], [\"[CACHE]/builder/src\", \"out/android_debug_unopt/some_dir\"]]"
],
"cwd": "[CACHE]/builder",
"infra_step": true,
diff --git a/recipes/engine/femu_test.expected/arm64_emulator_arch.json b/recipes/engine/femu_test.expected/arm64_emulator_arch.json
index ef85e61..05ed51e 100644
--- a/recipes/engine/femu_test.expected/arm64_emulator_arch.json
+++ b/recipes/engine/femu_test.expected/arm64_emulator_arch.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2882,10 +2882,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/femu_test.expected/dangerous_test_commands.json b/recipes/engine/femu_test.expected/dangerous_test_commands.json
index c9d2303..1f45504 100644
--- a/recipes/engine/femu_test.expected/dangerous_test_commands.json
+++ b/recipes/engine/femu_test.expected/dangerous_test_commands.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
diff --git a/recipes/engine/femu_test.expected/femu_vdl_with_package_list.json b/recipes/engine/femu_test.expected/femu_vdl_with_package_list.json
index 6e734ef..872e351 100644
--- a/recipes/engine/femu_test.expected/femu_vdl_with_package_list.json
+++ b/recipes/engine/femu_test.expected/femu_vdl_with_package_list.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2895,10 +2895,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/femu_test.expected/invalid_emulator_arch.json b/recipes/engine/femu_test.expected/invalid_emulator_arch.json
index 68380ce..a3eae8b 100644
--- a/recipes/engine/femu_test.expected/invalid_emulator_arch.json
+++ b/recipes/engine/femu_test.expected/invalid_emulator_arch.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2875,10 +2875,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/femu_test.expected/multiple_non_root_fars.json b/recipes/engine/femu_test.expected/multiple_non_root_fars.json
index 336000f..538ff15 100644
--- a/recipes/engine/femu_test.expected/multiple_non_root_fars.json
+++ b/recipes/engine/femu_test.expected/multiple_non_root_fars.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2885,10 +2885,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/femu_test.expected/no_zircon_file.json b/recipes/engine/femu_test.expected/no_zircon_file.json
index 4a6835b..1aeefa3 100644
--- a/recipes/engine/femu_test.expected/no_zircon_file.json
+++ b/recipes/engine/femu_test.expected/no_zircon_file.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
diff --git a/recipes/engine/femu_test.expected/run_on_test_specified_arch.json b/recipes/engine/femu_test.expected/run_on_test_specified_arch.json
index 5600270..7497a09 100644
--- a/recipes/engine/femu_test.expected/run_on_test_specified_arch.json
+++ b/recipes/engine/femu_test.expected/run_on_test_specified_arch.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2913,10 +2913,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/femu_test.expected/run_with_dart_aot_behavior.json b/recipes/engine/femu_test.expected/run_with_dart_aot_behavior.json
index 5549f7c..bdeb15f 100644
--- a/recipes/engine/femu_test.expected/run_with_dart_aot_behavior.json
+++ b/recipes/engine/femu_test.expected/run_with_dart_aot_behavior.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2888,10 +2888,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/femu_test.expected/start_femu_with_vdl.json b/recipes/engine/femu_test.expected/start_femu_with_vdl.json
index 009fc96..237ed53 100644
--- a/recipes/engine/femu_test.expected/start_femu_with_vdl.json
+++ b/recipes/engine/femu_test.expected/start_femu_with_vdl.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2887,10 +2887,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/femu_test.expected/test_run_command.json b/recipes/engine/femu_test.expected/test_run_command.json
index 832a5fd..1bfa015 100644
--- a/recipes/engine/femu_test.expected/test_run_command.json
+++ b/recipes/engine/femu_test.expected/test_run_command.json
@@ -1498,7 +1498,7 @@
"--json-output",
"/path/to/tmp/json",
"copy",
- "RECIPE_MODULE[fuchsia::tar]/resources/tool_manifest.json",
+ "RECIPE_MODULE[flutter::tar]/resources/tool_manifest.json",
"/path/to/tmp/json"
],
"cwd": "[CACHE]/builder",
@@ -2887,10 +2887,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/vdl_runfiles__tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/vdl_runfiles__tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/web_engine.expected/basic.json b/recipes/engine/web_engine.expected/basic.json
index ea97478..3ef621c 100644
--- a/recipes/engine/web_engine.expected/basic.json
+++ b/recipes/engine/web_engine.expected/basic.json
@@ -1778,10 +1778,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine/web_engine_framework.expected/linux-pre-submit.json b/recipes/engine/web_engine_framework.expected/linux-pre-submit.json
index 079d20b..2efb317 100644
--- a/recipes/engine/web_engine_framework.expected/linux-pre-submit.json
+++ b/recipes/engine/web_engine_framework.expected/linux-pre-submit.json
@@ -1879,10 +1879,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/cas-directory_tmp_1:."
+ "debug"
],
"cwd": "[CACHE]/builder",
"env": {
diff --git a/recipes/engine_v2/builder.expected/basic.json b/recipes/engine_v2/builder.expected/basic.json
index e1989bf..169b6d1 100644
--- a/recipes/engine_v2/builder.expected/basic.json
+++ b/recipes/engine_v2/builder.expected/basic.json
@@ -280,10 +280,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"name": "Archive full build for None",
diff --git a/recipes/engine_v2/builder.expected/basic_custom_vars.json b/recipes/engine_v2/builder.expected/basic_custom_vars.json
index 1568ce8..d5cf0c4 100644
--- a/recipes/engine_v2/builder.expected/basic_custom_vars.json
+++ b/recipes/engine_v2/builder.expected/basic_custom_vars.json
@@ -611,10 +611,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"name": "Archive full build for None",
diff --git a/recipes/engine_v2/builder.expected/basic_gcs.json b/recipes/engine_v2/builder.expected/basic_gcs.json
index e1989bf..169b6d1 100644
--- a/recipes/engine_v2/builder.expected/basic_gcs.json
+++ b/recipes/engine_v2/builder.expected/basic_gcs.json
@@ -280,10 +280,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"name": "Archive full build for None",
diff --git a/recipes/engine_v2/builder.expected/dart-internal-flutter.json b/recipes/engine_v2/builder.expected/dart-internal-flutter.json
index 82ec2c1..eb08592 100644
--- a/recipes/engine_v2/builder.expected/dart-internal-flutter.json
+++ b/recipes/engine_v2/builder.expected/dart-internal-flutter.json
@@ -510,10 +510,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"luci_context": {
diff --git a/recipes/engine_v2/builder.expected/mac.json b/recipes/engine_v2/builder.expected/mac.json
index 6ac3d0f..4d171c1 100644
--- a/recipes/engine_v2/builder.expected/mac.json
+++ b/recipes/engine_v2/builder.expected/mac.json
@@ -354,10 +354,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"name": "Archive full build for None",
diff --git a/recipes/engine_v2/builder.expected/monorepo.json b/recipes/engine_v2/builder.expected/monorepo.json
index 3abe8fc..f663497 100644
--- a/recipes/engine_v2/builder.expected/monorepo.json
+++ b/recipes/engine_v2/builder.expected/monorepo.json
@@ -459,10 +459,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"luci_context": {
diff --git a/recipes/engine_v2/builder.expected/monorepo_gcs.json b/recipes/engine_v2/builder.expected/monorepo_gcs.json
index 3abe8fc..f663497 100644
--- a/recipes/engine_v2/builder.expected/monorepo_gcs.json
+++ b/recipes/engine_v2/builder.expected/monorepo_gcs.json
@@ -459,10 +459,10 @@
"projects/example-cas-server/instances/default_instance",
"-dump-digest",
"/path/to/tmp/",
+ "-paths-json",
+ "[[\"[CLEANUP]/out-cas-directory_tmp_1\", \".\"]]",
"-log-level",
- "debug",
- "-paths",
- "[CLEANUP]/out-cas-directory_tmp_1:."
+ "debug"
],
"infra_step": true,
"luci_context": {