예제 #1
0
파일: addrepo.py 프로젝트: paledega/inary
    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
예제 #2
0
    def run(self):
        import inary.operations

        if not self.options.quiet:
            self.options.debug = True

        if self.options.package_format == "help":
            ctx.ui.info(_("Supported package formats:"))
            for format in inary.package.Package.formats:
                if format == inary.package.Package.default_format:
                    ctx.ui.info(_("  {} (default)").format(format))
                else:
                    ctx.ui.info("  {}".format(format))
            return

        self.init(False, False)

        if not ctx.get_option('output_dir'):
            ctx.config.options.output_dir = '.'

        for x in self.args or ["pspec.xml"]:
            if ctx.get_option('until'):
                inary.operations.build.build_until(x,
                                                   ctx.get_option('until'),
                                                   emerge=False)
            else:
                inary.operations.build.build(x, emerge=False)
예제 #3
0
    def run(self):
        self.init(database=False, write=False)

        if self.options.package_format == "help":
            ctx.ui.info(_("Supported package formats:"))
            for format in inary.package.Package.formats:
                if format == inary.package.Package.default_format:
                    ctx.ui.info(_("  {} (default)").format(format))
                else:
                    ctx.ui.info("  {}".format(format))
            return

        new_package = ctx.get_option("newest_package")
        if new_package:
            old_packages = self.args
        else:
            if len(self.args) < 2:
                self.help()
                return

            new_package = self.args[-1]
            old_packages = self.args[:-1]

        if not ctx.get_option('output_dir'):
            ctx.config.options.output_dir = '.'

        from inary.operations.delta import create_delta_packages
        create_delta_packages(old_packages, new_package)
예제 #4
0
def install(packages,
            reinstall=False,
            ignore_file_conflicts=False,
            ignore_package_conflicts=False):
    """
    Returns True if no errors occured during the operation
    @param packages: list of package names -> list_of_strings
    @param reinstall: reinstalls already installed packages else ignores
    @param ignore_file_conflicts: Ignores file conflicts during the installation and continues to install
    packages.
    @param ignore_package_conflicts: Ignores package conflicts during the installation and continues to
    install packages.
    """

    inary.db.historydb.HistoryDB().create_history("install")

    if not ctx.get_option('ignore_file_conflicts'):
        ctx.set_option('ignore_file_conflicts', ignore_file_conflicts)

    if not ctx.get_option('ignore_package_conflicts'):
        ctx.set_option('ignore_package_conflicts', ignore_package_conflicts)

    # Install inary package files or inary packages from a repository
    if packages and packages[0].endswith(ctx.const.package_suffix):
        return install_pkg_files(packages, reinstall)
    else:
        return install_pkg_names(packages, reinstall)
예제 #5
0
    def run(self):

        if self.options.fetch_only:
            self.init(database=True, write=False)
        else:
            self.init()

        if not ctx.get_option('bypass_update_repo'):
            ctx.ui.info(_('Updating repositories.'), color='green')
            repos = inary.db.repodb.RepoDB().list_repos(only_active=True)
            repository.update_repos(repos)
        else:
            ctx.ui.info(_('Will not update repositories.'))

        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)
예제 #6
0
파일: upgrade.py 프로젝트: sulincix/inary
def upgrade_base(A=None):
    if A is None:
        A = set()
    installdb = inary.db.installdb.InstallDB()
    packagedb = inary.db.packagedb.PackageDB()
    componentdb = inary.db.componentdb.ComponentDB()
    if not ctx.config.values.general.ignore_safety and not ctx.get_option(
            'ignore_safety'):
        if componentdb.has_component('system.base'):
            systembase = set(
                componentdb.get_union_component('system.base').packages)
            extra_installs = [
                x for x in systembase - set(A) if not installdb.has_package(x)
            ]
            extra_installs = inary.blacklist.exclude_from(
                extra_installs, ctx.const.blacklist)
            if extra_installs:
                ctx.ui.warning(
                    _("Safety switch forces the installation of "
                      "following packages:"))
                ctx.ui.info(util.format_by_columns(sorted(extra_installs)))

            # Will delete G_F and extra_upgrades
            install_order = operations.install.plan_install_pkg_names(
                extra_installs)
            extra_upgrades = [
                x for x in systembase - set(install_order)
                if is_upgradable(x, installdb, packagedb)
            ]
            upgrade_order = []

            extra_upgrades = inary.blacklist.exclude_from(
                extra_upgrades, ctx.const.blacklist)

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

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

            if extra_upgrades:
                ctx.ui.warning(
                    _("Safety switch forces the upgrade of "
                      "following packages:"))
                ctx.ui.info(util.format_by_columns(sorted(extra_upgrades)))
                upgrade_order = plan_upgrade(extra_upgrades,
                                             force_replaced=False)

            # no-need-for-upgrade-order patch
            # extra_upgrades = filter(lambda x: is_upgradable(x, ignore_build), systembase - set(extra_installs))
            # return set(extra_installs + extra_upgrades)

            # return packages that must be added to any installation
            return set(install_order + upgrade_order)
        else:
            ctx.ui.warning(
                _('Safety switch: The component system.base cannot be found.'))
    return set()
