From 7cebc75f75cc0f9c219bef0b4180fa60be357bb1 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 14 Aug 2024 13:15:41 +0200 Subject: [PATCH 1/3] coreos-base/oem-gce: Shrink the sysext image by removing python tests Not only python is being installed, but also some extra packages like setuptools. These amount of tests seems to be growing, which is not a bad thing per se, but we really don't need them in the GCE OEM sysext. --- .../coreos-base/oem-gce/files/manglefs.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/manglefs.sh diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/manglefs.sh b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/manglefs.sh new file mode 100755 index 0000000000..b4db342cbe --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-gce/files/manglefs.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -euo pipefail + +rootfs=${1} + +# Remove test stuff from python - it's quite large. +for p in "${rootfs}"/usr/lib/python*; do + if [[ ! -d ${p} ]]; then + continue + fi + # find directories named tests or test and remove them (-prune + # avoids searching below those directories) + find "${p}" \( -name tests -o -name test \) -type d -prune -exec rm -rf '{}' '+' +done From 131b56975fab82c5d3e60daeb25dc795135d83a9 Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 14 Aug 2024 17:25:00 +0200 Subject: [PATCH 2/3] coreos-base/oem-azure: Shrink the sysext image by removing python tests Do the same thing we did for GCE. --- .../coreos-base/oem-azure/files/manglefs.sh | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh index 29331dde04..aa6a58967f 100755 --- a/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh +++ b/sdk_container/src/third_party/coreos-overlay/coreos-base/oem-azure/files/manglefs.sh @@ -20,3 +20,13 @@ ln -sf /usr/bin/true "${rootfs}/usr/bin/eject" # both cases, so mangle manually. mkdir -p "${rootfs}"/usr/lib/systemd/system cp -a "${rootfs}"/{etc,usr/lib}/systemd/system/. + +# Remove test stuff from python - it's quite large. +for p in "${rootfs}"/usr/lib/python*; do + if [[ ! -d ${p} ]]; then + continue + fi + # find directories named tests or test and remove them (-prune + # avoids searching below those directories) + find "${p}" \( -name tests -o -name test \) -type d -prune -exec rm -rf '{}' '+' +done From 83c4cdcf4479a5b1ef69cb6a42d298ffca6e72ec Mon Sep 17 00:00:00 2001 From: Krzesimir Nowak Date: Wed, 14 Aug 2024 17:25:28 +0200 Subject: [PATCH 3/3] build_library: Shrink the sysext-python image by removing python tests Do the same thing we did for GCE and Azure. --- build_library/sysext_mangle_flatcar-python | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build_library/sysext_mangle_flatcar-python b/build_library/sysext_mangle_flatcar-python index 47dc37e2e1..6ac2f2a018 100755 --- a/build_library/sysext_mangle_flatcar-python +++ b/build_library/sysext_mangle_flatcar-python @@ -7,4 +7,14 @@ pushd "${rootfs}" rm -rf ./usr/{lib/debug,share,include,lib64/pkgconfig} +# Remove test stuff from python - it's quite large. +for p in ./usr/lib/python*; do + if [[ ! -d ${p} ]]; then + continue + fi + # find directories named tests or test and remove them (-prune + # avoids searching below those directories) + find "${p}" \( -name tests -o -name test \) -type d -prune -exec rm -rf '{}' '+' +done + popd