summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.copr/Makefile31
-rw-r--r--.copr/prepare.sh22
-rw-r--r--Makefile1
-rw-r--r--contrib/spec/podman.spec.in (renamed from contrib/spec/podman.spec)6
4 files changed, 31 insertions, 29 deletions
diff --git a/.copr/Makefile b/.copr/Makefile
index 0b2e1c8f2..3ba480376 100644
--- a/.copr/Makefile
+++ b/.copr/Makefile
@@ -1,28 +1,7 @@
#!/usr/bin/make -f
+mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
+current_dir := $(notdir $(patsubst %/,%,$(dir $(mkfile_path))))
-spec := contrib/spec/podman.spec
-outdir := $(CURDIR)
-tmpdir := build
-gitdir := $(PWD)/.git
-
-rev := $(shell git rev-list HEAD | head -n1 | cut -c -7)
-date := $(shell date +%Y%m%d.%H%M)
-
-version := $(shell sed -n '/Version:/{s/.* //;p}' $(spec))
-release := $(date).git.$(rev)
-
-srpm: $(outdir)/podman-$(version)-$(release).src.rpm
-
-$(tmpdir)/podman.spec: $(spec)
- @mkdir -p $(tmpdir)
- sed '/^Release:/s/\(: *\).*/\1$(release)%{?dist}/' $< >$@
-
-$(tmpdir)/$(version).tar.gz: $(gitdir)/..
- @mkdir -p $(tmpdir)
- tar c --exclude-vcs --exclude-vcs-ignores -C $< --transform 's|^\.|podman-$(version)|' . | gzip -9 >$@
-
-$(outdir)/podman-$(version)-$(release).src.rpm: $(tmpdir)/podman.spec $(tmpdir)/$(version).tar.gz
- @mkdir -p $(outdir)
- rpmbuild -D'_srcrpmdir $(outdir)' -D'_sourcedir $(tmpdir)' -bs $(tmpdir)/podman.spec
-
-.PHONY: srpm
+srpm:
+ sh $(current_dir)/prepare.sh
+ rpmbuild -bs -D "dist %{nil}" -D "_sourcedir build/" -D "_srcrpmdir ./" --nodeps contrib/spec/podman.spec
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"
diff --git a/Makefile b/Makefile
index a4ff16978..4b2d1b02b 100644
--- a/Makefile
+++ b/Makefile
@@ -97,6 +97,7 @@ endif
rm -f test/bin2img/bin2img
rm -f test/copyimg/copyimg
rm -f test/checkseccomp/checkseccomp
+ rm -fr build/
libpodimage:
docker build -t ${LIBPOD_IMAGE} .
diff --git a/contrib/spec/podman.spec b/contrib/spec/podman.spec.in
index 11e8aa3fb..590a6a21a 100644
--- a/contrib/spec/podman.spec
+++ b/contrib/spec/podman.spec.in
@@ -40,7 +40,7 @@
# https://github.com/projectatomic/libpod
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global import_path %{provider_prefix}
-%global commit 367213a3943961126c6f7c1dce45c7fafea9e6b2
+%global commit #COMMIT#
%global shortcommit %(c=%{commit}; echo ${c:0:7})
Name: podman
@@ -49,7 +49,7 @@ Release: git%{shortcommit}%{?dist}
Summary: Manage Pods, Containers and Container Images
License: ASL 2.0
URL: https://%{provider_prefix}
-Source0: https://%{provider_prefix}/%{version}.tar.gz
+Source0: https://%{provider_prefix}/podman-%{shortcommit}.tar.gz
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
#ExclusiveArch: %%{?go_arches:%%{go_arches}}%%{!?go_arches:%%{ix86} x86_64 aarch64 %%{arm}}
@@ -347,7 +347,7 @@ providing packages with %{import_path} prefix.
%endif
%prep
-%autosetup -Sgit
+%autosetup -Sgit -n podman-%{shortcommit}
sed -i '/\/bin\/bash/d' completions/bash/%{name}
%build