Esempio n. 1
0
 def process(self, srctree, classes, lines_before, lines_after, handled, extravalues):
     if 'PV' in extravalues and 'PN' in extravalues:
         return
     filelist = RecipeHandler.checkfiles(srctree, ['*.spec'], recursive=True)
     valuemap = {'Name': 'PN',
                 'Version': 'PV',
                 'Summary': 'SUMMARY',
                 'Url': 'HOMEPAGE',
                 'License': 'LICENSE'}
     foundvalues = {}
     for fileitem in filelist:
         linecount = 0
         with open(fileitem, 'r', errors='surrogateescape') as f:
             for line in f:
                 for value, varname in valuemap.items():
                     if line.startswith(value + ':') and not varname in foundvalues:
                         foundvalues[varname] = line.split(':', 1)[1].strip()
                         break
                 if len(foundvalues) == len(valuemap):
                     break
     if 'PV' in foundvalues:
         if not validate_pv(foundvalues['PV']):
             del foundvalues['PV']
     license = foundvalues.pop('LICENSE', None)
     if license:
         liccomment = '# NOTE: spec file indicates the license may be "%s"' % license
         for i, line in enumerate(lines_before):
             if line.startswith('LICENSE ='):
                 lines_before.insert(i, liccomment)
                 break
         else:
             lines_before.append(liccomment)
     extravalues.update(foundvalues)
    def process(self, srctree, classes, lines_before, lines_after, handled, extravalues):
        if 'buildsystem' in handled:
            return False

        autoconf = False
        if RecipeHandler.checkfiles(srctree, ['configure.ac', 'configure.in']):
            autoconf = True
            values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, extravalues)
            classes.extend(values.pop('inherit', '').split())
            for var, value in values.iteritems():
                lines_before.append('%s = "%s"' % (var, value))
        else:
            conffile = RecipeHandler.checkfiles(srctree, ['configure'])
            if conffile:
                # Check if this is just a pre-generated autoconf configure script
                with open(conffile[0], 'r') as f:
                    for i in range(1, 10):
                        if 'Generated by GNU Autoconf' in f.readline():
                            autoconf = True
                            break

        if autoconf and not ('PV' in extravalues and 'PN' in extravalues):
            # Last resort
            conffile = RecipeHandler.checkfiles(srctree, ['configure'])
            if conffile:
                with open(conffile[0], 'r') as f:
                    for line in f:
                        line = line.strip()
                        if line.startswith('VERSION=') or line.startswith('PACKAGE_VERSION='):
                            pv = line.split('=')[1].strip('"\'')
                            if pv and not 'PV' in extravalues and validate_pv(pv):
                                extravalues['PV'] = pv
                        elif line.startswith('PACKAGE_NAME=') or line.startswith('PACKAGE='):
                            pn = line.split('=')[1].strip('"\'')
                            if pn and not 'PN' in extravalues:
                                extravalues['PN'] = pn

        if autoconf:
            lines_before.append('')
            lines_before.append('# NOTE: if this software is not capable of being built in a separate build directory')
            lines_before.append('# from the source, you should replace autotools with autotools-brokensep in the')
            lines_before.append('# inherit line')
            classes.append('autotools')
            lines_after.append('# Specify any options you want to pass to the configure script using EXTRA_OECONF:')
            lines_after.append('EXTRA_OECONF = ""')
            lines_after.append('')
            handled.append('buildsystem')
            return True

        return False
