Commit 0fb1097e authored by Wez's avatar Wez Committed by Commit Bot

[Fuchsia] Fix update-sdk.py not to re-download the same SDK.

The script was looking in the wrong place for the legacy SDK files.

Bug: 977018, 989335
Change-Id: Ibd7d3f8e35633af579c27f282e47487a8fc20f23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1726959
Auto-Submit: Wez <wez@chromium.org>
Commit-Queue: Kevin Marshall <kmarshall@chromium.org>
Reviewed-by: default avatarKevin Marshall <kmarshall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#682877}
parent 0a3f1d27
...@@ -16,12 +16,10 @@ import sys ...@@ -16,12 +16,10 @@ import sys
import tarfile import tarfile
import tempfile import tempfile
from common import GetHostOsFromPlatform, GetHostArchFromPlatform, SDK_ROOT, \ from common import GetHostOsFromPlatform, GetHostArchFromPlatform, \
IMAGES_ROOT DIR_SOURCE_ROOT, SDK_ROOT, IMAGES_ROOT
REPOSITORY_ROOT = os.path.abspath(os.path.join( sys.path.append(os.path.join(DIR_SOURCE_ROOT, 'build'))
os.path.dirname(__file__), '..', '..'))
sys.path.append(os.path.join(REPOSITORY_ROOT, 'build'))
import find_depot_tools import find_depot_tools
...@@ -85,13 +83,14 @@ def EnsureDirExists(path): ...@@ -85,13 +83,14 @@ def EnsureDirExists(path):
os.makedirs(path) os.makedirs(path)
# Removes previous SDK from the specified path if it's detected there. # Removes legacy SDK if it's detected.
def Cleanup(): def CleanupLegacySDK():
hash_file = os.path.join(SDK_ROOT, '.hash') legacy_sdk_root = os.path.join(DIR_SOURCE_ROOT, 'third_party', 'fuchsia-sdk')
hash_file = os.path.join(legacy_sdk_root, '.hash')
if os.path.exists(hash_file): if os.path.exists(hash_file):
print('Removing old SDK from %s.' % SDK_ROOT) print('Removing legacy SDK.')
for d in SDK_SUBDIRS: for d in SDK_SUBDIRS:
to_remove = os.path.join(SDK_ROOT, d) to_remove = os.path.join(legacy_sdk_root, d)
if os.path.isdir(to_remove): if os.path.isdir(to_remove):
shutil.rmtree(to_remove) shutil.rmtree(to_remove)
os.remove(hash_file) os.remove(hash_file)
...@@ -150,7 +149,7 @@ def main(): ...@@ -150,7 +149,7 @@ def main():
# Previously SDK was unpacked in //third_party/fuchsia-sdk instead of # Previously SDK was unpacked in //third_party/fuchsia-sdk instead of
# //third_party/fuchsia-sdk/sdk . Remove the old files if they are still # //third_party/fuchsia-sdk/sdk . Remove the old files if they are still
# there. # there.
Cleanup() CleanupLegacySDK()
sdk_hash = GetSdkHashForPlatform() sdk_hash = GetSdkHashForPlatform()
if not sdk_hash: if not sdk_hash:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment