Exemplo n.º 1
0
def uprev_overlays(overlays, build_targets=None, chroot=None, output_dir=None):
    """Uprev the given overlays.

  Args:
    overlays (list[str]): The list of overlay paths.
    build_targets (list[build_target_lib.BuildTarget]|None): The build targets
      to clean in |chroot|, if desired. No effect unless |chroot| is provided.
    chroot (chroot_lib.Chroot|None): The chroot to clean, if desired.
    output_dir (str|None): The path to optionally dump result files.

  Returns:
    list[str] - The paths to all of the modified ebuild files. This includes the
      new files that were added (i.e. the new versions) and all of the removed
      files (i.e. the old versions).
  """
    assert overlays

    manifest = git.ManifestCheckout.Cached(constants.SOURCE_ROOT)

    uprev_manager = uprev_lib.UprevOverlayManager(overlays,
                                                  manifest,
                                                  build_targets=build_targets,
                                                  chroot=chroot,
                                                  output_dir=output_dir)
    uprev_manager.uprev()

    return uprev_manager.modified_ebuilds
    def test_clean_stale_packages_no_chroot(self):
        """Test no chroot skip."""
        manager = uprev_lib.UprevOverlayManager([], None)
        self.PatchObject(parallel, 'RunTasksInProcessPool')

        # pylint: disable=protected-access
        manager._clean_stale_packages()
    def test_clean_stale_packages_chroot_not_exists(self):
        """Cannot run the commands when the chroot does not exist."""
        chroot = Chroot()
        self.PatchObject(chroot, 'exists', return_value=False)
        manager = uprev_lib.UprevOverlayManager([], None, chroot=chroot)
        self.PatchObject(parallel, 'RunTasksInProcessPool')

        # pylint: disable=protected-access
        manager._clean_stale_packages()
Exemplo n.º 4
0
    def test_clean_stale_packages_no_chroot(self):
        """Test no chroot skip."""
        manager = uprev_lib.UprevOverlayManager([], None)
        patch = self.PatchObject(parallel, 'RunTasksInProcessPool')

        # pylint: disable=protected-access
        manager._clean_stale_packages()

        # Make sure we aren't doing any work.
        patch.assert_not_called()
Exemplo n.º 5
0
    def test_clean_stale_packages_no_build_targets(self):
        """Make sure it behaves as expected with no build targets provided."""
        chroot = Chroot()
        self.PatchObject(chroot, 'exists', return_value=True)
        manager = uprev_lib.UprevOverlayManager([], None, chroot=chroot)
        patch = self.PatchObject(parallel, 'RunTasksInProcessPool')

        # pylint: disable=protected-access
        manager._clean_stale_packages()

        # Make sure we aren't doing any work.
        patch.assert_called_once_with(mock.ANY, [[None]])
Exemplo n.º 6
0
    def test_clean_stale_packages_with_boards(self):
        """Test it cleans all boards as well as the chroot."""
        targets = ['board1', 'board2']
        build_targets = [BuildTarget(t) for t in targets]
        chroot = Chroot()
        self.PatchObject(chroot, 'exists', return_value=True)
        manager = uprev_lib.UprevOverlayManager([],
                                                None,
                                                chroot=chroot,
                                                build_targets=build_targets)
        patch = self.PatchObject(parallel, 'RunTasksInProcessPool')

        # pylint: disable=protected-access
        manager._clean_stale_packages()

        patch.assert_called_once_with(mock.ANY,
                                      [[t] for t in targets + [None]])
Exemplo n.º 7
0
def uprev_virglrenderer(_build_targets, refs, _chroot):
    """Updates virglrenderer ebuilds.

  See: uprev_versioned_package.

  Returns:
    UprevVersionedPackageResult: The result of updating virglrenderer ebuilds.
  """
    overlay = os.path.join(constants.SOURCE_ROOT,
                           constants.CHROMIUMOS_OVERLAY_DIR)
    repo_path = os.path.join(constants.SOURCE_ROOT, 'src', 'third_party',
                             'virglrenderer')
    manifest = git.ManifestCheckout.Cached(repo_path)

    uprev_manager = uprev_lib.UprevOverlayManager([overlay], manifest)
    # TODO(crbug.com/1066242): Ebuilds for virglrenderer are currently
    # blacklisted. Do not force uprevs after builder is stable and ebuilds are no
    # longer blacklisted.
    uprev_manager.uprev(package_list=['media-libs/virglrenderer'], force=True)

    updated_files = uprev_manager.modified_ebuilds
    result = UprevVersionedPackageResult()
    result.add_result(refs[0].revision, updated_files)
    return result