Blob Blame History Raw
# https://bugzilla.redhat.com/show_bug.cgi?id=995136#c12
%global _dwz_low_mem_die_limit 0
%global provider	github
%global provider_tld	com
%global project		google
%global repo		cadvisor
%global commit		35e876232a0a99a0fb70fd5e59c621cd8c1f790f
%global import_path	%{provider}.%{provider_tld}/%{project}/%{repo}
%global shortcommit	%(c=%{commit}; echo ${c:0:7})

Name:		%{repo}
Version:	0.13.0
Release:	1%{?dist}
Summary:	Analyzes resource usage and performance characteristics of running containers
License:	ASL 2.0
URL:		https://%{import_path}
Source0:	https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
Source1:	cadvisor
Source2:	cadvisor.service
Patch0:		0001-change-import-path.patch

BuildRequires:	docker-io-pkg-devel
BuildRequires:	git
BuildRequires:	systemd
BuildRequires:	glibc-static
BuildRequires:	golang >= 1.2.1-3

BuildRequires: golang(code.google.com/p/go.exp/inotify)
BuildRequires: golang(code.google.com/p/gomock/gomock)
BuildRequires: golang(code.google.com/p/google-api-go-client/bigquery/v2)
BuildRequires: golang(github.com/abbot/go-http-auth)
BuildRequires: golang(github.com/docker/docker/pkg/units)
BuildRequires: golang(github.com/docker/docker/pkg/mount)
BuildRequires: golang(github.com/docker/libcontainer/cgroups)
BuildRequires: golang(github.com/docker/libcontainer/cgroups/fs)
BuildRequires: golang(github.com/docker/libcontainer/configs)
BuildRequires: golang(github.com/docker/libcontainer/cgroups/systemd)
BuildRequires: golang(github.com/docker/libcontainer)
BuildRequires: golang(github.com/fsouza/go-dockerclient)
BuildRequires: golang(github.com/golang/glog)
BuildRequires: golang(github.com/influxdb/influxdb/client)
BuildRequires: golang(github.com/kr/pretty)
BuildRequires: golang(github.com/prometheus/client_golang/prometheus)
BuildRequires: golang(github.com/stretchr/testify/assert)
BuildRequires: golang(github.com/stretchr/testify/mock)
BuildRequires: golang(github.com/stretchr/testify/require)
BuildRequires: golang(golang.org/x/oauth2)
BuildRequires: golang(golang.org/x/oauth2/jwt)
BuildRequires: golang(google.golang.org/cloud/compute/metadata)

# indirect deps of docker
BuildRequires:  golang(github.com/Sirupsen/logrus)

ExclusiveArch:	x86_64 

%description
%{summary}

cAdvisor (Container Advisor) provides container users an understanding of the
resource usage and performance characteristics of their running containers.
It is a running daemon that collects, aggregates, processes, and exports
information about running containers. Specifically, for each container it keeps
resource isolation parameters, historical resource usage, histograms of
complete historical resource usage and network statistics. This data is
exported by container and machine-wide.

cAdvisor currently supports lmctfy containers as well as Docker containers
(those that use the default libcontainer execdriver). Other container backends
can also be added. cAdvisor's container abstraction is based on lmctfy's
so containers are inherently nested hierarchically.

%package devel
Summary:	Analyzes resource usage and performance characteristics of running containers

