예제 #1
0
    def __str__(self):
        s = specfile.Package.__str__(self)
        i_size = util.human_readable_size(self.installedSize)
        size = "%.2f %s" % (i_size[0], i_size[1])

        s += _("Distribution: %s, Dist. Release: %s\n") % (self.distribution, self.distributionRelease)
        s += _("Architecture: %s, Installed Size: %s") % (self.architecture, size)

        if self.packageSize:
            p_size = util.human_readable_size(self.packageSize)
            size = "%.2f %s" % (p_size[0], p_size[1])
            s += _(", Package Size: %s") % size

        return s
예제 #2
0
def install_pkg_names(A, reinstall=False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    A = [str(x)
         for x in A]  #FIXME: why do we still get unicode input here? :/ -- exa
    # A was a list, remove duplicates and expand components
    A_0 = A = expand_components(set(A))
    ctx.ui.debug('A = %s' % str(A))

    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not ctx.installdb.is_installed(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(
                _('Not re-installing the following packages: ') +
                util.strlist(d))
            A = Ap

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

    A |= upgrade_base(A)

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = A

    ctx.ui.info(
        _("""Following packages will be installed
in the respective order to satisfy dependencies:
""") + util.strlist(order))

    total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return

    if len(order) > len(A_0):
        if not ctx.ui.confirm(
                _('There are extra packages due to dependencies. Do you want to continue?'
                  )):
            return False

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

    pisi_installed = ctx.installdb.is_installed('pisi')

    for x in order:
        atomicoperations.install_single_name(x, True)  # allow reinstalls here

    if 'pisi' in order and pisi_installed:
        upgrade_pisi()
예제 #3
0
    def __str__(self):
        s = specfile.Package.__str__(self)
        i_size = util.human_readable_size(self.installedSize)
        size = "%.2f %s" % (i_size[0], i_size[1])

        s += _('Distribution: %s, Dist. Release: %s\n') % \
              (self.distribution, self.distributionRelease)
        s += _('Architecture: %s, Installed Size: %s') % \
              (self.architecture, size)

        if self.packageSize:
            p_size = util.human_readable_size(self.packageSize)
            size = "%.2f %s" % (p_size[0], p_size[1])
            s += _(', Package Size: %s') % size

        return s
예제 #4
0
def install_pkg_names(A, reinstall = False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    installdb = pisi.db.installdb.InstallDB()

    A = [str(x) for x in A] #FIXME: why do we still get unicode input here? :/ -- exa
    # A was a list, remove duplicates
    A_0 = A = set(A)

    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not installdb.has_package(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(_("The following package(s) are already installed and are not going to be installed again:\n") +
                             util.strlist(d))
            A = Ap

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

    A |= operations.upgrade.upgrade_base(A)

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    if len(order) > 1:
        ctx.ui.info(_("Following packages will be installed in the respective "
                      "order to satisfy dependencies:\n") + util.strlist(order))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of package(s): %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return True

    if set(order) - A_0:
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
            return False

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

    for x in order:
        atomicoperations.install_single_name(x, True)  # allow reinstalls here

    return True
예제 #5
0
def install_pkg_names(A, reinstall=False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    A = [str(x) for x in A]  # FIXME: why do we still get unicode input here? :/ -- exa
    # A was a list, remove duplicates and expand components
    A_0 = A = expand_components(set(A))
    ctx.ui.debug("A = %s" % str(A))

    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not ctx.installdb.is_installed(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(
                _("The following package(s) are already installed and are not going to be installed again:\n")
                + util.strlist(d)
            )
            A = Ap

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

    A |= upgrade_base(A)

    if not ctx.config.get_option("ignore_dependency"):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = list(A)

    if len(order) > 1:
        ctx.ui.info(
            _("Following packages will be installed in the respective " "order to satisfy dependencies:\n")
            + util.strlist(order)
        )

    total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_("Total size of package(s): %.2f %s") % (total_size, symbol))

    if ctx.get_option("dry_run"):
        return

    if set(order) - A_0:
        if not ctx.ui.confirm(_("There are extra packages due to dependencies. Do you want to continue?")):
            return False

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

    pisi_installed = ctx.installdb.is_installed("pisi")

    for x in order:
        atomicoperations.install_single_name(x, True)  # allow reinstalls here

    if "pisi" in order and pisi_installed:
        upgrade_pisi()
예제 #6
0
def install_pkg_names(A, reinstall = False, bypass_safety = False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    A = [str(x) for x in A] #FIXME: why do we still get unicode input here? :/ -- exa
    # A was a list, remove duplicates and expand components
    A_0 = A = expand_components(set(A))
    ctx.ui.debug('A = %s' % str(A))

    if not bypass_safety:
        upgrade_base(A)
    
    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not ctx.installdb.is_installed(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(_('Not re-installing the following packages: ') +
                           util.strlist(d))
            A = Ap

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

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = A

    ctx.ui.info(_("""Following packages will be installed
in the respective order to satisfy dependencies:
""") + util.strlist(order))

    total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return

    if len(order) > len(A_0):
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
            return False
            
    ctx.ui.notify(ui.packagestogo, order = order)

    pisi_installed = ctx.installdb.is_installed('pisi')
    
    for x in order:
        atomicoperations.install_single_name(x)
        
    if not bypass_safety and 'pisi' in order and pisi_installed:
        upgrade_pisi()
예제 #7
0
def install_pkg_names(A, reinstall = False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    # A was a list, remove duplicates and expand components
    A_0 = A = expand_components(set(A))
    ctx.ui.debug('A = %s' % str(A))

    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not ctx.installdb.is_installed(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(_('Not re-installing the following packages: ') +
                           util.strlist(d))
            A = Ap

    if len(A)==0:
        ctx.ui.info(_('No packages to install.'))
        return
        
    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = A

    ctx.ui.info(_("""The following minimal list of packages will be installed
in the respective order to satisfy dependencies:
""") + util.strlist(order))

    #this silly try/except block will be removed soon..
    try:
        total_size = sum([packagedb.get_package(p).packageSize for p in order])
    except:
        total_size = 0

    if total_size:
        total_size, symbol = util.human_readable_size(total_size)
        ctx.ui.warning(_('Total size of packages: %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return

    if len(order) > len(A_0):
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
            return False
            
    ctx.ui.notify(ui.packagestogo, order = order)
            
    for x in order:
        atomicoperations.install_single_name(x)
예제 #8
0
def install_pkg_names(A, reinstall=False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    installdb = pisi.db.installdb.InstallDB()
    packagedb = pisi.db.packagedb.PackageDB()

    A = [str(x) for x in A]  # FIXME: why do we still get unicode input here? :/ -- exa
    # A was a list, remove duplicates
    A_0 = A = set(A)

    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not installdb.has_package(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(
                _("The following package(s) are already installed and are not going to be installed again:\n")
                + util.strlist(d)
            )
            A = Ap

    if len(A) == 0:
        ctx.ui.info(_("No packages to install."))
        return True

    A |= operations.upgrade.upgrade_base(A)

    if not ctx.config.get_option("ignore_dependency"):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component("system.base"):
        order = operations.helper.reorder_base_packages(order)

    if len(order) > 1:
        ctx.ui.info(
            _("Following packages will be installed in the respective " "order to satisfy dependencies:\n")
            + util.strlist(order)
        )

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_("Total size of package(s): %.2f %s") % (total_size, symbol))

    if ctx.get_option("dry_run"):
        return True

    if set(order) - A_0:
        if not ctx.ui.confirm(_("There are extra packages due to dependencies. Do you want to continue?")):
            return False

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

    ignore_dep = ctx.config.get_option("ignore_dependency")

    conflicts = []
    if not ctx.get_option("ignore_package_conflicts"):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    paths = []
    for x in order:
        ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x) + 1, len(order)), "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be installed packages but do not install them.
    if ctx.get_option("fetch_only"):
        return

    if conflicts:
        operations.remove.remove_conflicting_packages(conflicts)

    for path in paths:
        ctx.ui.info(util.colorize(_("Installing %d / %d") % (paths.index(path) + 1, len(paths)), "yellow"))
        install_op = atomicoperations.Install(path)
        install_op.install(False)

    return True
예제 #9
0
파일: upgrade.py 프로젝트: poyraz76/pisi
def upgrade(A=[], repo=None):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    packagedb = pisi.db.packagedb.PackageDB()
    installdb = pisi.db.installdb.InstallDB()
    replaces = packagedb.get_replaces()
    if not A:
        # if A is empty, then upgrade all packages
        A = installdb.list_installed()

    if repo:
        repo_packages = set(packagedb.list_packages(repo))
        A = set(A).intersection(repo_packages)

    A_0 = A = set(A)
    Ap = find_upgrades(A, replaces)
    A = set(Ap)

    # Force upgrading of installed but replaced packages or else they will be removed (they are obsoleted also).
    # This is not wanted for a replaced driver package (eg. nvidia-X).
    A |= set(pisi.util.flatten_list(replaces.values()))

    A |= upgrade_base(A)

    A = pisi.blacklist.exclude_from(A, ctx.const.blacklist)

    if ctx.get_option('exclude_from'):
        A = pisi.blacklist.exclude_from(A, ctx.get_option('exclude_from'))

    if ctx.get_option('exclude'):
        A = pisi.blacklist.exclude(A, ctx.get_option('exclude'))

    ctx.ui.debug('A = %s' % str(A))

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

    ctx.ui.debug('A = %s' % str(A))

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_upgrade(A, replaces=replaces)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    ctx.ui.status(_('The following packages will be upgraded:'))
    ctx.ui.info(util.format_by_columns(sorted(order)))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(
        util.colorize(
            _('Total size of package(s): %.2f %s') % (total_size, symbol),
            "yellow"))

    needs_confirm = check_update_actions(order)

    # NOTE: replaces.values() was already flattened above, it can be reused
    if set(order) - A_0 - set(pisi.util.flatten_list(replaces.values())):
        ctx.ui.warning(_("There are extra packages due to dependencies."))
        needs_confirm = True

    if ctx.get_option('dry_run'):
        return

    if needs_confirm and \
            not ctx.ui.confirm(_("Do you want to continue?")):
        return False

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

    conflicts = []
    if not ctx.get_option('ignore_package_conflicts'):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    paths = []
    for x in order:
        ctx.ui.info(
            util.colorize(
                _("Downloading %d / %d") % (order.index(x) + 1, len(order)),
                "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option('fetch_only'):
        return

    if conflicts:
        operations.remove.remove_conflicting_packages(conflicts)

    operations.remove.remove_obsoleted_packages()

    for path in paths:
        ctx.ui.info(
            util.colorize(
                _("Installing %d / %d") % (paths.index(path) + 1, len(paths)),
                "yellow"))
        install_op = atomicoperations.Install(path, ignore_file_conflicts=True)
        install_op.install(not ctx.get_option('compare_sha1sum'))
예제 #10
0
def install_pkg_names(A, reinstall = False, extra = False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    installdb = pisi.db.installdb.InstallDB()
    packagedb = pisi.db.packagedb.PackageDB()

    A = [str(x) for x in A] #FIXME: why do we still get unicode input here? :/ -- exa
    # A was a list, remove duplicates
    A_0 = A = set(A)

    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not installdb.has_package(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(_("The following package(s) are already installed "
                             "and are not going to be installed again:"))
            ctx.ui.info(util.format_by_columns(sorted(d)))
            A = Ap

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

    A |= operations.upgrade.upgrade_base(A)

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    if len(order) > 1:
        ctx.ui.info(util.colorize(_("Following packages will be installed:"), "brightblue"))
        ctx.ui.info(util.format_by_columns(sorted(order)))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(util.colorize(_('Total size of package(s): %.2f %s') % (total_size, symbol), "yellow"))

    if ctx.get_option('dry_run'):
        return True

    extra_packages = set(order) - A_0
    if extra_packages:
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
            return False

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

    ignore_dep = ctx.config.get_option('ignore_dependency')

    conflicts = []
    if not ctx.get_option('ignore_package_conflicts'):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    paths = []
    extra_paths = {}
    for x in order:
        ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x)+1, len(order)), "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)
        if x in extra_packages or (extra and x in A):
            extra_paths[install_op.package_fname] = x
        elif reinstall and  x in installdb.installed_extra:
            installdb.installed_extra.remove(x)
            with open(os.path.join(ctx.config.info_dir(), ctx.const.installed_extra), "w") as ie_file:
                ie_file.write("\n".join(installdb.installed_extra) + ("\n" if installdb.installed_extra else ""))


    # fetch to be installed packages but do not install them.
    if ctx.get_option('fetch_only'):
        return

    if conflicts:
        operations.remove.remove_conflicting_packages(conflicts)

    for path in paths:
        ctx.ui.info(util.colorize(_("Installing %d / %d") % (paths.index(path)+1, len(paths)), "yellow"))
        install_op = atomicoperations.Install(path)
        install_op.install(False)
        try:
            with open(os.path.join(ctx.config.info_dir(), ctx.const.installed_extra), "a") as ie_file:
                ie_file.write("%s\n" % extra_paths[path])
            installdb.installed_extra.append(extra_paths[path])
        except KeyError:
            pass

    return True
예제 #11
0
def upgrade(A=[], repo=None):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    packagedb = pisi.db.packagedb.PackageDB()
    installdb = pisi.db.installdb.InstallDB()
    replaces = packagedb.get_replaces()
    if not A:
        # if A is empty, then upgrade all packages
        A = installdb.list_installed()

    if repo:
        repo_packages = set(packagedb.list_packages(repo))
        A = set(A).intersection(repo_packages)

    A_0 = A = set(A)
    Ap = find_upgrades(A, replaces)
    A = set(Ap)

    # Force upgrading of installed but replaced packages or else they will be removed (they are obsoleted also).
    # This is not wanted for a replaced driver package (eg. nvidia-X).
    A |= set(pisi.util.flatten_list(replaces.values()))

    A |= upgrade_base(A)

    A = pisi.blacklist.exclude_from(A, ctx.const.blacklist)

    if ctx.get_option('exclude_from'):
        A = pisi.blacklist.exclude_from(A, ctx.get_option('exclude_from'))

    if ctx.get_option('exclude'):
        A = pisi.blacklist.exclude(A, ctx.get_option('exclude'))

    ctx.ui.debug('A = %s' % str(A))

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

    ctx.ui.debug('A = %s' % str(A))

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_upgrade(A, replaces=replaces)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    ctx.ui.status(_('The following packages will be upgraded:'))
    ctx.ui.info(util.format_by_columns(sorted(order)))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(util.colorize(_('Total size of package(s): %.2f %s') % (total_size, symbol), "yellow"))

    needs_confirm = check_update_actions(order)

    # NOTE: replaces.values() was already flattened above, it can be reused
    if set(order) - A_0 - set(pisi.util.flatten_list(replaces.values())):
        ctx.ui.warning(_("There are extra packages due to dependencies."))
        needs_confirm = True

    if ctx.get_option('dry_run'):
        return

    if needs_confirm and \
            not ctx.ui.confirm(_("Do you want to continue?")):
        return False

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

    conflicts = []
    if not ctx.get_option('ignore_package_conflicts'):
        conflicts = operations.helper.check_conflicts(order, packagedb)


    automatic = operations.helper.extract_automatic(A, order)
    paths = []
    for x in order:
        ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x)+1, len(order)), "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option('fetch_only'):
        return

    if conflicts:
        operations.remove.remove_conflicting_packages(conflicts)

    operations.remove.remove_obsoleted_packages()

    try:
        for path in paths:
            ctx.ui.info(util.colorize(_("Installing %d / %d") % (paths.index(path)+1, len(paths)), "yellow"))
            install_op = atomicoperations.Install(path, ignore_file_conflicts = True)
            if install_op.pkginfo.name in automatic:
                install_op.automatic = True
            install_op.install(True)
    except Exception as e:
        raise e
    finally:
        ctx.exec_usysconf()
예제 #12
0
def install_pkg_names(A, reinstall=False):
    """This is the real thing. It installs packages from
    the repository, trying to perform a minimum number of
    installs"""

    installdb = pisi.db.installdb.InstallDB()
    packagedb = pisi.db.packagedb.PackageDB()

    A = [str(x)
         for x in A]  #FIXME: why do we still get unicode input here? :/ -- exa
    # A was a list, remove duplicates
    A_0 = A = set(A)

    # filter packages that are already installed
    if not reinstall:
        Ap = set(filter(lambda x: not installdb.has_package(x), A))
        d = A - Ap
        if len(d) > 0:
            ctx.ui.warning(
                _("The following package(s) are already installed and are not going to be installed again:\n"
                  ) + util.strlist(d))
            A = Ap

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

    A |= operations.upgrade.upgrade_base(A)

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_install_pkg_names(A)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    if len(order) > 1:
        ctx.ui.info(
            _("Following packages will be installed in the respective "
              "order to satisfy dependencies:\n") + util.strlist(order))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of package(s): %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return True

    if set(order) - A_0:
        if not ctx.ui.confirm(
                _('There are extra packages due to dependencies. Do you want to continue?'
                  )):
            return False

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

    ignore_dep = ctx.config.get_option('ignore_dependency')

    conflicts = []
    if not ctx.get_option('ignore_package_conflicts'):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    paths = []
    for x in order:
        ctx.ui.info(
            util.colorize(
                _("Downloading %d / %d") % (order.index(x) + 1, len(order)),
                "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be installed packages but do not install them.
    if ctx.get_option('fetch_only'):
        return

    if conflicts:
        operations.remove.remove_conflicting_packages(conflicts)

    for path in paths:
        ctx.ui.info(
            util.colorize(
                _("Installing %d / %d") % (paths.index(path) + 1, len(paths)),
                "yellow"))
        install_op = atomicoperations.Install(path)
        install_op.install(False)

    return True
예제 #13
0
def upgrade_pkg_names(A=[], bypass_safety=False):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    ignore_build = ctx.get_option("ignore_build_no")

    if not A:
        # if A is empty, then upgrade all packages
        A = ctx.installdb.list_installed()

    # filter packages that are not upgradable
    A_0 = A = expand_components(set(A))

    if not bypass_safety:
        upgrade_base(A)

    Ap = []
    for x in A:
        if x.endswith(ctx.const.package_suffix):
            ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))
        if not ctx.installdb.is_installed(x):
            ctx.ui.info(_("Package %s is not installed.") % x, True)
            continue
        (version, release, build) = ctx.installdb.get_version(x)
        if ctx.packagedb.has_package(x):
            pkg = ctx.packagedb.get_package(x)
        else:
            ctx.ui.info(_("Package %s is not available in repositories.") % x, True)
            continue

        if ignore_build or (not build) or (not pkg.build):
            if Version(release) < Version(pkg.release):
                Ap.append(x)
            else:
                ctx.ui.info(_("Package %s is already at the latest release %s.") % (pkg.name, pkg.release), True)
        else:
            if build < pkg.build:
                Ap.append(x)
            else:
                ctx.ui.info(_("Package %s is already at the latest build %s.") % (pkg.name, pkg.build), True)
    A = set(Ap)

    if len(A) == 0:
        ctx.ui.info(_("No packages to upgrade."))
        return True

    ctx.ui.debug("A = %s" % str(A))

    if not ctx.config.get_option("ignore_dependency"):
        G_f, order = plan_upgrade(A, ignore_build)
    else:
        G_f = None
        order = A

    ctx.ui.info(_("The following packages will be upgraded: ") + util.strlist(order))

    total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_("Total size of packages: %.2f %s") % (total_size, symbol))

    if ctx.get_option("dry_run"):
        return

    if len(order) > len(A_0):
        if not ctx.ui.confirm(_("There are extra packages due to dependencies. Do you want to continue?")):
            return False

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

    paths = []
    for x in order:
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    for path in paths:
        install_op = atomicoperations.Install(path)
        install_op.install(True)
예제 #14
0
def upgrade_pkg_names(A=[]):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    ignore_build = ctx.get_option('ignore_build_no')
    security_only = ctx.get_option('security_only')

    packagedb = pisi.db.packagedb.PackageDB()
    replaces = packagedb.get_replaces()

    installdb = pisi.db.installdb.InstallDB()

    if not A:
        # if A is empty, then upgrade all packages
        A = installdb.list_installed()

    A_0 = A = set(A)

    Ap = []
    for x in A:
        if x.endswith(ctx.const.package_suffix):
            ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))

        # Handling of replacement packages
        if x in replaces.values():
            Ap.append(x)
            continue

        if x in replaces.keys():
            Ap.append(replaces[x])
            continue

        if not installdb.has_package(x):
            ctx.ui.info(_('Package %s is not installed.') % x, True)
            continue
        (version, release, build) = installdb.get_version(x)
        if packagedb.has_package(x):
            pkg = packagedb.get_package(x)
        else:
            ctx.ui.info(
                _('Package %s is not available in repositories.') % x, True)
            continue

        if security_only:
            updates = [
                i for i in pkg.history if
                pisi.version.Version(i.release) > pisi.version.Version(release)
            ]
            if not pisi.util.any(lambda i: i.type == 'security', updates):
                continue

        if ignore_build or (not build) or (not pkg.build):
            if pisi.version.Version(release) < pisi.version.Version(
                    pkg.release):
                Ap.append(x)
            else:
                ctx.ui.info(
                    _('Package %s is already at the latest release %s.') %
                    (pkg.name, pkg.release), True)
        else:
            if build < pkg.build:
                Ap.append(x)
            else:
                ctx.ui.info(
                    _('Package %s is already at the latest build %s.') %
                    (pkg.name, pkg.build), True)

    A = set(Ap)

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

    A |= upgrade_base(A)

    ctx.ui.debug('A = %s' % str(A))

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_upgrade(A)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    if not ctx.get_option('ignore_package_conflicts'):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    ctx.ui.info(
        _('The following packages will be upgraded: ') + util.strlist(order))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of package(s): %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return

    if set(order) - A_0 - set(replaces.values()):
        if not ctx.ui.confirm(
                _('There are extra packages due to dependencies. Do you want to continue?'
                  )):
            return False

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

    paths = []
    for x in order:
        ctx.ui.info(
            util.colorize(
                _("Downloading %d / %d") % (order.index(x) + 1, len(order)),
                "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option('fetch_only'):
        return

    if not ctx.get_option('ignore_package_conflicts'):
        if conflicts:
            operations.remove.remove_conflicting_packages(conflicts)

    if replaces:
        operations.remove.remove_replaced_packages(order, replaces)

    operations.remove.remove_obsoleted_packages()

    for path in paths:
        ctx.ui.info(
            util.colorize(
                _("Installing %d / %d") % (paths.index(path) + 1, len(paths)),
                "yellow"))
        install_op = atomicoperations.Install(path, ignore_file_conflicts=True)
        install_op.install(True)
예제 #15
0
def upgrade_pkg_names(A=[]):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    ignore_build = ctx.get_option("ignore_build_no")
    security_only = ctx.get_option("security_only")

    if not A:
        # if A is empty, then upgrade all packages
        A = ctx.installdb.list_installed()

    A_0 = A = set(A)

    Ap = []
    for x in A:
        if x.endswith(ctx.const.package_suffix):
            ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))

        if not ctx.installdb.is_installed(x):
            ctx.ui.info(_("Package %s is not installed.") % x, True)
            continue
        (version, release, build) = ctx.installdb.get_version(x)
        if ctx.packagedb.has_package(x):
            pkg = ctx.packagedb.get_package(x)
        else:
            ctx.ui.info(_("Package %s is not available in repositories.") % x, True)
            continue

        if security_only:
            history = ctx.packageDB.get_history(x)
            updates = [i for i in history if pisi.version.Version(i.release) > pisi.version.Version(release)]
            if not pisi.util.any(lambda i: i.type == "security", updates):
                continue

        if ignore_build or (not build) or (not pkg.build):
            if pisi.version.Version(release) < pisi.version.Version(pkg.release):
                Ap.append(x)
            else:
                ctx.ui.info(_("Package %s is already at the latest release %s.") % (pkg.name, pkg.release), True)
        else:
            if build < pkg.build:
                Ap.append(x)
            else:
                ctx.ui.info(_("Package %s is already at the latest build %s.") % (pkg.name, pkg.build), True)

    A = set(Ap)

    if len(A) == 0:
        ctx.ui.info(_("No packages to upgrade."))
        return True

    A |= upgrade_base(A)

    ctx.ui.debug("A = %s" % str(A))

    if not ctx.config.get_option("ignore_dependency"):
        G_f, order = plan_upgrade(A, ignore_build)
    else:
        G_f = None
        order = list(A)

    # Bug 4211
    if ctx.componentdb.has_component("system.base"):
        order = reorder_base_packages(order)

    if not ctx.get_option("ignore_package_conflicts"):
        conflicts = check_conflicts(order, ctx.packagedb)

    ctx.ui.info(_("The following packages will be upgraded: ") + util.strlist(order))

    total_size, cached_size = calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_("Total size of package(s): %.2f %s") % (total_size, symbol))

    if ctx.get_option("dry_run"):
        return

    if set(order) - A_0:
        if not ctx.ui.confirm(_("There are extra packages due to dependencies. Do you want to continue?")):
            return False

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

    paths = []
    for x in order:
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option("fetch_only"):
        return

    if not ctx.get_option("ignore_package_conflicts"):
        if conflicts:
            remove_conflicting_packages(conflicts)

    for path in paths:
        install_op = atomicoperations.Install(path, ignore_file_conflicts=True)
        install_op.install(True)

    if "pisi" in order:
        upgrade_pisi()
예제 #16
0
def upgrade_pkg_names(A = []):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    ignore_build = ctx.get_option('ignore_build_no')
    security_only = ctx.get_option('security_only')

    packagedb = pisi.db.packagedb.PackageDB()
    replaces = packagedb.get_replaces()

    installdb = pisi.db.installdb.InstallDB()

    if not A:
        # if A is empty, then upgrade all packages
        A = installdb.list_installed()

    A_0 = A = set(A)

    Ap = []
    for x in A:
        if x.endswith(ctx.const.package_suffix):
            ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))

        # Handling of replacement packages
        if x in replaces.values():
            Ap.append(x)
            continue

        if x in replaces.keys():
            Ap.append(replaces[x])
            continue

        if not installdb.has_package(x):
            ctx.ui.info(_('Package %s is not installed.') % x, True)
            continue
        (version, release, build) = installdb.get_version(x)
        if packagedb.has_package(x):
            pkg = packagedb.get_package(x)
        else:
            ctx.ui.info(_('Package %s is not available in repositories.') % x, True)
            continue

        if security_only:
            updates = [i for i in pkg.history if pisi.version.Version(i.release) > pisi.version.Version(release)]
            if not pisi.util.any(lambda i:i.type == 'security', updates):
                continue

        if ignore_build or (not build) or (not pkg.build):
            if pisi.version.Version(release) < pisi.version.Version(pkg.release):
                Ap.append(x)
            else:
                ctx.ui.info(_('Package %s is already at the latest release %s.')
                            % (pkg.name, pkg.release), True)
        else:
            if build < pkg.build:
                Ap.append(x)
            else:
                ctx.ui.info(_('Package %s is already at the latest build %s.')
                            % (pkg.name, pkg.build), True)

                
    A = set(Ap)

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

    A |= upgrade_base(A)

    ctx.ui.debug('A = %s' % str(A))

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_upgrade(A)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    if not ctx.get_option('ignore_package_conflicts'):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    ctx.ui.info(_('The following packages will be upgraded: ') +
                util.strlist(order))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of package(s): %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return

    if set(order) - A_0 - set(replaces.values()):
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
            return False

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

    paths = []
    for x in order:
        ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x)+1, len(order)), "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option('fetch_only'):
        return

    if not ctx.get_option('ignore_package_conflicts'):
        if conflicts:
            operations.remove.remove_conflicting_packages(conflicts)

    if replaces:
        operations.remove.remove_replaced_packages(order, replaces)

    operations.remove.remove_obsoleted_packages()
    
    for path in paths:
        ctx.ui.info(util.colorize(_("Installing %d / %d") % (paths.index(path)+1, len(paths)), "yellow"))
        install_op = atomicoperations.Install(path, ignore_file_conflicts = True)
        install_op.install(True)
예제 #17
0
파일: upgrade.py 프로젝트: zaxebo1/pisi-1
def upgrade_pkg_names(A=[]):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    ignore_build = ctx.get_option('ignore_build_no')
    security = ctx.get_option('security')

    if not A:
        # if A is empty, then upgrade all packages
        A = ctx.installdb.list_installed()

    A_0 = A = component.expand_components(set(A))

    Ap = []
    for x in A:
        if x.endswith(ctx.const.package_suffix):
            ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))

        if not ctx.installdb.is_installed(x):
            ctx.ui.info(_('Package %s is not installed.') % x, True)
            continue
        (version, release, build) = ctx.installdb.get_version(x)
        if ctx.packagedb.has_package(x):
            pkg = ctx.packagedb.get_package(x)
        else:
            ctx.ui.info(
                _('Package %s is not available in repositories.') % x, True)
            continue

        if security:  # below is a readable functional code, don't overflow lines!
            updates = [
                x for x in pkg.history if Version(x.release) > Version(release)
            ]
            if not pisi.util.any(lambda x: x.type == 'security', updates):
                continue

        if ignore_build or (not build) or (not pkg.build):
            if Version(release) < Version(pkg.release):
                Ap.append(x)
            else:
                ctx.ui.info(
                    _('Package %s is already at the latest release %s.') %
                    (pkg.name, pkg.release), True)
        else:
            if build < pkg.build:
                Ap.append(x)
            else:
                ctx.ui.info(
                    _('Package %s is already at the latest build %s.') %
                    (pkg.name, pkg.build), True)

    A = set(Ap)

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

    A |= upgrade_base(A)

    ctx.ui.debug('A = %s' % str(A))

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_upgrade(A, ignore_build)
    else:
        G_f = None
        order = A

    ctx.ui.info(
        _('The following packages will be upgraded: ') + util.strlist(order))

    total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return

    if len(order) > len(A_0):
        if not ctx.ui.confirm(
                _('There are extra packages due to dependencies. Do you want to continue?'
                  )):
            return False

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

    paths = []
    for x in order:
        install_op = install.Install.from_name(x)
        paths.append(install_op.package_fname)

    for path in paths:
        install_op = install.Install(path, ignore_file_conflicts=True)
        install_op.install(True)

    if 'pisi' in order:
        upgradepisi.upgrade_pisi()
