diff --git a/flannel.spec b/flannel.spec index f30de9e..8463f4a 100644 --- a/flannel.spec +++ b/flannel.spec @@ -22,6 +22,7 @@ Source3: flannel-docker.conf ExclusiveArch: %{ix86} x86_64 %{arm} BuildRequires: golang >= 1.2.7 +%if 0%{?fedora} BuildRequires: golang-cover # accidentally missing in golang-github-coreos-go-etcd BuildRequires: golang(github.com/coreos/etcd/etcdserver/etcdhttp/httptypes) @@ -30,6 +31,7 @@ BuildRequires: golang(github.com/coreos/go-systemd/daemon) >= 2-2 BuildRequires: golang(github.com/golang/glog) BuildRequires: golang(github.com/vishvananda/netns) BuildRequires: golang(github.com/vishvananda/netlink) +%endif BuildRequires: pkgconfig(systemd) Requires: systemd Requires(post): systemd @@ -41,6 +43,7 @@ Flannel is an etcd driven address management agent. Most commonly it is used to manage the ip addresses of overlay networks between systems running containers that need to communicate with one another. +%if 0%{?fedora} %package devel BuildRequires: golang >= 1.2.7 BuildRequires: golang-cover @@ -77,10 +80,12 @@ that need to communicate with one another. This package contains library source intended for building other packages which use %{project}/%{repo}. +%endif %prep %setup -q -n %{repo}-%{version} +%if 0%{?fedora} find . -name "*.go" \ -print |\ xargs sed -i 's/github.com\/coreos\/flannel\/Godeps\/_workspace\/src\///g' @@ -97,6 +102,9 @@ popd mkdir bin function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; } GOPATH=${PWD}/_build:%{gopath} gobuild -o bin/flanneld . +%else +./build +%endif %install # package with binary @@ -105,9 +113,11 @@ install -D -p -m 644 %{SOURCE1} %{buildroot}/etc/sysconfig/flanneld install -D -p -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/flanneld.service install -D -p -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/docker.service.d/flannel.conf install -D -p -m 755 dist/mk-docker-opts.sh %{buildroot}%{_libexecdir}/flannel/mk-docker-opts.sh +%if 0%{?fedora} # devel package install -d -p %{buildroot}/%{gopath}/src/%{import_path}/ cp -pav {backend,pkg,subnet} %{buildroot}/%{gopath}/src/%{import_path}/ +%endif %post %systemd_post flanneld.service @@ -127,11 +137,13 @@ cp -pav {backend,pkg,subnet} %{buildroot}/%{gopath}/src/%{import_path}/ %{_libexecdir}/flannel/mk-docker-opts.sh %config(noreplace) %{_sysconfdir}/sysconfig/flanneld +%if 0%{?fedora} %files devel %doc CONTRIBUTING.md LICENSE MAINTAINERS README.md DCO NOTICE %dir %{gopath}/src/%{provider}.%{provider_tld}/%{project} %dir %{gopath}/src/%{import_path}/ %{gopath}/src/%{import_path}/ +%endif %changelog * Tue Apr 7 2015 Eric Paris - 0.3.0-1