Skip to content

Commit f938893

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 a303aba commit f938893

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
@@ -49,6 +49,7 @@ def add_common_args(parser):
4949
parser.add_argument('-e', '--env', action='append',
5050
help='Environment variables passed directly to '
5151
f'{RUNNER} -e')
52+
parser.add_argument('-U', '--disable-upstream-repos', action='store_true', help='disable the upstream repositories')
5253
parser.add_argument('-a', '--enablerepo',
5354
help='additional repositories to enable before installing build dependencies. '
5455
'Same syntax as yum\'s --enablerepo parameter. Available additional repositories: '
@@ -202,6 +203,8 @@ def container(args):
202203
if args.env:
203204
for env in args.env:
204205
docker_args += ["-e", env]
206+
if args.disable_upstream_repos:
207+
docker_args += ["-e", "DISABLE_UPSTREAM_REPOS=true"]
205208
if args.enablerepo:
206209
docker_args += ["-e", "ENABLEREPO=%s" % args.enablerepo]
207210
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
@@ -13,6 +13,8 @@ ARG CENTOS_VERSION
1313
COPY files/CentOS-Vault.repo.in /etc/yum.repos.d/CentOS-Vault-7.5.repo
1414
RUN sed -e "s/@CENTOS_VERSION@/${CENTOS_VERSION}/g" -i /etc/yum.repos.d/CentOS-Vault-7.5.repo
1515

16+
ENV UPSTREAM_REPOS="C${CENTOS_VERSION}-base C${CENTOS_VERSION}-updates C${CENTOS_VERSION}-extras"
17+
1618
# Add our repositories
1719
# Repository file depends on the target version of XCP-ng, and is pre-processed by build.sh
1820
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
@@ -49,6 +49,8 @@ RUN dnf install -y \
4949
xcp-ng-release \
5050
xcp-ng-release-presets
5151
52+
ENV UPSTREAM_REPOS="appstream baseos crb epel extras alma10-devel"
53+
5254
# enable repositories commonly required to build
5355
RUN dnf config-manager --enable crb
5456

src/xcp_ng_dev/files/init-container.sh

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

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

0 commit comments

Comments
 (0)