BuildRequires: golang >= 1.2.1-3
BuildRequires: docker-io-pkg-devel
BuildRequires: golang(code.google.com/p/go.exp/inotify)
BuildRequires: golang(code.google.com/p/gomock/gomock)
BuildRequires: golang(code.google.com/p/google-api-go-client/bigquery/v2)
BuildRequires: golang(github.com/abbot/go-http-auth)
BuildRequires: golang(github.com/docker/docker/pkg/units)
BuildRequires: golang(github.com/docker/docker/pkg/mount)
BuildRequires: golang(github.com/docker/libcontainer/cgroups)
BuildRequires: golang(github.com/docker/libcontainer/cgroups/fs)
BuildRequires: golang(github.com/docker/libcontainer/configs)
BuildRequires: golang(github.com/docker/libcontainer/cgroups/systemd)
BuildRequires: golang(github.com/docker/libcontainer)
BuildRequires: golang(github.com/fsouza/go-dockerclient)
BuildRequires: golang(github.com/golang/glog)
BuildRequires: golang(github.com/influxdb/influxdb/client)
BuildRequires: golang(github.com/kr/pretty)
BuildRequires: golang(github.com/prometheus/client_golang/prometheus)
BuildRequires: golang(github.com/stretchr/testify/assert)
BuildRequires: golang(github.com/stretchr/testify/mock)
BuildRequires: golang(github.com/stretchr/testify/require)
BuildRequires: golang(golang.org/x/oauth2)
BuildRequires: golang(golang.org/x/oauth2/jwt)
BuildRequires: golang(google.golang.org/cloud/compute/metadata)

Requires: golang >= 1.2.1-3
Requires: docker-io-pkg-devel
Requires: golang(code.google.com/p/go.exp/inotify)
Requires: golang(code.google.com/p/gomock/gomock)
Requires: golang(code.google.com/p/google-api-go-client/bigquery/v2)
Requires: golang(github.com/abbot/go-http-auth)
Requires: golang(github.com/docker/docker/pkg/units)
Requires: golang(github.com/docker/docker/pkg/mount)
Requires: golang(github.com/docker/libcontainer/cgroups)
Requires: golang(github.com/docker/libcontainer/cgroups/fs)
Requires: golang(github.com/docker/libcontainer/configs)
Requires: golang(github.com/docker/libcontainer/cgroups/systemd)
Requires: golang(github.com/docker/libcontainer)
Requires: golang(github.com/fsouza/go-dockerclient)
Requires: golang(github.com/golang/glog)
Requires: golang(github.com/influxdb/influxdb/client)
Requires: golang(github.com/kr/pretty)
Requires: golang(github.com/prometheus/client_golang/prometheus)
Requires: golang(github.com/stretchr/testify/assert)
Requires: golang(github.com/stretchr/testify/mock)
Requires: golang(github.com/stretchr/testify/require)
Requires: golang(golang.org/x/oauth2)
Requires: golang(golang.org/x/oauth2/jwt)
Requires: golang(google.golang.org/cloud/compute/metadata)

