aboutsummaryrefslogtreecommitdiff
path: root/sysutils/ganglia-webfrontend
diff options
context:
space:
mode:
authorBrooks Davis <brooks@FreeBSD.org>2005-04-27 20:36:33 +0000
committerBrooks Davis <brooks@FreeBSD.org>2005-04-27 20:36:33 +0000
commitab348058e84b8f0b864ed9b0793990843cdd0e18 (patch)
tree05d2c08f197edc3f7794adc0fc58fe8506a2e5ed /sysutils/ganglia-webfrontend
parent2672ac6c8c1524a858166aec53f196e2ccfcaad1 (diff)
downloadports-ab348058e84b8f0b864ed9b0793990843cdd0e18.tar.gz
ports-ab348058e84b8f0b864ed9b0793990843cdd0e18.zip
Populate the node list dropdown on the cluster view page when the user
has turned off show hosts. It's nice not to have to load 190+ images just so I can select a host from the dropdown. Do some general cleanup of the port infrastructure. - Install into a staging directory in the build target and install that. - Add a target to generate the plist from the staging directory rather than doing it by hand. - Use a pkg-install script to copy conf.php.sample to conf.php as needed instead of some bits in the make file and different ones in the plist. - Use SUB_FILES to handle pkg-message rather than hand-rolled sed.
Notes
Notes: svn path=/head/; revision=134278
Diffstat (limited to 'sysutils/ganglia-webfrontend')
-rw-r--r--sysutils/ganglia-webfrontend/Makefile50
-rw-r--r--sysutils/ganglia-webfrontend/files/patch-cluster__view.php22
-rw-r--r--sysutils/ganglia-webfrontend/files/patch-ganglia.php16
-rw-r--r--sysutils/ganglia-webfrontend/files/pkg-install.in10
-rw-r--r--sysutils/ganglia-webfrontend/files/pkg-message.in (renamed from sysutils/ganglia-webfrontend/pkg-message)0
-rw-r--r--sysutils/ganglia-webfrontend/pkg-plist47
6 files changed, 102 insertions, 43 deletions
diff --git a/sysutils/ganglia-webfrontend/Makefile b/sysutils/ganglia-webfrontend/Makefile
index 702d534d0c41..414619e8b090 100644
--- a/sysutils/ganglia-webfrontend/Makefile
+++ b/sysutils/ganglia-webfrontend/Makefile
@@ -7,6 +7,7 @@
PORTNAME= webfrontend
PORTVERSION= 3.0.1
+PORTREVISION= 1
CATEGORIES= sysutils net parallel www
MASTER_SITES= ${MASTER_SITE_SOURCEFORGE}
MASTER_SITE_SUBDIR= ganglia
@@ -18,11 +19,14 @@ COMMENT= "Ganglia cluster monitor, web frontend"
RUN_DEPENDS+= ${LOCALBASE}/sbin/gmetad:${PORTSDIR}/sysutils/ganglia-monitor-core
+PKGINSTALL= ${WRKDIR}/pkg-install
PKGMESSAGE= ${WRKDIR}/pkg-message
+SUB_FILES+= pkg-install pkg-message
+SUB_LIST+= WEBFRONTDIR="${WEBFRONTDIR}"
+
PLIST_SUB+= WEBFRONTDIR="${WEBFRONTDIR}"
-NO_BUILD= yes
USE_REINPLACE= yes
USE_PHP= gd pcre xml
USE_BZIP2= yes
@@ -46,11 +50,8 @@ EXCEPTFILES= AUTHORS \
addons \
version.php.in \
webfrontend.spec
-
-pre-patch:
- @${SED} -e 's|%%PREFIX%%|${PREFIX}|g' \
- -e 's|%%WEBFRONTDIR%%|${WEBFRONTDIR}|g' \
- ${.CURDIR}/pkg-message > ${PKGMESSAGE}
+CPIOARGS= --quiet -pdum -R
+TMP_WEBFRONTDIR= ${WRKDIR}/webfrontend
options:
@ ${ECHO_MSG} "===> Build options for ${PKGNAME}:"
@@ -67,22 +68,33 @@ post-extract:
post-patch:
@ ${REINPLACE_CMD} -e "s|%%LOCALBASE%%|${LOCALBASE}|g" ${WRKSRC}/conf.php
-do-install:
- ${MKDIR} ${PREFIX}/${WEBFRONTDIR}
- ${MKDIR} -m 0775 ${PREFIX}/${WEBFRONTDIR}
- cd ${WRKSRC} && ${FIND} * \( -name conf.php\* \
- ${EXCEPTFILES:S/^/-o -name /} \) \
+do-build:
+ @${MKDIR} -m 0755 ${TMP_WEBFRONTDIR}
+ @cd ${WRKSRC} && ${FIND} * \( -name conf.php\* \
+ ${EXCEPTFILES:S/^/-o -name /} -o -name \*.orig \) \
-a -prune -o -print \
- | ${TAR} cTf - - | ${TAR} xUCf ${PREFIX}/${WEBFRONTDIR} -
- ${CHOWN} -R ${WWWOWN}:${WWWGRP} ${PREFIX}/${WEBFRONTDIR}
- ${INSTALL} -c -o ${WWWOWN} -g ${WWWGRP} \
- ${WRKSRC}/conf.php ${PREFIX}/${WEBFRONTDIR}/conf.php.sample
- @if [ ! -f ${PREFIX}/${WEBFRONTDIR}/conf.php ]; then \
- ${INSTALL} -c -o ${WWWOWN} -g ${WWWGRP} \
- ${WRKSRC}/conf.php ${PREFIX}/${WEBFRONTDIR} ;\
- fi
+ | ${TAR} cTf - - | ${TAR} xUCf ${TMP_WEBFRONTDIR} -
+ @${CP} ${WRKSRC}/conf.php ${TMP_WEBFRONTDIR}/conf.php.sample
+
+do-install:
+ @${MKDIR} -m 0755 ${PREFIX}/${WEBFRONTDIR}
+ @${CHOWN} ${WWWOWN}:${WWWGRP} ${PREFIX}/${WEBFRONTDIR}
+ @cd ${TMP_WEBFRONTDIR} && \
+ ${FIND} . | \
+ ${CPIO} ${CPIOARGS} ${WWWOWN}:${WWWGRP} ${PREFIX}/${WEBFRONTDIR}
post-install:
+ @${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
@${CAT} ${PKGMESSAGE}
+build-plist:
+ @${FIND} ${TMP_WEBFRONTDIR}/* -type f | \
+ ${SED} -e 's|${TMP_WEBFRONTDIR}|%%WEBFRONTDIR%%|' | \
+ ${SORT} > ${PLIST}
+ @${FIND} ${TMP_WEBFRONTDIR}/* -type d | \
+ ${SED} -e 's|${TMP_WEBFRONTDIR}|@dirrm %%WEBFRONTDIR%%|' | \
+ ${SORT} -r >> ${PLIST}
+ @${ECHO} '@unexec if cmp -s %D/%%WEBFRONTDIR%%/conf.php %D/%%WEBFRONTDIR%%/conf.php.sample ; then rm -f %D/%%WEBFRONTDIR%%/conf.php; fi' >> ${PLIST}
+ @${ECHO} '@unexec rmdir %D/%%WEBFRONTDIR%% 2>/dev/null || (echo "Configuration information saved. If you will *NOT* use this package anymore," && echo "please remove %D/%%WEBFRONTDIR%% and its contents manually.")' >> ${PLIST}
+
.include <bsd.port.mk>
diff --git a/sysutils/ganglia-webfrontend/files/patch-cluster__view.php b/sysutils/ganglia-webfrontend/files/patch-cluster__view.php
new file mode 100644
index 000000000000..b4399bfecb98
--- /dev/null
+++ b/sysutils/ganglia-webfrontend/files/patch-cluster__view.php
@@ -0,0 +1,22 @@
+
+$FreeBSD$
+
+--- cluster_view.php.orig
++++ cluster_view.php
+@@ -6,11 +6,11 @@
+
+ $tpl->assign("images","./templates/$template_name/images");
+
+-$cpu_num = !$showhosts ? $metrics["cpu_num"][SUM] : cluster_sum("cpu_num", $metrics);
+-$load_one_sum = !$showhosts ? $metrics["load_one"][SUM] : cluster_sum("load_one", $metrics);
+-$load_five_sum = !$showhosts ? $metrics["load_five"][SUM] : cluster_sum("load_five", $metrics);
+-$load_fifteen_sum = !$showhosts ? $metrics["load_fifteen"][SUM] : cluster_sum("load_fifteen", $metrics);
+-$units = !$showhosts ? $metrics[$metricname][UNITS] : $metrics[key($metrics)][$metricname][UNITS];
++$cpu_num = cluster_sum("cpu_num", $metrics);
++$load_one_sum = cluster_sum("load_one", $metrics);
++$load_five_sum = cluster_sum("load_five", $metrics);
++$load_fifteen_sum = cluster_sum("load_fifteen", $metrics);
++$units = $metrics[key($metrics)][$metricname][UNITS];
+
+ $tpl->assign("num_nodes", intval($cluster[HOSTS_UP]));
+ $tpl->assign("num_dead_nodes", intval($cluster[HOSTS_DOWN]));
diff --git a/sysutils/ganglia-webfrontend/files/patch-ganglia.php b/sysutils/ganglia-webfrontend/files/patch-ganglia.php
new file mode 100644
index 000000000000..1af16d4fe466
--- /dev/null
+++ b/sysutils/ganglia-webfrontend/files/patch-ganglia.php
@@ -0,0 +1,16 @@
+
+$FreeBSD$
+
+--- ganglia.php.orig
++++ ganglia.php
+@@ -260,8 +260,8 @@
+ $request = "/$clustername";
+ break;
+ case "cluster-summary":
+- xml_set_element_handler($parser, "start_cluster_summary", "end_all");
+- $request = "/$clustername?filter=summary";
++ xml_set_element_handler($parser, "start_cluster", "end_all");
++ $request = "/$clustername";
+ break;
+ case "node":
+ case "host":
diff --git a/sysutils/ganglia-webfrontend/files/pkg-install.in b/sysutils/ganglia-webfrontend/files/pkg-install.in
new file mode 100644
index 000000000000..aa3cbfad9526
--- /dev/null
+++ b/sysutils/ganglia-webfrontend/files/pkg-install.in
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+case $2 in
+POST-INSTALL)
+ if [ ! -f %%PREFIX%%/%%WEBFRONTDIR%%/conf.php ]; then
+ cp %%PREFIX%%/%%WEBFRONTDIR%%/conf.php.sample \
+ %%PREFIX%%/%%WEBFRONTDIR%%/conf.php
+ fi
+ ;;
+esac
diff --git a/sysutils/ganglia-webfrontend/pkg-message b/sysutils/ganglia-webfrontend/files/pkg-message.in
index cfea5c253a47..cfea5c253a47 100644
--- a/sysutils/ganglia-webfrontend/pkg-message
+++ b/sysutils/ganglia-webfrontend/files/pkg-message.in
diff --git a/sysutils/ganglia-webfrontend/pkg-plist b/sysutils/ganglia-webfrontend/pkg-plist
index 4ddc54f480cf..679d0c5f2b0a 100644
--- a/sysutils/ganglia-webfrontend/pkg-plist
+++ b/sysutils/ganglia-webfrontend/pkg-plist
@@ -2,6 +2,7 @@
%%WEBFRONTDIR%%/class.TemplatePower.inc.php
%%WEBFRONTDIR%%/cluster_legend.html
%%WEBFRONTDIR%%/cluster_view.php
+%%WEBFRONTDIR%%/conf.php.sample
%%WEBFRONTDIR%%/footer.php
%%WEBFRONTDIR%%/functions.php
%%WEBFRONTDIR%%/ganglia.php
@@ -20,19 +21,33 @@
%%WEBFRONTDIR%%/private_clusters
%%WEBFRONTDIR%%/show_node.php
%%WEBFRONTDIR%%/styles.css
-%%WEBFRONTDIR%%/version.php
-%%WEBFRONTDIR%%/templates/Rocks/images/ganglia.jpg
-%%WEBFRONTDIR%%/templates/Rocks/images/rocks.jpg
-%%WEBFRONTDIR%%/templates/Rocks/images/hardhat.png
%%WEBFRONTDIR%%/templates/Rocks/cluster_extra.tpl
%%WEBFRONTDIR%%/templates/Rocks/header.tpl
%%WEBFRONTDIR%%/templates/Rocks/host_extra.tpl
+%%WEBFRONTDIR%%/templates/Rocks/images/ganglia.jpg
+%%WEBFRONTDIR%%/templates/Rocks/images/hardhat.png
+%%WEBFRONTDIR%%/templates/Rocks/images/rocks.jpg
+%%WEBFRONTDIR%%/templates/default/cluster_extra.tpl
+%%WEBFRONTDIR%%/templates/default/cluster_view.tpl
+%%WEBFRONTDIR%%/templates/default/footer.tpl
+%%WEBFRONTDIR%%/templates/default/grid_tree.tpl
+%%WEBFRONTDIR%%/templates/default/header-nobanner.tpl
+%%WEBFRONTDIR%%/templates/default/header.tpl
+%%WEBFRONTDIR%%/templates/default/host_extra.tpl
+%%WEBFRONTDIR%%/templates/default/host_gmetrics.tpl
+%%WEBFRONTDIR%%/templates/default/host_view.tpl
%%WEBFRONTDIR%%/templates/default/images/cluster_0-24.jpg
%%WEBFRONTDIR%%/templates/default/images/cluster_25-49.jpg
%%WEBFRONTDIR%%/templates/default/images/cluster_50-74.jpg
%%WEBFRONTDIR%%/templates/default/images/cluster_75-100.jpg
%%WEBFRONTDIR%%/templates/default/images/cluster_overloaded.jpg
%%WEBFRONTDIR%%/templates/default/images/cluster_private.jpg
+%%WEBFRONTDIR%%/templates/default/images/grid_0-24.jpg
+%%WEBFRONTDIR%%/templates/default/images/grid_25-49.jpg
+%%WEBFRONTDIR%%/templates/default/images/grid_50-74.jpg
+%%WEBFRONTDIR%%/templates/default/images/grid_75-100.jpg
+%%WEBFRONTDIR%%/templates/default/images/grid_overloaded.jpg
+%%WEBFRONTDIR%%/templates/default/images/grid_private.jpg
%%WEBFRONTDIR%%/templates/default/images/logo.jpg
%%WEBFRONTDIR%%/templates/default/images/node_0-24.jpg
%%WEBFRONTDIR%%/templates/default/images/node_25-49.jpg
@@ -40,31 +55,15 @@
%%WEBFRONTDIR%%/templates/default/images/node_75-100.jpg
%%WEBFRONTDIR%%/templates/default/images/node_dead.jpg
%%WEBFRONTDIR%%/templates/default/images/node_overloaded.jpg
-%%WEBFRONTDIR%%/templates/default/images/grid_0-24.jpg
-%%WEBFRONTDIR%%/templates/default/images/grid_25-49.jpg
-%%WEBFRONTDIR%%/templates/default/images/grid_50-74.jpg
-%%WEBFRONTDIR%%/templates/default/images/grid_75-100.jpg
-%%WEBFRONTDIR%%/templates/default/images/grid_overloaded.jpg
-%%WEBFRONTDIR%%/templates/default/images/grid_private.jpg
-%%WEBFRONTDIR%%/templates/default/cluster_extra.tpl
-%%WEBFRONTDIR%%/templates/default/cluster_view.tpl
-%%WEBFRONTDIR%%/templates/default/footer.tpl
-%%WEBFRONTDIR%%/templates/default/header-nobanner.tpl
-%%WEBFRONTDIR%%/templates/default/header.tpl
-%%WEBFRONTDIR%%/templates/default/host_extra.tpl
-%%WEBFRONTDIR%%/templates/default/host_gmetrics.tpl
-%%WEBFRONTDIR%%/templates/default/host_view.tpl
%%WEBFRONTDIR%%/templates/default/meta_view.tpl
%%WEBFRONTDIR%%/templates/default/node_extra.tpl
%%WEBFRONTDIR%%/templates/default/physical_view.tpl
%%WEBFRONTDIR%%/templates/default/show_node.tpl
-%%WEBFRONTDIR%%/templates/default/grid_tree.tpl
-@unexec if cmp -s %D/%%WEBFRONTDIR%%/conf.php %D/%%WEBFRONTDIR%%/conf.php.sample; then rm -f %D/%%WEBFRONTDIR%%/conf.php; fi
-%%WEBFRONTDIR%%/conf.php.sample
-@exec [ -f %B/conf.php ] || cp %B/%f %B/conf.php
-@dirrm %%WEBFRONTDIR%%/templates/Rocks/images
-@dirrm %%WEBFRONTDIR%%/templates/Rocks
+%%WEBFRONTDIR%%/version.php
@dirrm %%WEBFRONTDIR%%/templates/default/images
@dirrm %%WEBFRONTDIR%%/templates/default
+@dirrm %%WEBFRONTDIR%%/templates/Rocks/images
+@dirrm %%WEBFRONTDIR%%/templates/Rocks
@dirrm %%WEBFRONTDIR%%/templates
+@unexec if cmp -s %D/%%WEBFRONTDIR%%/conf.php %D/%%WEBFRONTDIR%%/conf.php.sample ; then rm -f %D/%%WEBFRONTDIR%%/conf.php; fi
@unexec rmdir %D/%%WEBFRONTDIR%% 2>/dev/null || (echo "Configuration information saved. If you will *NOT* use this package anymore," && echo "please remove %D/%%WEBFRONTDIR%% and its contents manually.")