[graphite-web] Split fhs+thirdparty patch into two

Jamie Nguyen jamielinux at fedoraproject.org
Wed Oct 1 13:55:35 UTC 2014


commit ca0acb18c3b000c3dcb0c7ba7f97a37d512f773b
Author: Jamie Nguyen <j at jamielinux.com>
Date:   Wed Oct 1 12:49:49 2014 +0100

    Split fhs+thirdparty patch into two

 ...0.9.12-Amend-default-filesystem-locations.patch |   83 ++++++++++
 ...-web-0.9.12-Force-use-of-system-libraries.patch |  101 ++++++++++++
 graphite-web-0.9.12-fhs-thirdparty.patch           |  162 --------------------
 graphite-web.spec                                  |   40 +++--
 4 files changed, 210 insertions(+), 176 deletions(-)
---
diff --git a/graphite-web-0.9.12-Amend-default-filesystem-locations.patch b/graphite-web-0.9.12-Amend-default-filesystem-locations.patch
new file mode 100644
index 0000000..7fcdabc
--- /dev/null
+++ b/graphite-web-0.9.12-Amend-default-filesystem-locations.patch
@@ -0,0 +1,83 @@
+From 2f3bcf7f272f1a69c9b7465e74845be9643c9377 Mon Sep 17 00:00:00 2001
+From: Jamie Nguyen <j at jamielinux.com>
+Date: Wed, 1 Oct 2014 14:49:09 +0100
+Subject: [PATCH] Amend default filesystem locations
+
+---
+ conf/graphite.wsgi.example                |  2 +-
+ setup.py                                  |  3 ++-
+ webapp/graphite/local_settings.py.example | 13 +++++++++++--
+ 3 files changed, 14 insertions(+), 4 deletions(-)
+
+diff --git a/conf/graphite.wsgi.example b/conf/graphite.wsgi.example
+index 0527f53..fcb7a41 100755
+--- a/conf/graphite.wsgi.example
++++ b/conf/graphite.wsgi.example
+@@ -1,5 +1,5 @@
+ import os, sys
+-sys.path.append('/opt/graphite/webapp')
++sys.path.append('/usr/share/graphite/webapp')
+ os.environ['DJANGO_SETTINGS_MODULE'] = 'graphite.settings'
+ 
+ import django.core.handlers.wsgi
+diff --git a/setup.py b/setup.py
+index 78d2b20..4dc0ce0 100644
+--- a/setup.py
++++ b/setup.py
+@@ -60,6 +60,7 @@ setup(
+   package_data={'graphite' :
+     ['templates/*', 'local_settings.py.example']},
+   scripts=glob('bin/*'),
+-  data_files=webapp_content.items() + storage_dirs + conf_files + examples,
++  #data_files=webapp_content.items() + storage_dirs + conf_files + examples,
++  data_files=webapp_content.items(),
+   **setup_kwargs
+ )
+diff --git a/webapp/graphite/local_settings.py.example b/webapp/graphite/local_settings.py.example
+index 73a0c57..d6f9857 100644
+--- a/webapp/graphite/local_settings.py.example
++++ b/webapp/graphite/local_settings.py.example
+@@ -54,7 +54,7 @@
+ #####################################
+ # Change only GRAPHITE_ROOT if your install is merely shifted from /opt/graphite
+ # to somewhere else
+-#GRAPHITE_ROOT = '/opt/graphite'
++GRAPHITE_ROOT = '/usr/share/graphite'
+ 
+ # Most installs done outside of a separate tree such as /opt/graphite will only
+ # need to change these three settings. Note that the default settings for each
+@@ -62,6 +62,9 @@
+ #CONF_DIR = '/opt/graphite/conf'
+ #STORAGE_DIR = '/opt/graphite/storage'
+ #CONTENT_DIR = '/opt/graphite/webapp/content'
++CONF_DIR = '/etc/graphite-web'
++STORAGE_DIR = '/var/lib/graphite-web'
++CONTENT_DIR = '/usr/share/graphite/webapp/content'
+ 
+ # To further or fully customize the paths, modify the following. Note that the
+ # default settings for each of these are relative to CONF_DIR and STORAGE_DIR
+@@ -69,6 +72,8 @@
+ ## Webapp config files
+ #DASHBOARD_CONF = '/opt/graphite/conf/dashboard.conf'
+ #GRAPHTEMPLATES_CONF = '/opt/graphite/conf/graphTemplates.conf'
++DASHBOARD_CONF = '/etc/graphite-web/dashboard.conf'
++GRAPHTEMPLATES_CONF = '/etc/graphite-web/graphTemplates.conf'
+ 
+ ## Data directories
+ # NOTE: If any directory is unreadable in DATA_DIRS it will break metric browsing
+@@ -77,7 +82,11 @@
+ #DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
+ #LOG_DIR = '/opt/graphite/storage/log/webapp'
+ #INDEX_FILE = '/opt/graphite/storage/index'  # Search index file
+-
++WHISPER_DIR = '/var/lib/carbon/whisper'
++RRD_DIR = '/var/lib/carbon/rrd'
++DATA_DIRS = [WHISPER_DIR, RRD_DIR] # Default: set from the above variables
++LOG_DIR = '/var/log/graphite-web/'
++INDEX_FILE = '/var/lib/graphite-web/index'  # Search index file
+ 
+ #####################################
+ # Email Configuration #
+-- 
+1.9.3
+
diff --git a/graphite-web-0.9.12-Force-use-of-system-libraries.patch b/graphite-web-0.9.12-Force-use-of-system-libraries.patch
new file mode 100644
index 0000000..fec546f
--- /dev/null
+++ b/graphite-web-0.9.12-Force-use-of-system-libraries.patch
@@ -0,0 +1,101 @@
+From 1ca73dd4ec442d6ada765e5375efee84bbc7522b Mon Sep 17 00:00:00 2001
+From: Jamie Nguyen <j at jamielinux.com>
+Date: Mon, 29 Sep 2014 09:53:22 +0100
+Subject: [PATCH] Force use of system libraries
+
+---
+ setup.py                          | 2 --
+ webapp/graphite/cli/parser.py     | 2 +-
+ webapp/graphite/render/attime.py  | 5 +----
+ webapp/graphite/render/glyph.py   | 5 +----
+ webapp/graphite/render/grammar.py | 2 +-
+ webapp/graphite/render/views.py   | 5 +----
+ 6 files changed, 5 insertions(+), 16 deletions(-)
+
+diff --git a/setup.py b/setup.py
+index 4dc0ce0..1b910d1 100644
+--- a/setup.py
++++ b/setup.py
+@@ -54,8 +54,6 @@ setup(
+     'graphite.graphlot',
+     'graphite.events',
+     'graphite.version',
+-    'graphite.thirdparty',
+-    'graphite.thirdparty.pytz',
+   ],
+   package_data={'graphite' :
+     ['templates/*', 'local_settings.py.example']},
+diff --git a/webapp/graphite/cli/parser.py b/webapp/graphite/cli/parser.py
+index ec1a435..7d7d48d 100644
+--- a/webapp/graphite/cli/parser.py
++++ b/webapp/graphite/cli/parser.py
+@@ -12,7 +12,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License."""
+ 
+-from graphite.thirdparty.pyparsing import *
++from pyparsing import *
+ 
+ grammar = Forward()
+ 
+diff --git a/webapp/graphite/render/attime.py b/webapp/graphite/render/attime.py
+index 55a644c..8adde3f 100644
+--- a/webapp/graphite/render/attime.py
++++ b/webapp/graphite/render/attime.py
+@@ -16,10 +16,7 @@ from datetime import datetime,timedelta
+ from time import daylight
+ from django.conf import settings
+ 
+-try: # See if there is a system installation of pytz first
+-  import pytz
+-except ImportError: # Otherwise we fall back to Graphite's bundled version
+-  from graphite.thirdparty import pytz
++import pytz
+ 
+ 
+ months = ['jan','feb','mar','apr','may','jun','jul','aug','sep','oct','nov','dec']
+diff --git a/webapp/graphite/render/glyph.py b/webapp/graphite/render/glyph.py
+index a2cc893..c6f31f1 100644
+--- a/webapp/graphite/render/glyph.py
++++ b/webapp/graphite/render/glyph.py
+@@ -22,10 +22,7 @@ from graphite.render.datalib import TimeSeries
+ from graphite.util import json
+ 
+ 
+-try: # See if there is a system installation of pytz first
+-  import pytz
+-except ImportError: # Otherwise we fall back to Graphite's bundled version
+-  from graphite.thirdparty import pytz
++import pytz
+ 
+ INFINITY = float('inf')
+ 
+diff --git a/webapp/graphite/render/grammar.py b/webapp/graphite/render/grammar.py
+index 07e3e4b..2b0ba41 100644
+--- a/webapp/graphite/render/grammar.py
++++ b/webapp/graphite/render/grammar.py
+@@ -1,4 +1,4 @@
+-from graphite.thirdparty.pyparsing import *
++from pyparsing import *
+ 
+ ParserElement.enablePackrat()
+ grammar = Forward()
+diff --git a/webapp/graphite/render/views.py b/webapp/graphite/render/views.py
+index 186232e..cd747a7 100644
+--- a/webapp/graphite/render/views.py
++++ b/webapp/graphite/render/views.py
+@@ -25,10 +25,7 @@ try:
+ except ImportError:
+   import pickle
+ 
+-try:  # See if there is a system installation of pytz first
+-  import pytz
+-except ImportError:  # Otherwise we fall back to Graphite's bundled version
+-  from graphite.thirdparty import pytz
++import pytz
+ 
+ from graphite.util import getProfileByUsername, json, unpickle
+ from graphite.remote_storage import HTTPConnectionWithTimeout
+-- 
+1.9.3
+
diff --git a/graphite-web.spec b/graphite-web.spec
index 5366bc3..35a0476 100644
--- a/graphite-web.spec
+++ b/graphite-web.spec
@@ -15,12 +15,13 @@ Source0:        https://github.com/graphite-project/graphite-web/archive/%{commi
 Source1:        graphite-web-vhost.conf
 Source2:        graphite-web-README.fedora
 Source3:        graphite-web-README.selinux
-Patch0:         graphite-web-0.9.12-fhs-thirdparty.patch
-Patch1:         graphite-web-0.9.12-dashboard-load.patch
-Patch2:         graphite-web-0.9.12-carbonlink-exception-log.patch
-Patch3:         graphite-web-0.9.12-safe-unpickle-deque-addition.patch
-BuildRoot:      %{_tmppath}/graphite-web-%{version}-%{release}-root-%(%{__id_u} -n)
+Patch0:         %{name}-0.9.12-Amend-default-filesystem-locations.patch
+Patch1:         %{name}-0.9.12-Force-use-of-system-libraries.patch
+Patch2:         %{name}-0.9.12-carbonlink-exception-log.patch
+Patch3:         %{name}-0.9.12-dashboard-load.patch
+Patch4:         %{name}-0.9.12-safe-unpickle-deque-addition.patch
 
+BuildRoot:      %{_tmppath}/graphite-web-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildArch:      noarch
 BuildRequires:  python-devel
 Requires:       python-whisper >= %{version}, mod_wsgi, pytz, pyparsing, python-simplejson
@@ -62,7 +63,6 @@ Requires(post): policycoreutils-python
 Requires(postun): policycoreutils-python
 %endif
 
-
 %description selinux
 SELinux labeling for graphite files.
 
@@ -72,17 +72,26 @@ SELinux labeling for graphite files.
 rm -rf webapp/graphite/thirdparty
 find -type f -iname '*.swf' -delete
 
-# Patch for Filesystem Hierarchy Standard
-# Remove thridparty libs
+install -m0644 %{SOURCE2} README.fedora
+install -m0644 %{SOURCE3} README.selinux
+
+# Amend default filesystem locations.
 %patch0 -p1
-# Fix loading dashboards by name (https://github.com/graphite-project/graphite-web/issues/411)
+
+# Force use of system libraries.
 %patch1 -p1
-# Log name of metric that throws exception for CarbonLink (https://github.com/graphite-project/graphite-web/pull/446)
+
+# To help diagnose some exceptions.
+# https://github.com/graphite-project/graphite-web/pull/446
 %patch2 -p1
-# Add deque to the PICKLE_SAFE filter (https://github.com/graphite-project/graphite-web/issues/423)
+
+# Dashboard not loading when passed as /dashboard/name.
+# https://github.com/graphite-project/graphite-web/issues/411
 %patch3 -p1
-%{__install} -m 644 %{SOURCE2} README.fedora
-%{__install} -m 644 %{SOURCE3} README.selinux
+
+# Add deque to the PICKLE_SAFE filter.
+# https://github.com/graphite-project/graphite-web/issues/423
+%patch4 -p1
 
 
 %build
@@ -91,7 +100,10 @@ find -type f -iname '*.swf' -delete
 
 %install
 rm -rf %{buildroot}
-%{__python} setup.py install -O1 --skip-build --root %{buildroot}
+%{__python} setup.py install --optimize=1 --skip-build --root %{buildroot} \
+    --install-lib=%{python_sitelib} \
+    --install-data=%{_datadir}/graphite \
+    --install-scripts=%{_bindir}
 
 # Create directories 
 %{__mkdir_p} %{buildroot}%{_localstatedir}/lib/graphite-web


More information about the scm-commits mailing list