Skip to content

Commit 0d0b822

Browse files
committed
New --ccache option to cache buid artifacts
Quite necessary for upcoming rebuilds of the kernel package. Signed-off-by: Yann Dirson <[email protected]>
1 parent b87efd8 commit 0d0b822

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Dockerfile-9.x

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ RUN dnf update -y
1919
RUN dnf install -y \
2020
gcc \
2121
gcc-c++ \
22+
ccache \
2223
git \
2324
make \
2425
rpm-build \

run.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ def main():
4949
"Any preexisting BUILD, BUILDROOT, RPMS or SRPMS directories will be removed first. "
5050
"If --output-dir is set, the RPMS and SRPMS directories will be copied to it "
5151
"after the build.")
52+
parser.add_argument('--ccache', action='store',
53+
help="Use given directory as a cache for ccache, mounted in the container")
5254
parser.add_argument('--define',
5355
help="Definitions to be passed to rpmbuild (if --build-local is "
5456
"passed too). Example: --define 'xcp_ng_section extras', for building the 'extras' "
@@ -111,6 +113,12 @@ def main():
111113
docker_args += ["-v", "%s:/home/builder/rpmbuild" %
112114
os.path.abspath(args.build_local)]
113115
docker_args += ["-e", "BUILD_LOCAL=1"]
116+
if args.ccache:
117+
docker_args += ["-v", f"{args.ccache}:/home/builder/ccachedir",
118+
"-e", "CCACHE_DIR=/home/builder/ccachedir",
119+
# FIXME
120+
"-e", "PATH=/usr/lib64/ccache:/home/builder/.local/bin:/home/builder/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
121+
]
114122
if args.define:
115123
docker_args += ["-e", "RPMBUILD_DEFINE=%s" % args.define]
116124
if args.rpmbuild_opts:

0 commit comments

Comments
 (0)