Exemplo n.º 1
0
Arquivo: api.py Projeto: Tayyib/uludag
def configure_pending():
    # start with pending packages
    # configure them in reverse topological order of dependency
    A = ctx.installdb.list_pending()
    #print A
    G_f = pgraph.PGraph(packagedb)               # construct G_f
    for x in A:
        G_f.add_package(x)
    B = A
    #state = {}
    while len(B) > 0:
        Bp = set()
        for x in B:
            pkg = packagedb.get_package(x)
            #print pkg
            for dep in pkg.runtimeDeps:
                if dep.package in G_f.vertices():
                    G_f.add_dep(x, dep)
        B = Bp
    G_f.write_graphviz(sys.stdout)
    order = G_f.topological_sort()
    order.reverse()
    #print order
    for x in order:
        comariface.run_postinstall(x)
Exemplo n.º 2
0
    def install(self, ask_reinstall = True):
        "entry point"
        ctx.ui.status(_('Installing %s, version %s, release %s, build %s') %
                (self.pkginfo.name, self.pkginfo.version,
                 self.pkginfo.release, self.pkginfo.build))
        ctx.ui.notify(pisi.ui.installing, package = self.pkginfo, files = self.files)

        self.ask_reinstall = ask_reinstall
        self.check_requirements()
        self.check_relations()
        self.check_reinstall()
        self.extract_install()
        self.store_pisi_files()
        if ctx.comar:
            import pisi.comariface as comariface
            self.register_comar_scripts()
            ctx.ui.notify(pisi.ui.configuring, package = self.pkginfo, files = self.files)
            comariface.run_postinstall(self.pkginfo.name)
            ctx.ui.notify(pisi.ui.configured, package = self.pkginfo, files = self.files)

        txn = ctx.dbenv.txn_begin()
        try:
            self.update_databases(txn)
            txn.commit()
        except db.DBError, e:
            txn.abort()
            raise e
Exemplo n.º 3
0
def configure_pending():
    # start with pending packages
    # configure them in reverse topological order of dependency
    A = ctx.installdb.list_pending()
    G_f = pgraph.PGraph(packagedb)  # 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 = packagedb.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"):
        G_f.write_graphviz(sys.stdout)
    order = G_f.topological_sort()
    order.reverse()
    try:
        import pisi.comariface as comariface

        for x in order:
            comariface.run_postinstall(x)
            ctx.installdb.clear_pending(x)
    except ImportError:
        raise Error(_("COMAR: comard not fully installed"))
Exemplo n.º 4
0
 def install(self, ask_reinstall = True):
     "entry point"
     ctx.ui.status(_('Installing %s, version %s, release %s, build %s') %
             (self.pkginfo.name, self.pkginfo.version,
              self.pkginfo.release, self.pkginfo.build))
     ctx.ui.notify(pisi.ui.installing, package = self.pkginfo, files = self.files)
     self.ask_reinstall = ask_reinstall
     self.check_requirements()
     self.check_relations()
     self.check_reinstall()
     self.extract_install()
     self.store_pisi_files()
     if ctx.comar:
         import pisi.comariface as comariface
         self.register_comar_scripts()
         if not ctx.config.options.postpone_postinstall:
             comariface.run_postinstall(self.pkginfo.name)
     self.update_databases()
     self.update_environment()
     ctx.ui.status()
     if self.upgrade:
         event = pisi.ui.upgraded
     else:
         event = pisi.ui.installed
     ctx.ui.notify(event, package = self.pkginfo, files = self.files)
