def test_calls_function(self): """Test calling a registered function.""" patch = self.PatchObject(self, 'uprev_category_package') cpv = portage_util.SplitCPV('category/package', strict=False) packages.uprev_versioned_package(cpv, [], [], Chroot()) patch.assert_called()
def UprevVersionedPackage(input_proto, output_proto, _config): """Uprev a versioned package. See go/pupr-generator for details about this endpoint. """ chroot = controller_util.ParseChroot(input_proto.chroot) build_targets = controller_util.ParseBuildTargets(input_proto.build_targets) package = controller_util.PackageInfoToCPV(input_proto.package_info) refs = [] for ref in input_proto.versions: refs.append(GitRef(path=ref.repository, ref=ref.ref, revision=ref.revision)) try: result = packages.uprev_versioned_package(package, build_targets, refs, chroot) except packages.Error as e: # Handle module errors nicely, let everything else bubble up. cros_build_lib.Die(e) if not result.uprevved: # No uprevs executed, skip the output population. return for modified in result.modified: uprev_response = output_proto.responses.add() uprev_response.version = modified.new_version for path in modified.files: uprev_response.modified_ebuilds.add().path = path
def test_unregistered_package(self): """Test calling with an unregistered package.""" cpv = package_info.SplitCPV('does-not/exist', strict=False) with self.assertRaises(packages.UnknownPackageError): packages.uprev_versioned_package(cpv, [], [], Chroot())