LAKITU: break cros_sdk.py dep on protobuf
cros_sdk.py depends on protobuf through ts_mon and the toolchain
library. We fully remove the ts_mon dependency, since our team doesn't
care about it, and we copy the exact behavior we need from the toolchain
library to remove the toolchain library dependency.
BUG=b/237711699
TEST=presubmit
RELEASE_NOTE=None
Change-Id: I99f46747e17791a686fe0b362e6e2748d0afd4c0
diff --git a/lib/metrics.py b/lib/metrics.py
index 84af7a4..aa011e3 100644
--- a/lib/metrics.py
+++ b/lib/metrics.py
@@ -24,10 +24,8 @@
from chromite.lib import cros_logging as logging
-try:
- from infra_libs import ts_mon
-except (ImportError, RuntimeError):
- ts_mon = None
+# lakitu: don't use ts_mon, since we don't need it, and it causes problems
+ts_mon = None
# This number is chosen because 1.16^100 seconds is about
diff --git a/scripts/cros_sdk.py b/scripts/cros_sdk.py
index d319395..120cfff 100644
--- a/scripts/cros_sdk.py
+++ b/scripts/cros_sdk.py
@@ -31,6 +31,7 @@
from chromite.lib import cros_build_lib
from chromite.lib import cros_logging as logging
from chromite.lib import cros_sdk_lib
+from chromite.lib import gs
from chromite.lib import locking
from chromite.lib import namespaces
from chromite.lib import osutils
@@ -38,7 +39,6 @@
from chromite.lib import process_util
from chromite.lib import retry_util
from chromite.lib import timeout_util
-from chromite.lib import toolchain
from chromite.utils import key_value_store
@@ -89,11 +89,25 @@
MAX_UNUSED_IMAGE_GBS = 20
+def GetSdkURL(for_gsutil=False, suburl=''):
+ """Construct a Google Storage URL for accessing SDK related archives
+
+ Args:
+ for_gsutil: Do you want a URL for passing to `gsutil`?
+ suburl: A url fragment to tack onto the end
+
+ Returns:
+ The fully constructed URL
+ """
+ return gs.GetGsURL(constants.SDK_GS_BUCKET, for_gsutil=for_gsutil,
+ suburl=suburl)
+
+
def GetArchStageTarballs(version):
"""Returns the URL for a given arch/version"""
extension = {'bz2': 'tbz2', 'xz': 'tar.xz'}
return [
- toolchain.GetSdkURL(
+ GetSdkURL(
suburl='cros-sdk-%s.%s' % (version, extension[compressor]))
for compressor in COMPRESSION_PREFERENCE
]