Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions container/Dockerfile-9.x
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ RUN dnf update -y \
&& dnf install -y \
gcc \
gcc-c++ \
ccache \
git \
make \
rpm-build \
Expand Down
10 changes: 10 additions & 0 deletions container/files/init-container.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ os_release()
)
}

if [ -n "${PATH_PREPEND}" ]; then
PATH="${PATH_PREPEND}:${PATH}"
fi

OS_RELEASE=$(os_release)

# get list of user repos
Expand Down Expand Up @@ -56,6 +60,12 @@ if [ -n "$ENABLEREPO" ]; then
sudo $CFGMGR --enable "$ENABLEREPO"
fi

# disable ccache unless its use was required
if [ -z "$CCACHE_DIR" ]; then
echo >&2 "Note: uninstalling not-requested ccache"
sudo $DNF remove -y ccache
fi

if [ -z "$NOUPDATE" ]; then
# update to either install newer updates or to take packages from added repos into account
sudo $DNF update -y --disablerepo=epel
Expand Down
8 changes: 8 additions & 0 deletions src/xcp_ng_dev/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ def add_common_args(parser):
group.add_argument('-e', '--env', action='append',
help='Environment variables passed directly to '
f'{RUNNER} -e')
parser.add_argument('--ccache', action='store',
help="Use given directory as a cache for ccache")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would rather use a docker volume for that, unless there is a point to access the ccached data from outside a container?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use it to check how well that works with CCACHE_DIR=... ccache -s. Also, that allows a caller to have its own management of the lifecycle of this cache like other standard directlries, whereas I understand a docker volume would be in docker/podman's own data store.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, maybe get the value from an environment variable, so we don't have to always pass it on the command line then.

group.add_argument('-a', '--enablerepo',
help='additional repositories to enable before installing build dependencies. '
'Same syntax as yum\'s --enablerepo parameter. Available additional repositories: '
Expand Down Expand Up @@ -169,6 +171,12 @@ def container(args):
if args.env:
for env in args.env:
docker_args += ["-e", env]
if args.ccache:
os.makedirs(args.ccache, exist_ok=True)
docker_args += ["-v", f"{os.path.realpath(args.ccache)}:/home/builder/ccachedir",
"-e", "CCACHE_DIR=/home/builder/ccachedir",
"-e", "PATH_PREPEND=/usr/lib64/ccache",
]
if args.enablerepo:
docker_args += ["-e", "ENABLEREPO=%s" % args.enablerepo]
if args.disablerepo:
Expand Down