Blame SPECS/cadvisor.spec

058502
%global provider	github
058502
%global provider_tld	com
058502
%global project		google
058502
%global repo		cadvisor
058502
%global commit		6906a8ce90e9f00d6a1a8b7530b83bf083622036
058502
058502
%global import_path	%{provider}.%{provider_tld}/%{project}/%{repo}
058502
%global gopath		%{_datadir}/gocode
058502
%global shortcommit	%(c=%{commit}; echo ${c:0:8})
058502
%global debug_package	%{nil}
058502
058502
Name:		%{repo}
058502
Version:	0.4.1
058502
Release:	0.3.git%{shortcommit}%{?dist}
058502
Summary:	Analyzes resource usage and performance characteristics of running containers
058502
License:	ASL 2.0
058502
URL:		https://%{import_path}
058502
Source0:	https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
058502
Source1:	cadvisor
058502
Source2:	cadvisor.service
058502
#BuildRequires:	docker-io-pkg-devel
058502
BuildRequires:	systemd
058502
BuildRequires:	golang >= 1.2.1-3
058502
ExclusiveArch:	x86_64 
058502
058502
%description
058502
%{summary}
058502
058502
cAdvisor (Container Advisor) provides container users an understanding of the
058502
resource usage and performance characteristics of their running containers.
058502
It is a running daemon that collects, aggregates, processes, and exports
058502
information about running containers. Specifically, for each container it keeps
058502
resource isolation parameters, historical resource usage, histograms of
058502
complete historical resource usage and network statistics. This data is
058502
exported by container and machine-wide.
058502
058502
cAdvisor currently supports lmctfy containers as well as Docker containers
058502
(those that use the default libcontainer execdriver). Other container backends
058502
can also be added. cAdvisor's container abstraction is based on lmctfy's
058502
so containers are inherently nested hierarchically.
058502
058502
058502
%prep
058502
%setup -n %{name}-%{commit} -q
058502
058502
%build
058502
mkdir _build
058502
058502
pushd _build
058502
  mkdir -p src/github.com/google
058502
  ln -s $(dirs +1 -l) src/github.com/google/cadvisor
058502
popd
058502
058502
### FIXME
058502
### Upstream uses this invocation of go build but it fails with the following:
058502
# go build --ldflags '-extldflags "-static"' github.com/google/cadvisor
058502
#   # github.com/google/cadvisor
058502
#   /usr/bin/ld: cannot find -lpthread
058502
#   /usr/bin/ld: cannot find -lc
058502
#   collect2: error: ld returned 1 exit status
058502
#   /usr/lib/golang/pkg/tool/linux_amd64/6l: running gcc failed: unsuccessful exit status 0x100
058502
#
058502
# It *seems* fine without it, but I assume upstream has a reason for doing
058502
# this, however I've yet to get a response on why and if it's necessary.
058502
058502
GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/_build:%{gopath} go build github.com/google/cadvisor
058502
058502
%install
058502
# main package binary
058502
install -d -p %{buildroot}%{_bindir}
058502
install -p -m0755 cadvisor %{buildroot}%{_bindir}
058502
058502
# install systemd/sysconfig 
058502
install -d -m0755 %{buildroot}%{_sysconfdir}/sysconfig/
058502
install -p -m0660 %{SOURCE1} %{buildroot}%{_sysconfdir}/sysconfig/%{name} 
058502
install -d -m0755 %{buildroot}%{_unitdir}
058502
install -p -m0644 %{SOURCE2} %{buildroot}%{_unitdir}/%{name}.service
058502
058502
%check
058502
for dir in client container info manager storage/memory utils/procfs; do
058502
	GOPATH=$(pwd)/Godeps/_workspace:$(pwd)/_build:%{gopath} go test github.com/google/cadvisor/$dir
058502
done
058502
058502
%post
058502
%systemd_post cadvisor.service
058502
058502
%preun
058502
%systemd_preun cadvisor.service
058502
058502
%postun
058502
%systemd_postun
058502
058502
%files
058502
%doc AUTHORS CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS LICENSE README.md 
058502
%{_bindir}/cadvisor
058502
%{_unitdir}/%{name}.service
058502
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
058502
058502
%changelog
058502
* Mon Oct 06 2014 jchaloup <jchaloup@redhat.com> - 0.4.1-0.3.git6906a8ce
058502
- Move cadvisor.service and cadvisor config file from patch into repo
058502
058502
* Sun Oct 05 2014 Eric Paris <eparis@redhat.com> - 0.4.1-0.2.git6906a8ce
058502
- Fix cadvisor storage driver since upstream removed 'memory'
058502
058502
* Wed Oct 01 2014 jchaloup <jchaloup@redhat.com> - 0.4.1-0.1.git6906a8ce
058502
- Bump to upstream 6906a8ce90e9f00d6a1a8b7530b83bf083622036
058502
- remove -devel subpackage
058502
- remove golang dependencies and build with Godeps directory
058502
- adding go test in check section
058502
058502
* Fri Sep 19 2014 Lokesh Mandvekar <lsm5@fedoraproject.org> - 0.3.0-0.3.git9d158c3
058502
- own parent directory of <gopath</src/<import_path>
058502
- preserve timestamps of copied files in -devel
058502
- use _unitdir macro for systemd install path
058502
058502
* Fri Sep 12 2014 Eric Paris 
058502
- Log to stderr (and thus journal) by default
058502
058502
* Thu Sep 11 2014 Eric Paris 
058502
- Bump to upstream 9d158c3d66e8e6d14cfeb1d73695ab18dbc744e8
058502
058502
* Wed Aug 20 2014 Eric Paris 
058502
- Bump to upstream 17b0ec576bcbeb321c133e4378dee1e500c9850d
058502
058502
* Thu Aug 07 2014 Adam Miller <maxamillion@fedoraproject.org> - 0.2.0-1
058502
- First package for Fedora