Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: client/common_lib/base_packages.py

Issue 6539001: Merge remote branch 'cros/upstream' into master. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/autotest.git@master
Patch Set: patch Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/bin/job_unittest.py ('k') | client/common_lib/hosts/base_classes.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 """ 1 """
2 This module defines the BasePackageManager Class which provides an 2 This module defines the BasePackageManager Class which provides an
3 implementation of the packaging system API providing methods to fetch, 3 implementation of the packaging system API providing methods to fetch,
4 upload and remove packages. Site specific extensions to any of these methods 4 upload and remove packages. Site specific extensions to any of these methods
5 should inherit this class. 5 should inherit this class.
6 """ 6 """
7 7
8 import re, os, sys, traceback, subprocess, shutil, time, traceback, urlparse 8 import re, os, sys, traceback, subprocess, shutil, time, traceback, urlparse
9 import fcntl, logging 9 import fcntl, logging
10 from autotest_lib.client.common_lib import error, utils, global_config 10 from autotest_lib.client.common_lib import error, utils, global_config
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 run_cmd = 'ssh %s "cd %s && %s"' % (host, remote_path, cmd) 43 run_cmd = 'ssh %s "cd %s && %s"' % (host, remote_path, cmd)
44 44
45 else: 45 else:
46 run_cmd = "cd %s && %s" % (repo, cmd) 46 run_cmd = "cd %s && %s" % (repo, cmd)
47 47
48 if run_cmd: 48 if run_cmd:
49 return utils.run(run_cmd, ignore_status=ignore_status) 49 return utils.run(run_cmd, ignore_status=ignore_status)
50 50
51 51
52 def check_diskspace(repo, min_free=None): 52 def check_diskspace(repo, min_free=None):
53 # Note: 1 GB = 10**9 bytes (SI unit).
53 if not min_free: 54 if not min_free:
54 min_free = global_config.global_config.get_config_value('PACKAGES', 55 min_free = global_config.global_config.get_config_value('PACKAGES',
55 'minimum_free_space', 56 'minimum_free_space',
56 type=int) 57 type=int)
57 try: 58 try:
58 df = repo_run_command(repo, 'df -mP . | tail -1').stdout.split() 59 df = repo_run_command(repo,
59 free_space_gb = int(df[3])/1000.0 60 'df -PB %d . | tail -1' % 10**9).stdout.split()
61 free_space_gb = int(df[3])
60 except Exception, e: 62 except Exception, e:
61 raise error.RepoUnknownError('Unknown Repo Error: %s' % e) 63 raise error.RepoUnknownError('Unknown Repo Error: %s' % e)
62 if free_space_gb < min_free: 64 if free_space_gb < min_free:
63 raise error.RepoDiskFullError('Not enough disk space available ' 65 raise error.RepoDiskFullError('Not enough disk space available '
64 '%sg < %sg' % (free_space_gb, min_free)) 66 '%sg < %sg' % (free_space_gb, min_free))
65 67
66 68
67 def check_write(repo): 69 def check_write(repo):
68 try: 70 try:
69 repo_testfile = '.repo_test_file' 71 repo_testfile = '.repo_test_file'
(...skipping 782 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 if not match: 854 if not match:
853 return ('', url) 855 return ('', url)
854 group, filename = match.groups() 856 group, filename = match.groups()
855 # Generate the group prefix. 857 # Generate the group prefix.
856 group = re.sub(r'\W', '_', group) 858 group = re.sub(r'\W', '_', group)
857 # Drop the extension to get the raw test name. 859 # Drop the extension to get the raw test name.
858 testname = re.sub(r'\.tar\.bz2', '', filename) 860 testname = re.sub(r'\.tar\.bz2', '', filename)
859 # Drop any random numbers at the end of the test name if any 861 # Drop any random numbers at the end of the test name if any
860 testname = re.sub(r'\.(\d*)', '', testname) 862 testname = re.sub(r'\.(\d*)', '', testname)
861 return (group, testname) 863 return (group, testname)
OLDNEW
« no previous file with comments | « client/bin/job_unittest.py ('k') | client/common_lib/hosts/base_classes.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698