Esempio n. 1
0
    def run(self):

        if len(self.args) == 2:
            self.init()
            name, indexuri = self.args
            self.just_add = False

            if ctx.get_option('no_fetch'):
                if ctx.ui.confirm(_('Add \"{}\" repository without updating the database?\nBy confirming '
                                        'this you are also adding the repository to your system without '
                                        'checking the distribution of the repository.\n'
                                        'Would you like to continue?').format(name)):
                    self.just_add=True

            if indexuri.endswith(".xml.xz") or indexuri.endswith(".xml"):
                repository.add_repo(name, indexuri, ctx.get_option('at'))
                if not self.just_add:
                    try:
                        repository.update_repos([name])
                    except (inary.errors.Error, IOError) as e:
                        ctx.ui.warning(_("{0} repository could not be reached: {1}").format(name, e))
                        self.warn_and_remove(_("Removing {0} from system.").format(name), name)
                else:
                    repository.set_repo_activity(name, False)

            else:
                raise Exception(_("Extension of repository URI must be \".xml.xz\" or \".xml\"."))


        else:
            self.help()
            return
Esempio n. 2
0
    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):
                repository.set_repo_activity(repo, True)
Esempio n. 3
0
    def run(self):
        import inary.operations.repository as repository
        self.init(database=True)

        if not self.args:
            self.help()
            return

        for repo in self.args:
            if self.repodb.has_repo(repo):
                repository.set_repo_activity(repo, False)