Esempio n. 3
0
    def process(self, srctree, classes, lines_before, lines_after, handled, extravalues):
        if "buildsystem" in handled:
            return False

        autoconf = False
        if RecipeHandler.checkfiles(srctree, ["configure.ac", "configure.in"]):
            autoconf = True
            values = AutotoolsRecipeHandler.extract_autotools_deps(lines_before, srctree, extravalues)
            classes.extend(values.pop("inherit", "").split())
            for var, value in values.iteritems():
                lines_before.append('%s = "%s"' % (var, value))
        else:
            conffile = RecipeHandler.checkfiles(srctree, ["configure"])
            if conffile:
                # Check if this is just a pre-generated autoconf configure script
                with open(conffile[0], "r") as f:
                    for i in range(1, 10):
                        if "Generated by GNU Autoconf" in f.readline():
                            autoconf = True
                            break

        if autoconf and not ("PV" in extravalues and "PN" in extravalues):
            # Last resort
            conffile = RecipeHandler.checkfiles(srctree, ["configure"])
            if conffile:
                with open(conffile[0], "r") as f:
                    for line in f:
                        line = line.strip()
                        if line.startswith("VERSION=") or line.startswith("PACKAGE_VERSION="):
                            pv = line.split("=")[1].strip("\"'")
                            if pv and not "PV" in extravalues and validate_pv(pv):
                                extravalues["PV"] = pv
                        elif line.startswith("PACKAGE_NAME=") or line.startswith("PACKAGE="):
                            pn = line.split("=")[1].strip("\"'")
                            if pn and not "PN" in extravalues:
                                extravalues["PN"] = pn

        if autoconf:
            lines_before.append("")
            lines_before.append("# NOTE: if this software is not capable of being built in a separate build directory")
            lines_before.append("# from the source, you should replace autotools with autotools-brokensep in the")
            lines_before.append("# inherit line")
            classes.append("autotools")
            lines_after.append("# Specify any options you want to pass to the configure script using EXTRA_OECONF:")
            lines_after.append('EXTRA_OECONF = ""')
            lines_after.append("")
            handled.append("buildsystem")
            return True

        return False
Esempio n. 4
0
 def process(self, srctree, classes, lines_before, lines_after, handled,
             extravalues):
     if 'PV' in extravalues and 'PN' in extravalues:
         return
     filelist = RecipeHandler.checkfiles(srctree, ['*.spec'],
                                         recursive=True)
     valuemap = {
         'Name': 'PN',
         'Version': 'PV',
         'Summary': 'SUMMARY',
         'Url': 'HOMEPAGE',
         'License': 'LICENSE'
     }
     foundvalues = {}
     for fileitem in filelist:
         linecount = 0
         with open(fileitem, 'r', errors='surrogateescape') as f:
             for line in f:
                 for value, varname in valuemap.items():
                     if line.startswith(value +
                                        ':') and not varname in foundvalues:
                         foundvalues[varname] = line.split(':',
                                                           1)[1].strip()
                         break
                 if len(foundvalues) == len(valuemap):
                     break
     # Drop values containing unexpanded RPM macros
     for k in list(foundvalues.keys()):
         if '%' in foundvalues[k]:
             del foundvalues[k]
     if 'PV' in foundvalues:
         if not validate_pv(foundvalues['PV']):
             del foundvalues['PV']
     license = foundvalues.pop('LICENSE', None)
     if license:
         liccomment = '# NOTE: spec file indicates the license may be "%s"' % license
         for i, line in enumerate(lines_before):
             if line.startswith('LICENSE ='):
                 lines_before.insert(i, liccomment)
                 break
         else:
             lines_before.append(liccomment)
     extravalues.update(foundvalues)
 def process(self, srctree, classes, lines_before, lines_after, handled, extravalues):
     if 'PV' in extravalues and 'PN' in extravalues:
         return
     filelist = RecipeHandler.checkfiles(srctree, ['*.spec'], recursive=True)
     pn = None
     pv = None
     for fileitem in filelist:
         linecount = 0
         with open(fileitem, 'r') as f:
             for line in f:
                 if line.startswith('Name:') and not pn:
                     pn = line.split(':')[1].strip()
                 if line.startswith('Version:') and not pv:
                     pv = line.split(':')[1].strip()
         if pv or pn:
             if pv and not 'PV' in extravalues and validate_pv(pv):
                 extravalues['PV'] = pv
             if pn and not 'PN' in extravalues:
                 extravalues['PN'] = pn
             break
