当前位置: 首页>>代码示例>>Python>>正文


Python metadata.MetaData类代码示例

本文整理汇总了Python中pisi.metadata.MetaData的典型用法代码示例。如果您正苦于以下问题:Python MetaData类的具体用法?Python MetaData怎么用?Python MetaData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MetaData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gen_metadata_xml

    def gen_metadata_xml(self, package):
        """Generate the metadata.xml file for build source.

        metadata.xml is composed of the information from specfile plus
        some additional information."""
        metadata = MetaData()
        metadata.from_spec(self.spec.source, package)

        metadata.package.distribution = ctx.config.values.general.distribution
        metadata.package.distributionRelease = ctx.config.values.general.distribution_release
        metadata.package.architecture = "Any"
        
        # FIXME: Bu hatalı. installsize'ı almak için tüm
        # pkg_install_dir()'ın boyutunu hesaplayamayız. Bir source
        # birden fazla kaynak üretebilir. package.paths ile
        # karşılaştırarak file listesinden boyutları hesaplatmalıyız.
        d = self.bctx.pkg_install_dir()
        size = util.dir_size(d)
        metadata.package.installedSize = str(size)
        
        # build no
        if ctx.config.options.ignore_build_no:
            metadata.package.build = None  # means, build no information n/a
            ctx.ui.warning('build number is not available.')
        else:
            metadata.package.build = self.calc_build_no(metadata.package.name)

        metadata_xml_path = os.path.join(self.bctx.pkg_dir(), ctx.const.metadata_xml)
        metadata.write(metadata_xml_path)
        self.metadata = metadata
开发者ID:Tayyib,项目名称:uludag,代码行数:30,代码来源:build.py

示例2: gen_metadata_xml

    def gen_metadata_xml(self, package, build_no=None):
        """Generate the metadata.xml file for build source.

        metadata.xml is composed of the information from specfile plus
        some additional information."""
        metadata = MetaData()
        metadata.from_spec(self.spec.source, package)

        metadata.package.distribution = ctx.config.values.general.distribution
        metadata.package.distributionRelease = ctx.config.values.general.distribution_release
        metadata.package.architecture = "Any"
        metadata.package.packageFormat = ctx.get_option('package_format')
        
        size = 0
        if package.debug_package:
            d = self.pkg_debug_dir()
        else:
            d = self.pkg_install_dir()

        for path in package.files:
            for p in glob.glob(util.join_path(d, path.path)):
                size += util.dir_size(p)

        metadata.package.installedSize = size

        self.metadata = metadata
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:26,代码来源:build.py

示例3: resurrect_package

def resurrect_package(package_fn):
    """Resurrect the package in the PiSi databases"""

    from os.path import exists

    metadata_xml = util.join_path(ctx.config.lib_dir(), package_fn, ctx.const.metadata_xml)
    if not exists(metadata_xml):
       raise Error, _("Metadata XML '%s' cannot be found") % metadata_xml

    metadata = MetaData()
    metadata.read(metadata_xml)

    errs = metadata.errors()
    if errs:   
       util.Checks.print_errors(errs)
       raise Error, _("MetaData format wrong (%s)") % package_fn
    
    ctx.ui.info(_('* Adding \'%s\' to db... ') % (metadata.package.name), noln=True)
    
    files_xml = util.join_path(ctx.config.lib_dir(), package_fn, ctx.const.files_xml)
    if not exists(files_xml):
       raise Error, _("Files XML '%s' cannot be found") % files_xml

    files = Files()
    files.read(files_xml)

    if files.errors():
       raise Error, _("Invalid %s") % ctx.const.files_xml

    import pisi.atomicoperations
    pisi.atomicoperations.virtual_install(metadata, files)
    ctx.ui.info(_('OK.'))
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:32,代码来源:atomicoperations.py

示例4: info_name

def info_name(package_name, installed=False):
    """fetch package information for a package"""
    if ctx.packagedb.has_package(package_name, pisi.itembyrepodb.all):
        if installed:
            package = ctx.packagedb.get_package(package_name, pisi.itembyrepodb.installed)
        else:
            package, repo = ctx.packagedb.get_package_repo(package_name)
            if repo==pisi.itembyrepodb.installed:
                raise Error(_('Package %s not found') % package_name)

        from pisi.metadata import MetaData
        metadata = MetaData()
        metadata.package = package
        #FIXME: get it from sourcedb if available
        metadata.source = None
        #TODO: fetch the files from server if possible (wow, you maniac -- future exa)
        if installed and ctx.installdb.is_installed(package.name):
            try:
                files = ctx.installdb.files(package.name)
            except pisi.Error, e:
                ctx.ui.warning(e)
                files = None
        else:
            files = None
        return metadata, files
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:25,代码来源:api.py