Provides: golang(%{import_path}/api) = %{version}-%{release}
Provides: golang(%{import_path}/client) = %{version}-%{release}
Provides: golang(%{import_path}/client/v2) = %{version}-%{release}
Provides: golang(%{import_path}/container) = %{version}-%{release}
Provides: golang(%{import_path}/container/docker) = %{version}-%{release}
Provides: golang(%{import_path}/container/libcontainer) = %{version}-%{release}
Provides: golang(%{import_path}/container/raw) = %{version}-%{release}
Provides: golang(%{import_path}/events) = %{version}-%{release}
Provides: golang(%{import_path}/fs) = %{version}-%{release}
Provides: golang(%{import_path}/healthz) = %{version}-%{release}
Provides: golang(%{import_path}/http) = %{version}-%{release}
Provides: golang(%{import_path}/http/mux) = %{version}-%{release}
Provides: golang(%{import_path}/info/v1) = %{version}-%{release}
Provides: golang(%{import_path}/info/v1/test) = %{version}-%{release}
Provides: golang(%{import_path}/info/v2) = %{version}-%{release}
Provides: golang(%{import_path}/integration/common) = %{version}-%{release}
Provides: golang(%{import_path}/integration/framework) = %{version}-%{release}
Provides: golang(%{import_path}/integration/tests/api) = %{version}-%{release}
Provides: golang(%{import_path}/manager) = %{version}-%{release}
Provides: golang(%{import_path}/metrics) = %{version}-%{release}
Provides: golang(%{import_path}/pages) = %{version}-%{release}
Provides: golang(%{import_path}/pages/static) = %{version}-%{release}
Provides: golang(%{import_path}/storage) = %{version}-%{release}
Provides: golang(%{import_path}/storage/bigquery) = %{version}-%{release}
Provides: golang(%{import_path}/storage/bigquery/client) = %{version}-%{release}
Provides: golang(%{import_path}/storage/influxdb) = %{version}-%{release}
Provides: golang(%{import_path}/storage/memory) = %{version}-%{release}
Provides: golang(%{import_path}/storage/test) = %{version}-%{release}
Provides: golang(%{import_path}/summary) = %{version}-%{release}
Provides: golang(%{import_path}/utils) = %{version}-%{release}
Provides: golang(%{import_path}/utils/cpuload) = %{version}-%{release}
Provides: golang(%{import_path}/utils/cpuload/netlink) = %{version}-%{release}
Provides: golang(%{import_path}/utils/fs) = %{version}-%{release}
Provides: golang(%{import_path}/utils/fs/mockfs) = %{version}-%{release}
Provides: golang(%{import_path}/utils/oomparser) = %{version}-%{release}
Provides: golang(%{import_path}/utils/procfs) = %{version}-%{release}
Provides: golang(%{import_path}/utils/sysfs) = %{version}-%{release}
Provides: golang(%{import_path}/utils/sysfs/fakesysfs) = %{version}-%{release}
Provides: golang(%{import_path}/utils/sysinfo) = %{version}-%{release}
Provides: golang(%{import_path}/validate) = %{version}-%{release}
Provides: golang(%{import_path}/version) = %{version}-%{release}

%description devel
%{summary}

cAdvisor (Container Advisor) provides container users an understanding of the
resource usage and performance characteristics of their running containers.
It is a running daemon that collects, aggregates, processes, and exports
information about running containers. Specifically, for each container it keeps
resource isolation parameters, historical resource usage, histograms of
complete historical resource usage and network statistics. This data is
exported by container and machine-wide.

cAdvisor currently supports lmctfy containers as well as Docker containers
(those that use the default libcontainer execdriver). Other container backends
can also be added. cAdvisor's container abstraction is based on lmctfy's
so containers are inherently nested hierarchically.

%prep
%autosetup -Sgit -n %{name}-%{commit}

%build
mkdir _build

pushd _build
  mkdir -p src/github.com/google
  ln -s $(dirs +1 -l) src/github.com/google/cadvisor
popd
export GOPATH=$(pwd)/_build:%{gopath}

function gobuild { go build -a -ldflags "-B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \n')" -v -x "$@"; }
gobuild %{import_path}
#go build --ldflags '-extldflags "-static"' github.com/google/cadvisor

%install
# main package binary
install -d -p %{buildroot}%{_bindir}
install -p -m0755 cadvisor %{buildroot}%{_bindir}

# install systemd/sysconfig 
install -d -m0755 %{buildroot}%{_sysconfdir}/sysconfig/
install -p -m0660 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name} 
install -d -m0755 %{buildroot}%{_unitdir}
install -p -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service

# devel package golang libs
install -d -p %{buildroot}/%{gopath}/src/%{import_path}/

for d in api client container deploy fs healthz info manager pages storage \
       utils
do
    cp -pav $d %{buildroot}/%{gopath}/src/%{import_path}/
done

%post
%systemd_post cadvisor.service

%preun
%systemd_preun cadvisor.service

%postun
%systemd_postun

%files
%doc AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE README.md 
%doc Godeps/Godeps.json
%{_bindir}/cadvisor
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}

