예제 #1
0
def virtual_install(metadata, files, txn):
    """Recreate the package info for rebuilddb command"""
    pkg = metadata.package

    # normally this can't be true. Just for backward compatibility
    # TODO: for speed only ctx.installdb.install exception can be
    # handled but this is much cleaner
    if ctx.installdb.is_installed(pkg.name, txn):
        if __is_virtual_upgrade(metadata):
            ctx.installdb.remove(pkg.name, txn)
            packagedb.remove_package(pkg.name, txn)
            ctx.filesdb.remove_files(ctx.installdb.files(pkg.name), txn)
        else:
            return

    pkginfo = metadata.package
    
    # installdb
    ctx.installdb.install(metadata.package.name,
                         metadata.package.version,
                         metadata.package.release,
                         metadata.package.build,
                         metadata.package.distribution,
                         True,
                         txn)

    # filesdb
    ctx.filesdb.add_files(metadata.package.name, files, txn)
    
    # installed packages
    packagedb.inst_packagedb.add_package(pkginfo, txn)
예제 #2
0
파일: operations.py 프로젝트: Tayyib/uludag
def remove_single(package_name):
    """Remove a single package"""
    inst_packagedb = packagedb.inst_packagedb

    #TODO: check dependencies

    ctx.ui.info('Removing package %s' % package_name)
    if not ctx.installdb.is_installed(package_name):
        raise Exception('Trying to remove nonexistent package '
                        + package_name)
    if ctx.comard:
        ctx.comard.remove(package_name)
        ctx.comard.call("System.Package", "preremove")
    for fileinfo in ctx.installdb.files(package_name).list:
        fpath = os.path.join(ctx.config.destdir, fileinfo.path)
        # TODO: We have to store configuration files for futher
        # usage. Currently we'are doing it like rpm does, saving
        # with a prefix and leaving the user to edit it. In the future
        # we'll have a plan for these configuration files.
        if fileinfo.type == ctx.const.conf:
            if os.path.isfile(fpath):
                os.rename(fpath, fpath + ".pisi")
        else:
            # check if file is removed manually.
            # And we don't remove directories!
            # FIXME: should give a warning if it is...
            if os.path.isfile(fpath):
                os.unlink(fpath)


    ctx.installdb.remove(package_name)
    packagedb.remove_package(package_name)
예제 #3
0
파일: operations.py 프로젝트: Tayyib/uludag
def remove_db(package_name):
    ctx.installdb.remove(package_name)
    packagedb.remove_package(package_name)  #FIXME: this looks like a mistake!
예제 #4
0
 def remove_db(self):
     ctx.installdb.remove(self.package_name)
     ctx.filesdb.remove_files(ctx.installdb.files(self.package_name))
     #FIXME: this looks like a mistake!
     packagedb.remove_package(self.package_name)