Skip to content

Commit

Permalink
fix: do not generate vendor tarball in builds
Browse files Browse the repository at this point in the history
Do not generate the vendor tarball in builds as we
will use the patched and filtered `vendor` dir instead

Signed-off-by: Miguel Martín <[email protected]>
  • Loading branch information
mmartinv committed Mar 15, 2024
1 parent 914fcd9 commit a5d29dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 47 deletions.
17 changes: 3 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
include /etc/os-release
#! /usr/bin/make -f

SRCDIR ?= .
COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD))
Expand Down Expand Up @@ -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" \
Expand Down
9 changes: 3 additions & 6 deletions fido-device-onboard.spec
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +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

# Because nobody cares
ExcludeArch: %{ix86}
Expand All @@ -35,19 +33,18 @@ 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
%endif
%endif

%if 0%{?fedora}
%autosetup -p1 -n %{name}-rs-%{version}
rm -rf .cargo vendor
%cargo_prep
%generate_buildrequires
%cargo_generate_buildrequires -a
Expand Down
27 changes: 0 additions & 27 deletions make-vendored-tarfile.sh

This file was deleted.

0 comments on commit a5d29dd

Please sign in to comment.