예제 #1
0
    def test_no_ebuild(self):
        """Tests assertion is raised if package has no ebuilds"""
        file_layout = (D(self.package, [self.manifest]), )
        cros_test_lib.CreateOnDiskHierarchy(self.tempdir, file_layout)

        package_path = os.path.join(self.tempdir, self.package)

        with self.assertRaises(packages.UprevError):
            packages.uprev_ebuild_from_pin(package_path,
                                           self.new_version,
                                           chroot=Chroot())
예제 #2
0
    def test_multiple_unstable_ebuilds(self):
        """Tests assertion is raised if multiple unstable ebuilds are present"""
        file_layout = (D(
            self.package,
            [self.ebuild, self.ebuild_template % '1.2.1', self.manifest]), )
        cros_test_lib.CreateOnDiskHierarchy(self.tempdir, file_layout)

        package_path = os.path.join(self.tempdir, self.package)

        with self.assertRaises(packages.UprevError):
            packages.uprev_ebuild_from_pin(package_path,
                                           self.new_version,
                                           chroot=Chroot())
예제 #3
0
    def test_uprev_ebuild(self):
        """Tests uprev of ebuild with version path"""
        file_layout = (D(self.package,
                         [self.ebuild, self.unstable_ebuild, self.manifest]), )
        cros_test_lib.CreateOnDiskHierarchy(self.tempdir, file_layout)

        package_path = os.path.join(self.tempdir, self.package)

        ebuild_path = os.path.join(package_path, self.ebuild)
        self.WriteTempFile(ebuild_path, 'KEYWORDS="*"\n')

        result = packages.uprev_ebuild_from_pin(package_path,
                                                self.new_version,
                                                chroot=Chroot())
        self.assertEqual(
            len(result.modified), 1,
            'unexpected number of results: %s' % len(result.modified))

        mod = result.modified[0]
        self.assertEqual(mod.new_version, self.new_version + '-r1',
                         'unexpected version number: %s' % mod.new_version)

        old_ebuild_path = os.path.join(package_path,
                                       self.ebuild_template % self.version)
        new_ebuild_path = os.path.join(package_path,
                                       self.ebuild_template % self.new_version)
        manifest_path = os.path.join(package_path, 'Manifest')

        expected_modified_files = [
            old_ebuild_path, new_ebuild_path, manifest_path
        ]
        self.assertCountEqual(mod.files, expected_modified_files)

        self.assertCommandContains(['ebuild', 'manifest'])