158e7a
%if 0%{?fedora} || 0%{?rhel} == 6
158e7a
%global with_devel 1
158e7a
%global with_bundled 0
158e7a
%global with_debug 1
158e7a
%global with_check 1
158e7a
%global with_unit_test 1
158e7a
%else
158e7a
%global with_devel 0
158e7a
%global with_bundled 1
158e7a
%global with_debug 0
158e7a
%global with_check 0
158e7a
%global with_unit_test 0
158e7a
%endif
158e7a
158e7a
%if 0%{?with_debug}
158e7a
%global _dwz_low_mem_die_limit 0
158e7a
%else
158e7a
%global debug_package   %{nil}
158e7a
%endif
158e7a
158e7a
%global provider        github
158e7a
%global provider_tld    com
158e7a
%global project         opencontainers
158e7a
%global repo            runc
158e7a
# https://github.com/opencontainers/runc
158e7a
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
158e7a
%global import_path     %{provider_prefix}
10646f
%global commit          8e129e097220b2591edd59957c4ff08e064e14b9
158e7a
%global shortcommit     %(c=%{commit}; echo ${c:0:7})
158e7a
158e7a
Name:           %{repo}
158e7a
%if 0%{?fedora}
158e7a
Epoch:          1
158e7a
%endif
10646f
Version:        0.1.0
10646f
Release:        3%{?dist}
158e7a
Summary:        CLI for running Open Containers
158e7a
License:        ASL 2.0
158e7a
URL:            https://%{provider_prefix}
158e7a
Source0:        https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
158e7a
Requires: criu
158e7a
158e7a
ExclusiveArch:  x86_64
158e7a
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
158e7a
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
158e7a
BuildRequires: go-md2man
10646f
BuildRequires: libseccomp-devel
158e7a
158e7a
%if ! 0%{?with_bundled}
158e7a
BuildRequires: golang(github.com/Sirupsen/logrus)
158e7a
BuildRequires: golang(github.com/codegangsta/cli)
158e7a
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
158e7a
BuildRequires: golang(github.com/coreos/go-systemd/util)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/mount)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/symlink)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/term)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/units)
158e7a
BuildRequires: golang(github.com/godbus/dbus)
158e7a
BuildRequires: golang(github.com/golang/protobuf/proto)
158e7a
BuildRequires: golang(github.com/opencontainers/specs)
158e7a
BuildRequires: golang(github.com/syndtr/gocapability/capability)
158e7a
%endif
158e7a
158e7a
%description
158e7a
The runc command can be used to start containers which are packaged
158e7a
in accordance with the Open Container Initiative's specifications,
158e7a
and to manage containers running under runc.
158e7a
158e7a
%if 0%{?with_devel}
158e7a
%package devel
158e7a
Summary:       %{summary}
158e7a
BuildArch:     noarch
158e7a
158e7a
%if 0%{?with_check}
158e7a
BuildRequires: golang(github.com/Sirupsen/logrus)
158e7a
BuildRequires: golang(github.com/codegangsta/cli)
158e7a
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
158e7a
BuildRequires: golang(github.com/coreos/go-systemd/util)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/mount)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/symlink)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/term)
158e7a
BuildRequires: golang(github.com/docker/docker/pkg/units)
158e7a
BuildRequires: golang(github.com/godbus/dbus)
158e7a
BuildRequires: golang(github.com/golang/protobuf/proto)
158e7a
BuildRequires: golang(github.com/opencontainers/specs)
158e7a
BuildRequires: golang(github.com/seccomp/libseccomp-golang)
158e7a
BuildRequires: golang(github.com/syndtr/gocapability/capability)
158e7a
BuildRequires: golang(github.com/vishvananda/netlink)
158e7a
%endif
158e7a
158e7a
Requires:      golang(github.com/Sirupsen/logrus)
158e7a
Requires:      golang(github.com/coreos/go-systemd/dbus)
158e7a
Requires:      golang(github.com/coreos/go-systemd/util)
158e7a
Requires:      golang(github.com/docker/docker/pkg/mount)
158e7a
Requires:      golang(github.com/docker/docker/pkg/symlink)
158e7a
Requires:      golang(github.com/docker/docker/pkg/units)
158e7a
Requires:      golang(github.com/godbus/dbus)
158e7a
Requires:      golang(github.com/golang/protobuf/proto)
158e7a
Requires:      golang(github.com/seccomp/libseccomp-golang)
158e7a
Requires:      golang(github.com/syndtr/gocapability/capability)
158e7a
Requires:      golang(github.com/vishvananda/netlink)
158e7a
158e7a
Provides:      golang(%{import_path}/libcontainer) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/apparmor) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/cgroups) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/cgroups/fs) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/cgroups/systemd) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/configs) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/configs/validate) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/criurpc) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/devices) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/integration) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/label) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/nsenter) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/seccomp) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/selinux) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/stacktrace) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/system) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/user) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/utils) = %{version}-%{release}
158e7a
Provides:      golang(%{import_path}/libcontainer/xattr) = %{version}-%{release}
158e7a
158e7a
%description devel
158e7a
The runc command can be used to start containers which are packaged
158e7a
in accordance with the Open Container Initiative's specifications,
158e7a
and to manage containers running under runc.
158e7a
158e7a
This package contains library source intended for
158e7a
building other packages which use import path with
158e7a
%{import_path} prefix.
158e7a
%endif
158e7a
158e7a
%if 0%{?with_unit_test} && 0%{?with_devel}
158e7a
%package unit-test
158e7a
Summary:         Unit tests for %{name} package
158e7a
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
158e7a
BuildRequires:  %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
158e7a
158e7a
%if 0%{?with_check}
158e7a
#Here comes all BuildRequires: PACKAGE the unit tests
158e7a
#in %%check section need for running
158e7a
%endif
158e7a
158e7a
# test subpackage tests code from devel subpackage
158e7a
Requires:        %{name}-devel = %{version}-%{release}
158e7a
158e7a
%description unit-test
158e7a
The runc command can be used to start containers which are packaged
158e7a
in accordance with the Open Container Initiative's specifications,
158e7a
and to manage containers running under runc.
158e7a
158e7a
This package contains unit tests for project
158e7a
providing packages with %{import_path} prefix.
158e7a
%endif
158e7a
158e7a
%prep
158e7a
%setup -q -n %{repo}-%{commit}
158e7a
158e7a
%build
158e7a
mkdir -p src/github.com/opencontainers
158e7a
ln -s ../../../ src/github.com/opencontainers/runc
158e7a
158e7a
%if ! 0%{?with_bundled}
158e7a
export GOPATH=$(pwd):%{gopath}
158e7a
%else
158e7a
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
158e7a
%endif
158e7a
10646f
sed -i 's/seccomp/selinux seccomp/' Makefile
10646f
make all
158e7a
158e7a
pushd man
158e7a
./md2man-all.sh
158e7a
popd
158e7a
158e7a
%install
158e7a
install -d -p %{buildroot}%{_bindir}
10646f
install -p -m 755 %{name} %{buildroot}%{_bindir}
158e7a
158e7a
install -d -p %{buildroot}%{_mandir}/man8
158e7a
install -p -m 644 man/man8/* %{buildroot}%{_mandir}/man8
158e7a
158e7a
# source codes for building projects
158e7a
%if 0%{?with_devel}
158e7a
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
158e7a
# find all *.go but no *_test.go files and generate devel.file-list
158e7a
for file in $(find . -iname "*.go" \! -iname "*_test.go" | grep -v "^./Godeps") ; do
158e7a
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
158e7a
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
158e7a
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
158e7a
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
158e7a
done
158e7a
for file in $(find . -iname "*.proto" | grep -v "^./Godeps") ; do
158e7a
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
158e7a
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
158e7a
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
158e7a
    echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
158e7a
done
158e7a
%endif
158e7a
158e7a
# testing files for this project
158e7a
%if 0%{?with_unit_test} && 0%{?with_devel}
158e7a
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
158e7a
# find all *_test.go files and generate unit-test.file-list
158e7a
for file in $(find . -iname "*_test.go" | grep -v "^./Godeps"); do
158e7a
    echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
158e7a
    install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
158e7a
    cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
158e7a
    echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
158e7a
done
158e7a
%endif
158e7a
158e7a
%if 0%{?with_devel}
158e7a
sort -u -o devel.file-list devel.file-list
158e7a
%endif
158e7a
158e7a
%check
158e7a
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
158e7a
%if ! 0%{?with_bundled}
158e7a
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
158e7a
%else
158e7a
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
158e7a
%endif
158e7a
158e7a
%if ! 0%{?gotest:1}
158e7a
%global gotest go test
158e7a
%endif
158e7a
158e7a
# FAIL: TestFactoryNewTmpfs (0.00s), factory_linux_test.go:59: operation not permitted
158e7a
#%%gotest %%{import_path}/libcontainer
158e7a
%gotest %{import_path}/libcontainer/cgroups
158e7a
%gotest %{import_path}/libcontainer/cgroups/fs
158e7a
%gotest %{import_path}/libcontainer/configs
158e7a
%gotest %{import_path}/libcontainer/devices
158e7a
# undefined reference to `nsexec'
158e7a
#%%gotest %%{import_path}/libcontainer/integration
158e7a
%gotest %{import_path}/libcontainer/label
158e7a
# Unable to create tstEth link: operation not permitted
158e7a
#%%gotest %%{import_path}/libcontainer/netlink
158e7a
# undefined reference to `nsexec'
158e7a
#%%gotest %%{import_path}/libcontainer/nsenter
158e7a
%gotest %{import_path}/libcontainer/selinux
158e7a
%gotest %{import_path}/libcontainer/stacktrace
158e7a
%gotest %{import_path}/libcontainer/user
158e7a
%gotest %{import_path}/libcontainer/utils
158e7a
%gotest %{import_path}/libcontainer/xattr
158e7a
%endif
158e7a
158e7a
#define license tag if not already defined
158e7a
%{!?_licensedir:%global license %doc}
158e7a
158e7a
%files
158e7a
%license LICENSE
158e7a
%doc MAINTAINERS_GUIDE.md PRINCIPLES.md README.md CONTRIBUTING.md
158e7a
%{_bindir}/%{name}
158e7a
%{_mandir}/man8/%{name}*
158e7a
158e7a
%if 0%{?with_devel}
158e7a
%files devel -f devel.file-list
158e7a
%license LICENSE
158e7a
%doc MAINTAINERS_GUIDE.md PRINCIPLES.md README.md CONTRIBUTING.md
158e7a
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
158e7a
%dir %{gopath}/src/%{import_path}
158e7a
%endif
158e7a
158e7a
%if 0%{?with_unit_test} && 0%{?with_devel}
158e7a
%files unit-test -f unit-test.file-list
158e7a
%license LICENSE
158e7a
%doc MAINTAINERS_GUIDE.md PRINCIPLES.md README.md CONTRIBUTING.md
158e7a
%endif
158e7a
158e7a
%changelog
10646f
* Tue May 03 2016 Lokesh Mandvekar <lsm5@redhat.com> - 0.1.0-3
10646f
- add selinux build tag
10646f
- add BR: libseccomp-devel
10646f
10646f
* Tue May 03 2016 Lokesh Mandvekar <lsm5@redhat.com> - 0.1.0-2
10646f
- Resolves: #1328970 - add seccomp buildtag
10646f
10646f
* Tue Apr 19 2016 Lokesh Mandvekar <lsm5@redhat.com> - 0.1.0-1
10646f
- Resolves: rhbz#1328616 - rebase to v0.1.0
10646f
158e7a
* Tue Mar 08 2016 Lokesh Mandvekar <lsm5@redhat.com> - 0.0.8-1.git4155b68
158e7a
- Resolves: rhbz#1277245 - bump to 0.0.8
158e7a
- Resolves: rhbz#1302363 - criu is a runtime dep
158e7a
- Resolves: rhbz#1302348 - libseccomp-golang is bundled in Godeps
158e7a
- manpages included
158e7a
158e7a
* Wed Nov 25 2015 jchaloup <jchaloup@redhat.com> - 1:0.0.5-0.1.git97bc9a7
158e7a
- Update to 0.0.5, introduce Epoch for Fedora due to 0.2 version instead of 0.0.2
158e7a
158e7a
* Fri Aug 21 2015 Jan Chaloupka <jchaloup@redhat.com> - 0.2-0.2.git90e6d37
158e7a
- First package for Fedora
158e7a
  resolves: #1255179