Skip to content

Commit 62aeb6e

Browse files
committed
Add the --disable-upstream-repos option (-U for short).
This allows to generate an error when a dependency is not aleardy packaged in XCP-ng. The developer can then decide if the dependency should be either imported or removed. Signed-off-by: Gaëtan Lehmann <[email protected]>
1 parent e9cafe6 commit 62aeb6e

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

src/xcp_ng_dev/cli.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def add_common_args(parser):
5454
group.add_argument('--disablerepo',
5555
help='disable repositories. Same syntax as yum\'s --disablerepo parameter. '
5656
'If both --enablerepo and --disablerepo are set, --disablerepo will be applied first')
57+
group.add_argument('-U', '--disable-upstream-repos', action='store_true', help='disable the upstream repositories')
5758
group.add_argument('--no-update', action='store_true',
5859
help='do not run "yum update" on container start, use it as it was at build time')
5960

@@ -170,6 +171,8 @@ def container(args):
170171
if args.env:
171172
for env in args.env:
172173
docker_args += ["-e", env]
174+
if args.disable_upstream_repos:
175+
docker_args += ["-e", "DISABLE_UPSTREAM_REPOS=true"]
173176
if args.enablerepo:
174177
docker_args += ["-e", "ENABLEREPO=%s" % args.enablerepo]
175178
if args.disablerepo:

src/xcp_ng_dev/files/Dockerfile-8.x

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ARG CENTOS_VERSION
1010
COPY files/CentOS-Vault.repo.in /etc/yum.repos.d/CentOS-Vault-7.5.repo
1111
RUN sed -i -e "s/@CENTOS_VERSION@/${CENTOS_VERSION}/g" /etc/yum.repos.d/CentOS-Vault-7.5.repo
1212

13+
ENV UPSTREAM_REPOS="C${CENTOS_VERSION}-base C${CENTOS_VERSION}-updates C${CENTOS_VERSION}-extras"
14+
1315
# Add our repositories
1416
# Repository file depends on the target version of XCP-ng, and is pre-processed by build.sh
1517
ARG XCP_NG_BRANCH=8.3

src/xcp_ng_dev/files/Dockerfile-9.x

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ RUN dnf update -y \
4141
# clean package cache to avoid download errors
4242
&& yum clean all
4343
44+
ENV UPSTREAM_REPOS="appstream baseos crb epel extras alma10-devel"
45+
4446
# enable repositories commonly required to build
4547
RUN dnf config-manager --enable crb
4648

src/xcp_ng_dev/files/init-container.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,13 @@ case "$OS_RELEASE" in
4646
*) echo >&2 "ERROR: unknown release, cannot know package manager"; exit 1 ;;
4747
esac
4848

49+
# disable upstream repositories if needed
50+
if [ "$DISABLE_UPSTREAM_REPOS" == "true" ]; then
51+
for repo in $UPSTREAM_REPOS; do
52+
sudo $CFGMGR --disable "$repo"
53+
done
54+
fi
55+
4956
# disable repositories if needed
5057
if [ -n "$DISABLEREPO" ]; then
5158
sudo $CFGMGR --disable "$DISABLEREPO"

0 commit comments

Comments
 (0)