Esempio n. 6
0
 def process(self, srctree, classes, lines_before, lines_after, handled, extravalues):
     if "PV" in extravalues and "PN" in extravalues:
         return
     filelist = RecipeHandler.checkfiles(srctree, ["*.spec"], recursive=True)
     pn = None
     pv = None
     for fileitem in filelist:
         linecount = 0
         with open(fileitem, "r") as f:
             for line in f:
                 if line.startswith("Name:") and not pn:
                     pn = line.split(":")[1].strip()
                 if line.startswith("Version:") and not pv:
                     pv = line.split(":")[1].strip()
         if pv or pn:
             if pv and not "PV" in extravalues and validate_pv(pv):
                 extravalues["PV"] = pv
             if pn and not "PN" in extravalues:
                 extravalues["PN"] = pn
             break
 def process(self, srctree, classes, lines_before, lines_after, handled, extravalues):
     if 'PV' not in extravalues:
         # Look for a VERSION or version file containing a single line consisting
         # only of a version number
         filelist = RecipeHandler.checkfiles(srctree, ['VERSION', 'version'])
         version = None
         for fileitem in filelist:
             linecount = 0
             with open(fileitem, 'r') as f:
                 for line in f:
                     line = line.rstrip().strip('"\'')
                     linecount += 1
                     if line:
                         if linecount > 1:
                             version = None
                             break
                         else:
                             if validate_pv(line):
                                 version = line
             if version:
                 extravalues['PV'] = version
                 break
 def process_macro(keyword, value):
     if keyword == 'PKG_CHECK_MODULES':
         res = pkg_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword == 'PKG_CHECK_EXISTS':
         res = pkgce_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword in ('AM_GNU_GETTEXT', 'AM_GLIB_GNU_GETTEXT', 'GETTEXT_PACKAGE'):
         inherits.append('gettext')
     elif keyword in ('AC_PROG_INTLTOOL', 'IT_PROG_INTLTOOL'):
         deps.append('intltool-native')
     elif keyword == 'AM_PATH_GLIB_2_0':
         deps.append('glib-2.0')
     elif keyword in ('AC_CHECK_PROG', 'AC_PATH_PROG', 'AX_WITH_PROG'):
         res = progs_re.search(value)
         if res:
             for prog in shlex.split(res.group(1)):
                 prog = prog.split()[0]
                 progclass = progclassmap.get(prog, None)
                 if progclass:
                     inherits.append(progclass)
                 else:
                     progdep = progmap.get(prog, None)
                     if progdep:
                         deps.append(progdep)
                     else:
                         if not prog.startswith('$'):
                             unmapped.append(prog)
     elif keyword == 'AC_CHECK_LIB':
         res = lib_re.search(value)
         if res:
             lib = res.group(1)
             if not lib.startswith('$'):
                 libdeps.append(lib)
     elif keyword == 'AX_CHECK_LIBRARY':
         res = libx_re.search(value)
         if res:
             lib = res.group(2)
             if not lib.startswith('$'):
                 header = res.group(1)
                 libdeps.add((lib, header))
     elif keyword == 'AC_PATH_X':
         deps.append('libx11')
     elif keyword in ('AX_BOOST', 'BOOST_REQUIRE'):
         deps.append('boost')
     elif keyword in ('AC_PROG_LEX', 'AM_PROG_LEX', 'AX_PROG_FLEX'):
         deps.append('flex-native')
     elif keyword in ('AC_PROG_YACC', 'AX_PROG_BISON'):
         deps.append('bison-native')
     elif keyword == 'AX_CHECK_ZLIB':
         deps.append('zlib')
     elif keyword in ('AX_CHECK_OPENSSL', 'AX_LIB_CRYPTO'):
         deps.append('openssl')
     elif keyword == 'AX_LIB_CURL':
         deps.append('curl')
     elif keyword == 'AX_LIB_BEECRYPT':
         deps.append('beecrypt')
     elif keyword == 'AX_LIB_EXPAT':
         deps.append('expat')
     elif keyword == 'AX_LIB_GCRYPT':
         deps.append('libgcrypt')
     elif keyword == 'AX_LIB_NETTLE':
         deps.append('nettle')
     elif keyword == 'AX_LIB_READLINE':
         deps.append('readline')
     elif keyword == 'AX_LIB_SQLITE3':
         deps.append('sqlite3')
     elif keyword == 'AX_LIB_TAGLIB':
         deps.append('taglib')
     elif keyword == 'AX_PKG_SWIG':
         deps.append('swig')
     elif keyword == 'AX_PROG_XSLTPROC':
         deps.append('libxslt-native')
     elif keyword == 'AX_WITH_CURSES':
         deps.append('ncurses')
     elif keyword == 'AX_PATH_BDB':
         deps.append('db')
     elif keyword == 'AX_PATH_LIB_PCRE':
         deps.append('libpcre')
     elif keyword == 'AC_INIT':
         if extravalues is not None:
             res = ac_init_re.match(value)
             if res:
                 extravalues['PN'] = process_value(res.group(1))
                 pv = process_value(res.group(2))
                 if validate_pv(pv):
                     extravalues['PV'] = pv
     elif keyword == 'AM_INIT_AUTOMAKE':
         if extravalues is not None:
             if 'PN' not in extravalues:
                 res = am_init_re.match(value)
                 if res:
                     if res.group(1) != 'AC_PACKAGE_NAME':
                         extravalues['PN'] = process_value(res.group(1))
                     pv = process_value(res.group(2))
                     if validate_pv(pv):
                         extravalues['PV'] = pv
     elif keyword == 'define(':
         res = define_re.match(value)
         if res:
             key = res.group(2).strip('[]')
             value = process_value(res.group(3))
             if value is not None:
                 defines[key] = value
 def process_macro(keyword, value):
     if keyword == 'PKG_CHECK_MODULES':
         res = pkg_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword in ('AM_GNU_GETTEXT', 'AM_GLIB_GNU_GETTEXT', 'GETTEXT_PACKAGE'):
         inherits.append('gettext')
     elif keyword in ('AC_PROG_INTLTOOL', 'IT_PROG_INTLTOOL'):
         deps.append('intltool-native')
     elif keyword == 'AM_PATH_GLIB_2_0':
         deps.append('glib-2.0')
     elif keyword == 'AC_CHECK_PROG' or keyword == 'AC_PATH_PROG':
         res = progs_re.search(value)
         if res:
             for prog in shlex.split(res.group(1)):
                 prog = prog.split()[0]
                 progclass = progclassmap.get(prog, None)
                 if progclass:
                     inherits.append(progclass)
                 else:
                     progdep = progmap.get(prog, None)
                     if progdep:
                         deps.append(progdep)
                     else:
                         if not prog.startswith('$'):
                             unmapped.append(prog)
     elif keyword == 'AC_CHECK_LIB':
         res = lib_re.search(value)
         if res:
             lib = res.group(1)
             if lib in ignorelibs:
                 logger.debug('Ignoring library dependency %s' % lib)
             else:
                 libdep = recipelibmap.get(lib, None)
                 if libdep:
                     deps.append(libdep)
                 else:
                     if libdep is None:
                         if not lib.startswith('$'):
                             unmappedlibs.append(lib)
     elif keyword == 'AC_PATH_X':
         deps.append('libx11')
     elif keyword == 'AC_INIT':
         if extravalues is not None:
             res = ac_init_re.match(value)
             if res:
                 extravalues['PN'] = process_value(res.group(1))
                 pv = process_value(res.group(2))
                 if validate_pv(pv):
                     extravalues['PV'] = pv
     elif keyword == 'AM_INIT_AUTOMAKE':
         if extravalues is not None:
             if 'PN' not in extravalues:
                 res = am_init_re.match(value)
                 if res:
                     if res.group(1) != 'AC_PACKAGE_NAME':
                         extravalues['PN'] = process_value(res.group(1))
                     pv = process_value(res.group(2))
                     if validate_pv(pv):
                         extravalues['PV'] = pv
     elif keyword == 'define(':
         res = define_re.match(value)
         if res:
             key = res.group(2).strip('[]')
             value = process_value(res.group(3))
             if value is not None:
                 defines[key] = value
