Telemetry-Autotest Integration: Run telemetry from Devservers.
As part of integrating telemetry into the autotest lab, we need the
devservers to extract and install telemetry for a given build.
BUG=chromium-os:37411
TEST=ran local devserver and through the rpc's downloaded the desired
build and made the rpc call to setup and stage telemetry and ensured
that it ran successfully.
Change-Id: I88cde49a177e484d8277369f6764e28a313dfd3e
Reviewed-on: https://gerrit.chromium.org/gerrit/43313
Reviewed-by: Chris Sosa <sosa@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
diff --git a/build_artifact.py b/build_artifact.py
index 19120e7..cf00238 100644
--- a/build_artifact.py
+++ b/build_artifact.py
@@ -280,29 +280,12 @@
Detects whether the tarball is compressed or not based on the file
extension and extracts the tarball into the install_path.
"""
- # Deal with exclusions.
- cmd = ['tar', 'xf', self.tmp_stage_path, '--directory', self.install_dir]
-
- # Determine how to decompress.
- tarball = os.path.basename(self.tmp_stage_path)
- if tarball.endswith('.tar.bz2'):
- cmd.append('--use-compress-prog=pbzip2')
- elif tarball.endswith('.tgz') or tarball.endswith('.tar.gz'):
- cmd.append('--gzip')
-
- if self._exclude:
- for exclude in self._exclude:
- cmd.extend(['--exclude', exclude])
-
- if self._files_to_extract:
- cmd.extend(self._files_to_extract)
-
try:
- subprocess.check_call(cmd)
- except subprocess.CalledProcessError, e:
- raise ArtifactDownloadError(
- 'An error occurred when attempting to untar %s:\n%s' %
- (self.tmp_stage_path, e))
+ common_util.ExtractTarball(self.tmp_stage_path, self.install_dir,
+ files_to_extract=self._files_to_extract,
+ excluded_files=self._exclude)
+ except common_util.CommonUtilError as e:
+ raise ArtifactDownloadError(str(e))
class AutotestTarballBuildArtifact(TarballBuildArtifact):