Example #1
0
def snapshot():
    """
    Takes snapshot of the system packages. The snapshot is only a record of which packages are currently
    installed. The record is kept by pisi history mechanism as it works automatically on install, remove
    and upgrade operations.
    """

    installdb = pisi.db.installdb.InstallDB()
    historydb = pisi.db.historydb.HistoryDB()
    historydb.create_history("snapshot")

    li = installdb.list_installed()
    progress = ctx.ui.Progress(len(li))

    processed = 0
    for name in installdb.list_installed():
        package = installdb.get_package(name)
        historydb.add_package(pkgBefore=package, operation="snapshot")
        # Save changed config files of the package in snapshot
        for f in installdb.get_files(name).list:
            if f.type == "config" and pisi.util.config_changed(f):
                fpath = pisi.util.join_path(ctx.config.dest_dir(), f.path)
                historydb.save_config(name, fpath)

        processed += 1
        ctx.ui.display_progress(operation="snapshot",
                                percent=progress.update(processed),
                                info=_("Taking snapshot of the system"))

    historydb.update_history()
Example #2
0
def snapshot():
    """
    Takes snapshot of the system packages. The snapshot is only a record of which packages are currently
    installed. The record is kept by pisi history mechanism as it works automatically on install, remove
    and upgrade operations.
    """

    installdb = pisi.db.installdb.InstallDB()
    historydb = pisi.db.historydb.HistoryDB()
    historydb.create_history("snapshot")

    li = installdb.list_installed()
    progress = ctx.ui.Progress(len(li))

    processed = 0
    for name in installdb.list_installed():
        package = installdb.get_package(name)
        historydb.add_package(pkgBefore=package, operation="snapshot")
        # Save changed config files of the package in snapshot
        for f in installdb.get_files(name).list:
            if f.type == "config" and pisi.util.config_changed(f):
                fpath = pisi.util.join_path(ctx.config.dest_dir(), f.path)
                historydb.save_config(name, fpath)

        processed += 1
        ctx.ui.display_progress(operation = "snapshot",
                                percent = progress.update(processed),
                                info = _("Taking snapshot of the system"))

    historydb.update_history()
Example #3
0
def list_upgradable():
    """
    Return a list of packages that are upgraded in the repository -> list_of_strings
    """
    installdb = pisi.db.installdb.InstallDB()
    is_upgradable = lambda pkg: pisi.operations.upgrade.is_upgradable(pkg, ctx.get_option('ignore_build_no'))
    
    upgradable = filter(is_upgradable, installdb.list_installed())
    # replaced packages can not pass is_upgradable test, so we add them manually
    upgradable.extend(list_replaces())
    return upgradable
Example #4
0
def list_upgradable():
    """
    Return a list of packages that are upgraded in the repository -> list_of_strings
    """
    installdb = pisi.db.installdb.InstallDB()
    is_upgradable = pisi.operations.upgrade.is_upgradable

    upgradable = list(filter(is_upgradable, installdb.list_installed()))
    # replaced packages can not pass is_upgradable test, so we add them manually
    upgradable.extend(list_replaces())

    # consider also blacklist filtering
    upgradable = pisi.blacklist.exclude_from(upgradable, ctx.const.blacklist)

    return upgradable
Example #5
0
def list_upgradable():
    """
    Return a list of packages that are upgraded in the repository -> list_of_strings
    """
    installdb = pisi.db.installdb.InstallDB()
    is_upgradable = pisi.operations.upgrade.is_upgradable

    upgradable = filter(is_upgradable, installdb.list_installed())
    # replaced packages can not pass is_upgradable test, so we add them manually
    upgradable.extend(list_replaces())

    # consider also blacklist filtering
    upgradable = pisi.blacklist.exclude_from(upgradable, ctx.const.blacklist)

    return upgradable