Skip to content

Commit

Permalink
Fix marking repo dir for COPR as safe 5
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Perina <mperina@redhat.com>
  • Loading branch information
mwperina committed May 9, 2022
1 parent 4cb3a0c commit 8d89c96
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .copr/Makefile
Original file line number Diff line number Diff line change
@@ -1,21 +1,27 @@
.PHONY: installdeps srpm
.PHONY: installdeps srpm git_config_pre create_srpm git_config_post

installdeps:
dnf -y install git

srpm: installdeps
git_config_pre:
# From git 2.35.2 we need to mark temporary directory, where the project is cloned to, as safe, otherwise
# git commands won't work, and the remove afterwards to make git user config clean
$(eval REPO_DIR=$(shell pwd))
git config --global --add safe.directory ${REPO_DIR}

create_srpm:
$(eval SUFFIX=.git$(shell git rev-parse --short HEAD))
echo ${SUFFIX}
git config --global --unset safe.directory ${REPO_DIR}
# changing the spec file as passing -D won't preserve the suffix when rebuilding in mock
sed "s:%{?release_suffix}:${SUFFIX}:" -i ovirt-engine.spec.in
mkdir -p tmp.repos/SOURCES
make dist
rpmbuild \
-D "_topdir tmp.repos" \
-ts ./*.tar.gz

git_config_post:
git config --global --unset safe.directory ${REPO_DIR}

srpm: installdeps git_config_pre create_srpm git_config_post
cp tmp.repos/SRPMS/*.src.rpm $(outdir)

0 comments on commit 8d89c96

Please sign in to comment.