From 8ba639952a95f2e24cc98987689138b67545576c Mon Sep 17 00:00:00 2001 From: Dan Walsh Date: Fri, 14 Oct 2016 11:33:26 -0400 Subject: [PATCH] Add ocid.spec to build rpms Signed-off-by: Dan Walsh --- Makefile | 4 +-- contrib/rpm/Makefile | 14 +++++++++ contrib/rpm/ocid.spec | 71 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 87 insertions(+), 2 deletions(-) create mode 100644 contrib/rpm/Makefile create mode 100644 contrib/rpm/ocid.spec diff --git a/Makefile b/Makefile index 4775dbae..4712f8f1 100644 --- a/Makefile +++ b/Makefile @@ -12,7 +12,7 @@ PREFIX ?= ${DESTDIR}/usr BINDIR ?= ${PREFIX}/bin LIBEXECDIR ?= ${PREFIX}/libexec MANDIR ?= ${PREFIX}/share/man -ETCDIR ?= ${PREFIX}/etc +ETCDIR ?= ${DESTDIR}/etc GO_MD2MAN ?= $(shell which go-md2man) export GOPATH := ${CURDIR}/vendor BUILDTAGS := selinux @@ -102,7 +102,7 @@ install: install -D -m 644 ocid.conf $(ETCDIR)/ocid.conf install.systemd: - install -D -m 644 contrib/systemd/ocid.service $(PREFIX)/lib/systemd/system + install -D -m 644 contrib/systemd/ocid.service $(PREFIX)/lib/systemd/system/ocid.service uninstall: rm -f $(BINDIR)/{ocid,ocic} diff --git a/contrib/rpm/Makefile b/contrib/rpm/Makefile new file mode 100644 index 00000000..8ae980b1 --- /dev/null +++ b/contrib/rpm/Makefile @@ -0,0 +1,14 @@ +.PHONY: dist +dist: ocid.spec + spectool -g ocid.spec + +.PHONY: rpm +rpm: dist + rpmbuild --define "_sourcedir `pwd`" --define "_specdir `pwd`" \ + --define "_rpmdir `pwd`" --define "_srcrpmdir `pwd`" -ba ocid.spec + +all: rpm + +clean: + rm -f *rpm *gz + rm -rf x86_64 diff --git a/contrib/rpm/ocid.spec b/contrib/rpm/ocid.spec new file mode 100644 index 00000000..293e2712 --- /dev/null +++ b/contrib/rpm/ocid.spec @@ -0,0 +1,71 @@ +%define debug_package %{nil} +%global provider github +%global provider_tld com +%global project kubernetes-incubator +%global repo cri-o +%global Name ocid +# https://github.com/kubernetes-incubator/cri-o +%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo} +%global import_path %{provider_prefix} +%global commit da8c0190322cfe972777765dbf3e9128cc05e70d +%global shortcommit %(c=%{commit}; echo ${c:0:7}) + +Name: %{Name} +Version: 0.0.1 +Release: 1.git%{shortcommit}%{?dist} +Summary: Kubelet Container Runtime Interface (CRI) for OCI runtimes. +Group: Applications/Text +License: Apache 2.0 +URL: https://%{provider_prefix} +Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz + +BuildRequires: golang-github-cpuguy83-go-md2man + +%description +The ocid package provides an implementation of the +Kubelet Container Runtime Interface (CRI) using OCI conformant runtimes. + +ocid provides following functionalities: + + Support multiple image formats including the existing Docker image format + Support for multiple means to download images including trust & image verification + Container image management (managing image layers, overlay filesystems, etc) + Container process lifecycle management + Monitoring and logging required to satisfy the CRI + Resource isolation as required by the CRI + +%prep +%setup -q -n %{repo}-%{commit} + +%build +make all + +%install +%make_install +%make_install install.systemd + +#define license tag if not already defined +%{!?_licensedir:%global license %doc} +%files +%{_bindir}/ocid +%{_bindir}/ocic +%{_mandir}/man5/ocid.conf.5* +%{_mandir}/man8/ocid.8* +%{_sysconfdir}/ocid.conf +%dir /%{_libexecdir}/ocid +/%{_libexecdir}/ocid/conmon +/%{_libexecdir}/ocid/pause +%{_unitdir}/ocid.service +%doc README.md +%license LICENSE + +%preun +%systemd_preun %{Name} + +%postun +%systemd_postun_with_restart %{Name} + +%changelog +* Mon Oct 31 2016 Dan Walsh - 0.0.1 +- Initial RPM release +