From 3249f839383bd1fe39320cd48d6b17935669698c Mon Sep 17 00:00:00 2001 From: Giulio Eulisse <10544+ktf@users.noreply.github.com> Date: Wed, 25 Sep 2024 11:50:39 +0200 Subject: [PATCH] Add --only-deps option for caching --- alibuild_helpers/args.py | 2 ++ alibuild_helpers/build.py | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/alibuild_helpers/args.py b/alibuild_helpers/args.py index 8f48bc42..da45b0bc 100644 --- a/alibuild_helpers/args.py +++ b/alibuild_helpers/args.py @@ -107,6 +107,8 @@ def doParseArgs(): "in multiple packages. The comment will only be stored if " "PACKAGE is compiled or downloaded during this run; if it " "already exists, this does not happen.")) + build_parser.add_argument("--only-deps", dest="onlyDeps", default=False, action="store_true", + help="Only build dependencies, not the main package (e.g. for caching)") build_docker = build_parser.add_argument_group(title="Build inside a container", description="""\ Builds can be done inside a Docker container, to make it easier to get a diff --git a/alibuild_helpers/build.py b/alibuild_helpers/build.py index 2716bf14..b13c1727 100644 --- a/alibuild_helpers/build.py +++ b/alibuild_helpers/build.py @@ -697,6 +697,12 @@ def doBuild(args, parser): deps=",".join(buildOrder[:-1]), ), args.architecture) + # If we are building only the dependencies, the last package in + # the build order can be considered done. + if args.onlyDeps: + mainPackage = buildOrder.pop() + warning("Not rebuilding %s because --only-deps option provided.", mainPackage["package"]) + while buildOrder: p = buildOrder[0] spec = specs[p]