def _AddProjectsToPartialManifests(self, atoms): """Add projects corresponding to a list of atoms to the local manifest. If we mark projects as workon that we don't have in our local checkout, it is convenient to have them added to the manifest. Note that users will need to `repo sync` to pull down repositories added in this way. Args: atoms: iterable of atoms to ensure are in the manifest. """ if git.ManifestCheckout.IsFullManifest(self._src_root): # If we're a full manifest, there is nothing to do. return should_repo_sync = False for ebuild_path in self._AtomsToEbuilds(atoms): infos = portage_util.GetRepositoryForEbuild( ebuild_path, self._sysroot) for info in infos: if not info.project: continue cmd = ['loman', 'add', '--workon', info.project] cros_build_lib.RunCommand(cmd, print_cmd=False) should_repo_sync = True if should_repo_sync: print('Please run "repo sync" now.')
def RunCommandInAtomSourceDirectory(self, atom, command): """Run a command in the source directory of an atom. Args: atom: string atom to run the command in (e.g. 'chromeos-base/shill'). command: string shell command to run in the source directory of |atom|. """ logging.info('Running "%s" on %s', command, atom) ebuild_path = self._FindEbuildForPackage(atom) if ebuild_path is None: raise WorkonError('Error looking for atom %s' % atom) for info in portage_util.GetRepositoryForEbuild(ebuild_path, self._sysroot): cros_build_lib.RunCommand(command, shell=True, cwd=info.srcdir, print_cmd=False)