From 15eeab05f72f65abb0e843d7d8969c3b8f996aa3 Mon Sep 17 00:00:00 2001 From: Faik Uygur Date: Tue, 23 Jun 2009 12:27:55 +0000 Subject: [PATCH] pisi enable-repo and disable-repo commands pisi enable-repo pardus-2009 pisi disable-repo pardus-2008 contrib-2008 --- pisi/cli/disablerepo.py | 49 +++++++++++++++++++++++++++++++++++++++++ pisi/cli/enablerepo.py | 49 +++++++++++++++++++++++++++++++++++++++++ pisi/cli/pisicli.py | 2 ++ 3 files changed, 100 insertions(+) create mode 100644 pisi/cli/disablerepo.py create mode 100644 pisi/cli/enablerepo.py diff --git a/pisi/cli/disablerepo.py b/pisi/cli/disablerepo.py new file mode 100644 index 00000000..da859448 --- /dev/null +++ b/pisi/cli/disablerepo.py @@ -0,0 +1,49 @@ +# -*- coding:utf-8 -*- +# +# Copyright (C) 2009, TUBITAK/UEKAE +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. +# + +import optparse + +import gettext +__trans = gettext.translation('pisi', fallback=True) +_ = __trans.ugettext + +import pisi.cli.command as command +import pisi.context as ctx +import pisi.api + +class DisableRepo(command.Command): + __doc__ = _("""Disable repository + +Usage: disable-repo [ ... ] + +: repository name + +Disabled repositories are not taken into account in operations +""") + __metaclass__ = command.autocommand + + def __init__(self,args): + super(DisableRepo, self).__init__(args) + self.repodb = pisi.db.repodb.RepoDB() + + name = ("disable-repo", "dr") + + def run(self): + self.init(database = True) + + if not self.args: + self.help() + return + + for repo in self.args: + if self.repodb.has_repo(repo): + pisi.api.set_repo_activity(repo, False) diff --git a/pisi/cli/enablerepo.py b/pisi/cli/enablerepo.py new file mode 100644 index 00000000..5305e917 --- /dev/null +++ b/pisi/cli/enablerepo.py @@ -0,0 +1,49 @@ +# -*- coding:utf-8 -*- +# +# Copyright (C) 2009, TUBITAK/UEKAE +# +# This program is free software; you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation; either version 2 of the License, or (at your option) +# any later version. +# +# Please read the COPYING file. +# + +import optparse + +import gettext +__trans = gettext.translation('pisi', fallback=True) +_ = __trans.ugettext + +import pisi.cli.command as command +import pisi.context as ctx +import pisi.api + +class EnableRepo(command.Command): + __doc__ = _("""Enable repository + +Usage: enable-repo [ ... ] + +: repository name + +Disabled repositories are not taken into account in operations +""") + __metaclass__ = command.autocommand + + def __init__(self,args): + super(EnableRepo, self).__init__(args) + self.repodb = pisi.db.repodb.RepoDB() + + name = ("enable-repo", "er") + + def run(self): + self.init(database = True) + + if not self.args: + self.help() + return + + for repo in self.args: + if self.repodb.has_repo(repo): + pisi.api.set_repo_activity(repo, True) diff --git a/pisi/cli/pisicli.py b/pisi/cli/pisicli.py index b28d7189..00faa74e 100644 --- a/pisi/cli/pisicli.py +++ b/pisi/cli/pisicli.py @@ -45,6 +45,8 @@ import pisi.cli.listupgrades import pisi.cli.rebuilddb import pisi.cli.remove import pisi.cli.removerepo +import pisi.cli.enablerepo +import pisi.cli.disablerepo import pisi.cli.searchfile import pisi.cli.search import pisi.cli.updaterepo