Exemplo n.º 5
0
def configure_pending():
    # start with pending packages
    # configure them in reverse topological order of dependency
    A = ctx.installdb.list_pending()
    G_f = pgraph.PGraph(ctx.packagedb)               # construct G_f
    for x in A.keys():
        G_f.add_package(x)
    B = A
    while len(B) > 0:
        Bp = set()
        for x in B.keys():
            pkg = ctx.packagedb.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'):
        G_f.write_graphviz(sys.stdout)
    order = G_f.topological_sort()
    order.reverse()
    try:
        import pisi.comariface as comariface
        for x in order:
            if ctx.installdb.is_installed(x):
                pkginfo = A[x]
                pkgname = util.package_name(x, pkginfo.version,
                                        pkginfo.release,
                                        False,
                                        False)
                pkg_path = util.join_path(ctx.config.lib_dir(),
                                          'package', pkgname)
                m = MetaData()
                metadata_path = util.join_path(pkg_path, ctx.const.metadata_xml)
                m.read(metadata_path)
                for pcomar in m.package.providesComar:
                    scriptPath = util.join_path(pkg_path,
                                            ctx.const.comar_dir,
                                            pcomar.script)
                    comariface.register(pcomar, x, scriptPath)
                    # FIXME: we need a full package info here!
                    # Eray, please fix this
                    # your wish is a command, darling -- eray
                    pkginfo.name = x
                    ctx.ui.notify(pisi.ui.configuring, package = pkginfo, files = None)
                    comariface.run_postinstall(x)
                    ctx.ui.notify(pisi.ui.configured, package = pkginfo, files = None)
            ctx.installdb.clear_pending(x)
    except ImportError:
        raise Error(_("COMAR: comard not fully installed"))
Exemplo n.º 6
0
 def install(self, ask_reinstall = True):
     "entry point"
     ctx.ui.info(_('Installing %s, version %s, release %s, build %s') %
             (self.pkginfo.name, self.pkginfo.version,
              self.pkginfo.release, self.pkginfo.build))
     self.ask_reinstall = ask_reinstall
     self.check_requirements()
     self.check_relations()
     self.check_reinstall()
     self.extract_install()
     self.store_pisi_files()
     if ctx.comard:
         self.register_comar_scripts()
         comariface.run_postinstall(self.pkginfo.name)
     self.update_databases()
Exemplo n.º 7
0
def configure_pending():
    # start with pending packages
    # configure them in reverse topological order of dependency
    A = ctx.installdb.list_pending()
    G_f = pgraph.PGraph(packagedb)               # construct G_f
    for x in A.keys():
        G_f.add_package(x)
    B = A
    while len(B) > 0:
        Bp = set()
        for x in B.keys():
            pkg = packagedb.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'):
        G_f.write_graphviz(sys.stdout)
    order = G_f.topological_sort()
    order.reverse()
    try:
        import pisi.comariface as comariface
        for x in order:
            pkginfo = A[x]
            pkgname = util.package_name(x, pkginfo.version,
                                        pkginfo.release,
                                        pkginfo.build,
                                        False)
            pkg_path = util.join_path(ctx.config.lib_dir(),
                                           pkgname)
            m = MetaData()
            metadata_path = util.join_path(pkg_path, ctx.const.metadata_xml)
            m.read(metadata_path)
            for pcomar in m.package.providesComar:
                scriptPath = util.join_path(pkg_path,
                                            ctx.const.comar_dir,
                                            pcomar.script)
                comariface.register(pcomar, x, scriptPath)
                comariface.run_postinstall(x)
            ctx.installdb.clear_pending(x)
    except ImportError:
        raise Error(_("COMAR: comard not fully installed"))
Exemplo n.º 8
0
    def install(self, ask_reinstall = True):
        "entry point"
        ctx.ui.status(_('Installing %s, version %s, release %s, build %s') %
                (self.pkginfo.name, self.pkginfo.version,
                 self.pkginfo.release, self.pkginfo.build))
        ctx.ui.notify(pisi.ui.installing, package = self.pkginfo, files = self.files)

        self.ask_reinstall = ask_reinstall
        self.check_requirements()
        self.check_relations()
        self.check_reinstall()
        self.extract_install()
        self.store_pisi_files()

        self.config_later = False

        if self.metadata.package.providesComar:
            if ctx.comar:
                import pisi.comariface as comariface
                self.register_comar_scripts()
            else:
                self.config_later = True # configure-pending will register scripts later

        if 'System.Package' in [x.om for x in self.metadata.package.providesComar]:
            if ctx.comar:
                ctx.ui.notify(pisi.ui.configuring, package = self.pkginfo, files = self.files)
                comariface.run_postinstall(self.pkginfo.name)
                ctx.ui.notify(pisi.ui.configured, package = self.pkginfo, files = self.files)
            else:
                self.config_later = True

        txn = ctx.dbenv.txn_begin()
        try:
            self.update_databases(txn)
            txn.commit()
        except db.DBError, e:
            txn.abort()
            raise e