]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Hopefully fix SBOM generation
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 25 Mar 2024 19:04:13 +0000 (20:04 +0100)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 26 Mar 2024 08:28:20 +0000 (09:28 +0100)
builder-support/dockerfiles/Dockerfile.rpmsbom
builder-support/dockerfiles/Dockerfile.rpmtest

index 00e6ea51c5999650680e7b4be802a8d2b9087836..6c0cbf12d7c91df2ce689f1cd08a925496bd35ee 100644 (file)
@@ -1,23 +1,36 @@
 RUN touch /var/lib/rpm/* && \
-    yum upgrade -y && yum install -y python3
+    if $(grep -q 'release 7' /etc/redhat-release); then \
+      yum upgrade -y && yum install -y python2 python2-dnf; \
+    else \
+      yum upgrade -y && yum install -y python3 python3-dnf; \
+    fi
 ADD builder-support/helpers/ /pdns/builder-support/helpers/
 
 @IF [ -n "$M_recursor$M_all" ]
-RUN cd /pdns/builder-support/helpers/ && python3 generate-sbom-dnf.py /dist/pdns-recursor-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json pdns-recursor rust.json
+RUN cd /pdns/builder-support/helpers/ && \
+    if ! $(grep -q 'release 7' /etc/redhat-release); then \
+      python3 generate-sbom-dnf.py /dist/pdns-recursor-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json pdns-recursor rust.json; \
+    else \
+      python2 generate-sbom-dnf.py /dist/pdns-recursor-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json pdns-recursor rust.json; \
+    fi
 @ENDIF
 
 @IF [ -n "$M_dnsdist$M_all" ]
 RUN cd /pdns/builder-support/helpers/; \
     if ! $(grep -q 'release 7' /etc/redhat-release); then \
-       python3 generate-sbom-dnf.py /dist/dnsdist-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json dnsdist rust.json quiche.json h2o.json ; \
+       python3 generate-sbom-dnf.py /dist/dnsdist-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json dnsdist rust.json quiche.json h2o.json; \
     else \
-       python3 generate-sbom-dnf.py /dist/dnsdist-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json dnsdist h2o.json ; \
+       python2 generate-sbom-dnf.py /dist/dnsdist-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json dnsdist h2o.json; \
     fi
 @ENDIF
 
 @IF [ -n "$M_authoritative$M_all" ]
 RUN cd /pdns/builder-support/helpers/ && \
     for pkg in pdns pdns-backend-geoip pdns-backend-ldap pdns-backend-lmdb pdns-backend-lua2 pdns-backend-mysql pdns-backend-odbc pdns-backend-postgresql pdns-backend-remote pdns-backend-sqlite pdns-backend-tinydns pdns-backend-ixfrdist pdns-tools; do \
-      python3 generate-sbom-dnf.py /dist/${pkg}-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json ${pkg}; \
+      if ! $(grep -q 'release 7' /etc/redhat-release); then \
+        python3 generate-sbom-dnf.py /dist/${pkg}-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json ${pkg}; \
+      else \
+        python2 generate-sbom-dnf.py /dist/${pkg}-${BUILDER_VERSION}-${BUILDER_TARGET}.cyclonedx.json ${pkg}; \
+      fi \
     done
 @ENDIF
index 87587499aedfb5d6d040f9e95a683259144def18..6dd5975b43aff6106a3859a689f1947f7bd78665 100644 (file)
@@ -4,6 +4,7 @@ FROM dist-base as dist
 # If you want to install extra packages or do generic configuration,
 # do it before the COPY. Either here, or in the dist-base layer.
 
+COPY --from=sdist /sdist /sdist
 COPY --from=package-builder /dist /dist
 
 # Install built packages with dependencies