Example #1
0
def failed_pattern(line, pattern, verbose, buildtool=None):
    global must_restart

    pat = re.compile(pattern)
    match = pat.search(line)
    if not match:
        return
    s = match.group(1)
    try:
        if not buildtool:
            req = config.failed_commands[s]
            if req:
                must_restart += buildreq.add_buildreq(req)
        elif buildtool == 'pkgconfig':
            must_restart += buildreq.add_pkgconfig_buildreq(s)
        elif buildtool == 'R':
            if buildreq.add_buildreq("R-" + s) > 0:
                must_restart += 1
                buildreq.add_requires("R-" + s)
        elif buildtool == 'perl':
            must_restart += buildreq.add_buildreq('perl(%s)' % s)
        elif buildtool == 'pypi':
            s = util.translate(s)
            if not s:
                return
            must_restart += buildreq.add_buildreq(
                util.translate('%s-python' % s))
        elif buildtool == 'ruby':
            if s in config.gems:
                must_restart += buildreq.add_buildreq(config.gems[s])
            else:
                must_restart += buildreq.add_buildreq('rubygem-%s' % s)
        elif buildtool == 'ruby table':
            if s in config.gems:
                must_restart += buildreq.add_buildreq(config.gems[s])
            else:
                print("Unknown ruby gem match", s)
        elif buildtool == 'maven':
            if s in config.maven_jars:
                must_restart += buildreq.add_buildreq(config.maven_jars[s])
            else:
                must_restart += buildreq.add_buildreq('jdk-%s' % s)
        elif buildtool == 'catkin':
            must_restart += buildreq.add_pkgconfig_buildreq(s)
            must_restart += buildreq.add_buildreq(s)

    except:
        if verbose > 0:
            print("Unknown pattern match: ", s)
Example #2
0
def simple_pattern_pkgconfig(line, pattern, pkgconfig):
    """Check for pkgconfig patterns and restart build as needed."""
    global must_restart
    pat = re.compile(pattern)
    match = pat.search(line)
    if match:
        must_restart += buildreq.add_pkgconfig_buildreq(pkgconfig, cache=True)
Example #3
0
def simple_pattern_pkgconfig(line, pattern, pkgconfig):
    global must_restart
    pat = re.compile(pattern)
    match = pat.search(line)
    if match:
        must_restart = must_restart + \
            buildreq.add_pkgconfig_buildreq(pkgconfig)
Example #4
0
 def test_add_pkgconfig_buildreq_32bit(self):
     """
     Test add_pkgconfig_buildreq with config_opts['32bit'] set to True
     """
     buildreq.config.config_opts['32bit'] = True
     self.assertTrue(buildreq.add_pkgconfig_buildreq('testreq'))
     self.assertIn('pkgconfig(testreq)', buildreq.buildreqs)
     self.assertIn('pkgconfig(32testreq)', buildreq.buildreqs)
Example #5
0
def failed_pattern_pkgconfig(line, pattern, verbose=0):
    global must_restart
    global failed_commands

    pat = re.compile(pattern)
    match = pat.search(line)
    if match:
        s = match.group(1)
        must_restart = must_restart + buildreq.add_pkgconfig_buildreq(s)
Example #6
0
def failed_pattern(line, pattern, verbose, buildtool=None):
    """Check against failed patterns to restart build as needed."""
    global must_restart
    global warned_about

    pat = re.compile(pattern)
    match = pat.search(line)
    if not match:
        return
    s = match.group(1)
    # standard configure cleanups
    s = cleanup_req(s)

    if s in config.ignored_commands:
        return

    try:
        if not buildtool:
            req = config.failed_commands[s]
            if req:
                must_restart += buildreq.add_buildreq(req, cache=True)
        elif buildtool == 'pkgconfig':
            must_restart += buildreq.add_pkgconfig_buildreq(s, cache=True)
        elif buildtool == 'R':
            if buildreq.add_buildreq("R-" + s, cache=True) > 0:
                must_restart += 1
                buildreq.add_requires("R-" + s)
        elif buildtool == 'perl':
            s = s.replace('inc::', '')
            must_restart += buildreq.add_buildreq('perl(%s)' % s, cache=True)
        elif buildtool == 'pypi':
            s = util.translate(s)
            if not s:
                return
            must_restart += buildreq.add_buildreq(util.translate('%s-python' %
                                                                 s),
                                                  cache=True)
        elif buildtool == 'ruby':
            if s in config.gems:
                must_restart += buildreq.add_buildreq(config.gems[s],
                                                      cache=True)
            else:
                must_restart += buildreq.add_buildreq('rubygem-%s' % s,
                                                      cache=True)
        elif buildtool == 'ruby table':
            if s in config.gems:
                must_restart += buildreq.add_buildreq(config.gems[s],
                                                      cache=True)
            else:
                print("Unknown ruby gem match", s)
        elif buildtool == 'maven':
            if s in config.maven_jars:
                must_restart += buildreq.add_buildreq(config.maven_jars[s],
                                                      cache=True)
            else:
                must_restart += buildreq.add_buildreq('jdk-%s' % s, cache=True)
        elif buildtool == 'catkin':
            must_restart += buildreq.add_pkgconfig_buildreq(s, cache=True)
            must_restart += buildreq.add_buildreq(s, cache=True)

    except Exception:
        if s not in warned_about and s[:2] != '--':
            print("Unknown pattern match: ", s)
            warned_about.add(s)