示例5: gen_metadata_xml

    def gen_metadata_xml(self, package):
        """Generate the metadata.xml file for build source.

        metadata.xml is composed of the information from specfile plus
        some additional information."""
        metadata = MetaData()
        metadata.from_spec(self.spec.source, package)

        metadata.package.distribution = ctx.config.values.general.distribution
        metadata.package.distributionRelease = ctx.config.values.general.distribution_release
        metadata.package.architecture = "Any"
        
        size, d = 0, self.pkg_install_dir()

        for path in package.files:
             size += util.dir_size(util.join_path(d, path.path))

        metadata.package.installedSize = size

        # build no
        if ctx.config.options.ignore_build_no:
            metadata.package.build = None  # means, build no information n/a
            ctx.ui.warning(_('Build number is not available due to --ignore-build'))
        elif (not ctx.config.values.build.buildno):
            metadata.package.build = None
            ctx.ui.warning(_('Build number is not available. For repo builds you must enable buildno in pisi.conf.'))
        else:
            metadata.package.build = self.calc_build_no(metadata.package.name)

        metadata_xml_path = util.join_path(self.pkg_dir(), ctx.const.metadata_xml)
        metadata.write(metadata_xml_path)
        self.metadata = metadata
开发者ID:Tayyib,项目名称:uludag,代码行数:32,代码来源:build.py

示例6: configure_pending

def configure_pending():
    # start with pending packages
    # configure them in reverse topological order of dependency
    A = ctx.installdb.list_pending()
    order = generate_pending_order(A)
    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)
                # FIXME: we need a full package info here!
                pkginfo.name = x
                ctx.ui.notify(pisi.ui.configuring, package = pkginfo, files = None)
                pisi.comariface.post_install(
                    pkginfo.name,
                    m.package.providesComar,
                    util.join_path(pkg_path, ctx.const.comar_dir),
                    util.join_path(pkg_path, ctx.const.metadata_xml),
                    util.join_path(pkg_path, ctx.const.files_xml),
                )
                ctx.ui.notify(pisi.ui.configured, package = pkginfo, files = None)
            ctx.installdb.clear_pending(x)
    except ImportError:
        raise Error(_("comar package is not fully installed"))
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:33,代码来源:api.py

示例7: configure_pending

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, pisi.itembyrepodb.installed) # 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, pisi.itembyrepodb.installed)
            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()

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

    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)
                # FIXME: we need a full package info here!
                pkginfo.name = x
                ctx.ui.notify(pisi.ui.configuring, package = pkginfo, files = None)
                pisi.comariface.post_install(
                    pkginfo.name,
                    m.package.providesComar,
                    util.join_path(pkg_path, ctx.const.comar_dir),
                    util.join_path(pkg_path, ctx.const.metadata_xml),
                    util.join_path(pkg_path, ctx.const.files_xml),
                )
                ctx.ui.notify(pisi.ui.configured, package = pkginfo, files = None)
            ctx.installdb.clear_pending(x)
    except ImportError:
        raise Error(_("comar package is not fully installed"))
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:53,代码来源:api.py

示例8: configure_pending

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"))
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:49,代码来源:api.py

示例9: resurrect_package

def resurrect_package(package_fn):
    """Resurrect the package in the PiSi databases"""

    from os.path import exists

    metadata_xml = util.join_path(ctx.config.lib_dir(), 'package', 
                                  package_fn, ctx.const.metadata_xml)
    if not exists(metadata_xml):
       raise Error, _("Metadata XML '%s' cannot be found") % metadata_xml

    metadata = MetaData()
    metadata.read(metadata_xml)

    errs = metadata.errors()
    if errs:   
       util.Checks.print_errors(errs)
       raise Error, _("MetaData format wrong (%s)") % package_fn

    # FIXME: there won't be any previous versions of the same package under /var/lib/pisi
    # therefore there won't be any need for this check and __is_virtual_upgrade function
    # this is just for backward compatibility for sometime

    # yes, this is an ugly hack
    passed = False
    if ctx.installdb.is_installed(metadata.package.name):
        passed = True
    
    if not passed:
        ctx.ui.info(_('* Adding \'%s\' to db... ') % (metadata.package.name), noln=True)
    
    files_xml = util.join_path(ctx.config.lib_dir(), 'package',
                               package_fn, ctx.const.files_xml)
    if not exists(files_xml):
       raise Error, _("Files XML '%s' cannot be found") % files_xml

    files = Files()
    files.read(files_xml)

    if files.errors():
       raise Error, _("Invalid %s") % ctx.const.files_xml

    import pisi.atomicoperations
    def f(txn):
        pisi.atomicoperations.virtual_install(metadata, files, txn)
    ctx.txn_proc(f)
    if not passed:
        ctx.ui.info(_('OK.'))
