コード例 #1
0
    def test_removable_pkg(self):
        grp = self.comps.group_by_pattern('base')
        self.solver._group_install(grp.id, dnf.comps.MANDATORY, [])
        self.persistor.commit()

        pkg1 = SwdbPkg.new("pepper", 0, "20", "0", "x86_64", "987abc", "sha256", SwdbItem.RPM)
        pid = self.history.add_package(pkg1)
        self.history.swdb.trans_data_beg(1, pid, SwdbReason.GROUP, "Installed", False)

        pkg2 = SwdbPkg.new("right", 1, "22", "0", "x86_64", "321abcd", "sha256", SwdbItem.RPM)
        pid2 = self.history.add_package(pkg2)
        self.history.swdb.trans_data_beg(1, pid2, SwdbReason.DEP, "Installed", False)

        n = "dupl"
        p_grp = self.persistor.new_group(n, n, n, True, 0)
        self.persistor.add_group(p_grp)
        p_grp.add_package(["tour"])

        pkg3 = SwdbPkg.new("tour", 0, "20", "0", "x86_64", "132abcd", "sha256", SwdbItem.RPM)
        pid3 = self.history.add_package(pkg3)
        self.history.swdb.trans_data_beg(1, pid3, SwdbReason.GROUP, "Installed", False)

        # pepper is in single group with reason "group"
        self.assertTrue(self.solver._removable_pkg('pepper'))
        # right's reason is "dep"
        self.assertFalse(self.solver._removable_pkg('right'))
        # tour appears in more than one group
        self.assertFalse(self.solver._removable_pkg('tour'))

        self.persistor.remove_group(p_grp, True)
        # tour appears only in one group now
        self.assertTrue(self.solver._removable_pkg('tour'))
コード例 #2
0
 def ipkg_to_pkg(self, ipkg):
     csum = ipkg.returnIdSum()
     pkgtup = map(ucd, ipkg.pkgtup)
     (n, a, e, v, r) = pkgtup
     pkg = SwdbPkg.new(n, int(e), v, r, a, csum[1] or '', csum[0] or '',
                       SwdbItem.RPM)
     return pkg
コード例 #3
0
ファイル: test_base.py プロジェクト: jsgh/dnf
 def _setup_packages(history):
     pkg1 = SwdbPkg.new("pepper", 0, "20", "0", "x86_64", "987abc",
                        "sha256", SwdbItem.RPM)
     pkg_data1 = SwdbPkgData()
     pid = history.add_package(pkg1)
     history.swdb.trans_data_beg(0, pid, SwdbReason.USER, "Installed",
                                 False)
     history.update_package_data(pid, 0, pkg_data1)
コード例 #4
0
 def ipkg_to_pkg(self, ipkg):
     try:
         csum = ipkg.returnIdSum()
     except AttributeError:
         csum = ('', '')
     pkgtup = map(ucd, ipkg.pkgtup)
     (n, a, e, v, r) = pkgtup
     pkg = SwdbPkg.new(n, int(e), v, r, a, csum[1] or '', csum[0] or '',
                       SwdbItem.RPM)
     return pkg
コード例 #5
0
    def _install_test_env(self):
        """Env installation itself does not handle packages. We need to handle
           them manually for proper functionality of env remove"""

        env = self.persistor.environment('sugar-desktop-environment')
        self.base.environment_install(env.name_id, ('mandatory',))
        self.persistor.commit()
        groups = env.get_group_list()
        for group in groups:
            _group = self.persistor.group(group)
            for pkg in _group.get_full_list():
                swdb_pkg = SwdbPkg.new(pkg, 0, "0", "0", "x86_64", "", "", SwdbItem.RPM)
                pid = self.history.add_package(swdb_pkg)
                self.history.swdb.trans_data_beg(1, pid, SwdbReason.GROUP, "Installed", False)
コード例 #6
0
    def _install_test_group(self):
        """Group installation itself does not handle packages. We need to
           handle them manually for proper functionality of group remove"""

        group = self.persistor.group('somerset')

        self.base.group_install(group.name_id, ('mandatory',))
        self.persistor.commit()

        for pkg in group.get_full_list():
            swdb_pkg = SwdbPkg.new(pkg, 0, "20", "0", "x86_64", "", "", SwdbItem.RPM)
            pid = self.history.add_package(swdb_pkg)
            self.history.swdb.trans_data_beg(1, pid, SwdbReason.GROUP, "Installed", False)

        self.base.reset(goal=True)
コード例 #7
0
ファイル: history.py プロジェクト: mscherer/dnf
 def ipkg_to_pkg(self, ipkg):
     try:
         csum = ipkg.returnIdSum()
     except AttributeError:
         csum = ('', '')
     pkgtup = map(ucd, ipkg.pkgtup)
     (n, a, e, v, r) = pkgtup
     pkg = SwdbPkg.new(
         n,
         int(e),
         v,
         r,
         a,
         csum[1] or '',
         csum[0] or '',
         SwdbItem.RPM)
     return pkg
コード例 #8
0
ファイル: test_base.py プロジェクト: mscherer/dnf
 def _setup_packages(history):
     pkg1 = SwdbPkg.new("pepper", 0, "20", "0", "x86_64", "987abc", "sha256", SwdbItem.RPM)
     pkg_data1 = SwdbPkgData()
     pid = history.add_package(pkg1)
     history.swdb.trans_data_beg(0, pid, SwdbReason.USER, "Installed", False)
     history.update_package_data(pid, 0, pkg_data1)