Skip to content

Commit fcf887b

Browse files
committed
Disable upstream repositories by default
and add the --enable-upstream-repos option (-U for short) to enable them. 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 14eb61e commit fcf887b

File tree

6 files changed

+21
-6
lines changed

6 files changed

+21
-6
lines changed

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

Dockerfile-9.x

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,11 @@ RUN dnf install -y \
4949
xcp-ng-release \
5050
xcp-ng-release-presets
5151
52-
# enable repositories commonly required to build
53-
RUN dnf config-manager --enable crb
52+
ENV UPSTREAM_REPOS="appstream baseos crb epel extras alma10-devel"
53+
54+
# TODO: move this before installing any packages, so we can make sure they are actually in the XCP-ng repository
55+
# disable upstream repositories
56+
RUN echo $UPSTREAM_REPOS | xargs -n1 dnf config-manager --disable
5457
5558
# workaround sudo not working (e.g. in podman 4.9.3 in Ubuntu 24.04)
5659
RUN chmod 0400 /etc/shadow

files/Alma10-devel.repo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[alma10-devel]
22
name=Almalinux 10 devel
33
baseurl=https://repo.almalinux.org/almalinux/10/devel/$basearch/os/
4-
enabled=1
4+
enabled=0
55
gpgcheck=1

files/CentOS-Vault.repo.in

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,23 @@ baseurl=http://vault.centos.org/@CENTOS_VERSION@/os/$basearch/
44
gpgcheck=1
55
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
66
exclude=ocaml*
7-
enabled=1
7+
enabled=0
88

99
[C@CENTOS_VERSION@-updates]
1010
name=CentOS-@CENTOS_VERSION@ - Updates
1111
baseurl=http://vault.centos.org/@CENTOS_VERSION@/updates/$basearch/
1212
gpgcheck=1
1313
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
1414
exclude=ocaml*
15-
enabled=1
15+
enabled=0
1616

1717
[C@CENTOS_VERSION@-extras]
1818
name=CentOS-@CENTOS_VERSION@ - Extras
1919
baseurl=http://vault.centos.org/@CENTOS_VERSION@/extras/$basearch/
2020
gpgcheck=1
2121
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
2222
exclude=ocaml*
23-
enabled=1
23+
enabled=0
2424

2525
[C@CENTOS_VERSION@-base-source]
2626
name=CentOS-@CENTOS_VERSION@ - Base

files/init-container.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ if [ -n "$DISABLEREPO" ]; then
4949
sudo $CFGMGR --disable "$DISABLEREPO"
5050
fi
5151

52+
# enable upstream repositories if needed
53+
if [ "$ENABLE_UPSTREAM_REPOS" == "true" ]; then
54+
for repo in $UPSTREAM_REPOS; do
55+
sudo $CFGMGR --enable "$repo"
56+
done
57+
fi
58+
5259
# enable additional repositories if needed
5360
if [ -n "$ENABLEREPO" ]; then
5461
sudo $CFGMGR --enable "$ENABLEREPO"

run.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def main():
7878
parser.add_argument('--name', help='Assign a name to the container')
7979
parser.add_argument('--ulimit', action='append',
8080
help='Ulimit options passed directly to docker run')
81+
parser.add_argument('-U', '--enable-upstream-repos', action='store_true', help='enable the upstream repositories')
8182
parser.add_argument('-a', '--enablerepo',
8283
help='additional repositories to enable before installing build dependencies. '
8384
'Same syntax as yum\'s --enablerepo parameter. Available additional repositories: '
@@ -156,6 +157,8 @@ def main():
156157
docker_args += ["-e", env]
157158
if args.enablerepo:
158159
docker_args += ["-e", "ENABLEREPO=%s" % args.enablerepo]
160+
if args.enable_upstream_repos:
161+
docker_args += ["-e", "ENABLE_UPSTREAM_REPOS=true"]
159162
if args.disablerepo:
160163
docker_args += ["-e", "DISABLEREPO=%s" % args.disablerepo]
161164
ulimit_nofile = False

0 commit comments

Comments
 (0)