开发者ID:Tayyib,项目名称:uludag,代码行数:47,代码来源:atomicoperations.py

示例10: info_name

def info_name(package_name):
    """fetch package information for a package"""
    if packagedb.has_package(package_name):
        package = packagedb.get_package(package_name)
        from pisi.metadata import MetaData
        metadata = MetaData()
        metadata.package = package
        #FIXME: get it from sourcedb
        metadata.source = None
        #TODO: fetch the files from server if possible
        if ctx.installdb.is_installed(package.name):
            files = ctx.installdb.files(package.name)
        else:
            files = None
        return metadata, files
    else:
        raise Error(_('Package %s not found') % package_name)
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:17,代码来源:api.py

示例11: configure_pending

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"))
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:42,代码来源:api.py

示例12: info_name

def info_name(package_name, installed=False):
    """Fetch package information for the given package."""
    if installed:
        package = ctx.packagedb.get_package(package_name, pisi.itembyrepodb.installed)
    else:
        package, repo = ctx.packagedb.get_package_repo(package_name, pisi.itembyrepodb.repos)
        repostr = repo

    from pisi.metadata import MetaData
    metadata = MetaData()
    metadata.package = package
    #FIXME: get it from sourcedb if available
    metadata.source = None
    #TODO: fetch the files from server if possible (wow, you maniac -- future exa)
    if installed and ctx.installdb.is_installed(package.name):
        try:
            files = ctx.installdb.files(package.name)
        except pisi.Error, e:
            ctx.ui.warning(e)
            files = None
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:20,代码来源:api.py

示例13: gen_metadata_xml

    def gen_metadata_xml(self, package, build_no=None):
        """Generate the metadata.xml file for build source.

        metadata.xml is composed of the information from specfile plus
        some additional information."""
        metadata = MetaData()
        metadata.from_spec(self.spec.source, package, self.spec.history)

        metadata.package.distribution = ctx.config.values.general.distribution
        metadata.package.distributionRelease = ctx.config.values.general.distribution_release
        metadata.package.architecture = "Any"
        metadata.package.packageFormat = ctx.get_option('package_format')

        size = 0
        for fileinfo in self.files.list:
            size += fileinfo.size

        metadata.package.installedSize = size

        self.metadata = metadata
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:20,代码来源:build.py

示例14: read

    def read(self, outdir = None):
        if not outdir:
            outdir = ctx.config.tmp_dir()

        # extract control files
        self.extract_PISI_files(outdir)

        self.metadata = MetaData()
        self.metadata.read( join(outdir, ctx.const.metadata_xml) )
        if self.metadata.has_errors():
            raise Error, _("MetaData format wrong")

        self.files = Files()
        self.files.read( join(outdir, ctx.const.files_xml) )
        if self.files.has_errors():
            raise Error, _("Invalid %s") % ctx.const.files_xml
开发者ID:Tayyib,项目名称:uludag,代码行数:16,代码来源:package.py

示例15: read

    def read(self, outdir = None):
        if not outdir:
            outdir = ctx.config.tmp_dir()

        # extract control files
        self.extract_pisi_files(outdir)

        self.metadata = MetaData()
        self.metadata.read( join(outdir, ctx.const.metadata_xml) )
        errs = self.metadata.errors()
        if errs:
            util.print_errors(errs)
            raise Error, _("MetaData format wrong")

        self.files = Files()
        self.files.read( join(outdir, ctx.const.files_xml) )
        if self.files.errors():
            raise Error, _("Invalid %s") % ctx.const.files_xml
开发者ID:dhirajkhatiwada1,项目名称:uludag,代码行数:18,代码来源:package.py


注:本文中的pisi.metadata.MetaData类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。