Changeset created on Mon May 30 16:31:56 CEST 2011 by Seek You Too Description: Upgrade to gcj 4.4 and libgcj10 Meresco components now also runs on gcj 4.4 and libgcj 10. Some dependencies are updated; Due to a new pyinotify which uses a logging modlue the logging module in meresco components is renamed to log Baseline version: https://meresco.svn.sourceforge.net/svnroot/meresco/meresco-components/tags/version_3.4.13 diff --unidirectional-new-file --exclude='*.so' --exclude='*.o' --exclude=.svn --exclude='*.pyc' --exclude=deps.d --exclude=applied --recursive --unified version_3.4.13/build-deps.txt version_3.4.13.1/build-deps.txt --- version_3.4.13/build-deps.txt 2011-05-30 14:11:30.000000000 +0200 +++ version_3.4.13.1/build-deps.txt 2011-05-30 16:31:11.000000000 +0200 @@ -2,13 +2,23 @@ python-dev (<< 2.6) libglib2.0-dev (>= 2.16.6-2) libglib2.0-dev (<< 2.16.7) -g++-4.3 (>= 4.3.2-1.1) -g++-4.3 (<< 4.4) -gcj-4.3 (>= 4.3.2-2.CQ2) -gcj-4.3 (<< 4.3.3) -libgcj9-dev (>= 4.3.2-2.CQ2) -libgcj9-dev (<< 4.3.3) -liblucene-core2-gcj9 (>= 2.2.0) -liblucene-core2-gcj9 (<< 2.2.1) -liblucene-core2-gcj9-dev (>= 2.2.0) -liblucene-core2-gcj9-dev (<< 2.2.1) +#lenny:g++-4.3 (>= 4.3.2-1.1) +#lenny:g++-4.3 (<< 4.4) +#lenny:gcj-4.3 (>= 4.3.2-2.CQ2) +#lenny:gcj-4.3 (<< 4.3.3) +#lenny:libgcj9-dev (>= 4.3.2-2.CQ2) +#lenny:libgcj9-dev (<< 4.3.3) +#lenny:liblucene-core2-gcj9 (>= 2.2.0) +#lenny:liblucene-core2-gcj9 (<< 2.2.1) +#lenny:liblucene-core2-gcj9-dev (>= 2.2.0) +#lenny:liblucene-core2-gcj9-dev (<< 2.2.1) +#squeeze:g++-4.4 (>= 4.4.5-8) +#squeeze:g++-4.4 (<< 4.5) +#squeeze:gcj-4.4 (>= 4.4.5-2.CQ2) +#squeeze:gcj-4.4 (<< 4.4.6) +#squeeze:libgcj10-dev (>= 4.4.5-2.CQ2) +#squeeze:libgcj10-dev (<< 4.4.6) +#squeeze:liblucene-core2-gcj10 (>= 2.2.0) +#squeeze:liblucene-core2-gcj10 (<< 2.2.1) +#squeeze:liblucene-core2-gcj10-dev (>= 2.2.0) +#squeeze:liblucene-core2-gcj10-dev (<< 2.2.1) diff --unidirectional-new-file --exclude='*.so' --exclude='*.o' --exclude=.svn --exclude='*.pyc' --exclude=deps.d --exclude=applied --recursive --unified version_3.4.13/deps.txt version_3.4.13.1/deps.txt --- version_3.4.13/deps.txt 2011-05-30 14:11:30.000000000 +0200 +++ version_3.4.13.1/deps.txt 2011-05-30 16:28:02.000000000 +0200 @@ -20,7 +20,10 @@ python-storage (<<5.2) python-weightless-core (>= 0.5) python-weightless-core (<< 0.6) -liblucene-core2-gcj9 (>= 2.2.0) -liblucene-core2-gcj9 (< 2.4.0) -libgcj9-0 +#lenny:liblucene-core2-gcj9 (>= 2.2.0) +#lenny:liblucene-core2-gcj9 (< 2.4.0) +#squeeze:liblucene-core2-gcj10 (>= 2.2.0) +#squeeze:liblucene-core2-gcj10 (< 2.4.0) +#lenny:libgcj9-0 +#squeeze:libgcj10 lsof diff --unidirectional-new-file --exclude='*.so' --exclude='*.o' --exclude=.svn --exclude='*.pyc' --exclude=deps.d --exclude=applied --recursive --unified version_3.4.13/meresco/components/log/directorylog.py version_3.4.13.1/meresco/components/log/directorylog.py --- version_3.4.13/meresco/components/log/directorylog.py 1970-01-01 01:00:00.000000000 +0100 +++ version_3.4.13.1/meresco/components/log/directorylog.py 2011-05-30 16:21:41.000000000 +0200 @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +## begin license ## +# +# "Meresco Components" are components to build searchengines, repositories +# and archives, based on "Meresco Core". +# +# Copyright (C) 2006-2011 Seek You Too (CQ2) http://www.cq2.nl +# Copyright (C) 2006-2011 Stichting Kennisnet http://www.kennisnet.nl +# +# This file is part of "Meresco Components" +# +# "Meresco Components" 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. +# +# "Meresco Components" 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 "Meresco Components"; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +## end license ## + +from __future__ import with_statement +from time import strftime, gmtime +from os.path import join, isdir, isfile +from os import makedirs, listdir, remove + +NR_OF_FILES_KEPT = 14 + +# '2009-11-02T11:30:00Z 127.0.0.1 0.0K 1.000s /sru query=query&operation=searchRetrieve&version=1.1\n' +logtemplate = '%(strTimestamp)s %(ipAddress)s %(size).1fK %(duration).3fs %(path)s %(queryArguments)s\n' + +class DirectoryLog(object): + def __init__(self, logdir): + self._previousLog = None + self._logdir = logdir + if not isdir(self._logdir): + makedirs(self._logdir) + + def log(self, timestamp, path, ipAddress, size, duration, queryArguments): + strTimestamp=strftime('%Y-%m-%dT%H:%M:%SZ', gmtime(timestamp)) + logFilename = join(self._logdir, strftime('%Y-%m-%d-query.log', gmtime(timestamp))) + + if logFilename != self._previousLog: + logs = sorted(listdir(self._logdir)) + while len(logs) >= NR_OF_FILES_KEPT: + remove(join(self._logdir, logs[0])) + logs = sorted(listdir(self._logdir)) + + with open(logFilename, 'a') as f: + f.write(logtemplate % locals()) + + def logExists(self, logName): + return isfile(join(self._logdir, logName)) + + def listlogs(self): + return listdir(self._logdir) + + def getlog(self, logName): + logFilename = join(self._logdir, logName) + with open(logFilename) as f: + for line in f: + yield line + + diff --unidirectional-new-file --exclude='*.so' --exclude='*.o' --exclude=.svn --exclude='*.pyc' --exclude=deps.d --exclude=applied --recursive --unified version_3.4.13/meresco/components/log/__init__.py version_3.4.13.1/meresco/components/log/__init__.py --- version_3.4.13/meresco/components/log/__init__.py 1970-01-01 01:00:00.000000000 +0100 +++ version_3.4.13.1/meresco/components/log/__init__.py 2011-05-30 16:24:24.000000000 +0200 @@ -0,0 +1,29 @@ +## begin license ## +# +# "Meresco Components" are components to build searchengines, repositories +# and archives, based on "Meresco Core". +# +# Copyright (C) 2011 Seek You Too (CQ2) http://www.cq2.nl +# Copyright (C) 2011 Stichting Kennisnet http://www.kennisnet.nl +# +# This file is part of "Meresco Components" +# +# "Meresco Components" 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. +# +# "Meresco Components" 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 "Meresco Components"; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +## end license ## + +from logfileserver import LogFileServer +from querylog import QueryLog, QueryLogHelperForSru, QueryLogHelper +from directorylog import DirectoryLog diff --unidirectional-new-file --exclude='*.so' --exclude='*.o' --exclude=.svn --exclude='*.pyc' --exclude=deps.d --exclude=applied --recursive --unified version_3.4.13/meresco/components/log/logfileserver.py version_3.4.13.1/meresco/components/log/logfileserver.py --- version_3.4.13/meresco/components/log/logfileserver.py 1970-01-01 01:00:00.000000000 +0100 +++ version_3.4.13.1/meresco/components/log/logfileserver.py 2011-05-30 16:21:41.000000000 +0200 @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +## begin license ## +# +# "Meresco Components" are components to build searchengines, repositories +# and archives, based on "Meresco Core". +# +# Copyright (C) 2006-2011 Seek You Too (CQ2) http://www.cq2.nl +# Copyright (C) 2006-2011 Stichting Kennisnet http://www.kennisnet.nl +# +# This file is part of "Meresco Components" +# +# "Meresco Components" 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. +# +# "Meresco Components" 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 "Meresco Components"; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# +## end license ## + +from meresco.components.http import utils as httputils +from meresco.components.http.utils import CRLF + +from cgi import escape as _escapeHtml + +def escapeHtml(aString): + return _escapeHtml(aString).replace('"','"') + +class LogFileServer(object): + """ + Serve the logs through http and show a filelisting when not + requesting a specific path. + """ + + def __init__(self, name, log, basepath): + self._indexPaths = ['', '/'] + self._basepath = basepath + self._log = log + self._name = name + + def handleRequest(self, path, **kwargs): + if path in [self._basepath + p for p in self._indexPaths]: + return self._generateIndex(path) + elif path.startswith(self._basepath) and self._log.logExists(self._logNameFromPath(path)): + return self._generateSingleLog(path) + else: + return (x for x in [httputils.notFoundHtml, "