From b120ee919d1798c0f1949801ad072d23450c9d9b Mon Sep 17 00:00:00 2001 From: Vadim Rutkovsky Date: Thu, 18 Mar 2021 18:34:40 +0100 Subject: [PATCH] Strip xattrs from RPM before unpacking This ensures RPMs are fetched without xattrs, as rpm-ostree 2020.2 no longer accepts those --- Dockerfile | 2 +- entrypoint.sh | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index e1a73e9e..4a776262 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM quay.io/openshift/origin-machine-config-operator:4.7 as mcd FROM quay.io/openshift/origin-artifacts:4.7 as artifacts -FROM quay.io/coreos-assembler/coreos-assembler:v0.10.0 AS build +FROM quay.io/coreos-assembler/coreos-assembler:latest AS build COPY --from=mcd /usr/bin/machine-config-daemon /srv/addons/usr/libexec/machine-config-daemon COPY --from=artifacts /srv/repo/*.rpm /tmp/rpms/ USER 0 diff --git a/entrypoint.sh b/entrypoint.sh index 5c7a540d..b3c06952 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -124,6 +124,15 @@ mkdir /extensions pushd /extensions mkdir okd yumdownloader ${YUMD_PARAMS} --destdir=/extensions/okd ${EXTENSION_RPMS[*]} + # Strip problematic xattrs from extension RPMs + for i in $(find /extensions/okd -iname *.rpm); do + fattr=$(getfattr -m 'user.*' $i) + if [ -n "$fattr" ]; then + attr=$(echo "$fattr" | grep -Ee '^user') + setfattr -x "${attr}" $i + fi + done + createrepo_c --no-database . popd @@ -137,6 +146,14 @@ yumdownloader ${YUMD_PARAMS} --destdir=/tmp/rpms --enablerepo=updates-testing-mo # inject MCD binary and cri-o, hyperkube, and bootstrap RPMs in the ostree commit mkdir /tmp/working pushd /tmp/working +# Strip problematic xattrs from extension RPMs + for i in $(find /tmp/rpms -iname *.rpm); do + fattr=$(getfattr -m 'user.*' $i) + if [ -n "$fattr" ]; then + attr=$(echo "$fattr" | grep -Ee '^user') + setfattr -x "${attr}" $i + fi + done for i in $(find /tmp/rpms/ -iname *.rpm); do echo "Extracting $i ..." rpm2cpio $i | cpio -div