166e717
%if 0%{?fedora} || 0%{?rhel} == 6
d44a86f
%global with_devel 1
d44a86f
%global with_bundled 0
d44a86f
%global with_debug 1
d44a86f
# some tests are failing
166e717
%global with_check 0
166e717
%global with_unit_test 1
d44a86f
%else
d44a86f
%global with_devel 0
d44a86f
%global with_bundled 1
d44a86f
%global with_debug 0
166e717
%global with_check 0
166e717
%global with_unit_test 0
d44a86f
%endif
d44a86f
d44a86f
%if 0%{?with_debug}
d44a86f
%global _dwz_low_mem_die_limit 0
d44a86f
%else
c3190f6
%global debug_package   %{nil}
d44a86f
%endif
166e717
166e717
%if ! 0%{?gobuild:1}
166e717
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
166e717
%endif
166e717
117e46f
%global provider        github
117e46f
%global provider_tld    com
117e46f
%global project         docker
117e46f
%global repo            libcontainer
166e717
# https://github.com/docker/libcontainer
166e717
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
166e717
%global import_path     %{provider_prefix}
d44a86f
%global commit          c9643688cb73c2588a9c9b14357bda6c3a9df67f
c3190f6
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
c3190f6
c3190f6
Name:           golang-github-docker-libcontainer
d44a86f
Version:        2.1.1
9ecf6ac
Release:        0.8.git%{shortcommit}%{?dist}
c3190f6
Summary:        Configuration options for containers
c3190f6
License:        ASL 2.0
166e717
URL:            https://%{provider_prefix}
166e717
Source0:	https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
166e717
Patch0:         update-to-newer-signature-of-systemd.Conn-methods.patch
c3df736
Patch1:         libcontainer-fixDup3syscall.patch
f9adfc4
166e717
# e.g. el6 has ppc64 arch without gcc-go, so EA tag is required
166e717
ExclusiveArch:  %{?go_arches:%{go_arches}}%{!?go_arches:%{ix86} x86_64 %{arm}}
166e717
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
166e717
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
d44a86f
d44a86f
%if ! 0%{?with_bundled}
f9adfc4
BuildRequires: golang(github.com/Sirupsen/logrus)
f9adfc4
BuildRequires: golang(github.com/codegangsta/cli) >= 1.1.0-1
f9adfc4
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
6199992
BuildRequires: golang(github.com/docker/go-units)
f9adfc4
BuildRequires: golang(github.com/docker/docker/pkg/mount)
d44a86f
BuildRequires: golang(github.com/docker/docker/pkg/symlink)
f9adfc4
BuildRequires: golang(github.com/docker/docker/pkg/term)
f9adfc4
BuildRequires: golang(github.com/godbus/dbus)
d44a86f
BuildRequires: golang(github.com/golang/protobuf/proto)
f9adfc4
BuildRequires: golang(github.com/syndtr/gocapability/capability) >= 0-0.9
d44a86f
%endif
f9adfc4
3de1d9b
Provides:       nsinit = %{version}-%{release}
c3190f6
c3190f6
%description
c3190f6
libcontainer specifies configuration options for what a container is. It
c3190f6
provides a native Go implementation for using Linux namespaces with no
c3190f6
external dependencies. libcontainer provides many convenience functions for
c3190f6
working with namespaces, networking, and management. 
c3190f6
c3190f6
This package provides the nsinit binary as well, but it is currently for
c3190f6
debugging purposes only and not officially supported.
c3190f6
d44a86f
%if 0%{?with_devel}
c3190f6
%package devel
3de1d9b
Summary:        Configuration options for containers
166e717
BuildArch:      noarch
166e717
166e717
%if 0%{?with_check}
f9adfc4
BuildRequires: golang(github.com/Sirupsen/logrus)
f9adfc4
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
f9adfc4
BuildRequires: golang(github.com/docker/docker/pkg/mount)
d44a86f
BuildRequires: golang(github.com/docker/docker/pkg/symlink)
f9adfc4
BuildRequires: golang(github.com/godbus/dbus)
d44a86f
BuildRequires: golang(github.com/golang/protobuf/proto)
f9adfc4
BuildRequires: golang(github.com/syndtr/gocapability/capability) >= 0-0.9
166e717
%endif
f9adfc4
f9adfc4
Requires: golang(github.com/Sirupsen/logrus)
f9adfc4
Requires: golang(github.com/coreos/go-systemd/dbus)
f9adfc4
Requires: golang(github.com/docker/docker/pkg/mount)
d44a86f
Requires: golang(github.com/docker/docker/pkg/symlink)
f9adfc4
Requires: golang(github.com/godbus/dbus)
d44a86f
Requires: golang(github.com/golang/protobuf/proto)
d44a86f
Requires: golang(github.com/syndtr/gocapability/capability) >= 0-0.9
f9adfc4
f9adfc4
Provides: golang(%{import_path}) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/apparmor) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/cgroups) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/cgroups/fs) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/cgroups/systemd) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/configs) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/configs/validate) = %{version}-%{release}
d44a86f
Provides: golang(%{import_path}/criurpc) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/devices) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/integration) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/label) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/netlink) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/nsenter) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/selinux) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/stacktrace) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/system) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/user) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/utils) = %{version}-%{release}
f9adfc4
Provides: golang(%{import_path}/xattr) = %{version}-%{release}
c3190f6
c3190f6
%description devel
c3190f6
libcontainer specifies configuration options for what a container is. It
c3190f6
provides a native Go implementation for using Linux namespaces with no
c3190f6
external dependencies. libcontainer provides many convenience functions for
c3190f6
working with namespaces, networking, and management. 
c3190f6
c3190f6
This package contains library source intended for building other packages
c3190f6
which use libcontainer.
d44a86f
%endif
c3190f6
166e717
%if 0%{?with_unit_test} && 0%{?with_devel}
166e717
%package unit-test-devel
166e717
Summary:         Unit tests for %{name} package
166e717
%if 0%{?with_check}
166e717
#Here comes all BuildRequires: PACKAGE the unit tests
166e717
#in %%check section need for running
166e717
%endif
166e717
166e717
# test subpackage tests code from devel subpackage
166e717
Requires:        %{name}-devel = %{version}-%{release}
166e717
166e717
%if 0%{?with_check} && ! 0%{?with_bundled}
166e717
%endif
166e717
166e717
%description unit-test-devel
166e717
%{summary}
166e717
166e717
This package contains unit tests for project
166e717
providing packages with %{import_path} prefix.
166e717
%endif
166e717
c3190f6
%prep
3de1d9b
%setup -q -n %{repo}-%{commit}
166e717
%if ! 0%{?with_bundled}
166e717
%patch0 -p1
c3df736
%patch1 -p1 -b .dup3
166e717
%endif
c3190f6
c3190f6
%build
166e717
mkdir -p src/github.com/docker
166e717
ln -s ../../../ src/github.com/docker/libcontainer
d44a86f
166e717
%if ! 0%{?with_bundled}
166e717
export GOPATH=$(pwd):%{gopath}
d44a86f
%else
166e717
export GOPATH=$(pwd):$(pwd)/vendor:%{gopath}
d44a86f
%endif
d44a86f
166e717
%gobuild -o bin/nsinit %{import_path}/nsinit
c3190f6
c3190f6
%install
c3190f6
# Install nsinit
c3190f6
install -d %{buildroot}%{_bindir}
d44a86f
install -p -m 755 bin/nsinit %{buildroot}%{_bindir}/nsinit
c3190f6
166e717
# source codes for building projects
d44a86f
%if 0%{?with_devel}
166e717
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
166e717
echo "%%dir %%{gopath}/src/%%{import_path}/." >> devel.file-list
166e717
# find all *.go but no *_test.go files and generate devel.file-list
166e717
for file in $(find . -iname "*.go" \! -iname "*_test.go" | egrep -v "./vendor/src") ; do
166e717
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
166e717
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
166e717
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
166e717
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
94bfdfd
done
d44a86f
%endif
94bfdfd
166e717
# testing files for this project
166e717
%if 0%{?with_unit_test} && 0%{?with_devel}
166e717
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
166e717
# find all *_test.go files and generate unit-test-devel.file-list
166e717
for file in $(find . -iname "*_test.go" | egrep -v "./vendor/src") ; do
166e717
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
166e717
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
166e717
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
166e717
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test-devel.file-list
166e717
done
166e717
%endif
166e717
166e717
%if 0%{?with_devel}
166e717
sort -u -o devel.file-list devel.file-list
166e717
%endif
166e717
c3190f6
%check
166e717
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
166e717
%if ! 0%{?with_bundled}
166e717
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
d44a86f
%else
166e717
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/vendor:%{gopath}
166e717
%endif
166e717
166e717
%if ! 0%{?gotest:1}
166e717
%global gotest go test
166e717
%endif
166e717
166e717
%gotest %{import_path}
166e717
%gotest %{import_path}/cgroups
166e717
%gotest %{import_path}/cgroups/fs
166e717
%gotest %{import_path}/configs
166e717
%gotest %{import_path}/devices
166e717
%gotest %{import_path}/integration
166e717
%gotest %{import_path}/label
166e717
%gotest %{import_path}/netlink
166e717
%gotest %{import_path}/nsenter
166e717
%gotest %{import_path}/selinux
166e717
%gotest %{import_path}/stacktrace
166e717
%gotest %{import_path}/user
166e717
%gotest %{import_path}/utils
166e717
%gotest %{import_path}/xattr
d44a86f
%endif
c3190f6
166e717
#define license tag if not already defined
166e717
%{!?_licensedir:%global license %doc}
166e717
c3190f6
%files
d44a86f
%license LICENSE
d44a86f
%doc MAINTAINERS MAINTAINERS_GUIDE.md NOTICE
94bfdfd
%doc PRINCIPLES.md README.md ROADMAP.md
c3190f6
%{_bindir}/nsinit
c3190f6
d44a86f
%if 0%{?with_devel}
166e717
%files devel -f devel.file-list
d44a86f
%license LICENSE
166e717
%doc ROADMAP.md PRINCIPLES.md MAINTAINERS_GUIDE.md CONTRIBUTING.md README.md SPEC.md
166e717
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
d44a86f
%endif
166e717
166e717
%if 0%{?with_unit_test} && 0%{?with_devel}
166e717
%files unit-test-devel -f unit-test-devel.file-list
166e717
%license LICENSE
166e717
%doc ROADMAP.md PRINCIPLES.md MAINTAINERS_GUIDE.md CONTRIBUTING.md README.md SPEC.md
d44a86f
%endif
c3190f6
c3190f6
%changelog
9ecf6ac
* Thu Jul 21 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-0.8.gitc964368
9ecf6ac
- https://fedoraproject.org/wiki/Changes/golang1.7
9ecf6ac
c3df736
* Sat Apr  9 2016 Peter Robinson <pbrobinson@fedoraproject.org> 2.1.1-0.7.gitc964368
c3df736
- Fix builds on aarch64
c3df736
166e717
* Thu Mar 17 2016 jchaloup <jchaloup@redhat.com> - 2.1.1-0.6.gitc964368
166e717
- Polish spec file
166e717
- Patch systemd.Conn methods
166e717
  resolves: #1230658
