Skip to content

Commit

Permalink
fix: generate the vendor tar file only when needed
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mmartinv committed Mar 12, 2024
1 parent 475fb1b commit b8e15be
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 28 deletions.
55 changes: 29 additions & 26 deletions .packit.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# https://packit.dev/docs/configuration/

specfile_path: fido-device-onboard.spec
Expand All @@ -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
...
11 changes: 9 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
include /etc/os-release

SRCDIR ?= .
COMMIT = $(shell (cd "$(SRCDIR)" && git rev-parse HEAD))

Expand Down Expand Up @@ -43,15 +45,20 @@ 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
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):
./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)
Expand Down

0 comments on commit b8e15be

Please sign in to comment.