%global provider github %global provider_tld com %global project google %global repo cadvisor %global commit 6906a8ce90e9f00d6a1a8b7530b83bf083622036 %global import_path %{provider}.%{provider_tld}/%{project}/%{repo} %global gopath %{_datadir}/gocode %global shortcommit %(c=%{commit}; echo ${c:0:8}) %global debug_package %{nil} Name: %{repo} Version: 0.4.1 Release: 0.3.git%{shortcommit}%{?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 #BuildRequires: docker-io-pkg-devel BuildRequires: systemd BuildRequires: golang >= 1.2.1-3 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. %prep %setup -n %{name}-%{commit} -q %build mkdir _build pushd _build mkdir -p src/github.com/google ln -s $(dirs +1 -l) src/github.com/google/cadvisor popd ### FIXME ### Upstream uses this invocation of go build but it fails with the following: # go build --ldflags '-extldflags "-static"' github.com/google/cadvisor # # github.com/google/cadvisor # /usr/bin/ld: cannot find -lpthread # /usr/bin/ld: cannot find -lc # collect2: error: ld returned 1 exit status # /usr/lib/golang/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100 # # It *seems* fine without it, but I assume upstream has a reason for doing # this, however I've yet to get a response on why and if it's necessary. GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/_build:%{gopath} go build 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 %check for dir in client container info manager storage/memory utils/procfs; do GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/_build:%{gopath} go test github.com/google/cadvisor/$dir done %post %systemd_post cadvisor.service %preun %systemd_preun cadvisor.service %postun %systemd_postun %files %doc AUTHORS CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS LICENSE README.md %{_bindir}/cadvisor %{_unitdir}/%{name}.service %config(noreplace) %{_sysconfdir}/sysconfig/%{name} %changelog * Mon Oct 06 2014 jchaloup - 0.4.1-0.3.git6906a8ce - Move cadvisor.service and cadvisor config file from patch into repo * Sun Oct 05 2014 Eric Paris - 0.4.1-0.2.git6906a8ce - Fix cadvisor storage driver since upstream removed 'memory' * Wed Oct 01 2014 jchaloup - 0.4.1-0.1.git6906a8ce - Bump to upstream 6906a8ce90e9f00d6a1a8b7530b83bf083622036 - remove -devel subpackage - remove golang dependencies and build with Godeps directory - adding go test in check section * Fri Sep 19 2014 Lokesh Mandvekar - 0.3.0-0.3.git9d158c3 - own parent directory of - preserve timestamps of copied files in -devel - use _unitdir macro for systemd install path * Fri Sep 12 2014 Eric Paris - 0.2.0-1 - First package for Fedora