166e717
4292900
* Mon Feb 22 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-0.5.gitc964368
4292900
- https://fedoraproject.org/wiki/Changes/golang1.6
4292900
8ced730
* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.1.1-0.4.gitc964368
8ced730
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
8ced730
6b5674c
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.1.1-0.3.gitc964368
6b5674c
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
6b5674c
19fbc3f
* Sun Jun 14 2015 jchaloup <jchaloup@redhat.com> - 2.1.1-0.2.gitc964368
19fbc3f
- Don't remove _build directory, it is used during debuginfo extracting
19fbc3f
  At the same time don't include _build directory in devel subpackage.
19fbc3f
  resolves: #1231486
19fbc3f
d44a86f
* Thu Jun 11 2015 jchaloup <jchaloup@redhat.com> - 2.1.1-0.1.gitc964368
d44a86f
- Update to 2.1.1
d44a86f
  Ppolish spec file
d44a86f
  Use license macro for LICENSE
d44a86f
  Remove runtime dependency on golang
d44a86f
  resolves: #1230658
d44a86f
f9adfc4
* Mon Apr 20 2015 jchaloup <jchaloup@redhat.com> - 1.4.0-3.gitbada39c
f9adfc4
- Bump to upstream bada39cf31c3305810c2575e036f594a7dc3c98f
f9adfc4
  related: #1164989