Esempio n. 10
0
 def process_macro(keyword, value):
     for handler in handlers:
         if handler.process_macro(srctree, keyword, value,
                                  process_value, libdeps, pcdeps, deps,
                                  outlines, inherits, values):
             return
     logger.debug('Found keyword %s with value "%s"' % (keyword, value))
     if keyword == 'PKG_CHECK_MODULES':
         res = pkg_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword == 'PKG_CHECK_EXISTS':
         res = pkgce_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword in ('AM_GNU_GETTEXT', 'AM_GLIB_GNU_GETTEXT',
                      'GETTEXT_PACKAGE'):
         inherits.append('gettext')
     elif keyword in ('AC_PROG_INTLTOOL', 'IT_PROG_INTLTOOL'):
         deps.append('intltool-native')
     elif keyword == 'AM_PATH_GLIB_2_0':
         deps.append('glib-2.0')
     elif keyword in ('AC_CHECK_PROG', 'AC_PATH_PROG', 'AX_WITH_PROG'):
         res = progs_re.search(value)
         if res:
             for prog in shlex.split(res.group(1)):
                 prog = prog.split()[0]
                 for handler in handlers:
                     if handler.process_prog(srctree, keyword, value,
                                             prog, deps, outlines,
                                             inherits, values):
                         return
                 progclass = progclassmap.get(prog, None)
                 if progclass:
                     inherits.append(progclass)
                 else:
                     progdep = RecipeHandler.recipebinmap.get(
                         prog, None)
                     if not progdep:
                         progdep = progmap.get(prog, None)
                     if progdep:
                         deps.append(progdep)
                     elif progdep is None:
                         if not prog.startswith('$'):
                             unmapped.append(prog)
     elif keyword == 'AC_CHECK_LIB':
         res = lib_re.search(value)
         if res:
             lib = res.group(1)
             if not lib.startswith('$'):
                 libdeps.append(lib)
     elif keyword == 'AX_CHECK_LIBRARY':
         res = libx_re.search(value)
         if res:
             lib = res.group(2)
             if not lib.startswith('$'):
                 header = res.group(1)
                 libdeps.append((lib, header))
     elif keyword == 'AC_PATH_X':
         deps.append('libx11')
     elif keyword in ('AX_BOOST', 'BOOST_REQUIRE'):
         deps.append('boost')
     elif keyword in ('AC_PROG_LEX', 'AM_PROG_LEX', 'AX_PROG_FLEX'):
         deps.append('flex-native')
     elif keyword in ('AC_PROG_YACC', 'AX_PROG_BISON'):
         deps.append('bison-native')
     elif keyword == 'AX_CHECK_ZLIB':
         deps.append('zlib')
     elif keyword in ('AX_CHECK_OPENSSL', 'AX_LIB_CRYPTO'):
         deps.append('openssl')
     elif keyword == 'AX_LIB_CURL':
         deps.append('curl')
     elif keyword == 'AX_LIB_BEECRYPT':
         deps.append('beecrypt')
     elif keyword == 'AX_LIB_EXPAT':
         deps.append('expat')
     elif keyword == 'AX_LIB_GCRYPT':
         deps.append('libgcrypt')
     elif keyword == 'AX_LIB_NETTLE':
         deps.append('nettle')
     elif keyword == 'AX_LIB_READLINE':
         deps.append('readline')
     elif keyword == 'AX_LIB_SQLITE3':
         deps.append('sqlite3')
     elif keyword == 'AX_LIB_TAGLIB':
         deps.append('taglib')
     elif keyword in ['AX_PKG_SWIG', 'AC_PROG_SWIG']:
         deps.append('swig-native')
     elif keyword == 'AX_PROG_XSLTPROC':
         deps.append('libxslt-native')
     elif keyword in [
             'AC_PYTHON_DEVEL', 'AX_PYTHON_DEVEL', 'AM_PATH_PYTHON'
     ]:
         pythonclass = 'pythonnative'
         res = version_re.search(value)
         if res:
             if res.group(1).startswith('3'):
                 pythonclass = 'python3native'
         # Avoid replacing python3native with pythonnative
         if not pythonclass in inherits and not 'python3native' in inherits:
             if 'pythonnative' in inherits:
                 inherits.remove('pythonnative')
             inherits.append(pythonclass)
     elif keyword == 'AX_WITH_CURSES':
         deps.append('ncurses')
     elif keyword == 'AX_PATH_BDB':
         deps.append('db')
     elif keyword == 'AX_PATH_LIB_PCRE':
         deps.append('libpcre')
     elif keyword == 'AC_INIT':
         if extravalues is not None:
             res = ac_init_re.match(value)
             if res:
                 extravalues['PN'] = process_value(res.group(1))
                 pv = process_value(res.group(2))
                 if validate_pv(pv):
                     extravalues['PV'] = pv
     elif keyword == 'AM_INIT_AUTOMAKE':
         if extravalues is not None:
             if 'PN' not in extravalues:
                 res = am_init_re.match(value)
                 if res:
                     if res.group(1) != 'AC_PACKAGE_NAME':
                         extravalues['PN'] = process_value(res.group(1))
                     pv = process_value(res.group(2))
                     if validate_pv(pv):
                         extravalues['PV'] = pv
     elif keyword == 'define(':
         res = define_re.match(value)
         if res:
             key = res.group(2).strip('[]')
             value = process_value(res.group(3))
             if value is not None:
                 defines[key] = value
