Add convenience flags --apt and --native.

This commit is contained in:
Jelmer Vernooij 2021-04-13 18:25:10 +01:00 committed by Jelmer Vernooij
parent 3658f6e0ec
commit 6f4e571e2f
No known key found for this signature in database
GPG key ID: 579C160D4C9E23E8
2 changed files with 15 additions and 3 deletions

View file

@ -106,6 +106,12 @@ def main(): # noqa: C901
default="auto",
help="What to do about missing dependencies",
)
parser.add_argument(
'--apt', help=argparse.SUPPRESS,
dest='resolve', action='store_const', const='apt')
parser.add_argument(
'--native', help=argparse.SUPPRESS,
dest='native', action='store_const', const='native')
parser.add_argument(
"--explain",
action="store_true",
@ -124,6 +130,8 @@ def main(): # noqa: C901
subparsers.add_parser("clean")
subparsers.add_parser("test")
subparsers.add_parser("info")
exec_parser = subparsers.add_parser("exec")
exec_parser.add_argument('subargv', nargs=argparse.REMAINDER, help='Command to run.')
install_parser = subparsers.add_parser("install")
install_parser.add_argument(
"--user", action="store_true", help="Install in local-user directories."
@ -161,10 +169,14 @@ def main(): # noqa: C901
elif args.resolve == "auto":
resolver = auto_resolver(session, explain=args.explain)
logging.info("Using requirement resolver: %s", resolver)
fixers = determine_fixers(session, resolver, explain=args.explain)
try:
if args.subcommand == "exec":
from .fix_build import run_with_build_fixers
run_with_build_fixers(session, args.subargv, fixers)
return 0
bss = list(detect_buildsystems(args.directory))
logging.info("Detected buildsystems: %s", ", ".join(map(str, bss)))
fixers = determine_fixers(session, resolver, explain=args.explain)
if not args.ignore_declared_dependencies:
stages = STAGE_MAP[args.subcommand]
if stages:

View file

@ -433,7 +433,7 @@ def fix_missing_makefile_pl(error, phase, context):
return False
def coerce_unaccpetable_predicate(error, phase, context):
def coerce_unacceptable_predicate(error, phase, context):
from debmutate.debcargo import DebcargoEditor
with DebcargoEditor(context.abspath('debian/debcargo.toml')) as editor:
editor['allow_prerelease_deps'] = True
@ -492,7 +492,7 @@ def versioned_package_fixers(session, packaging_context, apt):
packaging_context, MissingConfigStatusInput, fix_missing_config_status_input
),
SimpleBuildFixer(packaging_context, MissingPerlFile, fix_missing_makefile_pl),
SimpleBuildFixer(packaging_context, DebcargoUnacceptablePredicate, coerce_unaccpetable_predicate),
SimpleBuildFixer(packaging_context, DebcargoUnacceptablePredicate, coerce_unacceptable_predicate),
]