devserver: stop importing cros_update
We already execute it as a standalone program in one codepath, so
do that all the time. This simplifies the code too, and allows us
to migrate cros_update to Python 3 before devserver.
BUG=chromium:1057760
TEST=CQ passes
Change-Id: Ia8ac2db5e053c783b7ddf8ae4ddfb65a3484d6c5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2083676
Reviewed-by: Amin Hassani <ahassani@chromium.org>
Tested-by: Mike Frysinger <vapier@chromium.org>
Commit-Queue: Mike Frysinger <vapier@chromium.org>
diff --git a/devserver.py b/devserver.py
index 72dc9e2..365d8a5 100755
--- a/devserver.py
+++ b/devserver.py
@@ -64,7 +64,6 @@
from chromite.lib.xbuddy import devserver_constants
from chromite.lib.xbuddy import downloader
from chromite.lib.xbuddy import xbuddy
-from chromite.scripts import cros_update
# Module-local log function.
def _Log(message, *args):
@@ -818,42 +817,42 @@
devserver_url = updater.GetDevserverUrl()
static_url = updater.GetStaticUrl()
+ # Command of running auto-update.
+ cmd = ['cros_update', '--hostname', host_name, '-b', build_name,
+ '--static_dir', updater.static_dir]
+
+ # The original_build's format is like: link/3428.210.0
+ # The corresponding release_archive_url's format is like:
+ # gs://chromeos-releases/stable-channel/link/3428.210.0
+ if original_build:
+ release_archive_url = _build_uri_from_build_name(original_build)
+ # First staging the stateful.tgz synchronousely.
+ self.stage(files='stateful.tgz', is_async=False,
+ archive_url=release_archive_url)
+ cmd += ['--original_build', original_build]
+
+ if force_update:
+ cmd += ['--force_update']
+
+ if full_update:
+ cmd += ['--full_update']
+
+ if payload_filename:
+ cmd += ['--payload_filename', payload_filename]
+
+ if clobber_stateful:
+ cmd += ['--clobber_stateful']
+
+ if quick_provision:
+ cmd += ['--quick_provision']
+
+ if devserver_url:
+ cmd += ['--devserver_url', devserver_url]
+
+ if static_url:
+ cmd += ['--static_url', static_url]
+
if is_async:
- # Command of running auto-update.
- cmd = ['cros_update', '--hostname', host_name, '-b', build_name,
- '--static_dir', updater.static_dir]
-
- # The original_build's format is like: link/3428.210.0
- # The corresponding release_archive_url's format is like:
- # gs://chromeos-releases/stable-channel/link/3428.210.0
- if original_build:
- release_archive_url = _build_uri_from_build_name(original_build)
- # First staging the stateful.tgz synchronousely.
- self.stage(files='stateful.tgz', is_async=False,
- archive_url=release_archive_url)
- cmd += ['--original_build', original_build]
-
- if force_update:
- cmd += ['--force_update']
-
- if full_update:
- cmd += ['--full_update']
-
- if payload_filename:
- cmd += ['--payload_filename', payload_filename]
-
- if clobber_stateful:
- cmd += ['--clobber_stateful']
-
- if quick_provision:
- cmd += ['--quick_provision']
-
- if devserver_url:
- cmd += ['--devserver_url', devserver_url]
-
- if static_url:
- cmd += ['--static_url', static_url]
-
p = subprocess.Popen(cmd, preexec_fn=os.setsid)
pid = os.getpgid(p.pid)
@@ -864,12 +863,7 @@
return json.dumps((True, pid))
else:
- cros_update_trigger = cros_update.CrOSUpdateTrigger(
- host_name, build_name, updater.static_dir, force_update=force_update,
- full_update=full_update, original_build=original_build,
- payload_filename=payload_filename, quick_provision=quick_provision,
- devserver_url=devserver_url, static_url=static_url)
- cros_update_trigger.TriggerAU()
+ subprocess.check_call(cmd)
return json.dumps((True, -1))
@cherrypy.expose