summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2006-07-21 10:39:57 +0000
committerRobin H. Johnson <robbat2@gentoo.org>2006-07-21 10:39:57 +0000
commit588cb773b59f04f2da8b50abed54fa0bde62c5ea (patch)
treedca9bbcb22a8560d59295422ed0241de97cbe386 /net-analyzer/rrdtool
parentChange to ebuild for bug #141151 (diff)
downloadgentoo-2-588cb773b59f04f2da8b50abed54fa0bde62c5ea.tar.gz
gentoo-2-588cb773b59f04f2da8b50abed54fa0bde62c5ea.tar.bz2
gentoo-2-588cb773b59f04f2da8b50abed54fa0bde62c5ea.zip
Add a little bit of useful functionality to rrd_resize.
(Portage version: 2.1.1_pre3-r1)
Diffstat (limited to 'net-analyzer/rrdtool')
-rw-r--r--net-analyzer/rrdtool/ChangeLog8
-rw-r--r--net-analyzer/rrdtool/files/digest-rrdtool-1.2.15-r13
-rw-r--r--net-analyzer/rrdtool/files/rrdtool-1.2.15-newstyle-resize.patch142
-rw-r--r--net-analyzer/rrdtool/rrdtool-1.2.15-r1.ebuild126
4 files changed, 278 insertions, 1 deletions
diff --git a/net-analyzer/rrdtool/ChangeLog b/net-analyzer/rrdtool/ChangeLog
index 0357960b9544..55c13ac9f363 100644
--- a/net-analyzer/rrdtool/ChangeLog
+++ b/net-analyzer/rrdtool/ChangeLog
@@ -1,6 +1,12 @@
# ChangeLog for net-analyzer/rrdtool
# Copyright 2002-2006 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/net-analyzer/rrdtool/ChangeLog,v 1.93 2006/07/18 02:45:23 vanquirius Exp $
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/rrdtool/ChangeLog,v 1.94 2006/07/21 10:39:57 robbat2 Exp $
+
+*rrdtool-1.2.15-r1 (21 Jul 2006)
+
+ 21 Jul 2006; Robin H. Johnson <robbat2@gentoo.org>
+ +files/rrdtool-1.2.15-newstyle-resize.patch, +rrdtool-1.2.15-r1.ebuild:
+ Add a little bit of useful functionality to rrd_resize.
*rrdtool-1.2.15 (18 Jul 2006)
diff --git a/net-analyzer/rrdtool/files/digest-rrdtool-1.2.15-r1 b/net-analyzer/rrdtool/files/digest-rrdtool-1.2.15-r1
new file mode 100644
index 000000000000..4a38035815c3
--- /dev/null
+++ b/net-analyzer/rrdtool/files/digest-rrdtool-1.2.15-r1
@@ -0,0 +1,3 @@
+MD5 bde8b12c202bc4e27fb9a9588a0aaddf rrdtool-1.2.15.tar.gz 1043064
+RMD160 493e5b108ac363484eb4015c0962945c5fb9fb9e rrdtool-1.2.15.tar.gz 1043064
+SHA256 b33d68da8a39bb0fc745c0202f3a58e73bfc6a9fd35d71fbd8979d40a5ef7397 rrdtool-1.2.15.tar.gz 1043064
diff --git a/net-analyzer/rrdtool/files/rrdtool-1.2.15-newstyle-resize.patch b/net-analyzer/rrdtool/files/rrdtool-1.2.15-newstyle-resize.patch
new file mode 100644
index 000000000000..52b8c005a07e
--- /dev/null
+++ b/net-analyzer/rrdtool/files/rrdtool-1.2.15-newstyle-resize.patch
@@ -0,0 +1,142 @@
+Add support for a more useful resize method, that allows setting of the number
+of rows, instead of requiring manual calculation.
+
+Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
+
+diff -Nuar --exclude '*~' --exclude '*.txt' --exclude '*.html' --exclude '*.1' --exclude autom4te.cache --exclude bindings /dev/shm/portage/rrdtool-1.2.15/work/rrdtool-1.2.15/doc/rrdresize.pod /dev/shm/portage/rrdtool-1.2.15-r1/work/rrdtool-1.2.15/doc/rrdresize.pod
+--- rrdtool-1.2.15.orig/doc/rrdresize.pod 2006-07-14 05:11:26.000000000 -0700
++++ rrdtool-1.2.15/doc/rrdresize.pod 2006-07-21 01:56:56.333392940 -0700
+@@ -6,6 +6,8 @@
+
+ B<rrdtool> B<resize> I<filename> I<rra-num> B<GROW>I<|>B<SHRINK> I<rows>
+
++B<rrdtool> B<resize> I<filename> I<rra-num> [B<+>B<->B<=>]I<rows>
++
+ =head1 DESCRIPTION
+
+ The B<resize> function is used to modify the number of rows in
+@@ -23,17 +25,20 @@
+
+ =item B<GROW>
+
+-used if you want to add extra rows to an RRA. The extra rows will be inserted
+-as the rows that are oldest.
++(old style) used if you want to add extra rows to an RRA. The extra rows will
++be inserted as the rows that are oldest.
+
+ =item B<SHRINK>
+
+-used if you want to remove rows from an RRA. The rows that will be removed
+-are the oldest rows.
++(old style) used if you want to remove rows from an RRA. The rows that will be
++removed are the oldest rows.
+
+-=item I<rows>
++=item [B<+>B<->B<=>]I<rows>
+
+-the number of rows you want to add or remove.
++the number of rows you want to add or remove. when prefixed with any of B<+>,
++B<-> or B<=>, the B<GROW>I<|>B<SHRINK> argument is not required, and instead
++the prefix specifies to add (B<+>) I<rows>, remove (B<->) I<rows>, or set to
++exactly (B<=>) I<rows>.
+
+ =back
+
+diff -Nuar --exclude '*~' --exclude '*.txt' --exclude '*.html' --exclude '*.1' --exclude autom4te.cache --exclude bindings /dev/shm/portage/rrdtool-1.2.15/work/rrdtool-1.2.15/src/rrd_resize.c /dev/shm/portage/rrdtool-1.2.15-r1/work/rrdtool-1.2.15/src/rrd_resize.c
+--- rrdtool-1.2.15.orig/src/rrd_resize.c 2006-07-14 05:11:26.000000000 -0700
++++ rrdtool-1.2.15/src/rrd_resize.c 2006-07-21 03:09:45.656705610 -0700
+@@ -19,7 +19,7 @@
+ unsigned long l,rra;
+ long modify;
+ unsigned long target_rra;
+- int grow=0,shrink=0;
++ int grow=0,shrink=0,setsize=0,newstyle=0;
+ char *endptr;
+
+ infilename=argv[1];
+@@ -27,7 +27,7 @@
+ rrd_set_error("resize.rrd is a reserved name");
+ return(-1);
+ }
+- if (argc!=5) {
++ if (argc!=5 && argc != 4) {
+ rrd_set_error("wrong number of parameters");
+ return(-1);
+ }
+@@ -36,20 +36,39 @@
+
+ if (!strcmp(argv[3],"GROW")) grow=1;
+ else if (!strcmp(argv[3],"SHRINK")) shrink=1;
++ else if (argv[3][0] == '=' || argv[3][0] == '-' || argv[3][0] == '+') newstyle=3;
+ else {
+ rrd_set_error("I can only GROW or SHRINK");
+ return(-1);
+ }
+
+- modify=strtol(argv[4],&endptr,0);
+-
+- if ((modify<1)) {
+- rrd_set_error("Please grow or shrink with at least 1 row");
+- return(-1);
+- }
+-
+- if (shrink) modify = -modify;
++ // if the size starts with a character (=-+) then it's the new style
++ // instead. This is an extra mode so we can allow
++ // rrdtool resize FOO.rrd 5 GROW =5
++ if(argc == 5 && (argv[4][0] == '=' || argv[4][0] == '-' || argv[4][0] == '+')) {
++ newstyle = 4;
++ }
++ if(newstyle > 0) {
++ setsize = argv[newstyle][0] == '=' ? 1 : 0;
++ /* If we see a + or a -, then the codepath is simple */
++ grow = argv[newstyle][0] == '+' ? 1 : 0;
++ shrink = argv[newstyle][0] == '-' ? 1 : 0;
++ modify=strtol(argv[newstyle]+1,&endptr,0);
++ if(modify == 0) {
++ rrd_set_error("Refusing to add/delete/set with 0 rows");
++ return(-1);
++ }
++ } else {
++ /* this is the old code branch */
++ modify=strtol(argv[4],&endptr,0);
++
++ if ((modify<1)) {
++ rrd_set_error("Please grow or shrink with at least 1 row");
++ return(-1);
++ }
+
++ if (shrink) modify = -modify;
++ }
+
+ if (rrd_open(infilename, &infile, &rrdold, RRD_READWRITE)==-1) {
+ rrd_set_error("could not open RRD");
+@@ -68,6 +87,17 @@
+ fclose(infile);
+ return(-1);
+ }
++ /* if we are in setsize mode, we need to work out what modify factor to use */
++ if(setsize > 0) {
++ long oldsize = rrdold.rra_def[target_rra].row_cnt;
++ long newsize = modify;
++ // old=5, new=5 => modify = 0
++ if(newsize == oldsize) {
++ rrd_set_error("RRA is already set to that size!");
++ return(-1);
++ }
++ modify = newsize-oldsize;
++ }
+
+ if (modify < 0)
+ if ((long)rrdold.rra_def[target_rra].row_cnt <= -modify) {
+diff -Nuar --exclude '*~' --exclude '*.txt' --exclude '*.html' --exclude '*.1' --exclude autom4te.cache --exclude bindings /dev/shm/portage/rrdtool-1.2.15/work/rrdtool-1.2.15/src/rrd_tool.c /dev/shm/portage/rrdtool-1.2.15-r1/work/rrdtool-1.2.15/src/rrd_tool.c
+--- rrdtool-1.2.15.orig/src/rrd_tool.c 2006-07-14 05:11:26.000000000 -0700
++++ rrdtool-1.2.15/src/rrd_tool.c 2006-07-21 03:07:41.862541464 -0700
+@@ -152,6 +152,7 @@
+
+ char help_resize[] =
+ " * resize - alter the length of one of the RRAs in an RRD\n\n"
++ "\trrdtool resize filename rranum <+|-|=>rows\n";
+ "\trrdtool resize filename rranum GROW|SHRINK rows\n\n";
+
+ char help_xport[] =
diff --git a/net-analyzer/rrdtool/rrdtool-1.2.15-r1.ebuild b/net-analyzer/rrdtool/rrdtool-1.2.15-r1.ebuild
new file mode 100644
index 000000000000..f133c6b4617d
--- /dev/null
+++ b/net-analyzer/rrdtool/rrdtool-1.2.15-r1.ebuild
@@ -0,0 +1,126 @@
+# Copyright 1999-2006 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/net-analyzer/rrdtool/rrdtool-1.2.15-r1.ebuild,v 1.1 2006/07/21 10:39:57 robbat2 Exp $
+
+inherit perl-module flag-o-matic gnuconfig eutils multilib autotools
+
+DESCRIPTION="A system to store and display time-series data"
+HOMEPAGE="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/"
+SRC_URI="http://people.ee.ethz.ch/~oetiker/webtools/${PN}/pub/${P}.tar.gz"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86"
+IUSE="doc perl python rrdcgi tcltk"
+
+RDEPEND="tcltk? ( dev-lang/tcl )
+ >=sys-libs/zlib-1.2.1
+ >=media-libs/freetype-2.1.5
+ >=media-libs/libart_lgpl-2.3.16
+ >=media-libs/libpng-1.2.5
+ rrdcgi? ( >=dev-libs/cgilib-0.5 )"
+
+DEPEND="${RDEPEND}
+ perl? ( dev-lang/perl )
+ python? ( dev-lang/python )
+ sys-apps/gawk"
+
+TCLVER=""
+
+src_unpack() {
+ unpack ${A}
+ cd "${S}"
+ sed -i -e 's:<rrd_\(.*\)>:"../../src/rrd_\1":g' \
+ bindings/tcl/tclrrd.c || die "sed failed"
+ sed -i -e 's:-lrrd_private:-ltcl -lrrd:' \
+ bindings/tcl/Makefile.* || die "sed failed"
+ sed -i -e 's:python_PROGRAMS:pyexec_PROGRAMS:' \
+ bindings/python/Makefile.* || die "sed failed"
+ sed -i -e 's:\$TCL_PACKAGE_PATH:${TCL_PACKAGE_PATH%% *}:' \
+ configure.ac
+ epatch ${FILESDIR}/${P}-newstyle-resize.patch
+ eautoreconf
+}
+
+pkg_setup() {
+ use perl && perl-module_pkg_setup
+}
+
+src_compile() {
+ filter-mfpmath sse
+ filter-flags -ffast-math
+
+ local myconf
+ myconf="--datadir=/usr/share --enable-shared"
+
+ use tcltk \
+ && myconf="${myconf} --with-tcllib=/usr/$(get_libdir)" \
+ || myconf="${myconf} --without-tcllib"
+
+ use python || myconf="${myconf} --disable-python"
+
+ if use perl ; then
+ econf ${myconf} \
+ $(use_enable rrdcgi) \
+ --with-perl-options='PREFIX=/usr INSTALLDIRS=vendor DESTDIR=${D}' || \
+ die "econf failed"
+ else
+ econf ${myconf} \
+ $(use_enable rrdcgi) \
+ --disable-perl || die "econf failed"
+ fi
+
+ make || die "make failed"
+}
+
+src_install() {
+ make DESTDIR="${D}" install || die "make install failed"
+
+ rm -fr "${D}"/usr/examples
+ rm -fr "${D}"/usr/shared
+
+ if use doc ; then
+ dohtml doc/*.html
+ dodoc doc/*.pod
+ dodoc doc/*.txt
+ insinto /usr/share/doc/${PF}/examples
+ doins examples/*
+ insinto /usr/share/doc/${PF}/contrib
+ doins contrib/*
+ fi
+
+ if use perl ; then
+ perlinfo
+ mytargets="site-perl-install"
+ perl-module_src_install || die
+
+ # remove duplicate installation into /usr/lib/perl
+ rm -Rf "${D}"/usr/lib/perl
+ fi
+
+ if use tcltk ; then
+ mv "${S}"/bindings/tcl/tclrrd.so "${S}"/bindings/tcl/tclrrd${PV}.so
+ insinto /usr/$(get_libdir)/tcl${TCL_VER}/tclrrd${PV}
+ doins "${S}"/bindings/tcl/tclrrd${PV}.so
+ echo "package ifneeded Rrd ${PV} [list load [file join \$$dir .. tclrrd${PV}.so]]" \
+ >> "${D}"/usr/$(get_libdir)/tcl${TCL_VER}/tclrrd${PV}/pkgIndex.tcl
+ fi
+
+ dodoc CONTRIBUTORS README TODO
+}
+
+pkg_preinst() {
+ use perl && perl-module_pkg_preinst
+}
+
+pkg_postinst() {
+ use perl && perl-module_pkg_postinst
+}
+
+pkg_prerm() {
+ use perl && perl-module_pkg_prerm
+}
+
+pkg_postrm() {
+ use perl && perl-module_pkg_postrm
+}