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

Name:           golang-%{provider}-%{project}-%{repo}
Version:        0
Release:        0.2.git%{shortcommit}%{?dist}
Summary:        Simple netlink library for go
License:        ASL 2.0
URL:            https://%{import_path}
Source0:        https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
%if 0%{?fedora} >= 19 || 0%{?rhel} >= 7
BuildArch:      noarch
%else
ExclusiveArch:  %{ix86} x86_64 %{arm}
%endif

%description
The netlink package provides a simple netlink library for go.
Netlink is the interface a user-space program in linux uses to communicate
with the kernel. It can be used to add and remove interfaces, set ip addresses
and routes, and configure ipsec. Netlink communication requires elevated
privileges, so in most cases this code needs to be run as root. Since low-level
netlink messages are inscrutable at best, the library attempts to provide
an api that is loosely modeled on the CLI provied by iproute2.
Actions like ip link add will be accomplished via a similarly named function
like AddLink(). This library began its life as a fork of the netlink
functionality in docker/libcontainer but was heavily rewritten to improve
testability,performance, and to add new functionality like ipsec xfrm handling.

%package devel
BuildRequires:  golang >= 1.2.1-3
BuildRequires:  golang(github.com/vishvananda/netns)
Requires:       golang(github.com/vishvananda/netns)
Summary:        %{summary}
Provides:       golang(%{import_path}) = %{version}-%{release}
Provides:       golang(%{import_path}/nl) = %{version}-%{release}

%description devel
%{summary}

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

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

%build

%install
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
cp -pav *.go %{buildroot}/%{gopath}/src/%{import_path}/
cp -rpav nl %{buildroot}/%{gopath}/src/%{import_path}/

%check
#GOPATH=%{buildroot}/%{gopath}:%{gopath} go test %{import_path}
GOPATH=%{buildroot}/%{gopath}:%{gopath} go test %{import_path}/nl

%files devel
%if 0%{?fedora}
%license LICENSE
%doc README.md
%else
%doc README.md LICENSE
%endif
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
%{gopath}/src/%{import_path}

%changelog
* Wed May 20 2015 jchaloup <jchaloup@redhat.com> - 0-0.2.git991a7a2
- Bump to upstream 991a7a2fa7c073968fb27f36669df199b1fdf412
- Remove runtime dependency on golang
- Add license macro
  related: #1164176

* Fri Nov 14 2014 jchaloup <jchaloup@redhat.com> - 0-0.1.git2187ba6
- First package for Fedora
  resolves: #1164176