コード例 #1
0
def parse_scons(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    sconsargs = ''
    supports_non_srcdir_builds = True
    if node.hasAttribute('sconsargs'):
        autogenargs = node.getAttribute('sconsargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')

    # Make some substitutions; do special handling of '${prefix}' and '${libdir}'
    p = re.compile('(\${prefix})')
    sconsargs     = p.sub(config.prefix, sconsargs)
    # I'm not sure the replacement of ${libdir} is necessary for firefox...
    p = re.compile('(\${libdir})')
    libsubdir = '/lib'
    if config.use_lib64:
        libsubdir = '/lib64'
    sconsargs     = p.sub(config.prefix + libsubdir, autogenargs)

    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    return SconsModule(id, branch, sconsargs=sconsargs,
                         dependencies=dependencies,
                         after=after,
                         suggests=suggests,
                         supports_non_srcdir_builds=supports_non_srcdir_builds)
コード例 #2
0
ファイル: autotools.py プロジェクト: inducer/jhbuild
def parse_autotools(node, config, repositories, default_repo):
    id = node.getAttribute('id')
    kwargs = {}

    if node.hasAttribute('autogenargs'):
        kwargs["autogenargs"] = node.getAttribute('autogenargs')
    if node.hasAttribute('standardautogen'):
        kwargs["standardautogen"] = node.getAttribute('standardautogen') != 'no'
    if node.hasAttribute('makecommand'):
        kwargs["makecommand"] = node.getAttribute('makecommand')
    kwargs["makeargs"] = config.module_makeargs.get(id, config.makeargs)
    if node.hasAttribute('makeargs'):
        kwargs["makeargs"] = " " + node.getAttribute('makeargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        kwargs["supports_non_srcdir_builds"] = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')
    if node.hasAttribute('autogen-sh'):
        kwargs["autogen_sh"] = node.getAttribute('autogen-sh')
    if node.hasAttribute('makefile'):
        kwargs["makefile"] = makefile = node.getAttribute('makefile')
    if node.hasAttribute('alwaysautogen'):
        kwargs["alwaysautogen"] = node.getAttribute('alwaysautogen') != 'no'
    if node.hasAttribute('skipinstall'):
        kwargs["skipinstall"] = node.getAttribute('skipinstall') != 'no'

    dependencies, after = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo)

    return AutogenModule(id, branch, dependencies, after, **kwargs)
コード例 #3
0
ファイル: mozillamodule.py プロジェクト: inducer/jhbuild
def parse_mozillamodule(node, config, repositories, default_repo):
    name = node.getAttribute("id")
    projects = node.getAttribute("projects")
    revision = None
    autogenargs = ""
    makeargs = ""
    dependencies = []
    if node.hasAttribute("revision"):
        revision = node.getAttribute("revision")
    if node.hasAttribute("autogenargs"):
        autogenargs = node.getAttribute("autogenargs")
    if node.hasAttribute("makeargs"):
        makeargs = node.getAttribute("makeargs")

    # override revision tag if requested.
    revision = config.branches.get(name, revision)
    autogenargs += " " + config.module_autogenargs.get(name, config.autogenargs)
    makeargs += " " + config.module_makeargs.get(name, config.makeargs)

    dependencies, after = get_dependencies(node)

    for attrname in ["cvsroot", "root"]:
        if node.hasAttribute(attrname):
            repo = repositories[node.getAttribute(attrname)]
            break
    else:
        repo = repositories.get(default_repo, None)

    return MozillaModule(name, projects, revision, autogenargs, makeargs, dependencies, after, repo)
コード例 #4
0
ファイル: waf.py プロジェクト: ylatuya/jhbuild
def parse_waf(node, config, uri, repositories, default_repo):
    module_id = node.getAttribute('id')
    waf_cmd = './waf'
    if node.hasAttribute('waf-command'):
        waf_cmd = node.getAttribute('waf-command')

    # override revision tag if requested.
    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    return WafModule(module_id, branch, dependencies=dependencies, after=after,
            suggests=suggests, waf_cmd=waf_cmd)
コード例 #5
0
def parse_testmodule(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    test_type = node.getAttribute('type')
    if test_type not in __test_types__:
        # FIXME: create an error here
        pass

    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)
    tested_pkgs = get_tested_packages(node)
    return TestModule(id, branch, test_type, dependencies=dependencies,
            after=after, tested_pkgs=tested_pkgs)
