diff --git a/Makefile b/Makefile index 4c0646df2..b5067db52 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -include /etc/os-release +#! /usr/bin/make -f SRCDIR ?= . COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD)) @@ -40,34 +40,23 @@ help: RPM_SPECFILE=rpmbuild/SPECS/fido-device-onboard-rs-$(COMMIT).spec RPM_TARBALL=rpmbuild/SOURCES/fido-device-onboard-rs-$(COMMIT).tar.gz -VENDOR_TARBALL=rpmbuild/SOURCES/fido-device-onboard-rs-$(COMMIT)-vendor-patched.tar.xz $(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 - cp ./patches/0001-Revert-chore-use-git-fork-for-aws-nitro-enclaves-cos.patch rpmbuild/SOURCES/; git archive --prefix=fido-device-onboard-rs-$(COMMIT)/ --format=tar.gz HEAD > $(RPM_TARBALL) -$(VENDOR_TARBALL): - [ "$(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) +srpm: $(RPM_SPECFILE) $(RPM_TARBALL) rpmbuild -bs \ --define "_topdir $(CURDIR)/rpmbuild" \ $(RPM_SPECFILE) .PHONY: rpm -rpm: $(RPM_SPECFILE) $(RPM_TARBALL) $(VENDOR_TARBALL) +rpm: $(RPM_SPECFILE) $(RPM_TARBALL) sudo dnf builddep -y fido-device-onboard rpmbuild -bb \ --define "_topdir $(CURDIR)/rpmbuild" \ diff --git a/fido-device-onboard.spec b/fido-device-onboard.spec index 20953ed89..541900798 100644 --- a/fido-device-onboard.spec +++ b/fido-device-onboard.spec @@ -10,9 +10,6 @@ License: BSD-3-Clause URL: https://github.com/fdo-rs/fido-device-onboard-rs Source0: %{url}/archive/v%{version}/%{name}-rs-%{version}.tar.gz -# See make-vendored-tarfile.sh in upstream repo -Source1: %{name}-rs-%{version}-vendor-patched.tar.xz -Patch1: 0001-Revert-chore-use-git-fork-for-aws-nitro-enclaves-cos.patch # Because nobody cares ExcludeArch: %{ix86} @@ -36,24 +33,24 @@ BuildRequires: tpm2-tss-devel %{summary}. %prep +%autosetup -p1 -n %{name}-rs-%{version} %if 0%{?rhel} -%autosetup -p1 -a1 -n %{name}-rs-%{version} -rm -f Cargo.lock %if 0%{?rhel} >= 10 %cargo_prep -v vendor %else -%cargo_prep -V 1 +%cargo_prep -V 0 %endif %endif %if 0%{?fedora} -%autosetup -p1 -n %{name}-rs-%{version} %cargo_prep %generate_buildrequires %cargo_generate_buildrequires -a %endif +rm -f .cargo/cargo.toml + %build %cargo_build \ -F openssl-kdf/deny_custom diff --git a/make-vendored-tarfile.sh b/make-vendored-tarfile.sh deleted file mode 100755 index 745a2bbc3..000000000 --- a/make-vendored-tarfile.sh +++ /dev/null @@ -1,27 +0,0 @@ -#! /bin/bash - -set -x -VER=${1:-$(git rev-parse HEAD)} -shift -PLATFORMS=$* - -[ -n "$PLATFORMS" ] || PLATFORMS=$(echo {x86_64,aarch64,powerpc64le,s390x}-unknown-linux-gnu) - -for PLATFORM in $PLATFORMS; do - ARGS+="--platform ${PLATFORM} " -done - -# Clean vendor dir or the filterer will refuse to do the job -rm -rf vendor - -# We need v0.5.7 because of RHEL rust version -cargo install --quiet cargo-vendor-filterer@0.5.7 - -# Filter the vendor files for the given platforms -cargo vendor-filterer ${ARGS} - -# Patch the official crate so the build works. -git apply patches/0001-fix-aws-nitro-enclaves-cose.patch -tar cJf "fido-device-onboard-rs-${VER}-vendor-patched.tar.xz" vendor/ -# Remove previous patch and leave the official crate as it was. -git apply -R patches/0001-fix-aws-nitro-enclaves-cose.patch