Blob Blame History Raw
%if 0%{?fedora}
%global with_devel 1
%global with_bundled 0
%global with_debug 1
# some tests are failing
%global with_checks 0
%else
%global with_devel 0
%global with_bundled 1
%global with_debug 0
%global with_checks 0
%endif

%if 0%{?with_debug}
# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
%global _dwz_low_mem_die_limit 0
%else
%global debug_package   %{nil}
%endif
%global provider        github
%global provider_tld    com
%global project         docker
%global repo            libcontainer
%global import_path     %{provider}.%{provider_tld}/%{project}/%{repo}
%global commit          c9643688cb73c2588a9c9b14357bda6c3a9df67f
%global shortcommit     %(c=%{commit}; echo ${c:0:7})

Name:           golang-github-docker-libcontainer
Version:        2.1.1
Release:        0.3.git%{shortcommit}%{?dist}
Summary:        Configuration options for containers
License:        ASL 2.0
URL:            https://%{import_path}
Source0:        https://%{import_path}/archive/%{commit}/libcontainer-%{shortcommit}.tar.gz
ExclusiveArch:  x86_64

BuildRequires: golang >= 1.2.1-3

%if ! 0%{?with_bundled}
BuildRequires: golang(github.com/Sirupsen/logrus)
BuildRequires: golang(github.com/codegangsta/cli) >= 1.1.0-1
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
BuildRequires: golang(github.com/docker/docker/pkg/mount)
BuildRequires: golang(github.com/docker/docker/pkg/symlink)
BuildRequires: golang(github.com/docker/docker/pkg/term)
BuildRequires: golang(github.com/godbus/dbus)
BuildRequires: golang(github.com/golang/protobuf/proto)
BuildRequires: golang(github.com/syndtr/gocapability/capability) >= 0-0.9
%endif

Provides:       nsinit = %{version}-%{release}

%description
libcontainer specifies configuration options for what a container is. It
provides a native Go implementation for using Linux namespaces with no
external dependencies. libcontainer provides many convenience functions for
working with namespaces, networking, and management. 

This package provides the nsinit binary as well, but it is currently for
debugging purposes only and not officially supported.

%if 0%{?with_devel}
%package devel
Summary:        Configuration options for containers
BuildRequires: golang >= 1.2.1-3
BuildRequires: golang(github.com/Sirupsen/logrus)
BuildRequires: golang(github.com/codegangsta/cli) >= 1.1.0-1
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
BuildRequires: golang(github.com/docker/docker/pkg/mount)
BuildRequires: golang(github.com/docker/docker/pkg/symlink)
BuildRequires: golang(github.com/docker/docker/pkg/term)
BuildRequires: golang(github.com/godbus/dbus)
BuildRequires: golang(github.com/golang/protobuf/proto)
BuildRequires: golang(github.com/syndtr/gocapability/capability) >= 0-0.9

Requires: golang(github.com/Sirupsen/logrus)
Requires: golang(github.com/codegangsta/cli) >= 1.1.0-1
Requires: golang(github.com/coreos/go-systemd/dbus)
Requires: golang(github.com/docker/docker/pkg/mount)
Requires: golang(github.com/docker/docker/pkg/symlink)
Requires: golang(github.com/docker/docker/pkg/term)
Requires: golang(github.com/godbus/dbus)
Requires: golang(github.com/golang/protobuf/proto)
Requires: golang(github.com/syndtr/gocapability/capability) >= 0-0.9

Provides: golang(%{import_path}) = %{version}-%{release}
Provides: golang(%{import_path}/apparmor) = %{version}-%{release}
Provides: golang(%{import_path}/cgroups) = %{version}-%{release}
Provides: golang(%{import_path}/cgroups/fs) = %{version}-%{release}
Provides: golang(%{import_path}/cgroups/systemd) = %{version}-%{release}
Provides: golang(%{import_path}/configs) = %{version}-%{release}
Provides: golang(%{import_path}/configs/validate) = %{version}-%{release}
Provides: golang(%{import_path}/criurpc) = %{version}-%{release}
Provides: golang(%{import_path}/devices) = %{version}-%{release}
Provides: golang(%{import_path}/integration) = %{version}-%{release}
Provides: golang(%{import_path}/label) = %{version}-%{release}
Provides: golang(%{import_path}/netlink) = %{version}-%{release}
Provides: golang(%{import_path}/nsenter) = %{version}-%{release}
Provides: golang(%{import_path}/selinux) = %{version}-%{release}
Provides: golang(%{import_path}/stacktrace) = %{version}-%{release}
Provides: golang(%{import_path}/system) = %{version}-%{release}
Provides: golang(%{import_path}/user) = %{version}-%{release}
Provides: golang(%{import_path}/utils) = %{version}-%{release}
Provides: golang(%{import_path}/xattr) = %{version}-%{release}

%description devel
libcontainer specifies configuration options for what a container is. It
provides a native Go implementation for using Linux namespaces with no
external dependencies. libcontainer provides many convenience functions for
working with namespaces, networking, and management. 

This package contains library source intended for building other packages
which use libcontainer.
%endif

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

%build
mkdir -p ./_build/src/github.com/docker
ln -s $(pwd) ./_build/src/%{import_path}
mkdir bin

