def main(argv): parser = GetParser() options = parser.parse_args(argv) mc = git.ManifestCheckout.Cached(__file__) # TODO(cmasone): http://crbug.com/241805 support "internal" # checkouts of sonic chrome, once source access and codename issues # are sorted out. repo_url = (mc.remotes['sonic-partner']['fetch'] + mc.projects['partner/manifest']['name']) repo = repository.RepoRepository(repo_url=repo_url, directory=options.chrome_root) # Revert any lingering local changes. if not osutils.SafeMakedirs(options.chrome_root) and options.reset: try: repo.Detach() except cros_build_lib.RunCommandError: osutils.RmDir(options.chrome_root) osutils.SafeMakedirs(options.chrome_root) repo.Sync() return 0
def SyncSources(self): repo = repository.RepoRepository(self.manifest_dir, self.repo_root, referenced_repo=self.reference, manifest=MANIFEST_FILE, branch='master') # Trigger the network sync repo.Sync(jobs=multiprocessing.cpu_count() + 1, network_only=True) projects = [self.CHROMIUM_ROOT] if self.internal: projects.append(self.CHROME_ROOT) for project in projects: path = os.path.join(self.repo_root, project) if os.path.exists(path): try: git.CleanAndCheckoutUpstream(path, refresh_upstream=False) continue except cros_build_lib.RunCommandError: cros_build_lib.Error("Failed cleaning %r; wiping.", path) cros_build_lib.SudoRunCommand(['rm', '-rf', path], print_cmd=False) cros_build_lib.RunCommand(['repo', 'sync', '-ld', project], cwd=self.repo_root)
def TestNewManifest(self): """Runs a 'repo sync' off of new manifest to verify things aren't broken.""" # Do as cheap a sync as possible; network only is good enough, # allow shallow cloning if we don't have a reference, and sync # strictly the target branch. repo = repository.RepoRepository( self.manifest_dir, self.repo_root, branch=TEST_BRANCH, referenced_repo=self.reference, manifest=MANIFEST_FILE) try: repo.Sync(jobs=multiprocessing.cpu_count() + 1, network_only=True) except Exception: cros_build_lib.Error('Failed to sync with new manifest!') raise
def setUp(self): os.makedirs(os.path.join(self.tempdir, '.repo')) self.source_repo = 'ssh://source/repo' self.manifest_repo = 'ssh://manifest/repo' self.version_file = 'version-file.sh' self.branch = 'master' self.build_name = 'x86-generic' self.incr_type = 'branch' repo = repository.RepoRepository( self.source_repo, self.tempdir, self.branch) self.manager = manifest_version.BuildSpecsManager( repo, self.manifest_repo, self.build_name, self.incr_type, False, branch=self.branch, dry_run=True) # Change default to something we clean up. self.tmpmandir = os.path.join(self.tempdir, "man") osutils.SafeMakedirs(self.tmpmandir) self.manager.manifest_dir = self.tmpmandir
def setUp(self): self.mox.StubOutWithMock(git, 'CreatePushBranch') self.source_repo = 'ssh://source/repo' self.manifest_repo = 'ssh://manifest/repo' self.version_file = 'version-file.sh' self.branch = 'master' self.build_name = 'x86-generic' self.incr_type = 'branch' # Create tmp subdirs based on the one provided TempDirMixin. self.tmpdir = os.path.join(self.tempdir, "base") osutils.SafeMakedirs(self.tmpdir) self.tmpmandir = os.path.join(self.tempdir, "man") osutils.SafeMakedirs(self.tmpmandir) repo = repository.RepoRepository(self.source_repo, self.tmpdir, self.branch, depth=1) self.manager = lkgm_manager.LKGMManager(repo, self.manifest_repo, self.build_name, constants.PFQ_TYPE, 'branch', force=False, branch=self.branch, dry_run=True) self.manager.manifest_dir = self.tmpmandir self.manager.lkgm_path = os.path.join(self.tmpmandir, self.manager.LKGM_PATH) self.manager.all_specs_dir = '/LKGM/path' manifest_dir = self.manager.manifest_dir self.manager.specs_for_builder = os.path.join( manifest_dir, self.manager.rel_working_dir, 'build-name', '%(builder)s') self.manager.SLEEP_TIMEOUT = 0
def _Initialize(self, branch='master'): repo = repository.RepoRepository(constants.MANIFEST_URL, self.tempdir, branch=branch) repo.Initialize()