]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
container: avoid installing docs using the dnf configuration
authorJohn Mulligan <jmulligan@redhat.com>
Sat, 8 Feb 2025 19:51:23 +0000 (14:51 -0500)
committerJohn Mulligan <jmulligan@redhat.com>
Sat, 8 Feb 2025 20:07:52 +0000 (15:07 -0500)
Avoid installing docs by using the dnf configuration tsflags parameter,
passing the nodocs flag. This tells dnf and rpm not to install
documentation, such as manpages. Stop installing the docs just to delete
them later with an `rm -rf` type command.  Now the docs don't get
installed in the first place, saving space, but the rpm is happy
(`rpm -Va` no longer shows docs as 'missing').

Fixes: https://tracker.ceph.com/issues/69868
Signed-off-by: John Mulligan <jmulligan@redhat.com>
container/Containerfile

index 665e7991e8bf2511cd32da030dea1c13b4b7070d..5fe9880267add039a483b94257dba8ca57fb31ce 100644 (file)
@@ -51,6 +51,15 @@ OSD_FLAVOR=${OSD_FLAVOR}
 #   keeping run steps separate makes local rebuilds quick, but images are big without squash option
 #===================================================================================================
 
+# Disable documentation
+# (assumes only [main] section exists)
+RUN \
+    if grep -q 'tsflags' /etc/dnf/dnf.conf ; then \
+        sed -i 's/tsflags=.*/tsflags=nodocs/g' /etc/dnf/dnf.conf ; \
+    else \
+        echo "tsflags=nodocs" >> /etc/dnf/dnf.conf ; \
+    fi
+
 # Pre-reqs
 RUN dnf install -y --setopt=install_weak_deps=False epel-release jq
 
@@ -201,7 +210,7 @@ RUN set -ex && \
     rm -rf /var/lib/dnf/* && \
     rm -f /var/lib/rpm/__db* && \
     # remove unnecessary files with big impact
-    rm -rf /etc/selinux /usr/share/{doc,man,selinux} && \
+    rm -rf /etc/selinux /usr/share/selinux && \
     # don't keep compiled python binaries
     find / -xdev \( -name "*.pyc" -o -name "*.pyo" \) -delete && \
     rm -f /etc/yum.repos.d/{ceph,ganesha,tcmu-runner,ceph-iscsi}.repo