예제 #18
0
파일: upgrade.py 프로젝트: Tayyib/uludag
def upgrade_pkg_names(A = [], repo=None):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    packagedb = pisi.db.packagedb.PackageDB()
    installdb = pisi.db.installdb.InstallDB()
    replaces = packagedb.get_replaces()
    if not A:
        # if A is empty, then upgrade all packages
        A = installdb.list_installed()

    if repo:
        repo_packages = set(packagedb.list_packages(repo))
        A = set(A).intersection(repo_packages)

    A_0 = A = set(A)
    Ap = find_upgrades(A, replaces)
    A = set(Ap)

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

    # Force upgrading of installed but replaced packages or else they wil be removed (they are obsoleted also).
    # This is not wanted for a replaced driver package (eg. nvidia-X).
    A |= set(replaces.values())

    A |= upgrade_base(A)

    ctx.ui.debug('A = %s' % str(A))

    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_upgrade(A)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component('system.base'):
        order = operations.helper.reorder_base_packages(order)

    ctx.ui.info(_('The following packages will be upgraded: ') +
                util.strlist(order))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of package(s): %.2f %s') % (total_size, symbol))

    if ctx.get_option('dry_run'):
        return

    if set(order) - A_0 - set(replaces.values()):
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
            return False

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

    conflicts = []
    if not ctx.get_option('ignore_package_conflicts'):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    paths = []
    for x in order:
        ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x)+1, len(order)), "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option('fetch_only'):
        return

    if conflicts:
        operations.remove.remove_conflicting_packages(conflicts)

    operations.remove.remove_replaced_packages(replaces.keys())
    operations.remove.remove_obsoleted_packages()

    for path in paths:
        ctx.ui.info(util.colorize(_("Installing %d / %d") % (paths.index(path)+1, len(paths)), "yellow"))
        install_op = atomicoperations.Install(path, ignore_file_conflicts = True)
        install_op.install(True)