Esempio n. 11
0
 def process_macro(keyword, value):
     for handler in handlers:
         if handler.process_macro(
             srctree, keyword, value, process_value, libdeps, pcdeps, deps, outlines, inherits, values
         ):
             return
     if keyword == "PKG_CHECK_MODULES":
         res = pkg_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append("pkgconfig")
     elif keyword == "PKG_CHECK_EXISTS":
         res = pkgce_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append("pkgconfig")
     elif keyword in ("AM_GNU_GETTEXT", "AM_GLIB_GNU_GETTEXT", "GETTEXT_PACKAGE"):
         inherits.append("gettext")
     elif keyword in ("AC_PROG_INTLTOOL", "IT_PROG_INTLTOOL"):
         deps.append("intltool-native")
     elif keyword == "AM_PATH_GLIB_2_0":
         deps.append("glib-2.0")
     elif keyword in ("AC_CHECK_PROG", "AC_PATH_PROG", "AX_WITH_PROG"):
         res = progs_re.search(value)
         if res:
             for prog in shlex.split(res.group(1)):
                 prog = prog.split()[0]
                 for handler in handlers:
                     if handler.process_prog(srctree, keyword, value, prog, deps, outlines, inherits, values):
                         return
                 progclass = progclassmap.get(prog, None)
                 if progclass:
                     inherits.append(progclass)
                 else:
                     progdep = RecipeHandler.recipebinmap.get(prog, None)
                     if not progdep:
                         progdep = progmap.get(prog, None)
                     if progdep:
                         deps.append(progdep)
                     elif progdep is None:
                         if not prog.startswith("$"):
                             unmapped.append(prog)
     elif keyword == "AC_CHECK_LIB":
         res = lib_re.search(value)
         if res:
             lib = res.group(1)
             if not lib.startswith("$"):
                 libdeps.append(lib)
     elif keyword == "AX_CHECK_LIBRARY":
         res = libx_re.search(value)
         if res:
             lib = res.group(2)
             if not lib.startswith("$"):
                 header = res.group(1)
                 libdeps.append((lib, header))
     elif keyword == "AC_PATH_X":
         deps.append("libx11")
     elif keyword in ("AX_BOOST", "BOOST_REQUIRE"):
         deps.append("boost")
     elif keyword in ("AC_PROG_LEX", "AM_PROG_LEX", "AX_PROG_FLEX"):
         deps.append("flex-native")
     elif keyword in ("AC_PROG_YACC", "AX_PROG_BISON"):
         deps.append("bison-native")
     elif keyword == "AX_CHECK_ZLIB":
         deps.append("zlib")
     elif keyword in ("AX_CHECK_OPENSSL", "AX_LIB_CRYPTO"):
         deps.append("openssl")
     elif keyword == "AX_LIB_CURL":
         deps.append("curl")
     elif keyword == "AX_LIB_BEECRYPT":
         deps.append("beecrypt")
     elif keyword == "AX_LIB_EXPAT":
         deps.append("expat")
     elif keyword == "AX_LIB_GCRYPT":
         deps.append("libgcrypt")
     elif keyword == "AX_LIB_NETTLE":
         deps.append("nettle")
     elif keyword == "AX_LIB_READLINE":
         deps.append("readline")
     elif keyword == "AX_LIB_SQLITE3":
         deps.append("sqlite3")
     elif keyword == "AX_LIB_TAGLIB":
         deps.append("taglib")
     elif keyword == "AX_PKG_SWIG":
         deps.append("swig")
     elif keyword == "AX_PROG_XSLTPROC":
         deps.append("libxslt-native")
     elif keyword == "AX_WITH_CURSES":
         deps.append("ncurses")
     elif keyword == "AX_PATH_BDB":
         deps.append("db")
     elif keyword == "AX_PATH_LIB_PCRE":
         deps.append("libpcre")
     elif keyword == "AC_INIT":
         if extravalues is not None:
             res = ac_init_re.match(value)
             if res:
                 extravalues["PN"] = process_value(res.group(1))
                 pv = process_value(res.group(2))
                 if validate_pv(pv):
                     extravalues["PV"] = pv
     elif keyword == "AM_INIT_AUTOMAKE":
         if extravalues is not None:
             if "PN" not in extravalues:
                 res = am_init_re.match(value)
                 if res:
                     if res.group(1) != "AC_PACKAGE_NAME":
                         extravalues["PN"] = process_value(res.group(1))
                     pv = process_value(res.group(2))
                     if validate_pv(pv):
                         extravalues["PV"] = pv
     elif keyword == "define(":
         res = define_re.match(value)
         if res:
             key = res.group(2).strip("[]")
             value = process_value(res.group(3))
             if value is not None:
                 defines[key] = value
