commit fc3b8db50b440a78e9164db1c1c5acde8496396c
Author: Eric Paris <eparis(a)redhat.com>
Date: Fri Dec 5 19:09:17 2014 -0500
Bump to upstream 89088df70eca64cf9d6b9a23a3d2bc21a30916d6
.gitignore | 1 +
0001-support-the-new-libcontiner.patch | 53 ++++++++++++++
add-chglog | 117 ++++++++++++++++++++++++++++++++
cadvisor.spec | 16 +++--
getsource.sh | 50 ++++++++++++++
sources | 2 +-
6 files changed, 233 insertions(+), 6 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 63f88a7..8fe634f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
clog
/cadvisor-6906a8c.tar.gz
/cadvisor-8c4f650.tar.gz
+/cadvisor-89088df.tar.gz
diff --git a/0001-support-the-new-libcontiner.patch
b/0001-support-the-new-libcontiner.patch
new file mode 100644
index 0000000..91b4694
--- /dev/null
+++ b/0001-support-the-new-libcontiner.patch
@@ -0,0 +1,53 @@
+From 22c88d96b0a9e80cf6ec5e538963d17b6d350443 Mon Sep 17 00:00:00 2001
+From: Eric Paris <eparis(a)redhat.com>
+Date: Fri, 5 Dec 2014 19:02:44 -0500
+Subject: [PATCH] "support" the new libcontiner
+
+---
+ container/libcontainer/helpers.go | 10 +---------
+ container/raw/handler.go | 1 -
+ 2 files changed, 1 insertion(+), 10 deletions(-)
+
+diff --git a/container/libcontainer/helpers.go b/container/libcontainer/helpers.go
+index 2d28e6f..156bbce 100644
+--- a/container/libcontainer/helpers.go
++++ b/container/libcontainer/helpers.go
+@@ -30,7 +30,7 @@ func GetStats(cgroup *cgroups.Cgroup, state *libcontainer.State)
(*info.Containe
+ stats := &libcontainer.ContainerStats{}
+
+ var err error
+- stats.CgroupStats, err = cgroupfs.GetStats(cgroup)
++ stats.CgroupStats, err = cgroupfs.GetStats(state.CgroupPaths)
+ if err != nil {
+ return &info.ContainerStats{}, err
+ }
+@@ -39,14 +39,6 @@ func GetStats(cgroup *cgroups.Cgroup, state *libcontainer.State)
(*info.Containe
+ return toContainerStats(stats), nil
+ }
+
+-func GetStatsCgroupOnly(cgroup *cgroups.Cgroup) (*info.ContainerStats, error) {
+- s, err := cgroupfs.GetStats(cgroup)
+- if err != nil {
+- return nil, err
+- }
+- return toContainerStats(&libcontainer.ContainerStats{CgroupStats: s}), nil
+-}
+-
+ func DiskStatsCopy(blkio_stats []cgroups.BlkioStatEntry) (stat []info.PerDiskStats) {
+ if len(blkio_stats) == 0 {
+ return
+diff --git a/container/raw/handler.go b/container/raw/handler.go
+index 433a07b..1bc3d1f 100644
+--- a/container/raw/handler.go
++++ b/container/raw/handler.go
+@@ -252,7 +252,6 @@ func (self *rawContainerHandler) GetStats() (*info.ContainerStats,
error) {
+ NetworkState: network.NetworkState{
+ VethHost: self.networkInterface.VethHost,
+ VethChild: self.networkInterface.VethChild,
+- NsPath: "unknown",
+ },
+ }
+ }
+--
+1.9.3
+
diff --git a/add-chglog b/add-chglog
new file mode 100755
index 0000000..513026a
--- /dev/null
+++ b/add-chglog
@@ -0,0 +1,117 @@
+#!/usr/bin/python -t
+# -*- mode: Python; indent-tabs-mode: nil; coding: utf-8 -*-
+#
+# Copyright (c) 2005-2013 Fedora Project
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+import re
+import subprocess
+import sys
+import textwrap
+import time
+from optparse import OptionParser
+
+
+__version__ = "1.0.12"
+
+class SpecFile:
+ def __init__(self, filename):
+ self.filename = filename
+ f = None
+ try:
+ f = open(filename,"r")
+ self.lines = f.readlines()
+ finally:
+ f and f.close()
+
+ _changelog_pattern = re.compile(r"^%changelog(\s|$)", re.I)
+
+ def addChangelogEntry(self, evr, entry, email):
+ for i in range(len(self.lines)):
+ if SpecFile._changelog_pattern.match(self.lines[i]):
+ if len(evr):
+ evrstring = ' - %s' % evr
+ else:
+ evrstring = ''
+ date = time.strftime("%a %b %d %Y", time.gmtime())
+ newchangelogentry = "* %s %s%s\n%s\n\n" % \
+ (date, email, evrstring, entry)
+ self.lines[i] += newchangelogentry
+ return
+
+ def writeFile(self, filename):
+ f = open(filename, "w")
+ f.writelines(self.lines)
+ f.close()
+
+ def debugdiff(self, old, new):
+ print ('%s\n-%s\n+%s\n' % (self.filename, old, new))
+
+if __name__ == "__main__":
+ usage = '''Usage: %prog [OPTION]... SPECFILE...'''
+
+ userstring = subprocess.Popen("rpmdev-packager 2>/dev/null", shell =
True,
+ stdout = subprocess.PIPE).communicate()[0]
+ userstring = userstring.strip() or None
+
+ parser = OptionParser(usage=usage)
+ parser.add_option("-c", "--comment", default='-
rebuilt',
+ help="changelog comment (default: \"-
rebuilt\")")
+ parser.add_option("-u", "--userstring", default=userstring,
+ help="user name+email string (default: output from "+
+ "rpmdev-packager(1))")
+ (opts, args) = parser.parse_args()
+
+ if not args:
+ parser.error('No specfiles specified')
+
+ if not opts.userstring:
+ parser.error('Userstring required, see option -u')
+
+ # Grab bullet, insert one if not found.
+ bullet_re = re.compile(r'^([^\s\w])\s', re.UNICODE)
+ bullet = "-"
+ match = bullet_re.search(opts.comment)
+ if match:
+ bullet = match.group(1)
+ else:
+ opts.comment = bullet + " " + opts.comment
+
+ # Format comment.
+ if opts.comment.find("\n") == -1:
+ wrapopts = { "subsequent_indent": (len(bullet)+1) * " ",
+ "break_long_words": False }
+ if sys.version_info[:2] > (2, 5):
+ wrapopts["break_on_hyphens"] = False
+ opts.comment = textwrap.fill(opts.comment, 80, **wrapopts)
+
+ for aspec in args:
+ try:
+ s = SpecFile(aspec)
+ except:
+ # Not actually a parser error, but... meh.
+ parser.error(sys.exc_info()[1])
+
+ # Get EVR for changelog entry.
+ cmd = ("rpm", "-q", "--specfile",
"--define", "dist %{nil}",
+ "--qf=%|epoch?{%{epoch}:}:{}|%{version}-%{release}\n", aspec)
+ popen = subprocess.Popen(cmd, stdout = subprocess.PIPE)
+ evr = str(popen.communicate()[0]).split("\n")[0]
+
+ s.addChangelogEntry(evr, opts.comment, opts.userstring)
+ s.writeFile(aspec)
+
+sys.exit(0)
diff --git a/cadvisor.spec b/cadvisor.spec
index 71e7847..0edcef7 100644
--- a/cadvisor.spec
+++ b/cadvisor.spec
@@ -2,14 +2,14 @@
%global provider_tld com
%global project google
%global repo cadvisor
-%global commit 1e986029072ff511b0f069490d51dea35a50930e
+%global commit 89088df70eca64cf9d6b9a23a3d2bc21a30916d6
%global import_path %{provider}.%{provider_tld}/%{project}/%{repo}
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global debug_package %{nil}
Name: %{repo}
-Version: 0.6.0
+Version: 0.6.2
Release: 0.0.git%{shortcommit}%{?dist}
Summary: Analyzes resource usage and performance characteristics of running containers
License: ASL 2.0
@@ -17,6 +17,9 @@ URL: https://%{import_path}
Source0: https://%{import_path}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz
Source1: cadvisor
Source2: cadvisor.service
+
+Patch0: 0001-support-the-new-libcontiner.patch
+
BuildRequires: docker-io-pkg-devel
BuildRequires: systemd
BuildRequires: glibc-static
@@ -132,7 +135,7 @@ 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
+%autosetup -Sgit -n %{name}-%{commit} -q
%build
mkdir _build
@@ -175,13 +178,13 @@ done
%systemd_postun
%files
-%doc AUTHORS CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS LICENSE README.md
+%doc AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE README.md
%{_bindir}/cadvisor
%{_unitdir}/%{name}.service
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
%files devel
-%doc AUTHORS CHANGELOG.md CONTRIBUTING.md CONTRIBUTORS LICENSE README.md
+%doc AUTHORS CHANGELOG.md CONTRIBUTING.md LICENSE README.md
%dir %{gopath}/src/%{provider}.%{provider_tld}/%{project}
%dir %{gopath}/src/%{import_path}
%dir %{gopath}/src/%{import_path}/api
@@ -208,6 +211,9 @@ done
%{gopath}/src/%{import_path}/utils/*
%changelog
+* Fri Dec 05 2014 Eric Paris <eparis(a)redhat.com> - 0.6.2-0.0.git89088df
+- Bump to upstream 89088df70eca64cf9d6b9a23a3d2bc21a30916d6
+
* Fri Nov 14 2014 Eric Paris <eparis(a)redhat.com> - 0.6.0-0.0.git1e98602
- update to 0.6.0
diff --git a/getsource.sh b/getsource.sh
new file mode 100755
index 0000000..869c470
--- /dev/null
+++ b/getsource.sh
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+NAME=cadvisor
+GIT_COMMIT="$1"
+GIT_SHORT="${GIT_COMMIT:0:7}"
+GIT_VERSION="$2"
+
+set -o errexit
+set -o nounset
+set -o pipefail
+set -x
+
+SPEC="${NAME}.spec"
+
+curl -s -L
https://github.com/google/${NAME}/archive/${GIT_COMMIT}.tar.gz >
${NAME}-${GIT_SHORT}.tar.gz
+
+if [[ "${GIT_VERSION}" =~ ^([0-9]+)\.([0-9]+)(\.)?([0-9]+)?(-.*)?$ ]]; then
+ git_major=${BASH_REMATCH[1]}
+ git_minor=${BASH_REMATCH[2]}
+ git_really_minor=${BASH_REMATCH[4]}
+ since_tag=${BASH_REMATCH[5]}
+else
+ echo "Failed to parse version!"
+ /bin/false
+fi
+
+if [[ "${since_tag}" =~ ^-([0-9]+)-.*$ ]]; then
+ since_tag=${BASH_REMATCH[1]}
+else
+ since_tag=0
+fi
+
+version="${git_major}.${git_minor}"
+if [[ -n ${git_really_minor} ]]; then
+ version="${version}.${git_really_minor}"
+fi
+
+#put the git hash in as the commit
+sed -i -e "s/%global commit\t\t[[:xdigit:]]\{40\}/%global
commit\t\t${GIT_COMMIT}/" ${SPEC}
+#update the version with the latest tag
+sed -i -e
"s/Version:\t[[:digit:]]\+\.[[:digit:]]\+\(\.[[:digit:]]\+\)\?/Version:\t${version}/"
${SPEC}
+#update the release with since_tag
+sed -i -e "s/Release:\t[[:digit:]]\+\.[[:digit:]]\+/Release:\t${since_tag}.0/"
${SPEC}
+
+#increment the version number
+./add-chglog --comment="Bump to upstream ${GIT_COMMIT}" --userstring="Eric
Paris <eparis(a)redhat.com>" ${SPEC}
+
+fedpkg clog
+
+echo "****Don't forget to run: fedpkg new-sources
${NAME}-${GIT_SHORT}.tar.gz"
diff --git a/sources b/sources
index 31ef9f8..6289238 100644
--- a/sources
+++ b/sources
@@ -1 +1 @@
-620c545edda1d56dba9c28cb9eefc411 cadvisor-8c4f650.tar.gz
+b92e4aba83bce32777763d03378e02f7 cadvisor-89088df.tar.gz