Blob Blame History Raw
%global debug_package   %{nil}
%global provider        github
%global provider_tld    com
%global project         coreos
%global repo            flannel
%global import_path     %{provider}.%{provider_tld}/%{project}/%{repo}
%global commit          a7b435a9205335db25372bde8c1ff4e522ed3bc7
%global shortcommit     %(c=%{commit}; echo ${c:0:7})

Name:           flannel 
Version:        0.1.0
Release:        9.git%{shortcommit}%{?dist}
Summary:        Etcd address management agent for overlay networks
License:        ASL 2.0 
URL:            https://%{import_path}
Source0:        https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
Source1:        flanneld.service
Source2:        flanneld.sysconf
ExclusiveArch:  %{ix86} x86_64 %{arm}

Patch0: flannel-remove-third-party-dependency-on-Godeps.patch

BuildRequires:      golang >= 1.2.7
BuildRequires:      golang-cover
BuildRequires:      golang(github.com/coreos/go-systemd/daemon) >= 2-2
BuildRequires:      golang(github.com/coreos/go-etcd/etcd)
BuildRequires:      golang(github.com/golang/glog)
BuildRequires:      golang(github.com/vishvananda/netns)
BuildRequires:      golang(github.com/vishvananda/netlink)
BuildRequires:      pkgconfig(systemd)
Requires:           pkgconfig(systemd)
Requires(post):     systemd-units
Requires(preun):    systemd-units
Requires(postun):   systemd-units

%description
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.

%package devel
BuildRequires:      golang >= 1.2.7
BuildRequires:      golang-cover
BuildRequires:      golang(github.com/coreos/go-systemd/daemon) >= 2-2
BuildRequires:      golang(github.com/coreos/go-etcd/etcd)
BuildRequires:      golang(github.com/golang/glog)
BuildRequires:      golang(github.com/vishvananda/netns)
BuildRequires:      golang(github.com/vishvananda/netlink)
BuildRequires:      pkgconfig(systemd)
Requires:           golang >= 1.2.7
Requires:           golang-cover
Requires:           golang(github.com/coreos/go-systemd/daemon) >= 2-2
Requires:           golang(github.com/coreos/go-etcd/etcd)
Requires:           golang(github.com/golang/glog)
Requires:           golang(github.com/vishvananda/netns)
Requires:           golang(github.com/vishvananda/netlink)
Summary:            %{summary}
Provides:           golang(%{import_path}/subnet) = %{version}-%{release}
Provides:           golang(%{import_path}/pkg/ip) = %{version}-%{release}
Provides:           golang(%{import_path}/backend) = %{version}-%{release}
Provides:           golang(%{import_path}/backend/vxlan) = %{version}-%{release}
Provides:           golang(%{import_path}/backend/udp) = %{version}-%{release}
Provides:           golang(%{import_path}/backend/alloc) = %{version}-%{release}

%description devel
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.

This package contains library source intended for
building other packages which use %{project}/%{repo}.

%prep
%setup -q -n %{repo}-%{commit}
%patch0 -p1

%build
rm -rf Godeps

mkdir _build
pushd _build
  mkdir -p src/github.com/coreos
  ln -s $(dirs +1 -l) src/github.com/coreos/flannel
popd

mkdir bin
GOPATH=${PWD}/_build:%{gopath} go build -o bin/flanneld .

%install
# package with binary
install -D -p -m 755 bin/flanneld %{buildroot}%{_bindir}/flanneld
install -D -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/flanneld.service
install -D -p -m 644 %{SOURCE2} %{buildroot}/etc/sysconfig/flanneld
# devel package
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
cp -pav {backend,pkg,subnet} %{buildroot}/%{gopath}/src/%{import_path}/

%post
%systemd_post flanneld.service

%preun
# clean tempdir and workdir on removal or upgrade
%systemd_preun flanneld.service

%postun
%systemd_postun_with_restart flanneld.service

%files
%doc CONTRIBUTING.md  LICENSE MAINTAINERS README.md  DCO NOTICE
%{_bindir}/flanneld
%{_unitdir}/flanneld.service
%config(noreplace) %{_sysconfdir}/sysconfig/flanneld

%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}/

%changelog
* Fri Feb 20 2015 jchaloup <jchaloup@redhat.com> - 0.1.0-9.gita7b435a
- Update [Build]Requires for go-etcd package and go-systemd

* Tue Dec  2 2014 John W. Linville <linville@redhat.com> - 0.1.0-8.gita7b435a
- Remove patches related to out-of-tree slice backend
- Update to latest upstream

* Thu Nov 20 2014 jchaloup <jchaloup@redhat.com> - 0.1.0-7.git071d778
- Removing deps on Godeps and adding deps on golang-github packages
- Removing wait-online service and changing Type of flannel.service from simple to notify
- Adding README and other doc files
- Adding spec file header with commit, import_path, ...
- Adding devel subpackage
- spec polished based on Lokesh' notes (3 lines below)
- modify summary in specfile as in bug description (capitalize if needed)
- might need to enforce NVR for coreos/go-systemd in deps
- pkgconfig(systemd) is preferable to systemd in BR (I think)
  resolves: #1165688

* Fri Nov 07 2014 - Neil Horman <nhoramn@tuxdriver.com> 
- Updating to latest upstream 

* Fri Nov 07 2014 - Neil Horman <nhoramn@tuxdriver.com> 
- Added wait-online service to sync with docker

* Thu Nov 06 2014 - Neil Horman <nhoramn@tuxdriver.com> 
- Fixed flanneld.service file
- Added linvilles slice type patch

* Tue Nov 04 2014 - Neil Horman <nhorman@tuxdriver.com> - 0.1.0-20141104gitdc530ce
- Initial Build