예제 #7
0
파일: emerge.py 프로젝트: sulincix/inary
    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)
예제 #8
0
    def run(self):
        self.init(database=True, write=True)

        config_changes = helper.check_config_changes(order=self.installdb.list_installed())

        if config_changes:
            if ctx.get_option('purge'):
                for package in config_changes:
                    if config_changes[package]:
                        for file in config_changes[package]:
                            helper.apply_changed_config(file, keep=False)
                return

            if ctx.get_option('soft-keep'):
                for package in config_changes:
                    if config_changes[package]:
                        for file in config_changes[package]:
                            helper.apply_changed_config(file, keep=True)
                return


            if ctx.ui.confirm(_("[!] Some config files have been changed. Would you like to see and apply them?")):
                helper.show_changed_configs(config_changes)

        else:
            ctx.ui.info(_("There isn't any new config :)"), color='green')
예제 #9
0
파일: emergeup.py 프로젝트: paledega/inary
    def run(self):
        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)
예제 #10
0
    def run(self):
        self.init(database=True, write=False)
        orphaned = self.installdb.get_orphaned()
        if ctx.get_option('exclude'):
            orphaned = inary.blacklist.exclude(orphaned,
                                               ctx.get_option('exclude'))

        remove.remove(orphaned)
예제 #11
0
파일: history.py 프로젝트: paledega/inary
    def run(self):
        self.init(database=False, write=False)
        if ctx.get_option('snapshot'):
            self.take_snapshot()
            return
        elif ctx.get_option('takeback'):
            opno = ctx.get_option('takeback')
            if opno != -1:
                self.takeback(opno)
                return

        self.redirect_output(self.print_history)
예제 #12
0
    def run(self):
        self.init(database=True, write=False)

        build_host = ctx.get_option("with_build_host")
        if build_host is None:
            installed = self.installdb.list_installed()
        else:
            installed = self.installdb.list_installed_with_build_host(
                build_host)

        component = ctx.get_option('component')
        if component:
            component_pkgs = self.componentdb.get_union_packages(
                component, walk=True)
            installed = list(set(installed) & set(component_pkgs))

        installed.sort()

        # Resize the first column according to the longest package name
        if installed:
            maxlen = max([len(_p) for _p in installed])

        if self.options.install_info:
            ctx.ui.info(
                _('Package Name          |St|        Version|  Rel.|  Distro|             Date'))
            sys.stdout.write(
                '===========================================================================\n')

        if self.options.long:
            for pkg in installed:
                inst_info = self.installdb.get_info(pkg)
                ctx.ui.info(str(pkg))
                ctx.ui.info(str(inst_info))

        elif self.options.install_info:
            for pkg in installed:
                inst_info = self.installdb.get_info(pkg)
                ctx.ui.info('%-20s  ' % pkg, color='white', noln=True)
                ctx.ui.info('|%s' % inst_info.one_liner())

        elif self.options.name_only:
            for pkg in installed:
                ctx.ui.info(pkg, color='white')

        else:
            for pkg in installed:
                pkgname = pkg
                psum = self.installdb.get_summary(pkg)
                pkgname += ' ' * (maxlen - len(pkg))
                ctx.ui.info('{} '.format(pkgname), color='white', noln=True)
                ctx.ui.info('- {}'.format(str(psum)))
