Skip to content

Commit

Permalink
scripts/build-local.py: Allow use of ccache
Browse files Browse the repository at this point in the history
When doing continuous builds of a matrix, ccache can help speed up
rebuilds.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
  • Loading branch information
nathanchance authored and nickdesaulniers committed Jul 11, 2023
1 parent d86bdb7 commit 6df04b9
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions scripts/build-local.py
Expand Up @@ -14,6 +14,7 @@
NORMAL = '\033[0m'
RED = '\033[01;31m'
GREEN = '\033[01;32m'
YELLOW = '\033[01;33m'


def interrupt_handler(_signum, _frame):
Expand Down Expand Up @@ -46,6 +47,10 @@ def interrupt_handler(_signum, _frame):
'--build-dir',
default=default_build_dir,
help=f"Build folder (default: {default_build_dir})")
parser.add_argument('-c',
'--ccache',
action='store_true',
help='Use ccache if it is available')
parser.add_argument('-C',
'--directory',
help='Path to kernel source',
Expand Down Expand Up @@ -86,6 +91,15 @@ def interrupt_handler(_signum, _frame):
else:
runtime = None

wrapper = None
if args.ccache:
if shutil.which('ccache'):
wrapper = 'ccache'
else:
print(
f"{YELLOW}ccache was requested but it is not installed, ignoring...{NORMAL}"
)

# Combine all jobs into one object for easy iteration
jobs = {}
for file_str in args.files:
Expand Down Expand Up @@ -162,6 +176,7 @@ def interrupt_handler(_signum, _frame):
quiet=(not args.verbose),
runtime=runtime,
tree=tree,
wrapper=wrapper,
**build)

if all(info.passed for info in result.status.values()):
Expand Down

0 comments on commit 6df04b9

Please sign in to comment.