6fd958a2c3
- resolves: #1255179
259 lines
9.8 KiB
RPMSpec
259 lines
9.8 KiB
RPMSpec
%if 0%{?fedora} || 0%{?rhel} == 6
|
|
%global with_devel 1
|
|
%global with_bundled 0
|
|
%global with_debug 1
|
|
%global with_check 1
|
|
%global with_unit_test 1
|
|
%else
|
|
%global with_devel 0
|
|
%global with_bundled 0
|
|
%global with_debug 0
|
|
%global with_check 0
|
|
%global with_unit_test 0
|
|
%endif
|
|
|
|
%if 0%{?with_debug}
|
|
%global _dwz_low_mem_die_limit 0
|
|
%else
|
|
%global debug_package %{nil}
|
|
%endif
|
|
|
|
%global provider github
|
|
%global provider_tld com
|
|
%global project opencontainers
|
|
%global repo runc
|
|
# https://github.com/opencontainers/runc
|
|
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
|
|
%global import_path %{provider_prefix}
|
|
%global commit 90e6d3763e917ca0d6c24c63c07320f0424fcd0c
|
|
%global shortcommit %(c=%{commit}; echo ${c:0:7})
|
|
|
|
Name: %{repo}
|
|
Version: 0.2
|
|
Release: 0.2.git%{shortcommit}%{?dist}
|
|
Summary: CLI for running Open Containers
|
|
License: ASL 2.0
|
|
URL: https://%{provider_prefix}
|
|
Source0: https://%{provider_prefix}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
|
|
|
|
ExclusiveArch: x86_64
|
|
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
|
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
|
|
|
%if ! 0%{?with_bundled}
|
|
BuildRequires: golang(github.com/Sirupsen/logrus)
|
|
BuildRequires: golang(github.com/codegangsta/cli)
|
|
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
|
|
BuildRequires: golang(github.com/coreos/go-systemd/util)
|
|
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/docker/docker/pkg/units)
|
|
BuildRequires: golang(github.com/godbus/dbus)
|
|
BuildRequires: golang(github.com/golang/protobuf/proto)
|
|
BuildRequires: golang(github.com/opencontainers/specs)
|
|
BuildRequires: golang(github.com/syndtr/gocapability/capability)
|
|
%endif
|
|
|
|
%description
|
|
The runc command can be used to start containers which are packaged
|
|
in accordance with the Open Container Initiative's specifications,
|
|
and to manage containers running under runc.
|
|
|
|
%if 0%{?with_devel}
|
|
%package devel
|
|
Summary: %{summary}
|
|
BuildArch: noarch
|
|
|
|
%if 0%{?with_check}
|
|
BuildRequires: golang(github.com/Sirupsen/logrus)
|
|
BuildRequires: golang(github.com/coreos/go-systemd/dbus)
|
|
BuildRequires: golang(github.com/coreos/go-systemd/util)
|
|
BuildRequires: golang(github.com/docker/docker/pkg/mount)
|
|
BuildRequires: golang(github.com/docker/docker/pkg/symlink)
|
|
BuildRequires: golang(github.com/docker/docker/pkg/units)
|
|
BuildRequires: golang(github.com/godbus/dbus)
|
|
BuildRequires: golang(github.com/golang/protobuf/proto)
|
|
BuildRequires: golang(github.com/syndtr/gocapability/capability)
|
|
%endif
|
|
|
|
Requires: golang(github.com/Sirupsen/logrus)
|
|
Requires: golang(github.com/coreos/go-systemd/dbus)
|
|
Requires: golang(github.com/coreos/go-systemd/util)
|
|
Requires: golang(github.com/docker/docker/pkg/mount)
|
|
Requires: golang(github.com/docker/docker/pkg/symlink)
|
|
Requires: golang(github.com/docker/docker/pkg/units)
|
|
Requires: golang(github.com/godbus/dbus)
|
|
Requires: golang(github.com/golang/protobuf/proto)
|
|
Requires: golang(github.com/syndtr/gocapability/capability)
|
|
|
|
Provides: golang(%{import_path}/libcontainer) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/apparmor) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/cgroups) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/cgroups/fs) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/cgroups/systemd) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/configs) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/configs/validate) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/criurpc) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/devices) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/integration) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/label) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/netlink) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/nsenter) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/seccomp) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/selinux) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/stacktrace) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/system) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/user) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/utils) = %{version}-%{release}
|
|
Provides: golang(%{import_path}/libcontainer/xattr) = %{version}-%{release}
|
|
|
|
%description devel
|
|
The runc command can be used to start containers which are packaged
|
|
in accordance with the Open Container Initiative's specifications,
|
|
and to manage containers running under runc.
|
|
|
|
This package contains library source intended for
|
|
building other packages which use import path with
|
|
%{import_path} prefix.
|
|
%endif
|
|
|
|
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
%package unit-test
|
|
Summary: Unit tests for %{name} package
|
|
# If go_compiler is not set to 1, there is no virtual provide. Use golang instead.
|
|
BuildRequires: %{?go_compiler:compiler(go-compiler)}%{!?go_compiler:golang}
|
|
|
|
%if 0%{?with_check}
|
|
#Here comes all BuildRequires: PACKAGE the unit tests
|
|
#in %%check section need for running
|
|
%endif
|
|
|
|
# test subpackage tests code from devel subpackage
|
|
Requires: %{name}-devel = %{version}-%{release}
|
|
|
|
%description unit-test
|
|
The runc command can be used to start containers which are packaged
|
|
in accordance with the Open Container Initiative's specifications,
|
|
and to manage containers running under runc.
|
|
|
|
This package contains unit tests for project
|
|
providing packages with %{import_path} prefix.
|
|
%endif
|
|
|
|
%prep
|
|
%setup -q -n %{repo}-%{commit}
|
|
|
|
%build
|
|
mkdir -p src/github.com/opencontainers
|
|
ln -s ../../../ src/github.com/opencontainers/runc
|
|
|
|
%if ! 0%{?with_bundled}
|
|
export GOPATH=$(pwd):%{gopath}
|
|
%else
|
|
export GOPATH=$(pwd):$(pwd)/Godeps/_workspace:%{gopath}
|
|
%endif
|
|
|
|
%if ! 0%{?gobuild:1}
|
|
%define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
|
|
%endif
|
|
|
|
%gobuild -o bin/%{name} %{import_path}
|
|
|
|
%install
|
|
install -d -p %{buildroot}%{_bindir}
|
|
install -p -m 755 bin/%{name} %{buildroot}%{_bindir}
|
|
|
|
# source codes for building projects
|
|
%if 0%{?with_devel}
|
|
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
# find all *.go but no *_test.go files and generate devel.file-list
|
|
for file in $(find . -iname "*.go" \! -iname "*_test.go" | grep -v "^./Godeps") ; do
|
|
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
|
|
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
|
|
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
|
|
done
|
|
for file in $(find . -iname "*.proto" | grep -v "^./Godeps") ; do
|
|
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
|
|
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
|
|
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
echo "%%{gopath}/src/%%{import_path}/$file" >> devel.file-list
|
|
done
|
|
%endif
|
|
|
|
# testing files for this project
|
|
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/
|
|
# find all *_test.go files and generate unit-test.file-list
|
|
for file in $(find . -iname "*_test.go" | grep -v "^./Godeps"); do
|
|
echo "%%dir %%{gopath}/src/%%{import_path}/$(dirname $file)" >> devel.file-list
|
|
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/$(dirname $file)
|
|
cp -pav $file %{buildroot}/%{gopath}/src/%{import_path}/$file
|
|
echo "%%{gopath}/src/%%{import_path}/$file" >> unit-test.file-list
|
|
done
|
|
%endif
|
|
|
|
%if 0%{?with_devel}
|
|
sort -u -o devel.file-list devel.file-list
|
|
%endif
|
|
|
|
%check
|
|
%if 0%{?with_check} && 0%{?with_unit_test} && 0%{?with_devel}
|
|
%if ! 0%{?with_bundled}
|
|
export GOPATH=%{buildroot}/%{gopath}:%{gopath}
|
|
%else
|
|
export GOPATH=%{buildroot}/%{gopath}:$(pwd)/Godeps/_workspace:%{gopath}
|
|
%endif
|
|
|
|
%if ! 0%{?gotest:1}
|
|
%global gotest go test
|
|
%endif
|
|
|
|
# FAIL: TestFactoryNewTmpfs (0.00s), factory_linux_test.go:59: operation not permitted
|
|
#%%gotest %%{import_path}/libcontainer
|
|
%gotest %{import_path}/libcontainer/cgroups
|
|
%gotest %{import_path}/libcontainer/cgroups/fs
|
|
%gotest %{import_path}/libcontainer/configs
|
|
%gotest %{import_path}/libcontainer/devices
|
|
# undefined reference to `nsexec'
|
|
#%%gotest %%{import_path}/libcontainer/integration
|
|
%gotest %{import_path}/libcontainer/label
|
|
# Unable to create tstEth link: operation not permitted
|
|
#%%gotest %%{import_path}/libcontainer/netlink
|
|
# undefined reference to `nsexec'
|
|
#%%gotest %%{import_path}/libcontainer/nsenter
|
|
%gotest %{import_path}/libcontainer/selinux
|
|
%gotest %{import_path}/libcontainer/stacktrace
|
|
%gotest %{import_path}/libcontainer/user
|
|
%gotest %{import_path}/libcontainer/utils
|
|
%gotest %{import_path}/libcontainer/xattr
|
|
%endif
|
|
|
|
#define license tag if not already defined
|
|
%{!?_licensedir:%global license %doc}
|
|
|
|
%files
|
|
%license LICENSE
|
|
%doc MAINTAINERS_GUIDE.md PRINCIPLES.md README.md CONTRIBUTING.md
|
|
%{_bindir}/%{name}
|
|
|
|
%if 0%{?with_devel}
|
|
%files devel -f devel.file-list
|
|
%license LICENSE
|
|
%doc MAINTAINERS_GUIDE.md PRINCIPLES.md README.md CONTRIBUTING.md
|
|
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
|
|
%dir %{gopath}/src/%{import_path}
|
|
%endif
|
|
|
|
%if 0%{?with_unit_test} && 0%{?with_devel}
|
|
%files unit-test -f unit-test.file-list
|
|
%license LICENSE
|
|
%doc MAINTAINERS_GUIDE.md PRINCIPLES.md README.md CONTRIBUTING.md
|
|
%endif
|
|
|
|
%changelog
|
|
* Fri Aug 21 2015 Jan Chaloupka <jchaloup@redhat.com> - 0.2-0.2.git90e6d37
|
|
- First package for Fedora
|
|
resolves: #1255179
|