示例#1
0
文件: group.py 项目: ashateja/dnf
    def _mark_remove(self, patterns):
        q = CompsQuery(self.base.comps, self.base.history,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        for env_id in res.environments:
            assert dnf.util.is_string_type(env_id)
            solver._environment_remove(env_id)
        for grp_id in res.groups:
            assert dnf.util.is_string_type(grp_id)
            solver._group_remove(grp_id)

        if res.environments:
            logger.info(
                _('Environments marked removed: %s'), ','.join([
                    ucd(self.base.history.env.get(e_id).getTranslatedName())
                    for e_id in res.environments
                ]))
        if res.groups:
            logger.info(
                _('Groups marked removed: %s'), ','.join([
                    ucd(self.base.history.group.get(g_id).getTranslatedName())
                    for g_id in res.groups
                ]))

        if res.groups or res.environments:
            self._history_commit()
示例#2
0
文件: group.py 项目: rhn/dnf
    def _mark_install(self, patterns):
        prst = self.base._group_persistor
        q = CompsQuery(self.base.comps, prst,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        for env_id in res.environments:
            if not dnf.comps.install_or_skip(solver._environment_install,
                                             env_id, types):
                res.environments.remove(env_id)
        for group_id in res.groups:
            if not dnf.comps.install_or_skip(solver._group_install,
                                             group_id, types):
                res.groups.remove(group_id)

        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([prst.environment(g).ui_name
                                  for g in res.environments]))
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([prst.group(g).ui_name for g in res.groups]))
        prst.commit()
示例#3
0
文件: group.py 项目: achernet/dnf
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        def install_or_skip(install_fnc, grp_or_env):
            for grp in grp_or_env:
                try:
                    install_fnc(grp, types, None)
                except dnf.comps.CompsError as e:
                    logger.warning("%s, %s", str(e)[:-1], _("skipping."))
                    grp_or_env.remove(grp)

        install_or_skip(solver.environment_install, res.environments)
        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([g.ui_name for g in res.environments]))
        install_or_skip(solver.group_install, res.groups)
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([g.ui_name for g in res.groups]))
        persistor.commit()
示例#4
0
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        def install_or_skip(install_fnc, grp_or_env):
            for grp in grp_or_env:
                try:
                    install_fnc(grp, types, None)
                except dnf.comps.CompsError as e:
                    logger.warning("%s, %s", str(e)[:-1], _("skipping."))
                    grp_or_env.remove(grp)

        install_or_skip(solver.environment_install, res.environments)
        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([g.ui_name for g in res.environments]))
        install_or_skip(solver.group_install, res.groups)
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([g.ui_name for g in res.groups]))
        persistor.commit()
示例#5
0
文件: group.py 项目: ncoghlan/dnf
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        for env in res.environments:
            if not dnf.comps.install_or_skip(solver.environment_install, env,
                                             types):
                res.environments.remove(env)
        for group in res.groups:
            if not dnf.comps.install_or_skip(solver.group_install, group,
                                             types):
                res.groups.remove(group)

        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([g.ui_name for g in res.environments]))
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([g.ui_name for g in res.groups]))
        persistor.commit()