%if 0%{?with_debug}
function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; }
%else
function gobuild { go build "$@"; }
%endif

%if 0%{?with_bundled}
export GOPATH=$(pwd)/_build:$(pwd)/vendor:%{gopath}
gobuild -o bin/nsinit %{import_path}/nsinit
%else
export GOPATH=$(pwd)/_build:%{gopath}
gobuild -o bin/nsinit %{import_path}/nsinit
%endif

%install
# Install nsinit
install -d %{buildroot}%{_bindir}
install -p -m 755 bin/nsinit %{buildroot}%{_bindir}/nsinit

%if 0%{?with_devel}
rm -rf sample_configs vendor bin
install -d -p %{buildroot}%{gopath}/src/%{import_path}
cp -rpav ./*.go %{buildroot}%{gopath}/src/%{import_path}/

for file in */ ; do
    if [ "$file" == "_build/" ]; then
        continue
    fi
    if [ -d $file ]; then
        cp -rpav $file %{buildroot}%{gopath}/src/%{import_path}/
    fi
done
%endif

%if 0%{?with_checks}
%check
%if 0%{?with_bundled}
export GOPATH=$(pwd)/_build:$(pwd)/vendor:%{gopath}
%else
export GOPATH=$(pwd)/_build:%{gopath}
%endif
go test %{import_path}
go test %{import_path}/cgroups
go test %{import_path}/cgroups/fs
go test %{import_path}/configs
go test %{import_path}/devices
go test %{import_path}/integration
go test %{import_path}/label
go test %{import_path}/netlink
go test %{import_path}/nsenter
go test %{import_path}/selinux
go test %{import_path}/stacktrace
go test %{import_path}/user
go test %{import_path}/utils
go test %{import_path}/xattr
%endif

%files
%if 0%{?fedora}
%license LICENSE
%else
%doc LICENSE
%endif
%doc MAINTAINERS MAINTAINERS_GUIDE.md NOTICE
%doc PRINCIPLES.md README.md ROADMAP.md
%{_bindir}/nsinit

%if 0%{?with_devel}
%files devel
%if 0%{?fedora}
%license LICENSE
%else
%doc LICENSE
%endif
%doc MAINTAINERS MAINTAINERS_GUIDE.md NOTICE
%doc PRINCIPLES.md README.md ROADMAP.md
%dir %{gopath}/src/github.com/docker
%{gopath}/src/%{import_path}
%endif

%changelog
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-0.3.gitc964368
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sun Jun 14 2015 jchaloup <jchaloup@redhat.com> - 2.1.1-0.2.gitc964368
- Don't remove _build directory, it is used during debuginfo extracting
  At the same time don't include _build directory in devel subpackage.
  resolves: #1231486

* Thu Jun 11 2015 jchaloup <jchaloup@redhat.com> - 2.1.1-0.1.gitc964368
- Update to 2.1.1
  Ppolish spec file
  Use license macro for LICENSE
  Remove runtime dependency on golang
  resolves: #1230658

* Mon Apr 20 2015 jchaloup <jchaloup@redhat.com> - 1.4.0-3.gitbada39c
- Bump to upstream bada39cf31c3305810c2575e036f594a7dc3c98f
  related: #1164989

* Tue Mar 31 2015 jchaloup <jchaloup@redhat.com> - 1.4.0-2.gitd7dea0e
- Add [B]R to devel subpackage
  related: #1164989

* Mon Mar 09 2015 jchaloup <jchaloup@redhat.com> - 1.4.0-1.git83663f8
- Bump to upstream 83663f82e3d76f57ea57faf80b8fd7eb96933b9b
  related: #1164989

* Tue Nov 18 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.2.0-3.git28cb5f9
- Resolves: rhbz#1164989 - update to atleast b9c834b7

* Mon Oct 20 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.2.0-2.gitc907e40
- install namespaces/nsenter

* Mon Oct 20 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.2.0-1.gitc907e40
- bump to v1.2.0 commit c907e406fe81320d87b58edf74953ceb08facc13

* Sat Aug 23 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-10.git
- Include syncpipe, system and user dirs missed in previous build

* Fri Aug 22 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-9.git
- Update to db65c35051d05f3fb218a0e84a11267e0894fe0a for docker 1.2.0

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-8.git29363e2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Fri Aug 15 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-7.git
- Resolves: rhbz#1130500
- update to upstream commit 29363e2d2d7b8f62a5f353be333758f83df540a9

* Thu Jul 31 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-6
- Resolves: rhbz#1111916 - package review request
- remove attr for fedora
- correct NVR for codegangsta/cli 1.1.0-1

* Wed Jul 30 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-5
- LICENSE file installed in main package
- defattr gotten rid of

* Wed Jul 30 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-4
- Update BRs for main package

* Mon Jul 28 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-3
- nsinit needs docker-io-pkg-devel to build

* Fri Jul 25 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-2
- nsinit description: debugging only and no official support

* Fri Jul 25 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> 1.1.0-1
- use v1.1.0
- do not own dirs owned by golang
- do not redefine macros defined in golang
- main package provides nsinit

* Sat Jun 21 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> 1.0.1-1
- Initial fedora package