예제 #13
0
    def check_distribution(self, name):
        if ctx.get_option('ignore_check'):
            return

        dist_name = self.get_distribution(name)
        if dist_name is None:
            return

        compatible = dist_name == ctx.config.values.general.distribution

        dist_release = self.get_distribution_release(name)
        if dist_release is not None:
            compatible &= \
                dist_release == ctx.config.values.general.distribution_release

        if not compatible:
            self.deactivate_repo(name)
            raise IncompatibleRepoError(
                _("Repository \"{}\" is not compatible with your distribution. Repository is disabled."
                  "Your distribution is {} release {}"
                  "Repository distribution is {} release {}\n"
                  "If you want add this repository please use \"--ignore-check\" parameter with this command."
                  ).format(name, ctx.config.values.general.distribution,
                           ctx.config.values.general.distribution_release,
                           dist_name, dist_release))
예제 #14
0
파일: pgraph.py 프로젝트: paledega/inary
def generate_pending_order(A):
    # returns pending package list in reverse topological order of dependency
    installdb = inary.db.installdb.InstallDB()
    G_f = PGraph(installdb)  # construct G_f
    for x in A:
        G_f.add_package(x)
    B = A
    while len(B) > 0:
        Bp = set()
        for x in B:
            pkg = installdb.get_package(x)
            for dep in pkg.runtimeDependencies():
                if dep.package in G_f.vertices():
                    G_f.add_dep(x, dep)
        B = Bp
    if ctx.get_option('debug'):
        import sys
        G_f.write_graphviz(sys.stdout)
    order = G_f.topological_sort()
    order.reverse()

    componentdb = inary.db.componentdb.ComponentDB()
    # Bug 4211
    if componentdb.has_component('system.base'):
        order = op_helper.reorder_base_packages(order)

    return order
예제 #15
0
    def run(self):
        self.init(database=True, write=False)
        installed = self.installdb.list_installed()
        component = ctx.get_option('component')
        if component:
            component_pkgs = self.componentdb.get_union_packages(component,
                                                                 walk=True)
            installed = list(set(installed) & set(component_pkgs))

        installed.sort()
        need_reinstall = []
        broken_packages = []

        for pkg in installed:
            for p in self.installdb.get_package(pkg).runtimeDependencies():
                sys.stderr.write("\x1b[K" + _("Checking: {}").format(p) + "\r")
                if not self.installdb.has_package(str(p.package)):
                    need_reinstall.append(p.package)
                    sys.stderr.write(
                        _("Missing: - {} : Needed by: - {}").format(
                            p.package, pkg) + "\n")

        if self.options.force:
            for pkg in installed:
                pkgname = pkg
                files = self.installdb.get_files(pkg)
                sys.stderr.write("\x1b[K" + _("Checking: {}").format(pkg) +
                                 "\r")
                for f in files.list:
                    if not os.path.exists("/" + f.path):
                        need_reinstall.append(pkg)
                        sys.stderr.write(
                            _("Missing: /{} - {}").format(f.path, pkg) + "\n")
        self.fix_reinstall(need_reinstall)
예제 #16
0
파일: archive.py 프로젝트: sulincix/inary
    def unpack(self, target_dir, clean_dir=True):

        # check archive file's integrity
        if not util.check_file_hash(self.archiveFile, self.archive.sha1sum):
            ctx.ui.warning(
                _("Archive File: {}\n * Expected sha1 value: {}\n * Received sha1 value: {}\n"
                  .format(self.url.filename(), self.archive.sha1sum,
                          util.sha1_file(self.archiveFile))))
            if not ctx.get_option('ignore_verify'):
                raise SourceArchiveError(_("unpack: check_file_hash failed."))
            else:
                ctx.ui.warning(
                    _("* Archive verification passed. Such problems may occur during the build process."
                      ))
        try:
            archive = Archive(self.archiveFile, self.archive.type)
        except UnknownArchiveType:
            raise SourceArchiveError(
                _("Unknown archive type '{0}' is given for '{1}'.").format(
                    self.archive.type, self.url.filename()))
        except ArchiveHandlerNotInstalled:
            raise SourceArchiveError(
                _("Inary needs \'{}\' to unpack this archive but it is not installed."
                  ).format(self.archive.type))

        target_dir = os.path.join(target_dir, self.archive.target or "")
        archive.unpack(target_dir, clean_dir)
예제 #17
0
파일: misc.py 프로젝트: sulincix/inary
def colorize(msg, color):
    """Colorize the given message for console output"""
    if color in ctx.const.colors and not (ctx.get_option('no_color') or
                                          ctx.config.values.general.no_color):
        return str(ctx.const.colors[color] + msg + ctx.const.colors['default'])
    else:
        return str(msg)