예제 #19
0
def upgrade_pkg_names(A = []):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""
    
    ignore_build = ctx.get_option('ignore_build_no')
    security = ctx.get_option('security')

    if not A:
        # if A is empty, then upgrade all packages
        A = ctx.installdb.list_installed()
        
    A_0 = A = expand_components(set(A))

    Ap = []
    for x in A:
        if x.endswith(ctx.const.package_suffix):
            ctx.ui.debug(_("Warning: package *name* ends with '.pisi'"))
            
        if not ctx.installdb.is_installed(x):
            ctx.ui.info(_('Package %s is not installed.') % x, True)
            continue
        (version, release, build) = ctx.installdb.get_version(x)
        if ctx.packagedb.has_package(x):
            pkg = ctx.packagedb.get_package(x)
        else:
            ctx.ui.info(_('Package %s is not available in repositories.') % x, True)
            continue

        if security: # below is a readable functional code, don't overflow lines!
            updates = [i for i in pkg.history if Version(i.release) > Version(release)]
            if not pisi.util.any(lambda i:i.type == 'security', updates):
                continue
            
        if ignore_build or (not build) or (not pkg.build):
            if Version(release) < Version(pkg.release):
                Ap.append(x)
            else:
                ctx.ui.info(_('Package %s is already at the latest release %s.')
                            % (pkg.name, pkg.release), True)
        else:
            if build < pkg.build:
                Ap.append(x)
            else:
                ctx.ui.info(_('Package %s is already at the latest build %s.')
                            % (pkg.name, pkg.build), True)
        
        
    A = set(Ap)
    
    if len(A)==0:
        ctx.ui.info(_('No packages to upgrade.'))
        return True

    A |= upgrade_base(A)
        
    ctx.ui.debug('A = %s' % str(A))
    
    if not ctx.config.get_option('ignore_dependency'):
        G_f, order = plan_upgrade(A, ignore_build)
    else:
        G_f = None
        order = A

    ctx.ui.info(_('The following packages will be upgraded: ') +
                util.strlist(order))

    total_size = sum([ctx.packagedb.get_package(p).packageSize for p in order])
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(_('Total size of packages: %.2f %s') % (total_size, symbol))
    
    if ctx.get_option('dry_run'):
        return

    if len(order) > len(A_0):
        if not ctx.ui.confirm(_('There are extra packages due to dependencies. Do you want to continue?')):
            return False

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

    paths = []
    for x in order:
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option('fetch_only'):
        return
   
    for path in paths:
        install_op = atomicoperations.Install(path, ignore_file_conflicts = True)
        install_op.install(True)
        
    if 'pisi' in order:
        upgrade_pisi()
