From c70530a7baedd302c61dc2071edc4815b7e8cd58 Mon Sep 17 00:00:00 2001 From: Emma Foley Date: Thu, 27 Aug 2026 10:53:01 -0400 Subject: [PATCH] [cinder] Exclude unneeded requirements Remove the requirements that were previously excluded by the rpm package https://github.com/rdo-packages/cinder-distgit/blob/c92ea047b9dd198f2863a1e220f9eab46dc00eed/openstack-cinder.spec#L5 Assisted-by: Claude Sonnet --- containers/cinder/cinder-api/Containerfile | 17 +++++++++++++++++ containers/cinder/cinder-backup/Containerfile | 17 +++++++++++++++++ .../cinder/cinder-scheduler/Containerfile | 17 +++++++++++++++++ containers/cinder/cinder-volume/Containerfile | 17 +++++++++++++++++ containers/cinder/excluded-requirements.txt | 4 ++++ 5 files changed, 72 insertions(+) create mode 100644 containers/cinder/excluded-requirements.txt diff --git a/containers/cinder/cinder-api/Containerfile b/containers/cinder/cinder-api/Containerfile index f531857d..99ec0589 100644 --- a/containers/cinder/cinder-api/Containerfile +++ b/containers/cinder/cinder-api/Containerfile @@ -10,6 +10,23 @@ COPY ${CONSTRAINTS_FILE} /deps-upper-constraints.txt COPY src/ /src/ COPY cinder-api/src/ /src/ +# Drop excluded upstream requirements before building the service wheel, so the +# wheel's own metadata (Requires-Dist) cannot pull them back in at install time. +# Mirrors the RDO cinder distgit spec, which strips the same packages from +# requirements.txt in %prep. See docs/excluding-requirements.md. +COPY excluded-requirements.txt /tmp/excluded-requirements.txt +# Pre-strip comments, inline whitespace, and blank lines inline so the loop sees +# one bare package name per line -- identical to the host-side strip in build.sh. +RUN sed -e 's/#.*//' -e 's/[[:space:]]//g' -e '/^$/d' /tmp/excluded-requirements.txt | \ + while IFS= read -r pkg; do \ + for req in /src/*/requirements.txt /src/overrides/*/requirements.txt; do \ + if [ -f "${req}" ]; then \ + sed -i -E "/^${pkg}([[:space:]<>=!~;,#[]|\$)/Id" "${req}"; \ + fi; \ + done; \ + done && \ + rm /tmp/excluded-requirements.txt + # We can force build from source of all packages optionally ARG PIP_NO_BINARY="" ENV PIP_NO_BINARY=${PIP_NO_BINARY} diff --git a/containers/cinder/cinder-backup/Containerfile b/containers/cinder/cinder-backup/Containerfile index 7751ee86..845a4b55 100644 --- a/containers/cinder/cinder-backup/Containerfile +++ b/containers/cinder/cinder-backup/Containerfile @@ -10,6 +10,23 @@ COPY ${CONSTRAINTS_FILE} /deps-upper-constraints.txt COPY src/ /src/ COPY cinder-backup/src/ /src/ +# Drop excluded upstream requirements before building the service wheel, so the +# wheel's own metadata (Requires-Dist) cannot pull them back in at install time. +# Mirrors the RDO cinder distgit spec, which strips the same packages from +# requirements.txt in %prep. See docs/excluding-requirements.md. +COPY excluded-requirements.txt /tmp/excluded-requirements.txt +# Pre-strip comments, inline whitespace, and blank lines inline so the loop sees +# one bare package name per line -- identical to the host-side strip in build.sh. +RUN sed -e 's/#.*//' -e 's/[[:space:]]//g' -e '/^$/d' /tmp/excluded-requirements.txt | \ + while IFS= read -r pkg; do \ + for req in /src/*/requirements.txt /src/overrides/*/requirements.txt; do \ + if [ -f "${req}" ]; then \ + sed -i -E "/^${pkg}([[:space:]<>=!~;,#[]|\$)/Id" "${req}"; \ + fi; \ + done; \ + done && \ + rm /tmp/excluded-requirements.txt + # We can force build from source of all packages optionally ARG PIP_NO_BINARY="" ENV PIP_NO_BINARY=${PIP_NO_BINARY} diff --git a/containers/cinder/cinder-scheduler/Containerfile b/containers/cinder/cinder-scheduler/Containerfile index 3bb5509c..95e801d6 100644 --- a/containers/cinder/cinder-scheduler/Containerfile +++ b/containers/cinder/cinder-scheduler/Containerfile @@ -10,6 +10,23 @@ COPY ${CONSTRAINTS_FILE} /deps-upper-constraints.txt COPY src/ /src/ COPY cinder-scheduler/src/ /src/ +# Drop excluded upstream requirements before building the service wheel, so the +# wheel's own metadata (Requires-Dist) cannot pull them back in at install time. +# Mirrors the RDO cinder distgit spec, which strips the same packages from +# requirements.txt in %prep. See docs/excluding-requirements.md. +COPY excluded-requirements.txt /tmp/excluded-requirements.txt +# Pre-strip comments, inline whitespace, and blank lines inline so the loop sees +# one bare package name per line -- identical to the host-side strip in build.sh. +RUN sed -e 's/#.*//' -e 's/[[:space:]]//g' -e '/^$/d' /tmp/excluded-requirements.txt | \ + while IFS= read -r pkg; do \ + for req in /src/*/requirements.txt /src/overrides/*/requirements.txt; do \ + if [ -f "${req}" ]; then \ + sed -i -E "/^${pkg}([[:space:]<>=!~;,#[]|\$)/Id" "${req}"; \ + fi; \ + done; \ + done && \ + rm /tmp/excluded-requirements.txt + # We can force build from source of all packages optionally ARG PIP_NO_BINARY="" ENV PIP_NO_BINARY=${PIP_NO_BINARY} diff --git a/containers/cinder/cinder-volume/Containerfile b/containers/cinder/cinder-volume/Containerfile index e2378daa..ede674c5 100644 --- a/containers/cinder/cinder-volume/Containerfile +++ b/containers/cinder/cinder-volume/Containerfile @@ -10,6 +10,23 @@ COPY ${CONSTRAINTS_FILE} /deps-upper-constraints.txt COPY src/ /src/ COPY cinder-volume/src/ /src/ +# Drop excluded upstream requirements before building the service wheel, so the +# wheel's own metadata (Requires-Dist) cannot pull them back in at install time. +# Mirrors the RDO cinder distgit spec, which strips the same packages from +# requirements.txt in %prep. See docs/excluding-requirements.md. +COPY excluded-requirements.txt /tmp/excluded-requirements.txt +# Pre-strip comments, inline whitespace, and blank lines inline so the loop sees +# one bare package name per line -- identical to the host-side strip in build.sh. +RUN sed -e 's/#.*//' -e 's/[[:space:]]//g' -e '/^$/d' /tmp/excluded-requirements.txt | \ + while IFS= read -r pkg; do \ + for req in /src/*/requirements.txt /src/overrides/*/requirements.txt; do \ + if [ -f "${req}" ]; then \ + sed -i -E "/^${pkg}([[:space:]<>=!~;,#[]|\$)/Id" "${req}"; \ + fi; \ + done; \ + done && \ + rm /tmp/excluded-requirements.txt + # We can force build from source of all packages optionally ARG PIP_NO_BINARY="" ENV PIP_NO_BINARY=${PIP_NO_BINARY} diff --git a/containers/cinder/excluded-requirements.txt b/containers/cinder/excluded-requirements.txt new file mode 100644 index 00000000..1321e867 --- /dev/null +++ b/containers/cinder/excluded-requirements.txt @@ -0,0 +1,4 @@ +# zoneinfo library is provided in python3-libs which uses system installed tzdata. +# The distgit drops this from requirements.txt too. +# Source: https://raw.githubusercontent.com/rdo-packages/cinder-distgit/rpm-master/openstack-cinder.spec (line 5) +tzdata