rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'], | RunCommand(['repo', 'init', '-u', 'http://git.chromium.org/git/manifest'], | def _FullCheckout(buildroot, rw_checkout=True, retries=_DEFAULT_RETRIES): """Performs a full checkout and clobbers any previous checkouts.""" RunCommand(['sudo', 'rm', '-rf', buildroot]) MakeDir(buildroot, parents=True) RunCommand(['repo', 'init', '-u', 'http://src.chromium.org/git/manifest'], cwd=buildroot, input='\n\... |
return GetNewestLinkFromZipBase(board, channel, zip_server_base) | try: return GetNewestLinkFromZipBase(board, channel, zip_server_base) except: Warning('Failed to get url from standard zip base. Trying rc.') return GetNewestLinkFromZipBase(board + '-rc', channel, zip_server_base) | def GetLatestZipUrl(board, channel, latest_url_base, zip_server_base): """Returns the url of the latest image zip for the given arguments. Args: board: board for the image zip. channel: channel for the image zip. latest_url_base: base url for latest links. zip_server_base: base url for zipped images. """ if latest_ur... |
num_procs = int(RunCommand('grep -c processor /proc/cpuinfo'.split(), print_cmd=False, redirect_stdout=True)) | def RepoSync(buildroot, rw_checkout=False, retries=_DEFAULT_RETRIES): """Uses repo to checkout the source code. Keyword arguments: rw_checkout -- Reconfigure repo after sync'ing to read-write. retries -- Number of retries to try before failing on the sync. """ # Get the number of processors to use with repo sync. num... | |
RunCommand(['repo', 'sync', '--jobs=%d' % (num_procs)], cwd=buildroot) | RunCommand(['repo', '--trace', 'sync'], cwd=buildroot) | def RepoSync(buildroot, rw_checkout=False, retries=_DEFAULT_RETRIES): """Uses repo to checkout the source code. Keyword arguments: rw_checkout -- Reconfigure repo after sync'ing to read-write. retries -- Number of retries to try before failing on the sync. """ # Get the number of processors to use with repo sync. num... |
passwd = urllib.quote_plus(getpass.getpass(prompt='')) | passwd = getpass.getpass(prompt='') | def Authenticate(): default_username = getpass.getuser() username = os.environ.get('GSDCURL_USERNAME') if username is None: sys.stderr.write('Username [' + default_username + ']: ') username = raw_input() if username == '': username = default_username + '@google.com' elif '@' not in username: username = username + '@go... |
'-d', 'Passwd=' + passwd, | '-d', 'Passwd=' + urllib.quote_plus(passwd), | def Authenticate(): default_username = getpass.getuser() username = os.environ.get('GSDCURL_USERNAME') if username is None: sys.stderr.write('Username [' + default_username + ']: ') username = raw_input() if username == '': username = default_username + '@google.com' elif '@' not in username: username = username + '@go... |
cmd = ['./build_packages'] | def _Build(buildroot, emptytree): """Wrapper around build_packages.""" cwd = os.path.join(buildroot, 'src', 'scripts') cmd = ['./build_packages'] if emptytree: cmd.insert(0, 'EXTRA_BOARD_FLAGS=--emptytree') RunCommand(cmd, cwd=cwd, enter_chroot=True) | |
cmd.insert(0, 'EXTRA_BOARD_FLAGS=--emptytree') | cmd = ['sh', '-c', 'EXTRA_BOARD_FLAGS=--emptytree ./build_packages'] else: cmd = ['./build_packages'] | def _Build(buildroot, emptytree): """Wrapper around build_packages.""" cwd = os.path.join(buildroot, 'src', 'scripts') cmd = ['./build_packages'] if emptytree: cmd.insert(0, 'EXTRA_BOARD_FLAGS=--emptytree') RunCommand(cmd, cwd=cwd, enter_chroot=True) |
RunCommand(unmerge_board_cmd, env=env) | RunCommand(unmerge_board_cmd) | def _CleanStalePackages(board, package_array): """Cleans up stale package info from a previous build.""" Info('Cleaning up stale packages %s.' % package_array) unmerge_board_cmd = ['emerge-%s' % board, '--unmerge'] unmerge_board_cmd.extend(package_array) RunCommand(unmerge_board_cmd, env=env) unmerge_host_cmd = ['sudo... |
RunCommand(unmerge_host_cmd, env=env) | RunCommand(unmerge_host_cmd) | def _CleanStalePackages(board, package_array): """Cleans up stale package info from a previous build.""" Info('Cleaning up stale packages %s.' % package_array) unmerge_board_cmd = ['emerge-%s' % board, '--unmerge'] unmerge_board_cmd.extend(package_array) RunCommand(unmerge_board_cmd, env=env) unmerge_host_cmd = ['sudo... |
(_CHROMIUMOS_OVERLAYS_DIRECTORY, _STABLE_BRANCH_NAME)) | (os.getcwd(), _STABLE_BRANCH_NAME)) | def _PushChange(): """Pushes changes to the git repository. Pushes locals commits from calls to CommitChange to the remote git repository specified by os.pwd. Raises: OSError: Error occurred while pushing. """ # TODO(sosa) - Add logic for buildbot to check whether other slaves have # completed and push this change o... |
os.chdir(_CHROMIUMOS_OVERLAYS_DIRECTORY) | overlay_directory = '%s/third_party/chromiumos-overlay' % gflags.FLAGS.srcroot os.chdir(overlay_directory) | def main(argv): try: argv = gflags.FLAGS(argv) if len(argv) != 2: _PrintUsageAndDie('Must specify a valid command') else: command = argv[1] except gflags.FlagsError, e : _PrintUsageAndDie(str(e)) package_list = gflags.FLAGS.packages.split() if gflags.FLAGS.commit_ids: commit_id_list = gflags.FLAGS.commit_ids.split() e... |
_CHROMIUMOS_OVERLAYS_DIRECTORY) | overlay_directory) | def main(argv): try: argv = gflags.FLAGS(argv) if len(argv) != 2: _PrintUsageAndDie('Must specify a valid command') else: command = argv[1] except gflags.FlagsError, e : _PrintUsageAndDie(str(e)) package_list = gflags.FLAGS.packages.split() if gflags.FLAGS.commit_ids: commit_id_list = gflags.FLAGS.commit_ids.split() e... |
(package_list[:index], _CHROMIUMOS_OVERLAYS_DIRECTORY)) | (package_list[:index], overlay_directory)) | def main(argv): try: argv = gflags.FLAGS(argv) if len(argv) != 2: _PrintUsageAndDie('Must specify a valid command') else: command = argv[1] except gflags.FlagsError, e : _PrintUsageAndDie(str(e)) package_list = gflags.FLAGS.packages.split() if gflags.FLAGS.commit_ids: commit_id_list = gflags.FLAGS.commit_ids.split() e... |
_RunCommand('git cl upload --desc_from_logs -m "%s"' % 'Marking set of ebuilds as stable') | description = _RunCommand('git log --format=format:%s%n%n%b ' + gflags.FLAGS.tracking_branch + '..') description = 'Marking set of ebuilds as stable\n\n%s' % description merge_branch_name = 'merge_branch' | def _PushChange(): """Pushes changes to the git repository. Pushes locals commits from calls to CommitChange to the remote git repository specified by os.pwd. Raises: OSError: Error occurred while pushing. """ # TODO(sosa) - Add logic for buildbot to check whether other slaves have # completed and push this change o... |
_RunCommand('git rebase %s' % gflags.FLAGS.tracking_branch) _RunCommand('git cl push %s' % gflags.FLAGS.push_options) | _RunCommand('git checkout -b %s %s' % ( merge_branch_name, gflags.FLAGS.tracking_branch)) try: _RunCommand('git merge --squash %s' % _STABLE_BRANCH_NAME) _RunCommand('git commit -m "%s"' % description) _RunCommand('git config push.default tracking') _RunCommand('git push') finally: _RunCommand('git checkout %s' % _STA... | def _PushChange(): """Pushes changes to the git repository. Pushes locals commits from calls to CommitChange to the remote git repository specified by os.pwd. Raises: OSError: Error occurred while pushing. """ # TODO(sosa) - Add logic for buildbot to check whether other slaves have # completed and push this change o... |
mock_file = ['EAPI=2', 'EGIT_COMMIT=old_id', 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}'] | mock_file = ['EAPI=2', 'CROS_WORKON_COMMIT=old_id', 'KEYWORDS=\"~x86 ~arm\"', 'src_unpack(){}'] | def testRevEBuild(self): self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') m_file = self.mox.CreateMock(file) |
m_file.write('EGIT_COMMIT="my_id"') | m_file.write('CROS_WORKON_COMMIT="my_id"') | def testRevEBuild(self): self.mox.StubOutWithMock(cros_mark_as_stable.fileinput, 'input') self.mox.StubOutWithMock(cros_mark_as_stable.shutil, 'copyfile') m_file = self.mox.CreateMock(file) |
_SimpleRunCommand('git remote update') | _SimpleRunCommand('repo sync .') | def PushChange(stable_branch, tracking_branch): """Pushes commits in the stable_branch to the remote git repository. Pushes locals commits from calls to CommitChange to the remote git repository specified by current working directory. Args: stable_branch: The local branch with commits we want to push. tracking_branch... |
'http://src.chromium.org/git'], cwd=buildroot) | 'http://git.chromium.org/git'], cwd=buildroot) | def RepoSync(buildroot, rw_checkout, retries=_DEFAULT_RETRIES): while retries > 0: try: RunCommand(['repo', 'sync'], cwd=buildroot) if rw_checkout: # Always re-run in case of new git repos or repo sync # failed in a previous run because of a forced Stop Build. RunCommand(['repo', 'forall', '-c', 'git', 'config', 'url.s... |
_DumpManifest(buildroot, options.url) | if not options.chrome_rev: _DumpManifest(buildroot, options.url) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-a', '--acl', default='private', help='ACL to set on GSD archives') parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option... |
if _CheckOnStabilizingBranch(): _RunCommand('git reset HEAD --hard') _RunCommand('git checkout master') | def _Clean(): """Cleans up uncommitted changes on either stabilizing branch or master.""" if _CheckOnStabilizingBranch(): _RunCommand('git reset HEAD --hard') _RunCommand('git checkout master') _RunCommand('git reset HEAD --hard') | |
self._Checkout('master', create=False) | self._Checkout(gflags.FLAGS.tracking_branch, create=False) | def Delete(self): """Deletes the branch and returns the user to the master branch. |
Return a list of tuple arguments of the failed uploads | Return a set of tuple arguments of the failed uploads | def RemoteUpload(files, pool=10): """Upload to google storage. Create a pool of process and call _GsUpload with the proper arguments. Args: files: dictionary with keys to local files and values to remote path. pool: integer of maximum proesses to have at the same time. Returns: Return a list of tuple arguments of th... |
return result.get(60*60) | return set(result.get(60*60)) | def RemoteUpload(files, pool=10): """Upload to google storage. Create a pool of process and call _GsUpload with the proper arguments. Args: files: dictionary with keys to local files and values to remote path. pool: integer of maximum proesses to have at the same time. Returns: Return a list of tuple arguments of th... |
if failed_uploads: raise UploadFailed('Error uploading:\n%s' % '\n'.join(failed_uploads)) | if len(failed_uploads) > 1 or (None not in failed_uploads): error_msg = ['%s -> %s\n' % args for args in failed_uploads] raise UploadFailed('Error uploading:\n%s' % error_msg) | def UploadPrebuilt(build_path, bucket, board=None, git_file=None): """Upload Host prebuilt files to Google Storage space. Args: build_path: The path to the root of the chroot. bucket: The Google Storage bucket to upload to. board: The board to upload to Google Storage, if this is None upload host packages. git_file: I... |
def RevGitFile(filename, value): | def RevGitPushWithRetry(retries=5): """Repo sync and then push git changes in flight. Args: retries: The number of times to retry before giving up, default: 5 Raises: GitPushFailed if push was unsuccessful after retries """ for retry in range(retries+1): try: cros_build_lib.RunCommand('repo sync .', shell=True) cros_... | def RevGitFile(filename, value): """Update and push the git file. Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd() os... |
Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. | Args: filename: file to modify that is in a git repo already value: string representing the version of the prebuilt that has been uploaded. retries: The number of times to retry before giving up, default: 5 | def RevGitFile(filename, value): """Update and push the git file. Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd() os... |
cros_build_lib.RunCommand('repo sync', shell=True) cros_build_lib.RunCommand('repo start %s .' % prebuilt_branch, shell=True) | cros_build_lib.RunCommand('repo sync .', shell=True) cros_build_lib.RunCommand('repo start %s .' % prebuilt_branch, shell=True) | def RevGitFile(filename, value): """Update and push the git file. Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd() os... |
cros_build_lib.RunCommand('repo sync', shell=True) cros_build_lib.RunCommand('git push', shell=True) | RevGitPushWithRetry(retries) | def RevGitFile(filename, value): """Update and push the git file. Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd() os... |
board=None, git_sync=False): | board=None, git_sync=False, git_sync_retries=5): | def UploadPrebuilt(build_path, upload_location, version, binhost_base_url, board=None, git_sync=False): """Upload Host prebuilt files to Google Storage space. Args: build_path: The path to the root of the chroot. upload_location: The upload location. board: The board to upload to Google Storage, if this is None upload... |
RevGitFile(git_file, url_value) | RevGitFile(git_file, url_value, retries=git_sync_retries) | def UploadPrebuilt(build_path, upload_location, version, binhost_base_url, board=None, git_sync=False): """Upload Host prebuilt files to Google Storage space. Args: build_path: The path to the root of the chroot. upload_location: The upload location. board: The board to upload to Google Storage, if this is None upload... |
def __init__(self, tests, results_dir_root=None): | def __init__(self, tests, base_ssh_port=_DEFAULT_BASE_SSH_PORT, board=None, image_path=None, results_dir_root=None): | def __init__(self, tests, results_dir_root=None): """Constructs and initializes the test runner class. |
ssh_port = self._DEFAULT_START_SSH_PORT | ssh_port = self._base_ssh_port | def _SpawnTests(self): """Spawns VMs and starts the test runs on them. |
parser.add_option('--results_dir_root', help='Root results directory.') | parser.add_option('--base_ssh_port', type='int', default=_DEFAULT_BASE_SSH_PORT, help='Base SSH port. Spawned VMs listen to localhost SSH ' 'ports incrementally allocated starting from the base one. ' '[default: %default]') parser.add_option('--board', help='The target board. If none specified, ' 'cros_run_vm_test will... | def main(): usage = 'Usage: %prog [options] tests...' parser = optparse.OptionParser(usage=usage) parser.add_option('--results_dir_root', help='Root results directory.') (options, args) = parser.parse_args() if not args: parser.print_help() Die('no tests provided') runner = ParallelTestRunner(args, options.results_di... |
runner = ParallelTestRunner(args, options.results_dir_root) | runner = ParallelTestRunner(args, options.base_ssh_port, options.board, options.image_path, options.results_dir_root) | def main(): usage = 'Usage: %prog [options] tests...' parser = optparse.OptionParser(usage=usage) parser.add_option('--results_dir_root', help='Root results directory.') (options, args) = parser.parse_args() if not args: parser.print_help() Die('no tests provided') runner = ParallelTestRunner(args, options.results_di... |
cbuildbot._FullCheckout(options.buildroot, rw_checkout=False, retries=_NUMBER_OF_RETRIES) | cbuildbot._FullCheckout(options.buildroot, options.tracking_branch, rw_checkout=False, retries=_NUMBER_OF_RETRIES) | def main(): parser = optparse.OptionParser() parser.add_option('-r', '--buildroot', help='root directory where sync occurs') parser.add_option('-c', '--clobber', action='store_true', default=False, help='clobber build directory and do a full checkout') (options, args) = parser.parse_args() if options.buildroot: if opti... |
logging.info('Using tempdir = %s', temp_dir) | logging.debug('Using tempdir = %s', temp_dir) | def CreateTempDir(): """Creates a tempdir and returns the name of the tempdir.""" temp_dir = tempfile.mkdtemp(suffix='au', prefix='tmp') logging.info('Using tempdir = %s', temp_dir) return temp_dir |
logging.info('Running ldd on %s', file_name) | logging.debug('Running ldd on %s', file_name) | def DepsToCopy(ldd_files, black_list): """Returns a list of deps for a given dynamic executables list. Args: ldd_files: List of dynamic files that needs to have the deps evaluated black_list: List of files that we should ignore Returns: library_list: List of files that are dependencies """ for file_name in ldd_files: l... |
logging.info('Copying file %s to %s', file_name, dest_files_root) | logging.debug('Copying file %s to %s', file_name, dest_files_root) | def CopyRequiredFiles(dest_files_root): """Generates a list of files that are required for au-generator zip file Args: dest_files_root: location of the directory where we should copy the files """ if not dest_files_root: logging.error('Invalid option passed for dest_files_root') sys.exit(1) # Files that need to go thro... |
logging.info('Processing directory %s', source_dir) | logging.debug('Processing directory %s', source_dir) | def CopyRequiredFiles(dest_files_root): """Generates a list of files that are required for au-generator zip file Args: dest_files_root: location of the directory where we should copy the files """ if not dest_files_root: logging.error('Invalid option passed for dest_files_root') sys.exit(1) # Files that need to go thro... |
logging.info('Copying directory %s to %s.', full_path, target_dir) | logging.debug('Copying directory %s to %s.', full_path, target_dir) | def CopyRequiredFiles(dest_files_root): """Generates a list of files that are required for au-generator zip file Args: dest_files_root: location of the directory where we should copy the files """ if not dest_files_root: logging.error('Invalid option passed for dest_files_root') sys.exit(1) # Files that need to go thro... |
logging.info('Removed tempdir = %s', temp_dir) | logging.debug('Removed tempdir = %s', temp_dir) | def CleanUp(temp_dir): """Cleans up the tempdir Args: temp_dir = name of the directory to cleanup """ if os.path.exists(temp_dir): shutil.rmtree(temp_dir, ignore_errors=True) logging.info('Removed tempdir = %s', temp_dir) |
logging.info('Generating zip file %s with contents from %s', base_name, | logging.debug('Generating zip file %s with contents from %s', base_name, | def GenerateZipFile(base_name, root_dir): """Returns true if able to generate zip file Args: base_name: name of the zip file root_dir: location of the directory that we should zip Returns: True if successfully generates the zip file otherwise False """ logging.info('Generating zip file %s with contents from %s', base_n... |
logging.info('Copying %s to %s', zip_file_name, output_dir) | logging.debug('Copying %s to %s', zip_file_name, output_dir) | def CopyZipToFinalDestination(output_dir, zip_file_name): """Copies the generated zip file to a final destination Args: output_dir: Directory where the file should be copied to zip_file_name: name of the zip file that should be copied Returns: True on Success False on Failure """ if not os.path.isfile(zip_file_name): l... |
RunCommand(['repo', 'sync'], cwd=buildroot) | RunCommand(['repo', 'sync', '--jobs=%d' % (num_procs)], cwd=buildroot) | def RepoSync(buildroot, rw_checkout=False, retries=_DEFAULT_RETRIES): """Uses repo to checkout the source code. Keyword arguments: rw_checkout -- Reconfigure repo after sync'ing to read-write. retries -- Number of retries to try before failing on the sync. """ while retries > 0: try: RunCommand(['repo', 'sync'], cwd=... |
self.UpdateImage(target_image_path, 'clean') | try: self.UpdateImage(target_image_path, 'clean') except: if self.use_delta_updates: Warning('Delta update failed, disabling delta updates and retrying.') self.use_delta_updates = False self.source_image = '' self.UpdateImage(target_image_path) else: raise | def testFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. |
def _BuildChrome(buildroot, board, chrome_atom_to_build): """Wrapper for emerge call to build Chrome.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['emerge-%s' % board, '=%s' % chrome_atom_to_build], cwd=cwd, enter_chroot=True) | def _Build(buildroot, emptytree): """Wrapper around build_packages.""" cwd = os.path.join(buildroot, 'src', 'scripts') if emptytree: cmd = ['sh', '-c', 'EXTRA_BOARD_FLAGS=--emptytree ./build_packages'] else: cmd = ['./build_packages'] RunCommand(cmd, cwd=cwd, enter_chroot=True) | |
if chrome_atom_to_build: _BuildChrome(buildroot, buildconfig['board'], chrome_atom_to_build) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-a', '--acl', default='private', help='ACL to set on GSD archives') parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option... | |
def RevGitFile(filename, value): | def RevGitPushWithRetry(retries=5): """Repo sync and then push git changes in flight. Args: retries: The number of times to retry before giving up, default: 5 Raises: GitPushFailed if push was unsuccessful after retries """ for retry in range(1, retries+1): try: cros_build_lib.RunCommand('repo sync .', shell=True) cr... | def RevGitFile(filename, value): """Update and push the git file. Args: filename: file to modify that is in a git repo already key: board or host package type e.g. x86-dogfood value: string representing the version of the prebuilt that has been uploaded. """ prebuilt_branch = 'prebuilt_branch' old_cwd = os.getcwd() os... |
return max(url_parser.link_list) | return reduce(_GreaterVersion, url_parser.link_list) | def GetLatestLinkFromPage(url, regex): """Returns the latest link from the given url that matches regex. Args: url: Url to download and parse. regex: Regular expression to match links against. """ url_file = urllib.urlopen(url) url_html = url_file.read() url_file.close() # Parses links with versions embedded. url_par... |
RunCommand(['gzip', '-f', image_path]) | RunCommand(['gzip', '-f', '--fast', image_path]) | def _ArchiveTestResults(buildroot, board, archive_dir, test_results_dir): """Archives the test results into the www dir for later use. Takes the results from the test_results_dir and dumps them into the archive dir specified. This also archives the last qemu image. board: Board to find the qemu image. archive_dir: ... |
cros_mark_as_stable._SimpleRunCommand( 'equery-x86-generic which %s 2> /dev/null' % self.package).AndReturn( self.ebuild_path) | cmd = ('ACCEPT_KEYWORDS="x86 arm amd64" ' 'equery-x86-generic which %s 2> /dev/null') cros_mark_as_stable._SimpleRunCommand(cmd % self.package).AndReturn( self.ebuild_path) | def testFindEBuildPath(self): self.mox.StubOutWithMock(cros_mark_as_stable, '_SimpleRunCommand') cros_mark_as_stable._SimpleRunCommand( 'equery-x86-generic which %s 2> /dev/null' % self.package).AndReturn( self.ebuild_path) self.mox.ReplayAll() path = cros_mark_as_stable._EBuild._FindEBuildPath(self.package) self.mox.V... |
def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. | def testGetLatestZipUrl(self): """Test case that tests GetLatestZipUrl with test urls.""" self.mox.StubOutWithMock(urllib, 'urlopen') m_file = self.mox.CreateMock(file) | def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. Args: download_fo... |
The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. | urllib.urlopen('%s/%s/LATEST-%s' % (self.latestbase, self.channel, self.board)).AndReturn(m_file) m_file.read().AndReturn('%s.bin.gz' % self.image_name) m_file.close() | def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. Args: download_fo... |
Args: download_folder: Absoulte path to the download folder. redirect_file: For testing. Where to copy new boot desc. """ boot_desc_path = os.path.join(download_folder, 'boot.desc') in_chroot_folder = ReinterpretPathForChroot(download_folder) | self.mox.ReplayAll() self.assertEquals(ctest.GetLatestZipUrl(self.board, self.channel, self.latestbase, self.zipbase), self.image_url) self.mox.VerifyAll() | def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. Args: download_fo... |
for line in fileinput.input(boot_desc_path, inplace=1): if not redirect_file: redirect_file = sys.stdout split_line = line.split('=') if len(split_line) > 1: var_part = split_line[0] potential_path = split_line[1].replace('"', '').strip() | def testGrabZipAndExtractImageUseCached(self): """Test case where cache holds our image.""" self.mox.StubOutWithMock(os.path, 'exists') self.mox.StubOutWithMock(__builtins__, 'open') m_file = self.mox.CreateMock(file) | def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. Args: download_fo... |
if potential_path.startswith('/home') and not 'output_dir' in var_part: new_path = os.path.join(in_chroot_folder, os.path.basename(potential_path)) new_line = '%s="%s"' % (var_part, new_path) Info('Replacing line %s with %s' % (line, new_line)) redirect_file.write('%s\n' % new_line) continue elif 'output_dir' in var_pa... | os.path.exists('%s/%s' % ( self.download_folder, 'download_url')).AndReturn(True) | def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. Args: download_fo... |
redirect_file.write(line) | open('%s/%s' % (self.download_folder, 'download_url')).AndReturn(m_file) m_file.read().AndReturn(self.image_url) m_file.close() | def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. Args: download_fo... |
fileinput.close() | os.path.exists('%s/%s' % ( self.download_folder, ctest._IMAGE_TO_EXTRACT)).AndReturn(True) self.mox.ReplayAll() ctest.GrabZipAndExtractImage(self.image_url, self.download_folder, ctest._IMAGE_TO_EXTRACT) self.mox.VerifyAll() def CommonDownloadAndExtractImage(self): """Common code to mock downloading image, unzipping ... | def ModifyBootDesc(download_folder, redirect_file=None): """Modifies the boot description of a downloaded image to work with path. The default boot.desc from another system is specific to the directory it was created in. This modifies the boot description to be compatiable with the download folder. Args: download_fo... |
def GetLatestZipUrl(board, channel, latest_url_base, zip_server_base): """Returns the url of the latest image zip for the given arguments. | def testGrabZipAndExtractImageWrongCache(self): """Test case where download_url exists but doesn't match our url.""" self.mox.StubOutWithMock(os.path, 'exists') self.mox.StubOutWithMock(os, 'mkdir') self.mox.StubOutWithMock(__builtins__, 'open') self.mox.StubOutWithMock(ctest, 'RunCommand') self.mox.StubOutWithMock(url... | def GetLatestZipUrl(board, channel, latest_url_base, zip_server_base): """Returns the url of the latest image zip for the given arguments. Args: board: board for the image zip. channel: channel for the image zip. latest_url_base: base url for latest links. zip_server_base: base url for zipped images. """ # Grab the l... |
Args: board: board for the image zip. channel: channel for the image zip. latest_url_base: base url for latest links. zip_server_base: base url for zipped images. """ latest_file_url = os.path.join(latest_url_base, channel, 'LATEST-%s' % board) latest_image_file = urllib.urlopen(latest_file_url) latest_image = latest... | m_file = self.mox.CreateMock(file) | def GetLatestZipUrl(board, channel, latest_url_base, zip_server_base): """Returns the url of the latest image zip for the given arguments. Args: board: board for the image zip. channel: channel for the image zip. latest_url_base: base url for latest links. zip_server_base: base url for zipped images. """ # Grab the l... |
latest_image = latest_image.replace('.bin.gz', '.zip') version = latest_image.split('-')[1] zip_base = os.path.join(zip_server_base, channel, board) return os.path.join(zip_base, version, latest_image) | os.path.exists('%s/%s' % ( self.download_folder, 'download_url')).AndReturn(True) | def GetLatestZipUrl(board, channel, latest_url_base, zip_server_base): """Returns the url of the latest image zip for the given arguments. Args: board: board for the image zip. channel: channel for the image zip. latest_url_base: base url for latest links. zip_server_base: base url for zipped images. """ # Grab the l... |
def GrabZipAndExtractImage(zip_url, download_folder, image_name) : """Downloads the zip and extracts the given image. | os.path.exists('%s/%s' % ( self.download_folder, ctest._IMAGE_TO_EXTRACT)).AndReturn(False) | def GrabZipAndExtractImage(zip_url, download_folder, image_name) : """Downloads the zip and extracts the given image. Doesn't re-download if matching version found already in download folder. Args: zip_url - url for the image. download_folder - download folder to store zip file and extracted images. image_name - name ... |
Doesn't re-download if matching version found already in download folder. Args: zip_url - url for the image. download_folder - download folder to store zip file and extracted images. image_name - name of the image to extract from the zip file. """ zip_path = os.path.join(download_folder, 'image.zip') versioned_url_path... | self.CommonDownloadAndExtractImage() | def GrabZipAndExtractImage(zip_url, download_folder, image_name) : """Downloads the zip and extracts the given image. Doesn't re-download if matching version found already in download folder. Args: zip_url - url for the image. download_folder - download folder to store zip file and extracted images. image_name - name ... |
main() | unittest.main() | def main(): parser = optparse.OptionParser() parser.add_option('-b', '--board', help='board for the image to compare against.') parser.add_option('-c', '--channel', help='channel for the image to compare against.') parser.add_option('-l', '--latestbase', help='Base url for latest links.') parser.add_option('-z', '--zip... |
if self.use_delta_updates: self.source_image = base_image_path | def testFullUpdateKeepStateful(self): """Tests if we can update normally. | |
try: self.UpdateImage(target_image_path) except: if self.use_delta_updates: Warning('Delta update failed, disabling delta updates and retrying.') self.use_delta_updates = False self.source_image = '' self.UpdateImage(target_image_path) else: raise | self.TryDeltaAndFallbackToFull(base_image_path, target_image_path) | def testFullUpdateKeepStateful(self): """Tests if we can update normally. |
if self.use_delta_updates: self.source_image = target_image_path | def testFullUpdateKeepStateful(self): """Tests if we can update normally. | |
self.UpdateImage(base_image_path) | self.TryDeltaAndFallbackToFull(target_image_path, base_image_path) | def testFullUpdateKeepStateful(self): """Tests if we can update normally. |
if self.use_delta_updates: self.source_image = base_image_path | def testFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. | |
try: self.UpdateImage(target_image_path, 'clean') except: if self.use_delta_updates: Warning('Delta update failed, disabling delta updates and retrying.') self.use_delta_updates = False self.source_image = '' self.UpdateImage(target_image_path) else: raise | self.TryDeltaAndFallbackToFull(base_image_path, target_image_path, 'clean') | def testFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. |
if self.use_delta_updates: self.source_image = target_image_path | def testFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. | |
self.UpdateImage(base_image_path, 'clean') | self.TryDeltaAndFallbackToFull(target_image_path, base_image_path, 'clean') | def testFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. |
cwd=cwd) | cwd=cwd, enter_chroot=True) | def _SetupBoard(buildroot, board='x86-generic'): """Wrapper around setup_board.""" cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./setup_board', '--fast', '--default', '--board=%s' % board], cwd=cwd) |
RunCommand(['./build_image'], cwd=cwd) | RunCommand(['./build_image'], cwd=cwd, enter_chroot=True) | def _BuildImage(buildroot): cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./build_image'], cwd=cwd) |
RunCommand(['./cros_run_unit_tests'], cwd=cwd) | RunCommand(['./cros_run_unit_tests'], cwd=cwd, enter_chroot=True) | def _RunUnitTests(buildroot): cwd = os.path.join(buildroot, 'src', 'scripts') RunCommand(['./cros_run_unit_tests'], cwd=cwd) |
rev_file = revisionfile.open(revisionfile) revisions = rev_file.read() rev_file.close() | try: rev_file = open(revisionfile) revisions = rev_file.read() rev_file.close() except: print >> sys.stderr, 'Error reading %s' % revisionfile revisions = None | def _UprevPackages(buildroot, revisionfile): revisions = None if (revisionfile): rev_file = revisionfile.open(revisionfile) revisions = rev_file.read() rev_file.close() # Note: Revisions == "None" indicates a Force Build. if revisions and revisions != 'None': print 'CBUILDBOT - Revision list found %s' % revisions pri... |
filter_file: file to load into FILTER_PACKAGES | filter_file: file to load into _FILTER_PACKAGES | def LoadFilterFile(filter_file): """Load a file with keywords on a per line basis. Args: filter_file: file to load into FILTER_PACKAGES """ filter_fh = open(filter_file) try: FILTER_PACKAGES.update([filter.strip() for filter in filter_fh]) finally: filter_fh.close() return FILTER_PACKAGES |
FILTER_PACKAGES.update([filter.strip() for filter in filter_fh]) | _FILTER_PACKAGES.update([filter.strip() for filter in filter_fh]) | def LoadFilterFile(filter_file): """Load a file with keywords on a per line basis. Args: filter_file: file to load into FILTER_PACKAGES """ filter_fh = open(filter_file) try: FILTER_PACKAGES.update([filter.strip() for filter in filter_fh]) finally: filter_fh.close() return FILTER_PACKAGES |
return FILTER_PACKAGES | return _FILTER_PACKAGES | def LoadFilterFile(filter_file): """Load a file with keywords on a per line basis. Args: filter_file: file to load into FILTER_PACKAGES """ filter_fh = open(filter_file) try: FILTER_PACKAGES.update([filter.strip() for filter in filter_fh]) finally: filter_fh.close() return FILTER_PACKAGES |
Skip any files that machine the list of packages to filter in FILTER_PACKAGES. Args: file_path: string of a file path to inspect against FILTER_PACKAGES | Skip any files that machine the list of packages to filter in _FILTER_PACKAGES. Args: file_path: string of a file path to inspect against _FILTER_PACKAGES | def ShouldFilterPackage(file_path): """Skip a particular file if it matches a pattern. Skip any files that machine the list of packages to filter in FILTER_PACKAGES. Args: file_path: string of a file path to inspect against FILTER_PACKAGES Returns: True if we should filter the package, False otherwise. """ for name ... |
for name in FILTER_PACKAGES: | for name in _FILTER_PACKAGES: | def ShouldFilterPackage(file_path): """Skip a particular file if it matches a pattern. Skip any files that machine the list of packages to filter in FILTER_PACKAGES. Args: file_path: string of a file path to inspect against FILTER_PACKAGES Returns: True if we should filter the package, False otherwise. """ for name ... |
pool = Pool(processes=pool) | pool = multiprocessing.Pool(processes=pool) | def RemoteUpload(files, pool=10): """Upload to google storage. Create a pool of process and call _GsUpload with the proper arguments. Args: files: dictionary with keys to local files and values to remote path. pool: integer of maximum proesses to have at the same time. """ # TODO(scottz) port this to use _RunManyPara... |
print msg | print >> sys.stderr, msg | def usage(parser, msg): """Display usage message and parser help then exit with 1.""" print msg parser.print_help() sys.exit(1) |
if rw_checkout: RunCommand(['repo', 'forall', '-c', 'git', 'config', 'url.ssh://git@gitrw.chromium.org:9222.pushinsteadof', 'http://git.chromium.org/git'], cwd=buildroot) | def RepoSync(buildroot, rw_checkout=False, retries=_DEFAULT_RETRIES): """Uses repo to checkout the source code. Keyword arguments: rw_checkout -- Reconfigure repo after sync'ing to read-write. retries -- Number of retries to try before failing on the sync. """ while retries > 0: try: # The --trace option ensures that... | |
default='http://git.chromium.org/git/manifest', | default='ssh://git@gitrw.chromium.org:9222/manifest', | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... |
def ResolveOverlays(overlays): | def ResolveOverlays(buildroot, overlays): | def ResolveOverlays(overlays): """Return the list of overlays to use for a given buildbot. Args: overlays: A string describing which overlays you want. 'private': Just the private overlay. 'public': Just the public overlay. 'both': Both the public and private overlays. """ public_overlay = '%s/src/third_party/chromium... |
overlays = ResolveOverlays(buildconfig['overlays']) | overlays = ResolveOverlays(buildroot, buildconfig['overlays']) | def main(): # Parse options usage = "usage: %prog [options] cbuildbot_config" parser = optparse.OptionParser(usage=usage) parser.add_option('-r', '--buildroot', help='root directory where build occurs', default=".") parser.add_option('-n', '--buildnumber', help='build number', type='int', default=0) parser.add_option('... |
self.UpdateImage(image) | self._UpdateImageReportError(image) | def TryDeltaAndFallbackToFull(self, src_image, image, stateful_change='old'): """Tries the delta update first if set and falls back to full update.""" if self.use_delta_updates: try: self.source_image = src_image self.UpdateImage(image) except: Warning('Delta update failed, disabling delta updates and retrying.') self.... |
self.UpdateImage(image) def PrepareBase(self): | self._UpdateImageReportError(image) def _UpdateImageReportError(self, image_path, stateful_change='old'): """Calls UpdateImage and reports any error to the console. Still throws the exception. """ try: self.UpdateImage(image_path, stateful_change) except UpdateException as err: Warning(err.stdout) raise def _Attemp... | def TryDeltaAndFallbackToFull(self, src_image, image, stateful_change='old'): """Tries the delta update first if set and falls back to full update.""" if self.use_delta_updates: try: self.source_image = src_image self.UpdateImage(image) except: Warning('Delta update failed, disabling delta updates and retrying.') self.... |
self.PrepareBase() | self.PrepareBase(image_path=base_image_path) | def testFullUpdateKeepStateful(self): """Tests if we can update normally. |
self.PrepareBase() | self.PrepareBase(image_path=base_image_path) | def testFullUpdateWipeStateful(self): """Tests if we can update after cleaning the stateful partition. |
def PrepareBase(self): | def PrepareBase(self, image_path): | def PrepareBase(self): """Auto-update to base image to prepare for test.""" self.UpdateImage(base_image_path) |
self.UpdateImage(base_image_path) | self._UpdateImageReportError(image_path) | def PrepareBase(self): """Auto-update to base image to prepare for test.""" self.UpdateImage(base_image_path) |
RunCommand([ | (code, stdout, stderr) = RunCommandCaptureOutput([ | def UpdateImage(self, image_path, stateful_change='old'): """Updates a remote image using image_to_live.sh.""" stateful_change_flag = self.GetStatefulChangeFlag(stateful_change) |
'--src_image=%s' % self.source_image, ], enter_chroot=False) | '--src_image=%s' % self.source_image ]) if code != 0: raise UpdateException(code, stdout) def UpdateUsingPayload(self, update_path, stateful_change='old'): """Updates a remote image using image_to_live.sh.""" stateful_change_flag = self.GetStatefulChangeFlag(stateful_change) (code, stdout, stderr) = RunCommandCaptur... | def UpdateImage(self, image_path, stateful_change='old'): """Updates a remote image using image_to_live.sh.""" stateful_change_flag = self.GetStatefulChangeFlag(stateful_change) |
def PrepareBase(self): | def PrepareBase(self, image_path): | def PrepareBase(self): """Creates an update-able VM based on base image.""" self.vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( base_image_path) |
base_image_path) | image_path) Info('Creating: %s' % self.vm_image_path) | def PrepareBase(self): """Creates an update-able VM based on base image.""" self.vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( base_image_path) |
os.path.dirname(base_image_path)), | os.path.dirname(image_path)), | def PrepareBase(self): """Creates an update-able VM based on base image.""" self.vm_image_path = '%s/chromiumos_qemu_image.bin' % os.path.dirname( base_image_path) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.