コード例 #6
0
ファイル: ant.py プロジェクト: ylatuya/jhbuild
def parse_ant(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    supports_non_srcdir_builds = False

    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')
    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo)

    return AntModule(id, branch,
                           dependencies=dependencies, after=after,
                           supports_non_srcdir_builds=supports_non_srcdir_builds)
コード例 #7
0
ファイル: distutils.py プロジェクト: inducer/jhbuild
def parse_distutils(node, config, repositories, default_repo):
    id = node.getAttribute('id')
    supports_non_srcdir_builds = True

    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')
    dependencies, after = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo)

    return DistutilsModule(id, branch,
                           dependencies=dependencies, after=after,
                           supports_non_srcdir_builds=supports_non_srcdir_builds)
コード例 #8
0
ファイル: mesa.py プロジェクト: inducer/jhbuild
def parse_mesa(node, config, repositories, default_repo):
    id = node.getAttribute('id')
    makeargs = ''
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')

    # override revision tag if requested.
    makeargs += ' ' + config.module_makeargs.get(id, config.makeargs)

    dependencies, after = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo)

    return MesaModule(id, branch, makeargs,
                         dependencies=dependencies, after=after)
コード例 #9
0
ファイル: autotools.py プロジェクト: inducer/jhbuild
def parse_cvsmodule(node, config, repositories, default_repo):
    id = node.getAttribute('id')
    module = None
    revision = None
    checkoutdir = None
    autogenargs = ''
    makeargs = ''
    supports_non_srcdir_builds = True
    if node.hasAttribute('module'):
        module = node.getAttribute('module')
    if node.hasAttribute('revision'):
        revision = node.getAttribute('revision')
    if node.hasAttribute('checkoutdir'):
        checkoutdir = node.getAttribute('checkoutdir')
    if node.hasAttribute('autogenargs'):
        autogenargs = node.getAttribute('autogenargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')

    if not id:
        id = checkoutdir or module

    # override revision tag if requested.
    autogenargs += ' ' + config.module_autogenargs.get(id, config.autogenargs)
    makeargs += ' ' + config.module_makeargs.get(id, config.makeargs)

    dependencies, after = get_dependencies(node)

    for attrname in ['cvsroot', 'root']:
        if node.hasAttribute(attrname):
            try:
                repo = repositories[node.getAttribute(attrname)]
                break
            except KeyError:
                raise FatalError('Repository=%s not found for module id=%s. '
                                 'Possible repositories are %s'
                                 % (node.getAttribute(attrname),
                                    node.getAttribute('id'), repositories))
    else:
        repo = repositories.get(default_repo, None)
    branch = repo.branch(id, module=module, checkoutdir=checkoutdir,
                         revision=revision)

    return AutogenModule(id, branch, autogenargs, makeargs,
                         dependencies=dependencies,
                         after=after,
                         supports_non_srcdir_builds=supports_non_srcdir_builds)
コード例 #10
0
ファイル: binary.py プロジェクト: ylatuya/jhbuild
def parse_binary(node, config, uri, repositories, default_repo):
    name = node.getAttribute('id')
    version = node.getAttribute('version')
    source_url = ''
    source_size = None
    source_md5 = None
    patches = []
    configure_commands = []
    build_commands = []
    install_commands = []

    for childnode in node.childNodes:
        if childnode.nodeType != childnode.ELEMENT_NODE: continue
        if childnode.nodeName == 'source':
            source_url = childnode.getAttribute('href')
            if childnode.hasAttribute('size'):
                source_size = int(childnode.getAttribute('size'))
            if childnode.hasAttribute('md5sum'):
                source_md5 = childnode.getAttribute('md5sum')
        elif childnode.nodeName == 'patches':
            for patch in childnode.childNodes:
                if patch.nodeType != patch.ELEMENT_NODE: continue
                if patch.nodeName != 'patch': continue
                patchfile = patch.getAttribute('file')
                if patch.hasAttribute('strip'):
                    patchstrip = int(patch.getAttribute('strip'))
                else:
                    patchstrip = 0
                patches.append((patchfile, patchstrip))
        elif childnode.nodeName == 'configure':
            for cmd in childnode.childNodes:
                if cmd.nodeType != cmd.ELEMENT_NODE: continue
                if cmd.nodeName == 'cmd':
                    configure_commands.append( parse_command(cmd) )
        elif childnode.nodeName == 'build':
            for cmd in childnode.childNodes:
                if cmd.nodeType != cmd.ELEMENT_NODE: continue
                if cmd.nodeName == 'cmd':
                    build_commands.append( parse_command(cmd) )
        elif childnode.nodeName == 'install':
            for cmd in childnode.childNodes:
                if cmd.nodeType != cmd.ELEMENT_NODE: continue
                if cmd.nodeName == 'cmd':
                    install_commands.append( parse_command(cmd) )

    dependencies, after, suggests = get_dependencies(node)

    return Binary(config, name, version, source_url, source_size, source_md5, uri,
                  patches, configure_commands, build_commands, install_commands,
                  dependencies, after, suggests)
