[go: nahoru, domu]

Reland #2 chromeos: Add only the current SDK version's items to a test's data.

This is a reland of 1d040ab9e07f3f9a5c5777f06958591752ae53c4

Reason for reland: The fix is to determine cros_is_vm by checking for
VM image's location, instead of if it's a board suspected of having
a QEMU image.

Original change's description:
> Reland "chromeos: Add only the current SDK version's items to a test's data."
>
> This is a reland of 3a8d37c30ccdc64dc46acb7e92f01adbb8fc9157
>
> Reland fix:
>  - Only adds the needed test data if `cros_sdk_version != ""`
>
> That will prevent ebuild invocations from trying to add non-existant
> items to data (since the ebuild doesn't use the cros chrome-sdk cache).
>
> Original change's description:
> > chromeos: Add only the current SDK version's items to a test's data.
> >
> > Instead of adding every version of a given item, this will add only the
> > current version's. This is a bit tricky since individual versions of an
> > item are keyed by symlink. And since isolate doesn't follow symlinks,
> > we have to follow them ourselves.
> >
> > Bug: 1027382
> > Change-Id: I6b3ea4ec15de3804e99fd6af768daac64f490d5b
> > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1931155
> > Commit-Queue: Ben Pastene <bpastene@chromium.org>
> > Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> > Cr-Commit-Position: refs/heads/master@{#771959}
>
> Bug: 1027382
> Change-Id: I2ff8c8452f5f6f43e178d547e963b6f8b7d17166
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218581
> Reviewed-by: Nico Weber <thakis@chromium.org>
> Reviewed-by: Dirk Pranke <dpranke@chromium.org>
> Commit-Queue: Ben Pastene <bpastene@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#774341}

Bug: 1027382
Change-Id: Iee6e3e5300833bf6d90adac2749e371c2bd6c6c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2239166
Commit-Queue: Ben Pastene <bpastene@chromium.org>
Reviewed-by: Dirk Pranke <dpranke@chromium.org>
Cr-Commit-Position: refs/heads/master@{#777172}
diff --git a/build/get_symlink_targets.py b/build/get_symlink_targets.py
new file mode 100755
index 0000000..3285ff1
--- /dev/null
+++ b/build/get_symlink_targets.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+# Copyright (c) 2019 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+"""Prints the target paths of the given symlinks.
+
+Prints out each target in the order that the links were passed in.
+"""
+
+import os
+import sys
+
+
+def main():
+  for link_name in sys.argv[1:]:
+    if not os.path.islink(link_name):
+      sys.stderr.write("%s is not a link" % link_name)
+      return 1
+    target = os.readlink(link_name)
+    if not os.path.isabs(target):
+      target = os.path.join(os.path.dirname(link_name), target)
+    print(os.path.realpath(target))
+  return 0
+
+
+if __name__ == '__main__':
+  sys.exit(main())