Example #7
0
def simple_pattern_pkgconfig(line, pattern, pkgconfig):
    global must_restart
    pat = re.compile(pattern)
    match = pat.search(line)
    if match:
        must_restart += buildreq.add_pkgconfig_buildreq(pkgconfig)
Example #8
0
def failed_pattern(line, pattern, verbose, buildtool=None):
    """Check against failed patterns to restart build as needed."""
    global must_restart
    global warned_about

    pat = re.compile(pattern)
    match = pat.search(line)
    if not match:
        return
    s = match.group(1)
    # standard configure cleanups
    s = cleanup_req(s)

    if s in config.ignored_commands:
        return

    try:
        if not buildtool:
            req = config.failed_commands[s]
            if req:
                must_restart += buildreq.add_buildreq(req, cache=True)
        elif buildtool == 'pkgconfig':
            must_restart += buildreq.add_pkgconfig_buildreq(s, cache=True)
        elif buildtool == 'R':
            if buildreq.add_buildreq("R-" + s, cache=True) > 0:
                must_restart += 1
                buildreq.add_requires("R-" + s)
        elif buildtool == 'perl':
            s = s.replace('inc::', '')
            must_restart += buildreq.add_buildreq('perl(%s)' % s, cache=True)
        elif buildtool == 'pypi':
            s = util.translate(s)
            if not s:
                return
            must_restart += buildreq.add_buildreq(util.translate('%s-python' % s), cache=True)
        elif buildtool == 'ruby':
            if s in config.gems:
                must_restart += buildreq.add_buildreq(config.gems[s], cache=True)
            else:
                must_restart += buildreq.add_buildreq('rubygem-%s' % s, cache=True)
        elif buildtool == 'ruby table':
            if s in config.gems:
                must_restart += buildreq.add_buildreq(config.gems[s], cache=True)
            else:
                print("Unknown ruby gem match", s)
        elif buildtool == 'maven' or buildtool == 'gradle':
            group_count = len(match.groups())
            if group_count == 2:
                # Add fully qualified versioned mvn() dependency
                name = match.group(1)
                # Hyphens are disallowed for version strings, so use dots instead
                ver = match.group(2).replace('-', '.')
                mvn_provide = f'mvn({name}) = {ver}'
                must_restart += buildreq.add_buildreq(mvn_provide, cache=True)
            elif s in config.maven_jars:
                # Overrides for dependencies with custom grouping
                must_restart += buildreq.add_buildreq(config.maven_jars[s], cache=True)
            elif group_count == 3:
                org = match.group(1)
                name = match.group(2)
                ver = match.group(3).replace('-', '.')
                if re.search("-(parent|pom|bom)$", name):
                    mvn_provide = f'mvn({org}:{name}:pom) = {ver}'
                else:
                    mvn_provide = f'mvn({org}:{name}:jar) = {ver}'
                must_restart += buildreq.add_buildreq(mvn_provide, cache=True)
            else:
                # Fallback to mvn-ARTIFACTID package name
                must_restart += buildreq.add_buildreq('mvn-%s' % s, cache=True)
        elif buildtool == 'catkin':
            must_restart += buildreq.add_pkgconfig_buildreq(s, cache=True)
            must_restart += buildreq.add_buildreq(s, cache=True)

    except Exception:
        if s not in warned_about and s[:2] != '--':
            print("Unknown pattern match: ", s)
            warned_about.add(s)
Example #9
0
 def test_add_pkgconfig_buildreq(self):
     """
     Test add_pkgconfig_buildreq with config_opts['32bit'] set to False
     """
     self.assertTrue(buildreq.add_pkgconfig_buildreq('testreq'))
     self.assertIn('pkgconfig(testreq)', buildreq.buildreqs)