コード例 #11
0
def parse_binary(node, config, uri, repositories, default_repo):
    name = node.getAttribute('id')
    version = node.getAttribute('version')
    source_url = ''
    source_size = None
    source_md5 = None
    patches = []
    configure_commands = []
    build_commands = []
    install_commands = []

    for childnode in node.childNodes:
        if childnode.nodeType != childnode.ELEMENT_NODE: continue
        if childnode.nodeName == 'source':
            source_url = childnode.getAttribute('href')
            if childnode.hasAttribute('size'):
                source_size = int(childnode.getAttribute('size'))
            if childnode.hasAttribute('md5sum'):
                source_md5 = childnode.getAttribute('md5sum')
        elif childnode.nodeName == 'patches':
            for patch in childnode.childNodes:
                if patch.nodeType != patch.ELEMENT_NODE: continue
                if patch.nodeName != 'patch': continue
                patchfile = patch.getAttribute('file')
                if patch.hasAttribute('strip'):
                    patchstrip = int(patch.getAttribute('strip'))
                else:
                    patchstrip = 0
                patches.append((patchfile, patchstrip))
        elif childnode.nodeName == 'configure':
            for cmd in childnode.childNodes:
                if cmd.nodeType != cmd.ELEMENT_NODE: continue
                if cmd.nodeName == 'cmd':
                    configure_commands.append(parse_command(cmd))
        elif childnode.nodeName == 'build':
            for cmd in childnode.childNodes:
                if cmd.nodeType != cmd.ELEMENT_NODE: continue
                if cmd.nodeName == 'cmd':
                    build_commands.append(parse_command(cmd))
        elif childnode.nodeName == 'install':
            for cmd in childnode.childNodes:
                if cmd.nodeType != cmd.ELEMENT_NODE: continue
                if cmd.nodeName == 'cmd':
                    install_commands.append(parse_command(cmd))

    dependencies, after, suggests = get_dependencies(node)

    return Binary(config, name, version, source_url, source_size, source_md5,
                  uri, patches, configure_commands, build_commands,
                  install_commands, dependencies, after, suggests)