Esempio n. 12
0
 def process_macro(keyword, value):
     if keyword == 'PKG_CHECK_MODULES':
         res = pkg_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword in ('AM_GNU_GETTEXT', 'AM_GLIB_GNU_GETTEXT',
                      'GETTEXT_PACKAGE'):
         inherits.append('gettext')
     elif keyword in ('AC_PROG_INTLTOOL', 'IT_PROG_INTLTOOL'):
         deps.append('intltool-native')
     elif keyword == 'AM_PATH_GLIB_2_0':
         deps.append('glib-2.0')
     elif keyword == 'AC_CHECK_PROG' or keyword == 'AC_PATH_PROG':
         res = progs_re.search(value)
         if res:
             for prog in shlex.split(res.group(1)):
                 prog = prog.split()[0]
                 progclass = progclassmap.get(prog, None)
                 if progclass:
                     inherits.append(progclass)
                 else:
                     progdep = progmap.get(prog, None)
                     if progdep:
                         deps.append(progdep)
                     else:
                         if not prog.startswith('$'):
                             unmapped.append(prog)
     elif keyword == 'AC_CHECK_LIB':
         res = lib_re.search(value)
         if res:
             lib = res.group(1)
             if lib in ignorelibs:
                 logger.debug('Ignoring library dependency %s' % lib)
             else:
                 libdep = recipelibmap.get(lib, None)
                 if libdep:
                     deps.append(libdep)
                 else:
                     if libdep is None:
                         if not lib.startswith('$'):
                             unmappedlibs.append(lib)
     elif keyword == 'AC_PATH_X':
         deps.append('libx11')
     elif keyword == 'AC_INIT':
         if extravalues is not None:
             res = ac_init_re.match(value)
             if res:
                 extravalues['PN'] = process_value(res.group(1))
                 pv = process_value(res.group(2))
                 if validate_pv(pv):
                     extravalues['PV'] = pv
     elif keyword == 'AM_INIT_AUTOMAKE':
         if extravalues is not None:
             if 'PN' not in extravalues:
                 res = am_init_re.match(value)
                 if res:
                     if res.group(1) != 'AC_PACKAGE_NAME':
                         extravalues['PN'] = process_value(res.group(1))
                     pv = process_value(res.group(2))
                     if validate_pv(pv):
                         extravalues['PV'] = pv
     elif keyword == 'define(':
         res = define_re.match(value)
         if res:
             key = res.group(2).strip('[]')
             value = process_value(res.group(3))
             if value is not None:
                 defines[key] = value
 def process_macro(keyword, value):
     for handler in handlers:
         if handler.process_macro(srctree, keyword, value, process_value, libdeps, pcdeps, deps, outlines, inherits, values):
             return
     logger.debug('Found keyword %s with value "%s"' % (keyword, value))
     if keyword == 'PKG_CHECK_MODULES':
         res = pkg_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword == 'PKG_CHECK_EXISTS':
         res = pkgce_re.search(value)
         if res:
             res = dep_re.findall(res.group(1))
             if res:
                 pcdeps.extend([x[0] for x in res])
         inherits.append('pkgconfig')
     elif keyword in ('AM_GNU_GETTEXT', 'AM_GLIB_GNU_GETTEXT', 'GETTEXT_PACKAGE'):
         inherits.append('gettext')
     elif keyword in ('AC_PROG_INTLTOOL', 'IT_PROG_INTLTOOL'):
         deps.append('intltool-native')
     elif keyword == 'AM_PATH_GLIB_2_0':
         deps.append('glib-2.0')
     elif keyword in ('AC_CHECK_PROG', 'AC_PATH_PROG', 'AX_WITH_PROG'):
         res = progs_re.search(value)
         if res:
             for prog in shlex.split(res.group(1)):
                 prog = prog.split()[0]
                 for handler in handlers:
                     if handler.process_prog(srctree, keyword, value, prog, deps, outlines, inherits, values):
                         return
                 progclass = progclassmap.get(prog, None)
                 if progclass:
                     inherits.append(progclass)
                 else:
                     progdep = RecipeHandler.recipebinmap.get(prog, None)
                     if not progdep:
                         progdep = progmap.get(prog, None)
                     if progdep:
                         deps.append(progdep)
                     elif progdep is None:
                         if not prog.startswith('$'):
                             unmapped.append(prog)
     elif keyword == 'AC_CHECK_LIB':
         res = lib_re.search(value)
         if res:
             lib = res.group(1)
             if not lib.startswith('$'):
                 libdeps.append(lib)
     elif keyword == 'AX_CHECK_LIBRARY':
         res = libx_re.search(value)
         if res:
             lib = res.group(2)
             if not lib.startswith('$'):
                 header = res.group(1)
                 libdeps.append((lib, header))
     elif keyword == 'AC_PATH_X':
         deps.append('libx11')
     elif keyword in ('AX_BOOST', 'BOOST_REQUIRE'):
         deps.append('boost')
     elif keyword in ('AC_PROG_LEX', 'AM_PROG_LEX', 'AX_PROG_FLEX'):
         deps.append('flex-native')
     elif keyword in ('AC_PROG_YACC', 'AX_PROG_BISON'):
         deps.append('bison-native')
     elif keyword == 'AX_CHECK_ZLIB':
         deps.append('zlib')
     elif keyword in ('AX_CHECK_OPENSSL', 'AX_LIB_CRYPTO'):
         deps.append('openssl')
     elif keyword == 'AX_LIB_CURL':
         deps.append('curl')
     elif keyword == 'AX_LIB_BEECRYPT':
         deps.append('beecrypt')
     elif keyword == 'AX_LIB_EXPAT':
         deps.append('expat')
     elif keyword == 'AX_LIB_GCRYPT':
         deps.append('libgcrypt')
     elif keyword == 'AX_LIB_NETTLE':
         deps.append('nettle')
     elif keyword == 'AX_LIB_READLINE':
         deps.append('readline')
     elif keyword == 'AX_LIB_SQLITE3':
         deps.append('sqlite3')
     elif keyword == 'AX_LIB_TAGLIB':
         deps.append('taglib')
     elif keyword in ['AX_PKG_SWIG', 'AC_PROG_SWIG']:
         deps.append('swig-native')
     elif keyword == 'AX_PROG_XSLTPROC':
         deps.append('libxslt-native')
     elif keyword in ['AC_PYTHON_DEVEL', 'AX_PYTHON_DEVEL', 'AM_PATH_PYTHON']:
         pythonclass = 'pythonnative'
         res = version_re.search(value)
         if res:
             if res.group(1).startswith('3'):
                 pythonclass = 'python3native'
         # Avoid replacing python3native with pythonnative
         if not pythonclass in inherits and not 'python3native' in inherits:
             if 'pythonnative' in inherits:
                 inherits.remove('pythonnative')
             inherits.append(pythonclass)
     elif keyword == 'AX_WITH_CURSES':
         deps.append('ncurses')
     elif keyword == 'AX_PATH_BDB':
         deps.append('db')
     elif keyword == 'AX_PATH_LIB_PCRE':
         deps.append('libpcre')
     elif keyword == 'AC_INIT':
         if extravalues is not None:
             res = ac_init_re.match(value)
             if res:
                 extravalues['PN'] = process_value(res.group(1))
                 pv = process_value(res.group(2))
                 if validate_pv(pv):
                     extravalues['PV'] = pv
     elif keyword == 'AM_INIT_AUTOMAKE':
         if extravalues is not None:
             if 'PN' not in extravalues:
                 res = am_init_re.match(value)
                 if res:
                     if res.group(1) != 'AC_PACKAGE_NAME':
                         extravalues['PN'] = process_value(res.group(1))
                     pv = process_value(res.group(2))
                     if validate_pv(pv):
                         extravalues['PV'] = pv
     elif keyword == 'define(':
         res = define_re.match(value)
         if res:
             key = res.group(2).strip('[]')
             value = process_value(res.group(3))
             if value is not None:
                 defines[key] = value