summaryrefslogtreecommitdiff
path: root/.copr/prepare.sh
diff options
context:
space:
mode:
Diffstat (limited to '.copr/prepare.sh')
-rw-r--r--.copr/prepare.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/.copr/prepare.sh b/.copr/prepare.sh
new file mode 100644
index 000000000..d33d55dc7
--- /dev/null
+++ b/.copr/prepare.sh
@@ -0,0 +1,22 @@
+#!/bin/sh -euf
+set -x
+
+if [ ! -e /usr/bin/git ]; then
+ dnf -y install git-core
+fi
+
+git fetch --unshallow || :
+
+COMMIT=$(git rev-parse HEAD)
+COMMIT_SHORT=$(git rev-parse --short HEAD)
+COMMIT_NUM=$(git rev-list HEAD --count)
+COMMIT_DATE=$(date --date="@$(git show -s --format=%ct HEAD)" +%Y%m%d)
+
+sed "s,#COMMIT#,${COMMIT},;
+ s,#SHORTCOMMIT#,${COMMIT_SHORT},;
+ s,#COMMITNUM#,${COMMIT_NUM},;
+ s,#COMMITDATE#,${COMMIT_DATE}," \
+ contrib/spec/podman.spec.in > contrib/spec/podman.spec
+
+mkdir build/
+git archive --prefix "podman-${COMMIT_SHORT}/" --format "tar.gz" HEAD -o "build/podman-${COMMIT_SHORT}.tar.gz"