예제 #18
0
파일: history.py 프로젝트: sulincix/inary
    def print_history(self):
        ordered_history = [_("Inary Transaction History: ")]
        for operation in self.historydb.get_last(ctx.get_option('last')):

            msg_oprt = util.colorize(_("Operation "), 'yellow') \
                + util.colorize("#{}: ".format(operation.no), "blue") \
                + util.colorize("{}:".format(opttrans[operation.type]), "white")

            date_and_time = util.colorize(
                _("Date: "), "cyan") + "{0.date} {0.time}".format(operation)
            ordered_history.append(msg_oprt)
            ordered_history.append(date_and_time)

            if operation.type == "snapshot":
                msg_snap = util.colorize(
                    _("    * There are {} packages in this snapshot.").format(len(operation.packages)),
                    "purple")

                ordered_history.append(msg_snap)
            elif operation.type == "repoupdate":
                for repo in operation.repos:
                    ordered_history.append("    * " + repo.name)
            else:
                for pkg in operation.packages:
                    ordered_history.append("    * " + pkg.name)
        return ordered_history
예제 #19
0
파일: emerge.py 프로젝트: paledega/inary
def emerge(A):
    """
    Builds and installs the given packages from source
    @param A: list of package names -> list_of_strings
    """
    inary.db.historydb.HistoryDB().create_history("emerge")

    # A was a list, remove duplicates and expand components
    A = [str(x) for x in A]
    A_0 = A = inary.operations.helper.expand_src_components(set(A))
    ctx.ui.debug('A = {}'.format(str(A)))

    if len(A) == 0:
        ctx.ui.info(_('No packages to emerge.'))
        return

    # A |= upgrade_base(A)

    # FIXME: Errr... order_build changes type conditionally and this
    # is not good. - baris
    if not ctx.config.get_option('ignore_dependency'):
        G_f, order_inst, order_build = plan_emerge(A)
    else:
        G_f = None
        order_inst = []
        order_build = A

    if order_inst:
        ctx.ui.info(_("""The following list of packages will be installed
from repository in the respective order to satisfy dependencies:
""") + util.strlist(order_inst))
    ctx.ui.info(_("""The following list of packages will be built and
installed in the respective order to satisfy dependencies:
""") + util.strlist(order_build))

    if ctx.get_option('dry_run'):
        return

    if len(order_inst) + len(order_build) > len(A_0):
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Would you like to continue?')):
            return False

    ctx.ui.notify(ui.packagestogo, order=order_inst)

    for x in order_inst:
        atomicoperations.install_single_name(x)

    # ctx.ui.notify(ui.packagestogo, order = order_build)

    for x in order_build:
        package_names = operations.build.build(x).new_packages
        inary.operations.install.install_pkg_files(package_names, reinstall=True)  # handle inter-package deps here
        # reset counts between builds
        ctx.ui.errors = ctx.ui.warnings = 0

    # FIXME: take a look at the fixme above :(, we have to be sure
    # that order_build is a known type...
    U = set(order_build)
    U.update(order_inst)
예제 #20
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)
예제 #21
0
파일: search.py 프로젝트: paledega/inary
    def run(self):

        self.init(database=True, write=False)

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

        cs = ctx.get_option("case_sensitive")
        replace = re.compile("({})".format("|".join(self.args)),
                             0 if cs else re.I)
        lang = ctx.get_option('language')
        repo = ctx.get_option('repository')
        name = ctx.get_option('name')
        summary = ctx.get_option('summary')
        desc = ctx.get_option('description')
        fields = None
        if name or summary or desc:
            fields = {'name': name, 'summary': summary, 'desc': desc}

        if ctx.get_option('installdb'):
            db = inary.db.installdb.InstallDB()
            pkgs = db.search_package(self.args, lang, fields, cs)
            get_info = db.get_package
            get_name_sum = lambda pkg: (pkg.name, pkg.summary)
        elif ctx.get_option('sourcedb'):
            db = inary.db.sourcedb.SourceDB()
            pkgs = db.search_spec(self.args, lang, repo, fields, cs)
            get_info = db.get_spec
            get_name_sum = lambda pkg: (pkg.source.name, pkg.source.summary)
        else:
            db = inary.db.packagedb.PackageDB()
            pkgs = db.search_package(self.args, lang, repo, fields, cs)
            get_info = db.get_package
            get_name_sum = lambda pkg: (pkg.name, pkg.summary)

        if pkgs:
            maxlen = max([len(_pkg) for _pkg in pkgs])

        for pkg in pkgs:
            pkg_info = get_info(pkg)

            name, summary = get_name_sum(pkg_info)
            lenp = len(name)

            name = replace.sub(inary.util.colorize(r"\1", "brightred"), name)
            if lang and lang in summary:
                summary = replace.sub(inary.util.colorize(r"\1", "brightred"),
                                      str(summary[lang]))
            else:
                summary = replace.sub(inary.util.colorize(r"\1", "brightred"),
                                      str(summary))

            name += ' ' * max(0, maxlen - lenp)

            ctx.ui.info('{0} - {1}'.format(name, summary))