コード例 #12
0
ファイル: cmake.py プロジェクト: rpavlik/jhbuild-vrjuggler
def parse_cmake(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    cmakeargs = ''
    makeargs = ''
    if node.hasAttribute('cmakeargs'):
        cmakeargs = node.getAttribute('cmakeargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')

    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    return CMakeModule(id, branch, cmakeargs, makeargs,
                       dependencies = dependencies, after = after,
                       suggests = suggests)
コード例 #13
0
ファイル: waf.py プロジェクト: ylatuya/jhbuild
def parse_waf(node, config, uri, repositories, default_repo):
    module_id = node.getAttribute('id')
    waf_cmd = './waf'
    if node.hasAttribute('waf-command'):
        waf_cmd = node.getAttribute('waf-command')

    # override revision tag if requested.
    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    return WafModule(module_id,
                     branch,
                     dependencies=dependencies,
                     after=after,
                     suggests=suggests,
                     waf_cmd=waf_cmd)
コード例 #14
0
def parse_perl(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    makeargs = ''
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')

    # Make some substitutions; do special handling of '${prefix}'
    p = re.compile('(\${prefix})')
    makeargs = p.sub(config.prefix, makeargs)
    
    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    return PerlModule(id, branch, makeargs,
            dependencies=dependencies, after=after,
            suggests=suggests)
コード例 #15
0
def parse_cmake(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    cmakeargs = ''
    makeargs = ''
    if node.hasAttribute('cmakeargs'):
        cmakeargs = node.getAttribute('cmakeargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')

    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    return CMakeModule(id,
                       branch,
                       cmakeargs,
                       makeargs,
                       dependencies=dependencies,
                       after=after,
                       suggests=suggests)
コード例 #16
0
ファイル: autotools.py プロジェクト: inducer/jhbuild
def parse_svnmodule(node, config, repositories, default_repo):
    id = node.getAttribute('id')
    module = None
    checkoutdir = None
    autogenargs = ''
    makeargs = ''
    supports_non_srcdir_builds = True
    if node.hasAttribute('module'):
        module = node.getAttribute('module')
    if node.hasAttribute('checkoutdir'):
        checkoutdir = node.getAttribute('checkoutdir')
    if node.hasAttribute('autogenargs'):
        autogenargs = node.getAttribute('autogenargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')

    if not id:
        id = checkoutdir or os.path.basename(module)

    # override revision tag if requested.
    autogenargs += ' ' + config.module_autogenargs.get(id, config.autogenargs)
    makeargs += ' ' + config.module_makeargs.get(id, config.makeargs)

    dependencies, after = get_dependencies(node)

    if node.hasAttribute('root'):
        repo = repositories[node.getAttribute('root')]
    else:
        repo = repositories.get(default_repo, None)
    branch = repo.branch(id, module=module, checkoutdir=checkoutdir)

    return AutogenModule(id, branch, autogenargs, makeargs,
                         dependencies=dependencies,
                         after=after,
                         supports_non_srcdir_builds=supports_non_srcdir_builds)
コード例 #17
0
ファイル: autotools.py プロジェクト: inducer/jhbuild
def parse_archmodule(node, config, repositories, default_repo):
    id = node.getAttribute('id')
    version = None
    checkoutdir = None
    autogenargs = ''
    standardautogen = True
    makeargs = ''
    supports_non_srcdir_builds = True
    if node.hasAttribute('version'):
        version = node.getAttribute('version')
    if node.hasAttribute('checkoutdir'):
        checkoutdir = node.getAttribute('checkoutdir')
    if node.hasAttribute('autogenargs'):
        autogenargs = node.getAttribute('autogenargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')

    if not id:
        id = checkoutdir or version

    makeargs += ' ' + config.module_makeargs.get(id, makeargs)

    dependencies, after = get_dependencies(node)

    if node.hasAttribute('root'):
        repo = repositories[node.getAttribute('root')]
    else:
        repo = repositories.get(default_repo, None)
    branch = repo.branch(id, module=version, checkoutdir=checkoutdir)

    return AutogenModule(id, branch, autogenargs, standardautogen, makeargs,
                         dependencies=dependencies,
                         after=after,
                         supports_non_srcdir_builds=supports_non_srcdir_builds)
コード例 #18
0
def parse_tarball(node, config, uri, repositories, default_repo):
    name = node.getAttribute('id')
    version = node.getAttribute('version')
    source_url = None
    source_size = None
    source_hash = None
    patches = []
    checkoutdir = None
    autogenargs = ''
    makeargs = ''
    makeinstallargs = ''
    supports_non_srcdir_builds = True
    makefile = 'Makefile'
    if node.hasAttribute('checkoutdir'):
        checkoutdir = node.getAttribute('checkoutdir')
    if node.hasAttribute('autogenargs'):
        autogenargs = node.getAttribute('autogenargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')
    if node.hasAttribute('makeinstallargs'):
        makeinstallargs = node.getAttribute('makeinstallargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')
    if node.hasAttribute('makefile'):
        makefile = node.getAttribute('makefile')

    for childnode in node.childNodes:
        if childnode.nodeType != childnode.ELEMENT_NODE: continue
        if childnode.nodeName == 'source':
            source_url = childnode.getAttribute('href')
            if childnode.hasAttribute('size'):
                try:
                    source_size = int(childnode.getAttribute('size'))
                except ValueError:
                    logging.warning(
                        _('module \'%(module)s\' has invalid size attribute (\'%(size)s\')'
                          ) % {
                              'module': name,
                              'size': childnode.getAttribute('size')
                          })
            if childnode.hasAttribute('md5sum'):
                source_hash = 'md5:' + childnode.getAttribute('md5sum')
            if childnode.hasAttribute('hash') and hashlib:
                source_hash = childnode.getAttribute('hash')
        elif childnode.nodeName == 'patches':
            for patch in childnode.childNodes:
                if patch.nodeType != patch.ELEMENT_NODE: continue
                if patch.nodeName != 'patch': continue
                patchfile = patch.getAttribute('file')
                if patch.hasAttribute('strip'):
                    patchstrip = int(patch.getAttribute('strip'))
                else:
                    patchstrip = 0
                patches.append((patchfile, patchstrip))

    # for tarballs, don't ever pass --enable-maintainer-mode
    autogenargs = autogenargs.replace('--enable-maintainer-mode', '')

    dependencies, after, suggests = get_dependencies(node)

    from autotools import AutogenModule
    from jhbuild.versioncontrol.tarball import TarballBranch, TarballRepository

    # create a fake TarballRepository, and give it the moduleset uri
    repo = TarballRepository(config, None, None)
    repo.moduleset_uri = uri

    branch = TarballBranch(repo, source_url, version, checkoutdir, source_size,
                           source_hash, None)
    branch.patches = patches

    instance = AutogenModule(
        name,
        branch,
        autogenargs,
        makeargs,
        makeinstallargs,
        supports_non_srcdir_builds=supports_non_srcdir_builds,
        skip_autogen=False,
        autogen_sh='configure',
        makefile=makefile)
    instance.dependencies = dependencies
    instance.after = after
    instance.suggests = suggests
    instance.pkg_config = find_first_child_node_content(node, 'pkg-config')

    return instance
コード例 #19
0
def parse_autotools(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    autogenargs = ''
    makeargs = ''
    makeinstallargs = ''
    supports_non_srcdir_builds = True
    autogen_sh = None
    skip_autogen = False
    check_target = True
    makefile = 'Makefile'
    autogen_template = None
    if node.hasAttribute('autogenargs'):
        autogenargs = node.getAttribute('autogenargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')
    if node.hasAttribute('makeinstallargs'):
        makeinstallargs = node.getAttribute('makeinstallargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')
    if node.hasAttribute('skip-autogen'):
        skip_autogen = node.getAttribute('skip-autogen')
        if skip_autogen == 'true':
            skip_autogen = True
        elif skip_autogen == 'never':
            skip_autogen = 'never'
        else:
            skip_autogen = False
    if node.hasAttribute('check-target'):
        check_target = (node.getAttribute('check-target') == 'true')
    if node.hasAttribute('autogen-sh'):
        autogen_sh = node.getAttribute('autogen-sh')
    if node.hasAttribute('makefile'):
        makefile = node.getAttribute('makefile')
    if node.hasAttribute('autogen-template'):
        autogen_template = node.getAttribute('autogen-template')

    # Make some substitutions; do special handling of '${prefix}' and '${libdir}'
    p = re.compile('(\${prefix})')
    autogenargs = p.sub(config.prefix, autogenargs)
    makeargs = p.sub(config.prefix, makeargs)
    makeinstallargs = p.sub(config.prefix, makeinstallargs)
    # I'm not sure the replacement of ${libdir} is necessary for firefox...
    p = re.compile('(\${libdir})')
    libsubdir = '/lib'
    if config.use_lib64:
        libsubdir = '/lib64'
    autogenargs = p.sub(config.prefix + libsubdir, autogenargs)
    makeargs = p.sub(config.prefix + libsubdir, makeargs)
    makeinstallargs = p.sub(config.prefix + libsubdir, makeinstallargs)

    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    from jhbuild.versioncontrol.tarball import TarballBranch
    if isinstance(branch, TarballBranch):
        # in tarballs, force autogen-sh to be configure, unless autogen-sh is
        # already set
        if autogen_sh is None:
            autogen_sh = 'configure'
    elif not autogen_sh:
        autogen_sh = 'autogen.sh'

    return AutogenModule(id,
                         branch,
                         autogenargs,
                         makeargs,
                         makeinstallargs=makeinstallargs,
                         dependencies=dependencies,
                         after=after,
                         suggests=suggests,
                         supports_non_srcdir_builds=supports_non_srcdir_builds,
                         skip_autogen=skip_autogen,
                         autogen_sh=autogen_sh,
                         makefile=makefile,
                         autogen_template=autogen_template,
                         check_target=check_target)
コード例 #20
0
ファイル: tarball.py プロジェクト: MarFerMS/jhbuild
def parse_tarball(node, config, uri, repositories, default_repo):
    name = node.getAttribute('id')
    version = node.getAttribute('version')
    source_url = None
    source_size = None
    source_hash = None
    patches = []
    checkoutdir = None
    autogenargs = ''
    makeargs = ''
    makeinstallargs = ''
    supports_non_srcdir_builds = True
    makefile = 'Makefile'
    if node.hasAttribute('checkoutdir'):
        checkoutdir = node.getAttribute('checkoutdir')
    if node.hasAttribute('autogenargs'):
        autogenargs = node.getAttribute('autogenargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')
    if node.hasAttribute('makeinstallargs'):
        makeinstallargs = node.getAttribute('makeinstallargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')
    if node.hasAttribute('makefile'):
        makefile = node.getAttribute('makefile')

    for childnode in node.childNodes:
        if childnode.nodeType != childnode.ELEMENT_NODE: continue
        if childnode.nodeName == 'source':
            source_url = childnode.getAttribute('href')
            if childnode.hasAttribute('size'):
                try:
                    source_size = int(childnode.getAttribute('size'))
                except ValueError:
                    logging.warning(
                            _('module \'%(module)s\' has invalid size attribute (\'%(size)s\')') % {
                                'module': name, 'size': childnode.getAttribute('size')})
            if childnode.hasAttribute('md5sum'):
                source_hash = 'md5:' + childnode.getAttribute('md5sum')
            if childnode.hasAttribute('hash') and hashlib:
                source_hash = childnode.getAttribute('hash')
        elif childnode.nodeName == 'patches':
            for patch in childnode.childNodes:
                if patch.nodeType != patch.ELEMENT_NODE: continue
                if patch.nodeName != 'patch': continue
                patchfile = patch.getAttribute('file')
                if patch.hasAttribute('strip'):
                    patchstrip = int(patch.getAttribute('strip'))
                else:
                    patchstrip = 0
                patches.append((patchfile, patchstrip))

    # for tarballs, don't ever pass --enable-maintainer-mode
    autogenargs = autogenargs.replace('--enable-maintainer-mode', '')

    dependencies, after, suggests, systemdependencies = get_dependencies(node)

    from autotools import AutogenModule
    from jhbuild.versioncontrol.tarball import TarballBranch, TarballRepository

    # create a fake TarballRepository, and give it the moduleset uri
    repo = TarballRepository(config, None, None)
    repo.moduleset_uri = uri

    branch = TarballBranch(repo, source_url, version, checkoutdir,
            source_size, source_hash, None)
    branch.patches = patches

    instance = AutogenModule(name, branch,
                             autogenargs, makeargs, makeinstallargs,
                             supports_non_srcdir_builds = supports_non_srcdir_builds,
                             skip_autogen = False, autogen_sh = 'configure',
                             makefile = makefile)
    instance.dependencies = dependencies
    instance.after = after
    instance.suggests = suggests
    instance.systemdependencies = systemdependencies
    instance.pkg_config = find_first_child_node_content(node, 'pkg-config')
    instance.config = config

    return instance
コード例 #21
0
ファイル: tarball.py プロジェクト: inducer/jhbuild
def parse_tarball(node, config, repositories, default_repo):
    name = node.getAttribute("id")
    version = node.getAttribute("version")
    source_url = None
    source_size = None
    source_md5 = None
    patches = []
    checkoutdir = None
    autogenargs = ""
    makeargs = ""
    supports_non_srcdir_builds = True
    if node.hasAttribute("checkoutdir"):
        checkoutdir = node.getAttribute("checkoutdir")
    if node.hasAttribute("autogenargs"):
        autogenargs = node.getAttribute("autogenargs")
    if node.hasAttribute("makeargs"):
        makeargs = node.getAttribute("makeargs")
    if node.hasAttribute("supports-non-srcdir-builds"):
        supports_non_srcdir_builds = node.getAttribute("supports-non-srcdir-builds") != "no"
    for childnode in node.childNodes:
        if childnode.nodeType != childnode.ELEMENT_NODE:
            continue
        if childnode.nodeName == "source":
            source_url = childnode.getAttribute("href")
            if childnode.hasAttribute("size"):
                source_size = int(childnode.getAttribute("size"))
            if childnode.hasAttribute("md5sum"):
                source_md5 = childnode.getAttribute("md5sum")
        elif childnode.nodeName == "patches":
            for patch in childnode.childNodes:
                if patch.nodeType != patch.ELEMENT_NODE:
                    continue
                if patch.nodeName != "patch":
                    continue
                patchfile = patch.getAttribute("file")
                if patch.hasAttribute("strip"):
                    patchstrip = int(patch.getAttribute("strip"))
                else:
                    patchstrip = 0
                patches.append((patchfile, patchstrip))

    autogenargs += " " + config.module_autogenargs.get(name, config.autogenargs)
    makeargs += " " + config.module_makeargs.get(name, config.makeargs)

    # for tarballs, don't ever pass --enable-maintainer-mode
    autogenargs = autogenargs.replace("--enable-maintainer-mode", "")

    dependencies, after = get_dependencies(node)

    return Tarball(
        name,
        version,
        source_url,
        source_size,
        source_md5,
        patches,
        checkoutdir,
        autogenargs,
        makeargs,
        dependencies,
        after,
        supports_non_srcdir_builds=supports_non_srcdir_builds,
    )
コード例 #22
0
def parse_autotools(node, config, uri, repositories, default_repo):
    id = node.getAttribute('id')
    autogenargs = ''
    makeargs = ''
    makeinstallargs = ''
    supports_non_srcdir_builds = True
    autogen_sh = None
    skip_autogen = False
    check_target = True
    makefile = 'Makefile'
    autogen_template = None
    if node.hasAttribute('autogenargs'):
        autogenargs = node.getAttribute('autogenargs')
    if node.hasAttribute('makeargs'):
        makeargs = node.getAttribute('makeargs')
    if node.hasAttribute('makeinstallargs'):
        makeinstallargs = node.getAttribute('makeinstallargs')
    if node.hasAttribute('supports-non-srcdir-builds'):
        supports_non_srcdir_builds = \
            (node.getAttribute('supports-non-srcdir-builds') != 'no')
    if node.hasAttribute('skip-autogen'):
        skip_autogen = node.getAttribute('skip-autogen')
        if skip_autogen == 'true':
            skip_autogen = True
        elif skip_autogen == 'never':
            skip_autogen = 'never'
        else:
            skip_autogen = False
    if node.hasAttribute('check-target'):
        check_target = (node.getAttribute('check-target') == 'true')
    if node.hasAttribute('autogen-sh'):
        autogen_sh = node.getAttribute('autogen-sh')
    if node.hasAttribute('makefile'):
        makefile = node.getAttribute('makefile')
    if node.hasAttribute('autogen-template'):
        autogen_template = node.getAttribute('autogen-template')

    # Make some substitutions; do special handling of '${prefix}' and '${libdir}'
    p = re.compile('(\${prefix})')
    autogenargs     = p.sub(config.prefix, autogenargs)
    makeargs        = p.sub(config.prefix, makeargs)
    makeinstallargs = p.sub(config.prefix, makeinstallargs)
    # I'm not sure the replacement of ${libdir} is necessary for firefox...
    p = re.compile('(\${libdir})')
    libsubdir = '/lib'
    if config.use_lib64:
        libsubdir = '/lib64'
    autogenargs     = p.sub(config.prefix + libsubdir, autogenargs)
    makeargs        = p.sub(config.prefix + libsubdir, makeargs)
    makeinstallargs = p.sub(config.prefix + libsubdir, makeinstallargs)

    dependencies, after, suggests = get_dependencies(node)
    branch = get_branch(node, repositories, default_repo, config)

    from jhbuild.versioncontrol.tarball import TarballBranch
    if isinstance(branch, TarballBranch):
        # in tarballs, force autogen-sh to be configure, unless autogen-sh is
        # already set
        if autogen_sh is None:
            autogen_sh = 'configure'
    elif not autogen_sh:
        autogen_sh = 'autogen.sh'

    return AutogenModule(id, branch, autogenargs, makeargs,
                         makeinstallargs=makeinstallargs,
                         dependencies=dependencies,
                         after=after,
                         suggests=suggests,
                         supports_non_srcdir_builds=supports_non_srcdir_builds,
                         skip_autogen=skip_autogen,
                         autogen_sh=autogen_sh,
                         makefile=makefile,
                         autogen_template=autogen_template,
                         check_target=check_target)