From b8e15be37b6262805d3f3a243174c2c54ab978b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Mart=C3=ADn?= Date: Wed, 28 Feb 2024 14:55:54 +0100 Subject: [PATCH] fix: generate the vendor tar file only when needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generate the vendor tar file only for RHEL/CentOS builds and remove `Source1` and the comment above in fedora as we don't need vendoring in this case. Signed-off-by: Miguel Martín --- .packit.yaml | 55 +++++++++++++++++++++++++++------------------------- Makefile | 11 +++++++++-- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/.packit.yaml b/.packit.yaml index 3ccf207fe..cd89afdd4 100644 --- a/.packit.yaml +++ b/.packit.yaml @@ -1,3 +1,4 @@ +--- # https://packit.dev/docs/configuration/ specfile_path: fido-device-onboard.spec @@ -13,33 +14,35 @@ upstream_tag_template: v{version} copy_upstream_release_description: true srpm_build_deps: -- cargo + - cargo actions: - create-archive: - - bash -c "sed -i -r \"s/Source0:.+/Source0:\ fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}.tar/\" fido-device-onboard.spec" - - bash -c "sed -i \"/Source1/d\" fido-device-onboard.spec" - - bash -c "git archive --prefix=fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}/ --format=tar HEAD > fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}.tar" - - bash -c "tar -xvf fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}.tar" - - bash -c "ls -1 ./fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}.tar" - fix-spec-file: - - "cat fido-device-onboard.spec" + create-archive: + - bash -c "sed -i -r \"s/^Version:.*/Version:\ ${PACKIT_PROJECT_VERSION}/\" fido-device-onboard.spec" + - bash -c "sed -i '/Source1/d ; /^# See make-vendored-tarfile.sh in upstream repo/d ;' fido-device-onboard.spec" + - bash -c "cp ./patches/0001-Revert-chore-use-git-fork-for-aws-nitro-enclaves-cos.patch ." + - bash -c "git archive --prefix=fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}/ --format=tar HEAD > fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}.tar" + - bash -c "tar -xvf fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}.tar" + - bash -c "ls -1 ./fido-device-onboard-rs-${PACKIT_PROJECT_VERSION}.tar" + fix-spec-file: + - "cat fido-device-onboard.spec" jobs: -- job: copr_build - trigger: pull_request - targets: - - fedora-development-aarch64 - - fedora-development - - fedora-latest - - fedora-latest-aarch64 -- job: copr_build - trigger: commit - branch: main - owner: "@fedora-iot" # copr repo namespace - project: fedora-iot # copr repo name so you can consume the builds - targets: - - fedora-development-aarch64 - - fedora-development - - fedora-latest - - fedora-latest-aarch64 + - job: copr_build + trigger: pull_request + targets: + - fedora-development-aarch64 + - fedora-development + - fedora-latest + - fedora-latest-aarch64 + - job: copr_build + trigger: commit + branch: main + owner: "@fedora-iot" # copr repo namespace + project: fedora-iot # copr repo name so you can consume the builds + targets: + - fedora-development-aarch64 + - fedora-development + - fedora-latest + - fedora-latest-aarch64 +... diff --git a/Makefile b/Makefile index f2e1da56b..228a75783 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +include /etc/os-release + SRCDIR ?= . COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD)) @@ -43,6 +45,9 @@ VENDOR_TARBALL=rpmbuild/SOURCES/fido-device-onboard-rs-$(COMMIT)-vendor-patched. $(RPM_SPECFILE): mkdir -p $(CURDIR)/rpmbuild/SPECS sed -e "s/^Version:.*/Version: $(COMMIT)/;" fido-device-onboard.spec > $(RPM_SPECFILE) + if [ "$(ID)" = "fedora" ] && [ $(VARIANT_ID) != "eln" ]; then \ + sed -i "/Source1/d ; /^# See make-vendored-tarfile.sh in upstream repo/d ;" $(RPM_SPECFILE); \ + fi $(RPM_TARBALL): mkdir -p $(CURDIR)/rpmbuild/SOURCES @@ -50,8 +55,10 @@ $(RPM_TARBALL): git archive --prefix=fido-device-onboard-rs-$(COMMIT)/ --format=tar.gz HEAD > $(RPM_TARBALL) $(VENDOR_TARBALL): - ./make-vendored-tarfile.sh $(COMMIT) - cp fido-device-onboard-rs-$(COMMIT)-vendor-patched.tar.xz rpmbuild/SOURCES + [ "$(ID)" = "fedora" ] && [ $(VARIANT_ID) != "eln" ] || ( \ + mkdir -p $(CURDIR)/rpmbuild/SOURCES ; \ + ./make-vendored-tarfile.sh $(COMMIT) ; \ + mv fido-device-onboard-rs-$(COMMIT)-vendor-patched.tar.xz rpmbuild/SOURCES ;) .PHONY: srpm srpm: $(RPM_SPECFILE) $(RPM_TARBALL) $(VENDOR_TARBALL)