Accepting request 755626 from network:cluster

OBS-URL: https://build.opensuse.org/request/show/755626
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ganglia-web?expand=0&rev=4
This commit is contained in:
Dominique Leuenberger 2019-12-10 21:46:09 +00:00 committed by Git OBS Bridge
commit ea8f1c2edd
9 changed files with 234 additions and 20 deletions

View File

@ -0,0 +1,145 @@
From 3d5c9c2e308123a9d37e7cbab33b854a304bb381 Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.de>
Date: Fri, 6 Dec 2019 16:42:28 +0100
Subject: [PATCH 1/2] added of download_js
---
download_js.sh | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 126 insertions(+)
create mode 100755 download_js.sh
diff --git a/download_js.sh b/download_js.sh
new file mode 100755
index 0000000..67e26fd
--- /dev/null
+++ b/download_js.sh
@@ -0,0 +1,126 @@
+#!/bin/bash
+CONFFILE="/srv/www/htdocs/ganglia-web/conf_default.php"
+SAVEDIR='/srv/www/htdocs/ganglia-web'
+PHPCONFDIR='/etc/apache2/conf.d/'
+PHPCONFNAME='conf.php'
+TARBALL='/tmp/ajax_ganglia.tar.gz'
+RESCRIPT='/tmp/download_js.sh'
+SUFFIX='ajax_libs'
+TMPDIR='/tmp'
+
+function get_conf() {
+declare -f -F conf_stor > /dev/null
+if [ $? -eq 0 ] ; then
+ conf_stor
+else
+ cat ${CONFFILE}
+fi
+}
+
+function usage() {
+cat <<EOF
+ $0 parses ${CONFFILE}
+ for external java script libraries and downloads or recreate the script
+ so that it can download them on another computer.
+ Options are:
+ -h: prints this help
+ -d: download the libraries to
+ $SAVEDIR
+ and modify/write
+ ${PHPCONFDIR}/${PHPCONFNAME}
+ so that downloaded libraries are preferred
+ -t: download the libraries and store them in
+ $TARBALL
+ -r: recreate this script by parsing
+ $CONFFILE
+ and store the download locations of the java script libraries
+ direclty in the recreated script, which
+ will stored in
+ $RESCRIPT
+EOF
+}
+tarball=0
+recreate=0
+download_libs=0
+usage_set=1
+
+while getopts "h?trd" opt; do
+ case "$opt" in
+ h|\?)
+ usage_set=1
+ ;;
+ t)
+ usage_set=0
+ tarball=1
+ recreate=0
+ ;;
+ r)
+ usage_set=0
+ recreate=1
+ ;;
+ d)
+ usage_set=0
+ download_libs=1
+ recreate=0
+ ;;
+ esac
+done
+
+if [ $usage_set -eq 1 ] ; then
+ usage
+ exit 0
+fi
+
+if [ $recreate -eq 1 ] ; then
+ declare -f -F conf_stor > /dev/null
+ if [ $? -eq 0 ] ; then
+ echo "This script was recreated so could not recreate it."
+ exit 1
+ fi
+ cat << EOF > $RESCRIPT
+#!/bin/bash
+# this file was recreated on $(uname -n) at $(date)
+function conf_stor() {
+cat <<ENDCONF
+EOF
+ grep 'https://cdnjs' $CONFFILE | sed 's@\$@\\\$@' >> $RESCRIPT
+ cat << EOF >> $RESCRIPT
+
+ENDCONF
+}
+EOF
+ cat $0 | sed -e 's@#!/bin/bash@@' \
+ -e 's@usage_set=1@usage_set=0@' \
+ -e 's@tarball=0@tarball=1@' >> $RESCRIPT
+ echo "wrote $RESCRIPT"
+ exit 0
+fi
+
+
+which curl &> /dev/null || echo "need curl to download ajax libraries"
+which curl &> /dev/null || exit 1
+
+if [ $tarball -eq 1 ] ; then
+ test -d ${TMPDIR}/${SUFFIX} || mkdir -vp ${TMPDIR}/${SUFFIX}
+ PHPCONFFILELOC=${TMPDIR}/${SUFFIX}/${PHPCONFNAME}
+ cd ${TMPDIR}
+else
+ test -d ${SAVEDIR}/${SUFFIX} || mkdir -vp ${SAVEDIR}/${SUFFIX}
+ PHPCONFFILELOC=${PHPCONFDIR}/${PHPCONFNAME}
+ cd ${SAVEDIR}
+fi
+
+for lib_line in $(get_conf | grep -e '^$conf.* = \"https://cdnjs' | tr ' ' '@') ; do
+ conf_line=$(echo $lib_line | cut -f 1 -d '@')
+ url=$(echo $lib_line | cut -f 3 -d '@' |tr -d '"' | tr -d ';')
+ file_name=$(basename $url)
+ echo -n "getting ${file_name}: "
+ curl -# $url -o ${SUFFIX}/$file_name
+ echo "$conf_line = \"${SAVEDIR}/${SUFFIX}/${file_name}\";" >> ${PHPCONFFILELOC}
+done
+if [ $tarball -eq 1 ] ; then
+ tar czf ${TARBALL} ${SUFFIX}
+ echo "created ${TARBALL} , which also contains ${PHPCONFNAME}"
+fi
+cd - > /dev/null
+
--
2.16.4

View File

