diff --git a/src/xcp_ng_dev/cli.py b/src/xcp_ng_dev/cli.py index 642d543..2765d27 100755 --- a/src/xcp_ng_dev/cli.py +++ b/src/xcp_ng_dev/cli.py @@ -54,6 +54,7 @@ def add_common_args(parser): group.add_argument('--disablerepo', help='disable repositories. Same syntax as yum\'s --disablerepo parameter. ' 'If both --enablerepo and --disablerepo are set, --disablerepo will be applied first') + group.add_argument('-U', '--disable-upstream-repos', action='store_true', help='disable the upstream repositories') group.add_argument('--no-update', action='store_true', help='do not run "yum update" on container start, use it as it was at build time') @@ -170,6 +171,8 @@ def container(args): if args.env: for env in args.env: docker_args += ["-e", env] + if args.disable_upstream_repos: + docker_args += ["-e", "DISABLE_UPSTREAM_REPOS=true"] if args.enablerepo: docker_args += ["-e", "ENABLEREPO=%s" % args.enablerepo] if args.disablerepo: diff --git a/src/xcp_ng_dev/files/Dockerfile-8.x b/src/xcp_ng_dev/files/Dockerfile-8.x index b6e404c..c9dcc2e 100644 --- a/src/xcp_ng_dev/files/Dockerfile-8.x +++ b/src/xcp_ng_dev/files/Dockerfile-8.x @@ -10,6 +10,8 @@ ARG CENTOS_VERSION COPY files/CentOS-Vault.repo.in /etc/yum.repos.d/CentOS-Vault-7.5.repo RUN sed -i -e "s/@CENTOS_VERSION@/${CENTOS_VERSION}/g" /etc/yum.repos.d/CentOS-Vault-7.5.repo +ENV UPSTREAM_REPOS="C${CENTOS_VERSION}-base C${CENTOS_VERSION}-updates C${CENTOS_VERSION}-extras" + # Add our repositories # Repository file depends on the target version of XCP-ng, and is pre-processed by build.sh ARG XCP_NG_BRANCH=8.3 diff --git a/src/xcp_ng_dev/files/Dockerfile-9.x b/src/xcp_ng_dev/files/Dockerfile-9.x index be318d0..b1bb75d 100644 --- a/src/xcp_ng_dev/files/Dockerfile-9.x +++ b/src/xcp_ng_dev/files/Dockerfile-9.x @@ -41,6 +41,8 @@ RUN dnf update -y \ # clean package cache to avoid download errors && yum clean all +ENV UPSTREAM_REPOS="appstream baseos crb epel extras alma10-devel" + # enable repositories commonly required to build RUN dnf config-manager --enable crb diff --git a/src/xcp_ng_dev/files/init-container.sh b/src/xcp_ng_dev/files/init-container.sh index 27f8ef0..3637dcc 100755 --- a/src/xcp_ng_dev/files/init-container.sh +++ b/src/xcp_ng_dev/files/init-container.sh @@ -46,6 +46,13 @@ case "$OS_RELEASE" in *) echo >&2 "ERROR: unknown release, cannot know package manager"; exit 1 ;; esac +# disable upstream repositories if needed +if [ "$DISABLE_UPSTREAM_REPOS" == "true" ]; then + for repo in $UPSTREAM_REPOS; do + sudo $CFGMGR --disable "$repo" + done +fi + # disable repositories if needed if [ -n "$DISABLEREPO" ]; then sudo $CFGMGR --disable "$DISABLEREPO"