f9adfc4
3de1d9b
* Tue Mar 31 2015 jchaloup <jchaloup@redhat.com> - 1.4.0-2.gitd7dea0e
3de1d9b
- Add [B]R to devel subpackage
3de1d9b
  related: #1164989
3de1d9b
117e46f
* Mon Mar 09 2015 jchaloup <jchaloup@redhat.com> - 1.4.0-1.git83663f8
117e46f
- Bump to upstream 83663f82e3d76f57ea57faf80b8fd7eb96933b9b
117e46f
  related: #1164989
117e46f
429d323
* Tue Nov 18 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.2.0-3.git28cb5f9
429d323
- Resolves: rhbz#1164989 - update to atleast b9c834b7
429d323
c6f9452
* Mon Oct 20 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.2.0-2.gitc907e40
c6f9452
- install namespaces/nsenter
c6f9452
d3570fb
* Mon Oct 20 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.2.0-1.gitc907e40
d3570fb
- bump to v1.2.0 commit c907e406fe81320d87b58edf74953ceb08facc13
d3570fb
10deef8
* Sat Aug 23 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-10.git
10deef8
- Include syncpipe, system and user dirs missed in previous build
10deef8
6a7946e
* Fri Aug 22 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-9.git
6a7946e
- Update to db65c35051d05f3fb218a0e84a11267e0894fe0a for docker 1.2.0
6a7946e
1b31f71
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0-8.git29363e2
1b31f71
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
1b31f71
09c9443
* Fri Aug 15 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-7.git
09c9443
- Resolves: rhbz#1130500
09c9443
- update to upstream commit 29363e2d2d7b8f62a5f353be333758f83df540a9
09c9443
c3190f6
* Thu Jul 31 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-6
c3190f6
- Resolves: rhbz#1111916 - package review request
c3190f6
- remove attr for fedora
bfc18bb
- correct NVR for codegangsta/cli 1.1.0-1
c3190f6
c3190f6
* Wed Jul 30 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-5
c3190f6
- LICENSE file installed in main package
c3190f6
- defattr gotten rid of
c3190f6
c3190f6
* Wed Jul 30 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-4
c3190f6
- Update BRs for main package
c3190f6
c3190f6
* Mon Jul 28 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-3
c3190f6
- nsinit needs docker-io-pkg-devel to build
c3190f6
c3190f6
* Fri Jul 25 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 1.1.0-2
c3190f6
- nsinit description: debugging only and no official support
c3190f6
c3190f6
* Fri Jul 25 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> 1.1.0-1
c3190f6
- use v1.1.0
c3190f6
- do not own dirs owned by golang
c3190f6
- do not redefine macros defined in golang
c3190f6
- main package provides nsinit
c3190f6
c3190f6
* Sat Jun 21 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> 1.0.1-1
c3190f6
- Initial fedora package