示例#6
0
文件: group.py 项目: zhengrq-fnst/dnf
    def _mark_install(self, patterns):
        prst = self.base.history.group
        q = CompsQuery(self.base.comps, prst,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        for env_id in res.environments:
            if not dnf.comps.install_or_skip(solver._environment_install,
                                             env_id, types):
                res.environments.remove(env_id)
        for group_id in res.groups:
            if not dnf.comps.install_or_skip(solver._group_install, group_id,
                                             types):
                res.groups.remove(group_id)

        if res.environments:
            logger.info(
                _('Environments marked installed: %s'), ','.join([
                    ucd(prst.environment(g).ui_name) for g in res.environments
                ]))
        if res.groups:
            logger.info(
                _('Groups marked installed: %s'),
                ','.join([ucd(prst.group(g).ui_name) for g in res.groups]))
        prst.commit()
示例#7
0
    def test_all(self):
        status_all = CompsQuery.AVAILABLE | CompsQuery.INSTALLED
        kinds_all = CompsQuery.ENVIRONMENTS | CompsQuery.GROUPS
        q = CompsQuery(self.comps, self.prst, kinds_all, status_all)

        res = q.get('sugar*', '*er*')
        self.assertCountEqual(names(res.environments),
                              ('Sugar Desktop Environment', ))
        self.assertCountEqual(names(res.groups), ("Pepper's", 'Solid Ground'))
示例#8
0
文件: group.py 项目: gekoraus/dnf
 def _upgrade(self, patterns):
     q = CompsQuery(self.base.comps, self.base.group_persistor, CompsQuery.GROUPS, CompsQuery.INSTALLED)
     res = q.get(*patterns)
     cnt = 0
     for grp in res.groups:
         cnt += self.base.group_upgrade(grp)
     if not cnt:
         msg = _("No packages marked for upgrade.")
         raise dnf.cli.CliError(msg)
示例#9
0
    def test_all(self):
        status_all = CompsQuery.AVAILABLE | CompsQuery.INSTALLED
        kinds_all = CompsQuery.ENVIRONMENTS | CompsQuery.GROUPS
        q = CompsQuery(self.comps, self.prst, kinds_all, status_all)

        res = q.get('sugar*', '*er*')
        self.assertCountEqual(names(res.environments),
                              ('Sugar Desktop Environment',))
        self.assertCountEqual(names(res.groups), ("Pepper's", 'Solid Ground'))
示例#10
0
文件: test_group.py 项目: mavit/dnf
    def test_all(self):
        status_all = CompsQuery.AVAILABLE | CompsQuery.INSTALLED
        kinds_all = CompsQuery.ENVIRONMENTS | CompsQuery.GROUPS
        q = CompsQuery(self.comps, self.persistor, kinds_all, status_all)

        res = q.get('sugar*', '*er*')
        self.assertCountEqual(res.environments,
                              ('sugar-desktop-environment',))
        self.assertCountEqual(res.groups, ("Peppers", 'somerset'))
示例#11
0
    def test_all(self):
        status_all = CompsQuery.AVAILABLE | CompsQuery.INSTALLED
        kinds_all = CompsQuery.ENVIRONMENTS | CompsQuery.GROUPS
        q = CompsQuery(self.comps, self.prst, kinds_all, status_all)

        res = q.get('sugar*', '*er*')
        self.assertCountEqual(res.environments,
                              ('sugar-desktop-environment', ))
        self.assertCountEqual(res.groups, ("Peppers", 'somerset'))
示例#12
0
文件: test_group.py 项目: edynox/dnf
 def test_installed(self):
     q = CompsQuery(self.comps, self.prst, CompsQuery.GROUPS,
                    CompsQuery.INSTALLED)
     self.base.read_mock_comps(False)
     grp = self.base.comps.group_by_pattern('somerset')
     self.base.group_install(grp.id, ('mandatory',))
     res = q.get('somerset')
     self.assertEmpty(res.environments)
     grp_ids = [grp.name_id for grp in res.groups]
     self.assertCountEqual(grp_ids, ('somerset',))
示例#13
0
文件: test_group.py 项目: jsgh/dnf
 def test_installed(self):
     q = CompsQuery(self.comps, self.prst, CompsQuery.GROUPS,
                    CompsQuery.INSTALLED)
     self.base.read_mock_comps(False)
     grp = self.base.comps.group_by_pattern('somerset')
     self.base.group_install(grp.id, ('mandatory', ))
     res = q.get('somerset')
     self.assertEmpty(res.environments)
     grp_ids = [grp.name_id for grp in res.groups]
     self.assertCountEqual(grp_ids, ('somerset', ))
示例#14
0
文件: group.py 项目: ncoghlan/dnf
 def _upgrade(self, patterns):
     q = CompsQuery(self.base.comps, self.base.group_persistor,
                    CompsQuery.GROUPS, CompsQuery.INSTALLED)
     res = q.get(*patterns)
     cnt = 0
     for grp in res.groups:
         cnt += self.base.group_upgrade(grp)
     if not cnt:
         msg = _('No packages marked for upgrade.')
         raise dnf.cli.CliError(msg)
示例#15
0
 def _mark_remove(self, patterns):
     q = CompsQuery(self.base.comps, self.base.history,
                    CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                    CompsQuery.INSTALLED)
     solver = self.base._build_comps_solver()
     res = q.get(*patterns)
     for env_id in res.environments:
         assert dnf.util.is_string_type(env_id)
         solver._environment_remove(env_id)
     for grp_id in res.groups:
         assert dnf.util.is_string_type(grp_id)
         solver._group_remove(grp_id)
示例#16
0
    def test_installed(self):
        q = CompsQuery(self.comps, self.history, CompsQuery.GROUPS,
                       CompsQuery.INSTALLED)
        self.base.read_mock_comps(False)
        grp = self.base.comps.group_by_pattern('somerset')
        self.base.group_install(grp.id, ('mandatory', ))

        self._swdb_commit()

        res = q.get('somerset')
        self.assertEmpty(res.environments)
        grp_ids = list(res.groups)
        self.assertCountEqual(grp_ids, ('somerset', ))
示例#17
0
    def test_installed(self):
        q = CompsQuery(self.comps, self.history, CompsQuery.GROUPS,
                       CompsQuery.INSTALLED)
        self.base.read_mock_comps(False)
        grp = self.base.comps.group_by_pattern('somerset')
        self.base.group_install(grp.id, ('mandatory',))

        self._swdb_commit()

        res = q.get('somerset')
        self.assertEmpty(res.environments)
        grp_ids = list(res.groups)
        self.assertCountEqual(grp_ids, ('somerset',))
示例#18
0
文件: group.py 项目: gekoraus/dnf
    def _mark_remove(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor, CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS, CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        for env in res.environments:
            solver.environment_remove(env)
        for grp in res.groups:
            solver.group_remove(grp)

        if res.environments:
            logger.info(_("Environments marked removed: %s"), ",".join([g.ui_name for g in res.environments]))
        if res.groups:
            logger.info(_("Groups marked removed: %s"), ",".join([g.ui_name for g in res.groups]))
        persistor.commit()
示例#19
0
文件: group.py 项目: zhangrui182/dnf
    def _mark_install(self, patterns):
        q = CompsQuery(self.base.comps, self.base.history,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)

        if self.opts.with_optional:
            types = tuple(self.base.conf.group_package_types + ['optional'])
        else:
            types = tuple(self.base.conf.group_package_types)
        pkg_types = self.base._translate_comps_pkg_types(types)
        for env_id in res.environments:
            dnf.comps.install_or_skip(solver._environment_install, env_id, pkg_types)
        for group_id in res.groups:
            dnf.comps.install_or_skip(solver._group_install, group_id, pkg_types)
示例#20
0
    def _mark_install(self, patterns):
        q = CompsQuery(self.base.comps, self.base.history,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)

        if self.opts.with_optional:
            types = tuple(self.base.conf.group_package_types + ['optional'])
        else:
            types = tuple(self.base.conf.group_package_types)
        pkg_types = libdnf.transaction.listToCompsPackageType(types)
        for env_id in res.environments:
            solver._environment_install(env_id, pkg_types)
        for group_id in res.groups:
            solver._group_install(group_id, pkg_types)
示例#21
0
 def _mark_remove(self, patterns):
     persistor = self.base.group_persistor
     q = CompsQuery(self.base.comps, persistor,
                    CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                    CompsQuery.INSTALLED)
     solver = self.base.build_comps_solver()
     res = q.get(*patterns)
     for env in res.environments:
         solver.environment_remove(env)
     if res.environments:
         logger.info(_('Environments marked removed: %s'),
                     ','.join([g.ui_name for g in res.environments]))
     for grp in res.groups:
         solver.group_remove(grp)
     if res.groups:
         logger.info(_('Groups marked removed: %s'),
                     ','.join([g.ui_name for g in res.groups]))
     persistor.commit()
示例#22
0
文件: group.py 项目: Aftermath/dnf
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(self.base.comps, persistor,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        dnf.comps.install_or_skip(solver.environment_install,
                                  res.environments, types)
        if res.environments:
            logger.info(_('Environments marked installed: %s'),
                        ','.join([g.ui_name for g in res.environments]))
        dnf.comps.install_or_skip(solver.group_install, res.groups, types)
        if res.groups:
            logger.info(_('Groups marked installed: %s'),
                        ','.join([g.ui_name for g in res.groups]))
        persistor.commit()
示例#23
0
文件: group.py 项目: rhn/dnf
    def _mark_remove(self, patterns):
        prst = self.base._group_persistor
        q = CompsQuery(self.base.comps, prst,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        for env_id in res.environments:
            solver._environment_remove(env_id)
        for grp_id in res.groups:
            solver._group_remove(grp_id)

        if res.environments:
            logger.info(_('Environments marked removed: %s'),
                        ','.join([prst.environment(e_id).ui_name
                                  for e_id in res.environments]))
        if res.groups:
            logger.info(_('Groups marked removed: %s'),
                        ','.join([prst.group(g_id).ui_name
                                  for g_id in res.groups]))
        prst.commit()
示例#24
0
    def _mark_remove(self, patterns):
        prst = self.base._group_persistor
        q = CompsQuery(self.base.comps, prst,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        for env_id in res.environments:
            solver._environment_remove(env_id)
        for grp_id in res.groups:
            solver._group_remove(grp_id)

        if res.environments:
            logger.info(_('Environments marked removed: %s'),
                        ','.join([prst.environment(e_id).ui_name
                                  for e_id in res.environments]))
        if res.groups:
            logger.info(_('Groups marked removed: %s'),
                        ','.join([prst.group(g_id).ui_name
                                  for g_id in res.groups]))
        prst.commit()
示例#25
0
文件: group.py 项目: ashateja/dnf
    def _mark_install(self, patterns):
        q = CompsQuery(self.base.comps, self.base.history,
                       CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
                       CompsQuery.AVAILABLE | CompsQuery.INSTALLED)
        solver = self.base._build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        for env_id in res.environments:
            if not dnf.comps.install_or_skip(solver._environment_install,
                                             env_id, types):
                res.environments.remove(env_id)
        for group_id in res.groups:
            if not dnf.comps.install_or_skip(solver._group_install, group_id,
                                             types):
                res.groups.remove(group_id)

        if res.groups or res.environments:
            self._history_commit()

        if res.environments:
            logger.info(
                _('Environments marked installed: %s'), ','.join([
                    ucd(self.base.history.env.get(g).getTranslatedName())
                    for g in res.environments
                ]))
        if res.groups:
            print(res.groups)
            for g in res.groups:
                x = self.base.history.group.get(g)
                print(x, type(x), dir(x))
            logger.info(
                _('Groups marked installed: %s'), ','.join([
                    ucd(self.base.history.group.get(g).getTranslatedName())
                    for g in res.groups
                ]))
示例#26
0
文件: group.py 项目: gekoraus/dnf
    def _mark_install(self, patterns):
        persistor = self.base.group_persistor
        q = CompsQuery(
            self.base.comps,
            persistor,
            CompsQuery.GROUPS | CompsQuery.ENVIRONMENTS,
            CompsQuery.AVAILABLE | CompsQuery.INSTALLED,
        )
        solver = self.base.build_comps_solver()
        res = q.get(*patterns)
        types = dnf.comps.DEFAULT | dnf.comps.MANDATORY | dnf.comps.OPTIONAL

        for env in res.environments:
            if not dnf.comps.install_or_skip(solver.environment_install, env, types):
                res.environments.remove(env)
        for group in res.groups:
            if not dnf.comps.install_or_skip(solver.group_install, group, types):
                res.groups.remove(group)

        if res.environments:
            logger.info(_("Environments marked installed: %s"), ",".join([g.ui_name for g in res.environments]))
        if res.groups:
            logger.info(_("Groups marked installed: %s"), ",".join([g.ui_name for g in res.groups]))
        persistor.commit()
示例#27
0
文件: test_group.py 项目: gbraad/dnf
 def test_installed(self):
     q = CompsQuery(self.comps, self.prst, CompsQuery.GROUPS,
                    CompsQuery.INSTALLED)
     res = q.get('somerset')
     self.assertEmpty(res.environments)
     self.assertCountEqual(res.groups, ('somerset',))
示例#28
0
 def test_installed(self):
     q = CompsQuery(self.comps, self.prst, CompsQuery.GROUPS,
                    CompsQuery.INSTALLED)
     res = q.get('somerset')
     self.assertEmpty(res.environments)
     self.assertCountEqual(res.groups, ('somerset', ))
示例#29
0
 def test_err(self):
     q = CompsQuery(self.comps, self.prst, CompsQuery.ENVIRONMENTS,
                    CompsQuery.AVAILABLE)
     with self.assertRaises(dnf.exceptions.CompsError):
         q.get('*er*')
示例#30
0
文件: test_group.py 项目: mavit/dnf
 def test_err(self):
     q = CompsQuery(self.comps, self.persistor, CompsQuery.ENVIRONMENTS,
                    CompsQuery.AVAILABLE)
     with self.assertRaises(dnf.exceptions.CompsError):
         q.get('*er*')