| OLD | NEW |
| 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 file_exists = self.run_command( | 145 file_exists = self.run_command( |
| 146 'ls %s' % dest_path, | 146 'ls %s' % dest_path, |
| 147 _run_command_dargs={'ignore_status': True}).exit_status == 0 | 147 _run_command_dargs={'ignore_status': True}).exit_status == 0 |
| 148 if not file_exists: | 148 if not file_exists: |
| 149 logging.error('wget failed: %s', result) | 149 logging.error('wget failed: %s', result) |
| 150 raise error.CmdError(cmd, result) | 150 raise error.CmdError(cmd, result) |
| 151 | 151 |
| 152 logging.debug('Successfully fetched %s from %s', filename, | 152 logging.debug('Successfully fetched %s from %s', filename, |
| 153 package_url) | 153 package_url) |
| 154 except error.CmdError: | 154 except error.CmdError: |
| 155 # remove whatever junk was retrieved when the get failed |
| 156 self.run_command('rm -f %s' % dest_path) |
| 157 |
| 155 raise error.PackageFetchError('%s not found in %s' % (filename, | 158 raise error.PackageFetchError('%s not found in %s' % (filename, |
| 156 package_url)) | 159 package_url)) |
| 157 | 160 |
| 158 | 161 |
| 159 class LocalFilesystemFetcher(RepositoryFetcher): | 162 class LocalFilesystemFetcher(RepositoryFetcher): |
| 160 def __init__(self, package_manager, local_dir): | 163 def __init__(self, package_manager, local_dir): |
| 161 self.run_command = package_manager._run_command | 164 self.run_command = package_manager._run_command |
| 162 self.url = local_dir | 165 self.url = local_dir |
| 163 | 166 |
| 164 | 167 |
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 if not match: | 839 if not match: |
| 837 return ('', url) | 840 return ('', url) |
| 838 group, filename = match.groups() | 841 group, filename = match.groups() |
| 839 # Generate the group prefix. | 842 # Generate the group prefix. |
| 840 group = re.sub(r'\W', '_', group) | 843 group = re.sub(r'\W', '_', group) |
| 841 # Drop the extension to get the raw test name. | 844 # Drop the extension to get the raw test name. |
| 842 testname = re.sub(r'\.tar\.bz2', '', filename) | 845 testname = re.sub(r'\.tar\.bz2', '', filename) |
| 843 # Drop any random numbers at the end of the test name if any | 846 # Drop any random numbers at the end of the test name if any |
| 844 testname = re.sub(r'\.(\d*)', '', testname) | 847 testname = re.sub(r'\.(\d*)', '', testname) |
| 845 return (group, testname) | 848 return (group, testname) |
| OLD | NEW |