Skip to content

Commit

Permalink
fix: Makefile and create copr_script.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
kilesduli committed Oct 3, 2024
1 parent cc5e62c commit 5f3a4a8
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 20 deletions.
22 changes: 3 additions & 19 deletions .copr/Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
src := $(shell pwd)/.copr
tag=

srpm: dep
pushd $(src)
$(eval tag=$(shell git tag -l 'v*' --sort=-v:refname | head -n 1))
@echo $(tag)
spectool -g artalk.spec
./vendor-tarball.sh $(tag)
git stash # make sure workspace is empty.
cp changelog artalk.spec ../
git add ../changelog ../artalk.spec && git commit -m "for rpmautospec [skip changelog]"
rpmautospec process-distgit ../artalk.spec artalk.spec
git stash pop # pop it!
rpkg srpm --spec artalk.spec --outdir=$(outdir)
popd

dep:
dnf -y install git rpmdevtools golang rpmautospec rpkg
srpm:
# dnf -y install git rpmdevtools golang rpmautospec rpkg
.copr/copr_script.sh $(outdir)
33 changes: 33 additions & 0 deletions .copr/copr_script.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env sh

set -euo pipefail

outdir=$1
echo "Outdir: $outdir"

tag=$(git tag -l 'v*' --sort=-v:refname | head -n 1)
echo "Using tag: $tag"

pushd .copr

# Download source
spectool -g artalk.spec

rm -rf "artalk-${tag#v}-vendored.tar.gz"
./vendor-tarball.sh $tag

# Parse %autorelease and %autochangelog
git stash
cp changelog artalk.spec ../
git add ../changelog ../artalk.spec
git commit -m "for rpmautospec [skip changelog]"
rpmautospec process-distgit ../artalk.spec artalk.spec
if git stash list | grep -q 'stash@'; then
git stash pop
fi

# Generate srpm
mkdir -p $outdir
rpkg srpm --spec artalk.spec --outdir=$outdir

popd
2 changes: 1 addition & 1 deletion .copr/vendor-tarball.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TARFLAGS=(
--mode=go+u,go-w
)

tar "${TARFLAGS[@]}" -czf "$name-$version-vendored.tar.gz" "$name-$version"
tar "${TARFLAGS[@]}" -czvf "$name-$version-vendored.tar.gz" "$name-$version"

# Clean up the temporary directory
rm -rf "$name-$version"

0 comments on commit 5f3a4a8

Please sign in to comment.