@ -0,0 +1,28 @@
From b88b085b67e48ec5baf1bc66a973beb31b737360 Mon Sep 17 00:00:00 2001
From: Christian Goll <cgoll@suse.de>
Date: Mon, 9 Dec 2019 11:52:48 +0100
Subject: [PATCH 2/2] looking for systemwide user config
---
eval_conf.php | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/eval_conf.php b/eval_conf.php
index b39fb2e..5e3d884 100644
--- a/eval_conf.php
+++ b/eval_conf.php
@@ -12,6 +12,11 @@ require_once $base_dir . "/conf_default.php";
require_once 'lib/GangliaAcl.php';
require_once 'lib/GangliaAuth.php';
+# Include system-wide overrides if they exist.
+if( file_exists( "/etc/ganglia/conf.d/conf.php" ) ) {
+ include_once "/etc/ganglia/conf.d/conf.php";
+}
+
# Include user-defined overrides if they exist.
if( file_exists( $base_dir . "/conf.php" ) ) {
include_once $base_dir . "/conf.php";
--
2.16.4

View File

@ -1,11 +1,10 @@
You need to enable the apache2 php7 or php5 module, before ganglia-web works.
SLE-12* is shipped with php5 and SLE-15* is shipped with php7, for this
products you also have to add the "Web and Scripting Module".
This can be done with
a2enmod php7
or
a2enmod php5
apache2 must be restarted after this
* The apache2 php7 or php5 module must be enabled , before ganglia-web works.
SLE-12* is shipped with php5 and SLE-15* is shipped with php7, for this
products you also have to add the "Web and Scripting Module". This can be done
with a2enmod php7 or a2enmod php5
apache2 must be restarted after this
* The web interface uses some external java script libraries for a better user
experience. The script download_js.sh can be used to download this libraries
from a host with internet connection.
-- cgoll@suse.de

18
_service Normal file
View File

@ -0,0 +1,18 @@
<services>
<!-- mode is disabled, so that it is not executed at every commit -->
<service name="obs_scm" mode="disabled">
<param name="url">https://github.com/ganglia/ganglia-web.git</param>
<!-- this is %version -->
<param name="version">3.7.4</param>
<!-- which git commit to use, if no tag is available -->
<param name="revision">3.7.4</param>
<param name="scm">git</param>
</service>
<!-- the prior part will check out an git, archive, but we want a tar ball -->
<service mode="buildtime" name="tar" />
<service mode="buildtime" name="recompress">
<param name="file">*.tar</param>
<param name="compression">xz</param>
</service>
<service mode="disabled" name="set_version" />
</services>

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:98820187c98d24d3645b92d31060623de696dad331a361a19874898339523628
size 704632

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c33c603e9133b25bf5dc86a16d8292cf5eabec5b9020fe86db1c2ef9bcd80472
size 2700812

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Wed Dec 4 12:54:20 UTC 2019 - Christian Goll <cgoll@suse.com>
- updated to version 3.7.4
- added patches for a global user config under /etc/ganglia/conf.d/
and added download_js.sh which can download the external java
script libararies.
* new file: 0001-added-of-download_js.patch which adds download_js.sh
* new file: 0002-looking-for-systemwide-user-config.patch which
makes ganglia-web to serach for config in /etc/ganglia/conf.d/
-------------------------------------------------------------------
Mon Apr 16 21:24:26 UTC 2018 - eich@suse.com

5
ganglia-web.obsinfo Normal file
View File

@ -0,0 +1,5 @@
name: ganglia-web
version: 3.7.4
mtime: 1520973429
commit: d4e14cce414dda46c303000b8f6c5db4db4083ed

View File

@ -1,7 +1,7 @@
#
# spec file for package ganglia-web
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -12,22 +12,24 @@
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%define web_prefixdir /srv/www/htdocs/ganglia-web
Name: ganglia-web
Version: 3.7.2
Version: 3.7.4
Release: 0
Summary: Ganglia web frontend
License: BSD-3-Clause
Group: System/Monitoring
Url: http://ganglia.info/
Source0: https://downloads.sourceforge.net/project/ganglia/ganglia-web/3.7.2/ganglia-web-3.7.2.tar.gz
URL: http://ganglia.info/
Source0: ganglia-web-%{version}.tar.xz
Source1: ganglia-httpd24.conf.d
Source2: README.SUSE
Patch1: 0001-added-of-download_js.patch
Patch2: 0002-looking-for-systemwide-user-config.patch
BuildRequires: apache2
BuildRequires: fdupes
BuildRequires: rsync
@ -49,6 +51,7 @@ written in the PHP5/7 language and uses the Dwoo templating engine.
%prep
%setup -q
%autopatch -p1
%build
cp %SOURCE2 .
@ -61,18 +64,23 @@ cp %SOURCE2 .
make install
install -d %{buildroot}/etc/apache2/conf.d
install %SOURCE1 %{buildroot}/etc/apache2/conf.d/%{name}.conf
install -m 644 %SOURCE1 %{buildroot}/etc/apache2/conf.d/%{name}.conf
mkdir -pv %{buildroot}%{_docdir}/%{name}/
cp -v download_js.sh %{buildroot}%{_docdir}/%{name}/download_js.sh
# fix suprious buildroot in config
%{__sed} -i 's@%{buildroot}@@' %{buildroot}/%{web_prefixdir}/conf_default.php
%fdupes %{buildroot}%{web_prefixdir}
%fdupes %{buildroot}%{_localstatedir}/lib/ganglia-web
%files
%defattr(-,root,root)
%doc AUTHORS COPYING TODO README README.SUSE
%doc AUTHORS TODO README README.SUSE
%{_docdir}/%{name}/download_js.sh
%license COPYING
%dir %{web_prefixdir}/
%dir %{web_prefixdir}/dwoo
%{web_prefixdir}/*
%config(noreplace) %{web_prefixdir}/conf_default.php
%config(noreplace) /etc/apache2/conf.d/%{name}.conf
%dir %{_localstatedir}/lib/ganglia-web
%{_localstatedir}/lib/ganglia-web/conf