예제 #20
0
def upgrade(A=[], repo=None):
    """Re-installs packages from the repository, trying to perform
    a minimum or maximum number of upgrades according to options."""

    packagedb = pisi.db.packagedb.PackageDB()
    installdb = pisi.db.installdb.InstallDB()
    replaces = packagedb.get_replaces()
    if not A:
        # if A is empty, then upgrade all packages
        A = installdb.list_installed()

    if repo:
        repo_packages = set(packagedb.list_packages(repo))
        A = set(A).intersection(repo_packages)

    A_0 = A = set(A)
    Ap = find_upgrades(A, replaces)
    A = set(Ap)

    # Force upgrading of installed but replaced packages or else they will be removed (they are obsoleted also).
    # This is not wanted for a replaced driver package (eg. nvidia-X).
    #
    # sum(array, []) is a nice trick to flatten an array of arrays
    A |= set(sum(replaces.values(), []))

    A |= upgrade_base(A)

    A = pisi.blacklist.exclude_from(A, ctx.const.blacklist)

    if ctx.get_option("exclude_from"):
        A = pisi.blacklist.exclude_from(A, ctx.get_option("exclude_from"))

    if ctx.get_option("exclude"):
        A = pisi.blacklist.exclude(A, ctx.get_option("exclude"))

    ctx.ui.debug("A = %s" % str(A))

    if len(A) == 0:
        ctx.ui.info(_("No packages to upgrade."))
        return True

    ctx.ui.debug("A = %s" % str(A))

    if not ctx.config.get_option("ignore_dependency"):
        G_f, order = plan_upgrade(A, replaces=replaces)
    else:
        G_f = None
        order = list(A)

    componentdb = pisi.db.componentdb.ComponentDB()

    # Bug 4211
    if componentdb.has_component("system.base"):
        order = operations.helper.reorder_base_packages(order)

    ctx.ui.status(_("The following packages will be upgraded:"))
    ctx.ui.info(util.format_by_columns(sorted(order)))

    total_size, cached_size = operations.helper.calculate_download_sizes(order)
    total_size, symbol = util.human_readable_size(total_size)
    ctx.ui.info(util.colorize(_("Total size of package(s): %.2f %s") % (total_size, symbol), "yellow"))

    needs_confirm = check_update_actions(order)

    if set(order) - A_0 - set(sum(replaces.values(), [])):
        ctx.ui.warning(_("There are extra packages due to dependencies."))
        needs_confirm = True

    if ctx.get_option("dry_run"):
        return

    if needs_confirm and not ctx.ui.confirm(_("Do you want to continue?")):
        return False

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

    conflicts = []
    if not ctx.get_option("ignore_package_conflicts"):
        conflicts = operations.helper.check_conflicts(order, packagedb)

    paths = []
    for x in order:
        ctx.ui.info(util.colorize(_("Downloading %d / %d") % (order.index(x) + 1, len(order)), "yellow"))
        install_op = atomicoperations.Install.from_name(x)
        paths.append(install_op.package_fname)

    # fetch to be upgraded packages but do not install them.
    if ctx.get_option("fetch_only"):
        return

    if conflicts:
        operations.remove.remove_conflicting_packages(conflicts)

    operations.remove.remove_obsoleted_packages()

    for path in paths:
        ctx.ui.info(util.colorize(_("Installing %d / %d") % (paths.index(path) + 1, len(paths)), "yellow"))
        install_op = atomicoperations.Install(path, ignore_file_conflicts=True)
        install_op.install(True)