Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 1 | # Copyright (c) 2012 The Chromium OS Authors. All rights reserved. |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
| 5 | """Helper class for interacting with the Dev Server.""" |
| 6 | |
| 7 | import cherrypy |
| 8 | import distutils.version |
| 9 | import errno |
| 10 | import os |
| 11 | import shutil |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 12 | |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 13 | import downloadable_artifact |
| 14 | import gsutil_util |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 15 | |
| 16 | AU_BASE = 'au' |
| 17 | NTON_DIR_SUFFIX = '_nton' |
| 18 | MTON_DIR_SUFFIX = '_mton' |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 19 | DEV_BUILD_PREFIX = 'dev' |
| 20 | |
| 21 | |
| 22 | class DevServerUtilError(Exception): |
| 23 | """Exception classes used by this module.""" |
| 24 | pass |
| 25 | |
| 26 | |
| 27 | def ParsePayloadList(payload_list): |
| 28 | """Parse and return the full/delta payload URLs. |
| 29 | |
| 30 | Args: |
| 31 | payload_list: A list of Google Storage URLs. |
| 32 | |
| 33 | Returns: |
| 34 | Tuple of 3 payloads URLs: (full, nton, mton). |
| 35 | |
| 36 | Raises: |
| 37 | DevServerUtilError: If payloads missing or invalid. |
| 38 | """ |
| 39 | full_payload_url = None |
| 40 | mton_payload_url = None |
| 41 | nton_payload_url = None |
| 42 | for payload in payload_list: |
| 43 | if '_full_' in payload: |
| 44 | full_payload_url = payload |
| 45 | elif '_delta_' in payload: |
| 46 | # e.g. chromeos_{from_version}_{to_version}_x86-generic_delta_dev.bin |
| 47 | from_version, to_version = payload.rsplit('/', 1)[1].split('_')[1:3] |
| 48 | if from_version == to_version: |
| 49 | nton_payload_url = payload |
| 50 | else: |
| 51 | mton_payload_url = payload |
| 52 | |
Chris Sosa | 781ba6d | 2012-04-11 12:44:43 -0700 | [diff] [blame] | 53 | if not full_payload_url or not nton_payload_url: |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 54 | raise DevServerUtilError( |
| 55 | 'Payloads are missing or have unexpected name formats.', payload_list) |
| 56 | |
| 57 | return full_payload_url, nton_payload_url, mton_payload_url |
| 58 | |
| 59 | |
Chris Masone | c8209f4 | 2012-04-24 13:30:34 -0700 | [diff] [blame^] | 60 | def GatherArtifactDownloads(main_staging_dir, archive_url, build, build_dir, |
| 61 | static_dir): |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 62 | """Generates artifacts that we mean to download and install for autotest. |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 63 | |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 64 | This method generates the list of artifacts we will need for autotest. These |
Chris Masone | c8209f4 | 2012-04-24 13:30:34 -0700 | [diff] [blame^] | 65 | artifacts are instances of downloadable_artifact.DownloadableArtifact. |
| 66 | |
| 67 | Note, these artifacts can be downloaded asynchronously iff |
| 68 | !artifact.Synchronous(). |
Scott Zawalski | 51ccf9e | 2012-03-28 08:16:01 -0700 | [diff] [blame] | 69 | """ |
Scott Zawalski | 51ccf9e | 2012-03-28 08:16:01 -0700 | [diff] [blame] | 70 | cmd = 'gsutil ls %s/*.bin' % archive_url |
| 71 | msg = 'Failed to get a list of payloads.' |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 72 | payload_list = gsutil_util.GSUtilRun(cmd, msg).splitlines() |
Scott Zawalski | 51ccf9e | 2012-03-28 08:16:01 -0700 | [diff] [blame] | 73 | |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 74 | # First we gather the urls/paths for the update payloads. |
| 75 | full_url, nton_url, mton_url = ParsePayloadList(payload_list) |
Scott Zawalski | 51ccf9e | 2012-03-28 08:16:01 -0700 | [diff] [blame] | 76 | |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 77 | full_payload = os.path.join(build_dir, downloadable_artifact.ROOT_UPDATE) |
| 78 | nton_payload = os.path.join(build_dir, AU_BASE, build + NTON_DIR_SUFFIX, |
| 79 | downloadable_artifact.ROOT_UPDATE) |
Scott Zawalski | 51ccf9e | 2012-03-28 08:16:01 -0700 | [diff] [blame] | 80 | |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 81 | artifacts = [] |
| 82 | artifacts.append(downloadable_artifact.DownloadableArtifact(full_url, |
| 83 | main_staging_dir, full_payload, synchronous=True)) |
| 84 | artifacts.append(downloadable_artifact.AUTestPayload(nton_url, |
| 85 | main_staging_dir, nton_payload)) |
Chris Sosa | 781ba6d | 2012-04-11 12:44:43 -0700 | [diff] [blame] | 86 | if mton_url: |
| 87 | mton_payload = os.path.join(build_dir, AU_BASE, build + MTON_DIR_SUFFIX, |
| 88 | downloadable_artifact.ROOT_UPDATE) |
| 89 | artifacts.append(downloadable_artifact.AUTestPayload( |
| 90 | mton_url, main_staging_dir, mton_payload)) |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 91 | |
| 92 | # Next we gather the miscellaneous payloads. |
Chris Masone | c8209f4 | 2012-04-24 13:30:34 -0700 | [diff] [blame^] | 93 | debug_url = archive_url + '/' + downloadable_artifact.DEBUG_SYMBOLS |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 94 | stateful_url = archive_url + '/' + downloadable_artifact.STATEFUL_UPDATE |
| 95 | autotest_url = archive_url + '/' + downloadable_artifact.AUTOTEST_PACKAGE |
| 96 | test_suites_url = (archive_url + '/' + |
| 97 | downloadable_artifact.TEST_SUITES_PACKAGE) |
| 98 | |
| 99 | stateful_payload = os.path.join(build_dir, |
| 100 | downloadable_artifact.STATEFUL_UPDATE) |
| 101 | |
Chris Masone | c8209f4 | 2012-04-24 13:30:34 -0700 | [diff] [blame^] | 102 | artifacts.append(downloadable_artifact.DebugTarball( |
| 103 | debug_url, main_staging_dir, static_dir)) |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 104 | artifacts.append(downloadable_artifact.DownloadableArtifact( |
| 105 | stateful_url, main_staging_dir, stateful_payload, synchronous=True)) |
| 106 | artifacts.append(downloadable_artifact.AutotestTarball( |
| 107 | autotest_url, main_staging_dir, build_dir)) |
| 108 | artifacts.append(downloadable_artifact.Tarball( |
| 109 | test_suites_url, main_staging_dir, build_dir, synchronous=True)) |
| 110 | return artifacts |
Scott Zawalski | 51ccf9e | 2012-03-28 08:16:01 -0700 | [diff] [blame] | 111 | |
| 112 | |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 113 | def PrepareBuildDirectory(build_dir): |
| 114 | """Preliminary staging of installation directory for build. |
Scott Zawalski | 51ccf9e | 2012-03-28 08:16:01 -0700 | [diff] [blame] | 115 | |
| 116 | Args: |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 117 | build_dir: Directory to install build components into. |
| 118 | """ |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 119 | if not os.path.isdir(build_dir): |
| 120 | os.path.makedirs(build_dir) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 121 | |
| 122 | # Create blank chromiumos_test_image.bin. Otherwise the Dev Server will |
| 123 | # try to rebuild it unnecessarily. |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 124 | test_image = os.path.join(build_dir, downloadable_artifact.TEST_IMAGE) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 125 | open(test_image, 'a').close() |
| 126 | |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 127 | |
| 128 | def SafeSandboxAccess(static_dir, path): |
| 129 | """Verify that the path is in static_dir. |
| 130 | |
| 131 | Args: |
| 132 | static_dir: Directory where builds are served from. |
| 133 | path: Path to verify. |
| 134 | |
| 135 | Returns: |
| 136 | True if path is in static_dir, False otherwise |
| 137 | """ |
| 138 | static_dir = os.path.realpath(static_dir) |
| 139 | path = os.path.realpath(path) |
| 140 | return (path.startswith(static_dir) and path != static_dir) |
| 141 | |
| 142 | |
| 143 | def AcquireLock(static_dir, tag): |
| 144 | """Acquires a lock for a given tag. |
| 145 | |
| 146 | Creates a directory for the specified tag, telling other |
| 147 | components the resource/task represented by the tag is unavailable. |
| 148 | |
| 149 | Args: |
| 150 | static_dir: Directory where builds are served from. |
| 151 | tag: Unique resource/task identifier. Use '/' for nested tags. |
| 152 | |
| 153 | Returns: |
| 154 | Path to the created directory or None if creation failed. |
| 155 | |
| 156 | Raises: |
| 157 | DevServerUtilError: If lock can't be acquired. |
| 158 | """ |
| 159 | build_dir = os.path.join(static_dir, tag) |
| 160 | if not SafeSandboxAccess(static_dir, build_dir): |
Chris Sosa | 9164ca3 | 2012-03-28 11:04:50 -0700 | [diff] [blame] | 161 | raise DevServerUtilError('Invalid tag "%s".' % tag) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 162 | |
| 163 | try: |
| 164 | os.makedirs(build_dir) |
| 165 | except OSError, e: |
| 166 | if e.errno == errno.EEXIST: |
| 167 | raise DevServerUtilError(str(e)) |
| 168 | else: |
| 169 | raise |
| 170 | |
| 171 | return build_dir |
| 172 | |
| 173 | |
| 174 | def ReleaseLock(static_dir, tag): |
| 175 | """Releases the lock for a given tag. Removes lock directory content. |
| 176 | |
| 177 | Args: |
| 178 | static_dir: Directory where builds are served from. |
| 179 | tag: Unique resource/task identifier. Use '/' for nested tags. |
| 180 | |
| 181 | Raises: |
| 182 | DevServerUtilError: If lock can't be released. |
| 183 | """ |
| 184 | build_dir = os.path.join(static_dir, tag) |
| 185 | if not SafeSandboxAccess(static_dir, build_dir): |
| 186 | raise DevServerUtilError('Invaid tag "%s".' % tag) |
| 187 | |
| 188 | shutil.rmtree(build_dir) |
| 189 | |
| 190 | |
| 191 | def FindMatchingBoards(static_dir, board): |
| 192 | """Returns a list of boards given a partial board name. |
| 193 | |
| 194 | Args: |
| 195 | static_dir: Directory where builds are served from. |
| 196 | board: Partial board name for this build; e.g. x86-generic. |
| 197 | |
| 198 | Returns: |
| 199 | Returns a list of boards given a partial board. |
| 200 | """ |
| 201 | return [brd for brd in os.listdir(static_dir) if board in brd] |
| 202 | |
| 203 | |
| 204 | def FindMatchingBuilds(static_dir, board, build): |
| 205 | """Returns a list of matching builds given a board and partial build. |
| 206 | |
| 207 | Args: |
| 208 | static_dir: Directory where builds are served from. |
| 209 | board: Partial board name for this build; e.g. x86-generic-release. |
| 210 | build: Partial build string to look for; e.g. R17-1234. |
| 211 | |
| 212 | Returns: |
| 213 | Returns a list of (board, build) tuples given a partial board and build. |
| 214 | """ |
| 215 | matches = [] |
| 216 | for brd in FindMatchingBoards(static_dir, board): |
| 217 | a = [(brd, bld) for bld in |
| 218 | os.listdir(os.path.join(static_dir, brd)) if build in bld] |
| 219 | matches.extend(a) |
| 220 | return matches |
| 221 | |
| 222 | |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 223 | def GetLatestBuildVersion(static_dir, target, milestone=None): |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 224 | """Retrieves the latest build version for a given board. |
| 225 | |
| 226 | Args: |
| 227 | static_dir: Directory where builds are served from. |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 228 | target: The build target, typically a combination of the board and the |
| 229 | type of build e.g. x86-mario-release. |
| 230 | milestone: For latest build set to None, for builds only in a specific |
| 231 | milestone set to a str of format Rxx (e.g. R16). Default: None. |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 232 | |
| 233 | Returns: |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 234 | If latest found, a full build string is returned e.g. R17-1234.0.0-a1-b983. |
| 235 | If no latest is found for some reason or another a '' string is returned. |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 236 | |
| 237 | Raises: |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 238 | DevServerUtilError: If for some reason the latest build cannot be |
| 239 | deteremined, this could be due to the dir not existing or no builds |
| 240 | being present after filtering on milestone. |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 241 | """ |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 242 | target_path = os.path.join(static_dir, target) |
| 243 | if not os.path.isdir(target_path): |
| 244 | raise DevServerUtilError('Cannot find path %s' % target_path) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 245 | |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 246 | builds = [distutils.version.LooseVersion(build) for build in |
| 247 | os.listdir(target_path)] |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 248 | |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 249 | if milestone and builds: |
| 250 | # Check if milestone Rxx is in the string representation of the build. |
| 251 | builds = filter(lambda x: milestone.upper() in str(x), builds) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 252 | |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 253 | if not builds: |
| 254 | raise DevServerUtilError('Could not determine build for %s' % target) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 255 | |
Scott Zawalski | 1695453 | 2012-03-20 15:31:36 -0400 | [diff] [blame] | 256 | return str(max(builds)) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 257 | |
| 258 | |
| 259 | def CloneBuild(static_dir, board, build, tag, force=False): |
| 260 | """Clone an official build into the developer sandbox. |
| 261 | |
| 262 | Developer sandbox directory must already exist. |
| 263 | |
| 264 | Args: |
| 265 | static_dir: Directory where builds are served from. |
| 266 | board: Fully qualified board name; e.g. x86-generic-release. |
| 267 | build: Fully qualified build string; e.g. R17-1234.0.0-a1-b983. |
| 268 | tag: Unique resource/task identifier. Use '/' for nested tags. |
| 269 | force: Force re-creation of build_dir even if it already exists. |
| 270 | |
| 271 | Returns: |
| 272 | The path to the new build. |
| 273 | """ |
| 274 | # Create the developer build directory. |
| 275 | dev_static_dir = os.path.join(static_dir, DEV_BUILD_PREFIX) |
| 276 | dev_build_dir = os.path.join(dev_static_dir, tag) |
| 277 | official_build_dir = os.path.join(static_dir, board, build) |
| 278 | cherrypy.log('Cloning %s -> %s' % (official_build_dir, dev_build_dir), |
| 279 | 'DEVSERVER_UTIL') |
| 280 | dev_build_exists = False |
| 281 | try: |
| 282 | AcquireLock(dev_static_dir, tag) |
| 283 | except DevServerUtilError: |
| 284 | dev_build_exists = True |
| 285 | if force: |
| 286 | dev_build_exists = False |
| 287 | ReleaseLock(dev_static_dir, tag) |
| 288 | AcquireLock(dev_static_dir, tag) |
| 289 | |
| 290 | # Make a copy of the official build, only take necessary files. |
| 291 | if not dev_build_exists: |
Chris Sosa | 47a7d4e | 2012-03-28 11:26:55 -0700 | [diff] [blame] | 292 | copy_list = [downloadable_artifact.TEST_IMAGE, |
| 293 | downloadable_artifact.ROOT_UPDATE, |
| 294 | downloadable_artifact.STATEFUL_UPDATE] |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 295 | for f in copy_list: |
| 296 | shutil.copy(os.path.join(official_build_dir, f), dev_build_dir) |
| 297 | |
| 298 | return dev_build_dir |
| 299 | |
Scott Zawalski | 84a39c9 | 2012-01-13 15:12:42 -0500 | [diff] [blame] | 300 | |
| 301 | def GetControlFile(static_dir, build, control_path): |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 302 | """Attempts to pull the requested control file from the Dev Server. |
| 303 | |
| 304 | Args: |
| 305 | static_dir: Directory where builds are served from. |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 306 | build: Fully qualified build string; e.g. R17-1234.0.0-a1-b983. |
| 307 | control_path: Path to control file on Dev Server relative to Autotest root. |
| 308 | |
| 309 | Raises: |
| 310 | DevServerUtilError: If lock can't be acquired. |
| 311 | |
| 312 | Returns: |
| 313 | Content of the requested control file. |
| 314 | """ |
Scott Zawalski | 1572d15 | 2012-01-16 14:36:02 -0500 | [diff] [blame] | 315 | # Be forgiving if the user passes in the control_path with a leading / |
| 316 | control_path = control_path.lstrip('/') |
Scott Zawalski | 84a39c9 | 2012-01-13 15:12:42 -0500 | [diff] [blame] | 317 | control_path = os.path.join(static_dir, build, 'autotest', |
Scott Zawalski | 4647ce6 | 2012-01-03 17:17:28 -0500 | [diff] [blame] | 318 | control_path) |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 319 | if not SafeSandboxAccess(static_dir, control_path): |
| 320 | raise DevServerUtilError('Invaid control file "%s".' % control_path) |
| 321 | |
Scott Zawalski | 84a39c9 | 2012-01-13 15:12:42 -0500 | [diff] [blame] | 322 | if not os.path.exists(control_path): |
| 323 | # TODO(scottz): Come up with some sort of error mechanism. |
| 324 | # crosbug.com/25040 |
| 325 | return 'Unknown control path %s' % control_path |
| 326 | |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 327 | with open(control_path, 'r') as control_file: |
| 328 | return control_file.read() |
| 329 | |
| 330 | |
Scott Zawalski | 84a39c9 | 2012-01-13 15:12:42 -0500 | [diff] [blame] | 331 | def GetControlFileList(static_dir, build): |
Scott Zawalski | 4647ce6 | 2012-01-03 17:17:28 -0500 | [diff] [blame] | 332 | """List all control|control. files in the specified board/build path. |
| 333 | |
| 334 | Args: |
| 335 | static_dir: Directory where builds are served from. |
Scott Zawalski | 4647ce6 | 2012-01-03 17:17:28 -0500 | [diff] [blame] | 336 | build: Fully qualified build string; e.g. R17-1234.0.0-a1-b983. |
| 337 | |
| 338 | Raises: |
| 339 | DevServerUtilError: If path is outside of sandbox. |
| 340 | |
| 341 | Returns: |
| 342 | String of each file separated by a newline. |
| 343 | """ |
Scott Zawalski | 1572d15 | 2012-01-16 14:36:02 -0500 | [diff] [blame] | 344 | autotest_dir = os.path.join(static_dir, build, 'autotest/') |
Scott Zawalski | 4647ce6 | 2012-01-03 17:17:28 -0500 | [diff] [blame] | 345 | if not SafeSandboxAccess(static_dir, autotest_dir): |
| 346 | raise DevServerUtilError('Autotest dir not in sandbox "%s".' % autotest_dir) |
| 347 | |
| 348 | control_files = set() |
Scott Zawalski | 84a39c9 | 2012-01-13 15:12:42 -0500 | [diff] [blame] | 349 | if not os.path.exists(autotest_dir): |
| 350 | # TODO(scottz): Come up with some sort of error mechanism. |
| 351 | # crosbug.com/25040 |
| 352 | return 'Unknown build path %s' % autotest_dir |
| 353 | |
Scott Zawalski | 4647ce6 | 2012-01-03 17:17:28 -0500 | [diff] [blame] | 354 | for entry in os.walk(autotest_dir): |
| 355 | dir_path, _, files = entry |
| 356 | for file_entry in files: |
| 357 | if file_entry.startswith('control.') or file_entry == 'control': |
| 358 | control_files.add(os.path.join(dir_path, |
Chris Sosa | ea148d9 | 2012-03-06 16:22:04 -0800 | [diff] [blame] | 359 | file_entry).replace(autotest_dir, '')) |
Scott Zawalski | 4647ce6 | 2012-01-03 17:17:28 -0500 | [diff] [blame] | 360 | |
| 361 | return '\n'.join(control_files) |
| 362 | |
| 363 | |
Frank Farzan | 37761d1 | 2011-12-01 14:29:08 -0800 | [diff] [blame] | 364 | def ListAutoupdateTargets(static_dir, board, build): |
| 365 | """Returns a list of autoupdate test targets for the given board, build. |
| 366 | |
| 367 | Args: |
| 368 | static_dir: Directory where builds are served from. |
| 369 | board: Fully qualified board name; e.g. x86-generic-release. |
| 370 | build: Fully qualified build string; e.g. R17-1234.0.0-a1-b983. |
| 371 | |
| 372 | Returns: |
| 373 | List of autoupdate test targets; e.g. ['0.14.747.0-r2bf8859c-b2927_nton'] |
| 374 | """ |
| 375 | return os.listdir(os.path.join(static_dir, board, build, AU_BASE)) |