%files devel
%doc AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE README.md 
%doc Godeps/Godeps.json
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
%dir %{gopath}/src/%{import_path}
%dir %{gopath}/src/%{import_path}/api
%dir %{gopath}/src/%{import_path}/client
%dir %{gopath}/src/%{import_path}/container
%dir %{gopath}/src/%{import_path}/deploy
%dir %{gopath}/src/%{import_path}/healthz
%dir %{gopath}/src/%{import_path}/fs
%dir %{gopath}/src/%{import_path}/info
%dir %{gopath}/src/%{import_path}/manager
%dir %{gopath}/src/%{import_path}/pages
%dir %{gopath}/src/%{import_path}/storage
%dir %{gopath}/src/%{import_path}/utils
%{gopath}/src/%{import_path}/api/*
%{gopath}/src/%{import_path}/client/*
%{gopath}/src/%{import_path}/container/*
%{gopath}/src/%{import_path}/deploy/*
%{gopath}/src/%{import_path}/healthz/*
%{gopath}/src/%{import_path}/fs/*
%{gopath}/src/%{import_path}/info/*
%{gopath}/src/%{import_path}/manager/*
%{gopath}/src/%{import_path}/pages/*
%{gopath}/src/%{import_path}/storage/*
%{gopath}/src/%{import_path}/utils/*

%changelog
* Fri May 08 2015 jchaloup <jchaloup@redhat.com> - 0.13.0-1
- Update to 0.13.0
- Add missing [B]Rs for devel subpackage
- Add Godeps.json to docs
  resolves: #1219972

* Thu Apr 09 2015 jchaloup <jchaloup@redhat.com> - 0.10.1-2
- Remove wrong option in cadvisor.service
  resolves: #1210336

* Mon Mar 30 2015 jchaloup <jchaloup@redhat.com> - 0.10.1-0.1.gitef7dddf
- Update to 0.10.1
- Add debug info
  related: #1141896

* Thu Mar 26 2015 jchaloup <jchaloup@redhat.com> - 0.6.2-0.3.git89088df
- Fix broken dependencies
- Convert int64 to float64 when calling HumanSize
  related: #1141896

* Fri Dec 12 2014 jchaloup <jchaloup@redhat.com> - 0.6.2-0.1.git89088df
- remove -q option from autosetup, it is not supported
  related: #1141896

* Fri Dec 05 2014 Eric Paris <eparis@redhat.com> - 0.6.2-0.0.git89088df
- Bump to upstream 89088df70eca64cf9d6b9a23a3d2bc21a30916d6

* Fri Nov 14 2014 Eric Paris <eparis@redhat.com> - 0.6.0-0.0.git1e98602
- update to 0.6.0

* Fri Nov 14 2014 Eric Paris <eparis@redhat.com> - 0.5.0-0.1.git8c4f650
- include fs/*.go

* Thu Nov 13 2014 Eric Paris <eparis@redhat.com> - 0.5.0-0.0.git8c4f650
- update to 0.5.0

* Sat Oct 18 2014 jchaloup <jchaloup@redhat.com> - 0.4.1-0.1.git6906a8c
- update to 0.4.1

* Thu Oct 09 2014 jchaloup <jchaloup@redhat.com> - 0.3.0-0.4.git9d158c3
- Move cadvisor.service and cadvisor config file from patch into repo
- Fix the build, thanks to Lokesh

* Fri Sep 19 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.3.0-0.3.git9d158c3
- own parent directory of <gopath</src/<import_path>
- preserve timestamps of copied files in -devel
- use _unitdir macro for systemd install path

* Fri Sep 12 2014 Eric Paris <eparis@redhat.com - 0.3.0-0.2.git9d158c3
- Log to stderr (and thus journal) by default

* Thu Sep 11 2014 Eric Paris <eparis@redhat.com - 0.3.0-0.1.git9d158c3
- Bump to upstream 9d158c3d66e8e6d14cfeb1d73695ab18dbc744e8

* Wed Aug 20 2014 Eric Paris <eparis@redhat.com - 0.2.0-2
- Bump to upstream 17b0ec576bcbeb321c133e4378dee1e500c9850d

* Thu Aug 07 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.2.0-1
- First package for Fedora