Rerun autoconf if it didn't expand all macros.
This commit is contained in:
parent
f40a611ae2
commit
0220d5c524
2 changed files with 36 additions and 2 deletions
|
@ -71,7 +71,9 @@ def create_dist(
|
|||
from .buildsystem import detect_buildsystems
|
||||
from .buildlog import InstallFixer
|
||||
from .fix_build import BuildFixer
|
||||
from .fixers import GitIdentityFixer, SecretGpgKeyFixer
|
||||
from .fixers import (
|
||||
GitIdentityFixer, SecretGpgKeyFixer,
|
||||
UnexpandedAutoconfMacroFixer, )
|
||||
|
||||
if subdir is None:
|
||||
subdir = "package"
|
||||
|
@ -86,7 +88,9 @@ def create_dist(
|
|||
# TODO(jelmer): use scan_buildsystems to also look in subdirectories
|
||||
buildsystems = list(detect_buildsystems(export_directory))
|
||||
resolver = auto_resolver(session)
|
||||
fixers: List[BuildFixer] = [InstallFixer(resolver)]
|
||||
fixers: List[BuildFixer] = [UnexpandedAutoconfMacroFixer(session, resolver)]
|
||||
|
||||
fixers.append(InstallFixer(resolver))
|
||||
|
||||
if session.is_temporary:
|
||||
# Only muck about with temporary sessions
|
||||
|
|
|
@ -22,7 +22,10 @@ from buildlog_consultant import Problem
|
|||
from buildlog_consultant.common import (
|
||||
MissingGitIdentity,
|
||||
MissingSecretGpgKey,
|
||||
MissingAutoconfMacro,
|
||||
)
|
||||
from ognibuild.requirements import AutoconfMacroRequirement
|
||||
from ognibuild.resolver import UnsatisfiedRequirements
|
||||
|
||||
from .fix_build import BuildFixer
|
||||
|
||||
|
@ -70,3 +73,30 @@ Passphrase: ""
|
|||
if p.returncode == 0:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
class UnexpandedAutoconfMacroFixer(BuildFixer):
|
||||
|
||||
def __init__(self, session, resolver):
|
||||
self.session = session
|
||||
self.resolver = resolver
|
||||
|
||||
def __repr__(self):
|
||||
return "%s(%r)" % (type(self).__name__, self.resolver)
|
||||
|
||||
def __str__(self):
|
||||
return "unexpanded m4 macro fixer (%s)" % self.resolver
|
||||
|
||||
def can_fix(self, error):
|
||||
return isinstance(error, MissingAutoconfMacro)
|
||||
|
||||
def _fix(self, error, phase):
|
||||
try:
|
||||
self.resolver.install([AutoconfMacroRequirement(error.macro)])
|
||||
except UnsatisfiedRequirements:
|
||||
return False
|
||||
from .fix_build import run_detecting_problems
|
||||
|
||||
run_detecting_problems(self.session, ['autoconf'])
|
||||
|
||||
return True
|
||||
|
|
Loading…
Add table
Reference in a new issue