예제 #22
0
파일: misc.py 프로젝트: SulinOS/inary
def colorize(msg, color):
    """Colorize the given message for console output"""
    if ctx.get_option(
            'no_color'
    ) or ctx.config.values.general.no_color or "NO_COLOR" in os.environ:
        return str(msg)
    else:
        return str(ctx.const.colors[color] + msg + ctx.const.colors['default'])
예제 #23
0
파일: __init__.py 프로젝트: sulincix/inary
 def error(self, msg):
     msg = str(msg)
     self.errors += 1
     if ctx.log:
         ctx.log.error(msg)
     if ctx.get_option('no_color'):
         self.output(_('Error: ') + msg + '\n', err=True)
     else:
         self.output(util.colorize(msg + '\n', 'brightred'), err=True)
예제 #24
0
    def run(self):
        self.init(database=True, write=False)

        from inary.file import File

        ctypes = {
            "bz2": File.COMPRESSION_TYPE_BZ2,
            "xz": File.COMPRESSION_TYPE_XZ
        }
        compression = 0
        for type_str in ctx.get_option("compression_types").split(","):
            compression |= ctypes.get(type_str, 0)

        index.index(self.args or ["."],
                    ctx.get_option('output'),
                    skip_sources=ctx.get_option('skip_sources'),
                    skip_signing=ctx.get_option('skip_signing'),
                    compression=compression)
예제 #25
0
    def run(self):
        self.init(database=True)

        if self.args:
            repos = self.args
        else:
            repos = inary.db.repodb.RepoDB().list_repos(only_active=True)

        repository.update_repos(repos, ctx.get_option('force'))
예제 #26
0
    def run(self):
        self.init(database=True, write=False)

        from inary.file import File

        ctypes = {"bz2": File.COMPRESSION_TYPE_BZ2,
                  "xz": File.COMPRESSION_TYPE_XZ}
        compression = 0
        for type_str in ctx.get_option("compression_types").split(","):
            compression |= ctypes.get(type_str, 0)

        util.xterm_title(_("Taking inary repo index."))
        ctx.config.options.yes_all = True
        index.index(self.args or ["."], ctx.get_option('output'),
                    skip_sources=ctx.get_option('skip_sources'),
                    skip_signing=ctx.get_option('skip_signing'),
                    compression=compression)
        util.xterm_title_reset()
예제 #27
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)
예제 #28
0
 def run(self):
     self.init(database=True)
     if ctx.ui.confirm(_('Rebuild INARY databases?')):
         ctx.ui.info(_("Updating database caches"))
         inary.db.regenerate_caches()
         ctx.ui.info(_("Saving database caches"))
         inary.db.update_caches()
         if ctx.get_option('files'):
             ctx.ui.info(_("Updating filesdb"))
             inary.db.filesdb.rebuild_db()
예제 #29
0
파일: __init__.py 프로젝트: sulincix/inary
 def warning(self, msg, verbose=False):
     msg = str(msg)
     self.warnings += 1
     if ctx.log:
         ctx.log.warning(msg)
     if ctx.get_option('no_color'):
         self.output(_('Warning: ') + msg + '\n', err=True, verbose=verbose)
     else:
         self.output(util.colorize(msg + '\n', 'brightyellow'),
                     err=True,
                     verbose=verbose)
예제 #30
0
파일: history.py 프로젝트: sulincix/inary
 def run(self):
     self.init(database=False, write=False)
     if ctx.get_option('snapshot'):
         self.take_snapshot()
         return
     elif ctx.get_option('takeback') != -1:
         opno = ctx.get_option('takeback')
         self.takeback(opno)
         return
     elif ctx.get_option('reset'):
         ctx.ui.info(_("Resetting history casts"), verbose=True)
         util.clean_dir(ctx.config.history_dir())
         util.makedirs(ctx.config.history_dir())
         import inary.data.history as History
         history = History.History()
         history.create("reset")
         history.update()
         return
     else:
         self.redirect_output(self.print_history())