Merge pull request #419 from baude/coprgit

Re-enable copr builds
This commit is contained in:
Brent Baude
2018-02-28 13:18:09 -06:00
committed by GitHub
4 changed files with 31 additions and 29 deletions

View File

@ -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

22
.copr/prepare.sh Normal file
View File

@ -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"

View File

@ -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} .

View File

@ -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