Use tar instead of git archive in Copr Makefile to fix missing git in…#265
Use tar instead of git archive in Copr Makefile to fix missing git in…#265
Conversation
… mock chroot The mock minimal buildroot does not include git, causing the SRPM build to fail. Replace git archive with tar which is available in the chroot. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Updates the COPR SRPM build Makefile to avoid relying on git inside the mock minimal buildroot by generating the source tarball with tar instead of git archive.
Changes:
- Replace
git archivewith atarcommand to producesems-$(VERSION).tar.gzduringmake srpm.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| $(eval VERSION := $(shell cat VERSION)) | ||
| mkdir -p ~/rpmbuild/SOURCES | ||
| git archive --format=tar.gz --prefix=sems-$(VERSION)/ HEAD > ~/rpmbuild/SOURCES/sems-$(VERSION).tar.gz | ||
| tar --transform 's,^\.,sems-$(VERSION),' --exclude=.git -czf ~/rpmbuild/SOURCES/sems-$(VERSION).tar.gz -C $$(pwd) . |
There was a problem hiding this comment.
Switching from git archive to tar changes the contents of the generated source tarball: tar -C $(pwd) . will include all files in the working tree (including untracked/ignored build artifacts like build/, *.o, *.tar.gz, etc. per .gitignore), whereas git archive only included version-controlled sources. This can make SRPMs non-reproducible and can accidentally package local artifacts (or sensitive files) if make srpm is run from a non-clean checkout. Consider using GNU tar options to better match VCS semantics (e.g., exclude VCS + VCS-ignored files) or otherwise explicitly exclude ignored/artifact paths so only intended sources end up in the tarball.
| tar --transform 's,^\.,sems-$(VERSION),' --exclude=.git -czf ~/rpmbuild/SOURCES/sems-$(VERSION).tar.gz -C $$(pwd) . | |
| git archive --format=tar.gz --prefix=sems-$(VERSION)/ -o ~/rpmbuild/SOURCES/sems-$(VERSION).tar.gz HEAD |
… mock chroot
The mock minimal buildroot does not include git, causing the SRPM build to fail. Replace git archive with tar which is available in the chroot.