Example #1
0
    def run(self):
        from inary.operations import emerge
        self.init(database=True)

        component = ctx.get_option('component')
        if not self.args and not component:
            self.help()
            return

        if component:
            componentdb = inary.db.componentdb.ComponentDB()
            sources = componentdb.get_union_sources(component, walk=True)
        else:
            sources = self.args

        if ctx.get_option('output_dir'):
            ctx.ui.info(
                _('Output directory: {}').format(
                    ctx.config.options.output_dir))
        else:
            ctx.ui.info(_('Outputting binary packages in the package cache.'))
            ctx.config.options.output_dir = ctx.config.cached_packages_dir()

        emerge.emerge(sources)

        if not self.options.ignore_sysconf:
            sysconf.proceed(self.options.force_sysconf)
Example #2
0
    def run(self):
        from inary.operations import repository, emerge
        self.init(database=True)

        source = inary.db.sourcedb.SourceDB()

        imdb = inary.db.installdb.InstallDB()

        installed_emerge_packages = imdb.list_installed_with_build_host(
            "localhost")

        emerge_up_list = []

        for package in installed_emerge_packages:
            if source.has_spec(package):
                spec = source.get_spec(package)
                if spec.getSourceRelease() > imdb.get_version(package)[1]:
                    emerge_up_list.append(package)

        if ctx.get_option('output_dir'):
            ctx.ui.info(
                _('Output directory: {}').format(
                    ctx.config.options.output_dir))
        else:
            ctx.ui.info(_('Outputting binary packages in the package cache.'))
            ctx.config.options.output_dir = ctx.config.cached_packages_dir()

        repos = inary.db.repodb.RepoDB().list_repos(only_active=True)
        repository.update_repos(repos, ctx.get_option('force'))

        emerge.emerge(emerge_up_list)

        if not self.options.ignore_sysconf:
            sysconf.proceed(self.options.force_sysconf)
Example #3
0
    def run(self):
        from inary.operations import install, helper
        if self.options.fetch_only:
            self.init(database=True, write=False)
        else:
            self.init()

        components = ctx.get_option('component')
        if not components and not self.args:
            self.help()
            return

        packages = []
        if components:
            for name in components:
                if self.componentdb.has_component(name):
                    repository = ctx.get_option('repository')
                    if repository:
                        packages.extend(
                            self.componentdb.get_packages(name,
                                                          walk=True,
                                                          repo=repository))
                    else:
                        packages.extend(
                            self.componentdb.get_union_packages(name,
                                                                walk=True))
                else:
                    ctx.ui.info(
                        _('There is no component named  as \"{}\"').format(
                            name))

        packages.extend(self.args)

        if ctx.get_option('exclude_from'):
            packages = inary.blacklist.exclude_from(
                packages, ctx.get_option('exclude_from'))

        if ctx.get_option('exclude'):
            packages = inary.blacklist.exclude(packages,
                                               ctx.get_option('exclude'))

        reinstall = bool(packages) and packages[0].endswith(
            ctx.const.package_suffix)
        install.install(packages, ctx.get_option('reinstall') or reinstall)

        try:
            config_changes, opt = helper.check_config_changes([
                util.parse_package_name_legacy(i.split("/")[-1])[0]
                for i in packages
            ])
            if config_changes:
                if ctx.ui.confirm(
                        _("[!] Some config files have been changed. Would you like to see and apply them?"
                          )):
                    helper.show_changed_configs(config_changes, opt)
        except ValueError:
            pass
        if not self.options.ignore_sysconf:
            sysconf.proceed(self.options.force_sysconf)
Example #4
0
    def run(self):
        from inary.operations import remove
        self.init()
        orphaned = [0]
        first = True
        while len(orphaned) > 0:
            orphaned = inary.db.installdb.InstallDB().get_orphaned()
            if ctx.get_option('exclude'):
                orphaned = inary.blacklist.exclude(
                    orphaned, ctx.get_option('exclude'))

            if len(orphaned) > 0:
                remove.remove(orphaned, confirm=first)
                first = False

        if not self.options.ignore_sysconf:
            sysconf.proceed(self.options.force_sysconf)
Example #5
0
    def run(self):
        from inary.operations import repository, upgrade, helper
        if self.options.fetch_only:
            self.init(database=True, write=False)
        else:
            self.init()

        reposit = ctx.get_option('repository')
        components = ctx.get_option('component')
        packages = []
        if components:
            componentdb = inary.db.componentdb.ComponentDB()
            for name in components:
                if componentdb.has_component(name):
                    if repository:
                        packages.extend(
                            componentdb.get_packages(name,
                                                     walk=True,
                                                     repo=reposit))
                    else:
                        packages.extend(
                            componentdb.get_union_packages(name, walk=True))
        packages.extend(self.args)

        upgrade.upgrade(packages, reposit)

        try:
            config_changes, opt = helper.check_config_changes([
                util.parse_package_name_legacy(i.split("/")[-1])[0]
                for i in packages
            ])
            if config_changes:
                if ctx.ui.confirm(
                        _("[!] Some config files have been changed. Would you like to see and apply them?"
                          )):
                    helper.show_changed_configs(config_changes, opt)
        except ValueError:
            pass

        if not self.options.ignore_sysconf:
            sysconf.proceed(self.options.force_sysconf)
Example #6
0
    def run(self):
        from inary.operations import remove
        self.init()

        components = ctx.get_option('component')
        if not components and not self.args:
            self.help()
            return

        packages = []
        if components:
            for name in components:
                if self.componentdb.has_component(name):
                    packages.extend(
                        self.componentdb.get_union_packages(name, walk=True))
        packages.extend(self.args)

        remove.remove(packages)

        if not self.options.ignore_sysconf:
            sysconf.proceed(self.options.force_sysconf)
Example #7
0
 def run(self):
     sc.proceed(self.options.force)