* publish internal tools for svn/trac
authormitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Fri, 22 Apr 2011 08:15:22 +0000 (08:15 +0000)
committermitty <mitty@7d2118f6-f56c-43e7-95a2-4bb3031d96e7>
Fri, 22 Apr 2011 08:15:22 +0000 (08:15 +0000)
git-svn-id: https://lab.mitty.jp/svn/lab/trunk@116 7d2118f6-f56c-43e7-95a2-4bb3031d96e7

20 files changed:
TipAndDoc/apache2/conf.d/apache2-doc [new file with mode: 0644]
TipAndDoc/apache2/conf.d/denydot [new file with mode: 0644]
TipAndDoc/apache2/httpd.conf [new file with mode: 0644]
TipAndDoc/apache2/sites-available/lab [new file with mode: 0644]
TipAndDoc/apache2/sites-available/ssl.lab [new file with mode: 0644]
TipAndDoc/tools/passwd/svn-authz.lab [new file with mode: 0644]
TipAndDoc/tools/svn/hooks/post-commit [new file with mode: 0644]
TipAndDoc/tools/svn/hooks/start-commit [new file with mode: 0644]
TipAndDoc/tools/tool/buildrepos.sh [new file with mode: 0644]
TipAndDoc/tools/tool/buildtrac.sh [new file with mode: 0644]
TipAndDoc/tools/tool/trac.ini.build [new file with mode: 0644]
TipAndDoc/tools/trac/cgi-bin/trac.cgi [new file with mode: 0644]
TipAndDoc/tools/trac/cgi-bin/trac.fcgi [new file with mode: 0644]
TipAndDoc/tools/trac/conf/lab.tracignore [new file with mode: 0644]
TipAndDoc/tools/trac/conf/trac.ini [new file with mode: 0644]
TipAndDoc/tools/trac/contrib/trac-svn-hook [new file with mode: 0644]
TipAndDoc/tools/trac/htdocs/custom.css [new file with mode: 0644]
TipAndDoc/tools/trac/templates/site.html [new file with mode: 0644]
TipAndDoc/tools/www/svn/svnindex.css [new file with mode: 0644]
TipAndDoc/tools/www/svn/svnindex.xsl [new file with mode: 0644]

diff --git a/TipAndDoc/apache2/conf.d/apache2-doc b/TipAndDoc/apache2/conf.d/apache2-doc
new file mode 100644 (file)
index 0000000..01315c5
--- /dev/null
@@ -0,0 +1,21 @@
+Alias /manual /usr/share/doc/apache2-doc/manual/
+
+<Directory "/usr/share/doc/apache2-doc/manual/">
+    Options Indexes FollowSymlinks
+    AllowOverride None
+    Order allow,deny
+    Allow from all
+    AddDefaultCharset ISO-8859-1
+</Directory>
+
+<Directory "/usr/share/doc/apache2-doc/manual/ja/">
+       AddDefaultCharset UTF-8
+</Directory>
+
+<Directory "/usr/share/doc/apache2-doc/manual/ko/">
+       AddDefaultCharset EUC-KR
+</Directory>
+
+<Directory "/usr/share/doc/apache2-doc/manual/tr/">
+       AddDefaultCharset UTF-8
+</Directory>
diff --git a/TipAndDoc/apache2/conf.d/denydot b/TipAndDoc/apache2/conf.d/denydot
new file mode 100644 (file)
index 0000000..a361448
--- /dev/null
@@ -0,0 +1,12 @@
+# prevent files and directories started with 'dot' (ex: .svn/)
+# from being viewed
+
+<FilesMatch "^\.">
+       Order Allow,Deny
+       Deny from all
+</FilesMatch>
+
+<DirectoryMatch "/\.">
+       Order Allow,Deny
+       Deny from all
+</DirectoryMatch>
diff --git a/TipAndDoc/apache2/httpd.conf b/TipAndDoc/apache2/httpd.conf
new file mode 100644 (file)
index 0000000..b5a8b2e
--- /dev/null
@@ -0,0 +1,4 @@
+NameVirtualHost *:443
+<IfModule mod_status.c>
+       ExtendedStatus On
+</IfModule>
diff --git a/TipAndDoc/apache2/sites-available/lab b/TipAndDoc/apache2/sites-available/lab
new file mode 100644 (file)
index 0000000..8903934
--- /dev/null
@@ -0,0 +1,74 @@
+<VirtualHost *:80>
+#   General setup for the virtual host
+       ServerName lab.mitty.jp
+       ServerSignature On
+
+       LogLevel warn
+       ErrorLog "|/usr/sbin/rotatelogs /var/log/apache2/error_lab_%Y%m%d_log 86400 540"
+       CustomLog "|/usr/sbin/rotatelogs /var/log/apache2/access_lab_%Y%m%d_log 86400 540" combined
+
+       DocumentRoot "/var/www/lab"
+       <Directory />
+               Options FollowSymLinks
+               AllowOverride None
+               Order Deny,Allow
+               Deny from all
+       </Directory>
+       <Directory /var/www/lab>
+               Order Allow,Deny
+               Allow from all
+       </Directory>
+
+# Alias for project independent contents
+       <Location /static>
+               Order Allow,Deny
+               Allow from all
+       </Location>
+       Alias /static/trac      /var/www/trac
+       Alias /static/svn       /home/tools/www/svn
+       Alias /static/htdocs    /home/tools/trac/htdocs
+
+# Alias for SVN
+        RedirectMatch ^/svn$ /svn/
+       <Location /svn/>
+               # Requests for a collection must have a trailing slash on the URI.
+               DAV svn
+               SVNParentPath /var/svn/lab
+               SVNListParentPath on
+               SVNIndexXSLT "/static/svn/svnindex.xsl"
+               <LimitExcept GET PROPFIND OPTIONS REPORT>
+                       Order Allow,Deny
+                       Deny from all
+               </LimitExcept>
+               Order Allow,Deny
+               Allow from all
+       </Location>
+
+# Alias for Trac
+       ScriptAlias /trac       /home/tools/trac/cgi-bin/trac.fcgi
+       FcgidInitialEnv PYTHON_EGG_CACHE "/tmp"
+       FcgidInitialEnv TRAC_ENV_PARENT_DIR "/var/trac/lab"
+
+       # increase fcgi timeout value to wait slow cgi exec
+       FcgidIOTimeout 180
+
+       <Location /trac>
+               <LimitExcept GET>
+                       Order Allow,Deny
+                       Deny from all
+               </LimitExcept>
+               Order Allow,Deny
+               Allow from all
+       </Location>
+       <LocationMatch /trac/[^/]+/login>
+               Deny from all
+       </LocationMatch>
+
+## Trac query redirect
+       RewriteEngine On
+       RewriteCond %{QUERY_STRING} ^$
+       RewriteCond %{REQUEST_METHOD} !POST
+       RewriteCond %{HTTP_COOKIE} !trac_auth=
+       RewriteRule ^/trac/([^/]+)/query$ /trac/$1/query?status=!&group=component [R,L]
+
+</VirtualHost>
diff --git a/TipAndDoc/apache2/sites-available/ssl.lab b/TipAndDoc/apache2/sites-available/ssl.lab
new file mode 100644 (file)
index 0000000..6e36656
--- /dev/null
@@ -0,0 +1,98 @@
+<VirtualHost *:443>
+#   General setup for the virtual host
+       ServerName lab.mitty.jp
+       ServerSignature On
+
+       LogLevel warn
+       ErrorLog "|/usr/sbin/rotatelogs /var/log/apache2/ssl/error_lab_%Y%m%d_log 86400 540"
+       CustomLog "|/usr/sbin/rotatelogs /var/log/apache2/ssl/access_lab_%Y%m%d_log 86400 540" combined
+
+       SSLEngine on
+       SSLCertificateFile "/path/to/ssl/server.crt"
+       SSLCertificateKeyFile "/path/to/ssl/server.key"
+
+       BrowserMatch "MSIE [2-6]" \
+                nokeepalive ssl-unclean-shutdown \
+                downgrade-1.0 force-response-1.0
+       # MSIE 7 and newer should be able to use keepalive
+       BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown
+
+       DocumentRoot "/var/www/lab"
+       <Directory />
+               SSLRequireSSL
+               Options FollowSymLinks
+               AllowOverride None
+               Order Deny,Allow
+               Deny from all
+       </Directory>
+       <Directory /var/www/lab>
+               Order Allow,Deny
+               Allow from all
+       </Directory>
+
+       SetEnv HTTPS 1
+
+# Alias for project independent contents
+       <Location /static>
+               Order Allow,Deny
+               Allow from all
+       </Location>
+       Alias /static/trac      /var/www/trac
+       Alias /static/svn       /home/tools/www/svn
+       Alias /static/htdocs    /home/tools/trac/htdocs
+
+# Alias for SVN
+        RedirectMatch ^/svn$ /svn/
+       <Location /svn/>
+               # Requests for a collection must have a trailing slash on the URI.
+               DAV svn
+               SVNParentPath /var/svn/lab
+               SVNListParentPath on
+               SVNIndexXSLT "/static/svn/svnindex.xsl"
+               <LimitExcept GET PROPFIND OPTIONS REPORT>
+                       AuthType Basic
+                       AuthName "Authentication for lab.mitty.jp"
+                       AuthUserFile /home/tools/passwd/htpasswd.lab
+                       AuthzSVNAccessFile /home/tools/passwd/svn-authz.lab
+                       Require valid-user
+               </LimitExcept>
+               Order Allow,Deny
+               Allow from all
+       </Location>
+
+# Alias for Trac
+       ScriptAlias /trac       /home/tools/trac/cgi-bin/trac.fcgi
+       FcgidInitialEnv PYTHON_EGG_CACHE "/tmp"
+       FcgidInitialEnv TRAC_ENV_PARENT_DIR "/var/trac/lab"
+
+       # increase fcgi timeout value to wait slow cgi exec
+       FcgidIOTimeout 180
+
+       <Location /trac>
+               <LimitExcept GET>
+                       AuthType Basic
+                       AuthName "Authentication for lab.mitty.jp"
+                       AuthUserFile /home/tools/passwd/htpasswd.lab
+                       Require valid-user
+               </LimitExcept>
+               Order Allow,Deny
+               Allow from all
+       </Location>
+       <LocationMatch /trac/[^/]+/login>
+               Require valid-user
+       </LocationMatch>
+
+## Trac query redirect
+       RewriteEngine On
+       RewriteCond %{REQUEST_METHOD} POST
+       RewriteRule ^/trac/([^/]+)/query$ - [L]
+       
+       RewriteCond %{QUERY_STRING} ^$
+       RewriteCond %{HTTP_COOKIE} !trac_auth=
+       RewriteRule ^/trac/([^/]+)/query$ /trac/$1/query?status=!&group=component [R,L]
+       
+       RewriteCond %{QUERY_STRING} ^$
+       RewriteCond %{HTTP_COOKIE} trac_auth=
+       RewriteRule ^/trac/([^/]+)/query$ /trac/$1/query?status=!closed&group=component [R,L]
+
+</VirtualHost>
diff --git a/TipAndDoc/tools/passwd/svn-authz.lab b/TipAndDoc/tools/passwd/svn-authz.lab
new file mode 100644 (file)
index 0000000..2f1f403
--- /dev/null
@@ -0,0 +1,9 @@
+[groups]
+
+[/]
+* = r
+mitty = rw
+
+[lab:/]
+
+[test:/]
diff --git a/TipAndDoc/tools/svn/hooks/post-commit b/TipAndDoc/tools/svn/hooks/post-commit
new file mode 100644 (file)
index 0000000..53f8a72
--- /dev/null
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+# POST-COMMIT HOOK
+#
+# The post-commit hook is invoked after a commit.  Subversion runs
+# this hook by invoking a program (script, executable, binary, etc.)
+# named 'post-commit' (for which this file is a template) with the 
+# following ordered arguments:
+#
+#   [1] REPOS-PATH   (the path to this repository)
+#   [2] REV          (the number of the revision just committed)
+#
+# The default working directory for the invocation is undefined, so
+# the program should set one explicitly if it cares.
+#
+# Because the commit has already completed and cannot be undone,
+# the exit code of the hook program is ignored.  The hook program
+# can use the 'svnlook' utility to help it examine the
+# newly-committed tree.
+#
+# On a Unix system, the normal procedure is to have 'post-commit'
+# invoke other programs to do the real work, though it may do the
+# work itself too.
+#
+# Note that 'post-commit' must be executable by the user(s) who will
+# invoke it (typically the user httpd runs as), and that user must
+# have filesystem-level permission to access the repository.
+#
+# On a Windows system, you should name the hook program
+# 'post-commit.bat' or 'post-commit.exe',
+# but the basic idea is the same.
+# 
+# The hook program typically does not inherit the environment of
+# its parent process.  For example, a common problem is for the
+# PATH environment variable to not be set to its usual value, so
+# that subprograms fail to launch unless invoked via absolute path.
+# If you're having unexpected problems with a hook program, the
+# culprit may be unusual (or missing) environment variables.
+# 
+# Here is an example hook script, for a Unix /bin/sh interpreter.
+# For more examples and pre-written hooks, see those in
+# /usr/share/subversion/hook-scripts, and in the repository at
+# http://svn.collab.net/repos/svn/trunk/tools/hook-scripts/ and
+# http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/
+
+
+REPOS="$1"
+REV="$2"
+
+# "$REPOS"/hooks/mailer.py commit "$REPOS" $REV "$REPOS"/mailer.conf
+
+PROJECT_NAME=`basename $REPOS`
+DIRNAME=`dirname $REPOS`
+SUB_ROOTDIR=`basename $DIRNAME`
+
+export PYTHON_EGG_CACHE="/tmp"
+export TRAC_ENV="/var/trac/${SUB_ROOTDIR}/${PROJECT_NAME}"
+/home/tools/trac/contrib/trac-svn-hook $REPOS $REV
diff --git a/TipAndDoc/tools/svn/hooks/start-commit b/TipAndDoc/tools/svn/hooks/start-commit
new file mode 100644 (file)
index 0000000..88290a9
--- /dev/null
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+
+# START-COMMIT HOOK
+#
+#   [1] REPOS-PATH   (the path to this repository)
+#   [2] USER         (the authenticated user attempting to commit)
+#   [3] CAPABILITIES (a colon-separated list of capabilities reported
+#                     by the client; see note below)
+#
+# Note: The CAPABILITIES parameter is new in Subversion 1.5, and 1.5
+# clients will typically report at least the "mergeinfo" capability.
+# If there are other capabilities, then the list is colon-separated,
+# e.g.: "mergeinfo:some-other-capability" (the order is undefined).
+#
+
+my $repospath     = $ARGV[0];
+my $user          = $ARGV[1];
+my $capabilities  = $ARGV[2];
+
+# CAPABILITIES is a colon-separated list of svn client capabilities
+if (! defined $capabilities) {
+    print STDERR "commit fail: you must use Subversion 1.5 or later\n";
+    exit 1;
+}
+
+my @capabilities  = split /:/, $capabilities;
+
+foreach my $parameter ( @capabilities ){
+    $capabilities{ $parameter }++;
+}
+
+if( $capabilities{ "mergeinfo" } ){
+    exit 0;
+}
+else{
+    print STDERR "commit fail: you must use Subversion 1.5 or later\n";
+    exit 1;
+}
diff --git a/TipAndDoc/tools/tool/buildrepos.sh b/TipAndDoc/tools/tool/buildrepos.sh
new file mode 100644 (file)
index 0000000..af17132
--- /dev/null
@@ -0,0 +1,51 @@
+#!/bin/sh
+
+set -x
+export LANG=C
+
+PROJECT_NAME="${1:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> [-noinit] "}"
+SUB_ROOTDIR="${2:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> [-noinit] "}"
+
+# stop script if "$1" exists
+isexist () {
+    if [ -e "$1" ] ; then
+        echo "$1" already exists
+        exit
+    fi
+}
+
+# set global environments
+NEWREPOS="/var/svn/${SUB_ROOTDIR}/${PROJECT_NAME}"
+REPOSBACKUP="/var/backups/svn/${SUB_ROOTDIR}/${PROJECT_NAME}"
+
+HOOKSKEL="/home/tools/svn/hooks"
+
+# check paths to be created
+isexist ${NEWREPOS}
+isexist ${REPOSBACKUP}
+
+# make repos
+mkdir -p ${NEWREPOS}
+svnadmin create --fs-type fsfs ${NEWREPOS}
+for HOOK in `ls ${HOOKSKEL}`; do
+  ln -s ${HOOKSKEL}/${HOOK} ${NEWREPOS}/hooks
+done
+mkdir -p ${NEWREPOS}/dav
+chgrp -R www-data ${NEWREPOS}
+chmod -R o-rw ${NEWREPOS}
+chmod -R g+ws ${NEWREPOS}/db
+chmod -R g+ws ${NEWREPOS}/dav
+
+# make repos backup
+mkdir -p ${REPOSBACKUP}/incremental
+chgrp -R www-data ${REPOSBACKUP}
+chmod -R g+ws ${REPOSBACKUP}
+
+if [ "$3" != "-noinit" ]; then
+    # initial commit
+    svn mkdir -m "REPOS init." file://${NEWREPOS}/trunk file://${NEWREPOS}/tags file://${NEWREPOS}/branches file://${NEWREPOS}/vendor
+fi
+
+
+echo "done"
+echo "${NEWREPOS} ${REPOSBACKUP} are created"
diff --git a/TipAndDoc/tools/tool/buildtrac.sh b/TipAndDoc/tools/tool/buildtrac.sh
new file mode 100644 (file)
index 0000000..23c2963
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh
+
+set -x
+export LANG=C
+
+PROJECT_NAME="${1:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> <SUBDOMAIN> "}"
+SUB_ROOTDIR="${2:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> <SUBDOMAIN> "}"
+SUBDOMAIN="${3:?"usage: $0 <PROJECT_NAME> <SUB_ROOTDIR> <SUBDOMAIN> "}"
+
+# stop script if "$1" exists
+isexist () {
+    if [ -e "$1" ] ; then
+        echo "$1" already exists
+        exit
+    fi
+}
+
+# set global environments
+NEWTRAC="/var/trac/${SUB_ROOTDIR}/${PROJECT_NAME}"
+TRACBACKUP="/var/backups/trac/${SUB_ROOTDIR}/${PROJECT_NAME}"
+TRACINI="/home/tools/tool/trac.ini.build"
+SVNPATH="/var/svn/${SUB_ROOTDIR}/${PROJECT_NAME}"
+
+# check paths to be created
+isexist ${NEWTRAC}
+isexist ${TRACBACKUP}
+
+# make trac
+mkdir -p ${NEWREPOS}
+trac-admin ${NEWTRAC} initenv ${PROJECT_NAME} sqlite:db/trac.db svn ${SVNPATH}
+trac-admin ${NEWTRAC} permission add mitty TRAC_ADMIN
+chgrp -R www-data ${NEWTRAC}
+chmod -R o-rw ${NEWTRAC}
+chmod -R g-w ${NEWTRAC}
+chmod -R g+w ${NEWTRAC}/attachments
+chmod -R g+w ${NEWTRAC}/db
+chmod -R g+w ${NEWTRAC}/log
+
+# make trac backup
+mkdir -p ${TRACBACKUP}
+chgrp -R www-data ${TRACBACKUP}
+chmod -R g+ws ${TRACBACKUP}
+
+# modify trac.ini
+mv ${NEWTRAC}/conf/trac.ini ${NEWTRAC}/conf/trac.ini.original
+cp ${TRACINI} ${NEWTRAC}/conf/trac.ini
+sed -i s#PROJECT_NAME#${PROJECT_NAME}#g ${NEWTRAC}/conf/trac.ini
+sed -i s#SUBDOMAIN#${SUBDOMAIN}#g ${NEWTRAC}/conf/trac.ini
+sed -i s#SUB_ROOTDIR#${SUB_ROOTDIR}#g ${NEWTRAC}/conf/trac.ini
+sed -i s#SVNPATH#${SVNPATH}#g ${NEWTRAC}/conf/trac.ini
+chgrp -R www-data ${NEWTRAC}/conf/trac.ini
+chmod -R g+w ${NEWTRAC}/conf/trac.ini
+chmod    g+w ${NEWTRAC}/conf
+
+
+echo "done"
+echo "${NEWTRAC} ${TRACBACKUP} are created"
diff --git a/TipAndDoc/tools/tool/trac.ini.build b/TipAndDoc/tools/tool/trac.ini.build
new file mode 100644 (file)
index 0000000..6f811b2
--- /dev/null
@@ -0,0 +1,17 @@
+# -*- coding: utf-8 -*-
+
+[header_logo]
+link = https://SUBDOMAIN.mitty.jp/trac/
+
+[inherit]
+file = /home/tools/trac/conf/trac.ini
+
+[project]
+descr = PROJECT_NAME
+name = PROJECT_NAME
+url = https://SUBDOMAIN.mitty.jp/trac/PROJECT_NAME/
+
+[trac]
+authz_file = /home/tools/passwd/svn-authz.SUB_ROOTDIR
+authz_module_name = PROJECT_NAME
+repository_dir = SVNPATH
diff --git a/TipAndDoc/tools/trac/cgi-bin/trac.cgi b/TipAndDoc/tools/trac/cgi-bin/trac.cgi
new file mode 100644 (file)
index 0000000..6b27b43
--- /dev/null
@@ -0,0 +1,37 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2003-2009 Edgewall Software
+# Copyright (C) 2003-2004 Jonas Borgström <jonas@edgewall.com>
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://trac.edgewall.org/wiki/TracLicense.
+#
+# This software consists of voluntary contributions made by many
+# individuals. For the exact contribution history, see the revision
+# history and logs, available at http://trac.edgewall.org/log/.
+#
+# Author: Jonas Borgström <jonas@edgewall.com>
+
+try:
+    from trac.web import cgi_frontend
+    cgi_frontend.run()
+except SystemExit:
+    raise
+except Exception, e:
+    import sys
+    import traceback
+
+    print>>sys.stderr, e
+    traceback.print_exc(file=sys.stderr)
+
+    print 'Status: 500 Internal Server Error'
+    print 'Content-Type: text/plain'
+    print
+    print 'Oops...'
+    print
+    print 'Trac detected an internal error:', e
+    print
+    traceback.print_exc(file=sys.stdout)
diff --git a/TipAndDoc/tools/trac/cgi-bin/trac.fcgi b/TipAndDoc/tools/trac/cgi-bin/trac.fcgi
new file mode 100644 (file)
index 0000000..23c28e2
--- /dev/null
@@ -0,0 +1,35 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2003-2009 Edgewall Software
+# Copyright (C) 2003-2004 Jonas Borgström <jonas@edgewall.com>
+# All rights reserved.
+#
+# This software is licensed as described in the file COPYING, which
+# you should have received as part of this distribution. The terms
+# are also available at http://trac.edgewall.org/wiki/TracLicense.
+#
+# This software consists of voluntary contributions made by many
+# individuals. For the exact contribution history, see the revision
+# history and logs, available at http://trac.edgewall.org/log/.
+#
+# Author: Jonas Borgström <jonas@edgewall.com>
+
+try:
+    from trac.web import fcgi_frontend
+    fcgi_frontend.run()
+except SystemExit:
+    raise
+except Exception, e:
+    print 'Content-Type: text/plain\r\n\r\n',
+    print 'Oops...'
+    print
+    print 'Trac detected an internal error:'
+    print
+    print e
+    print
+    import traceback
+    import StringIO
+    tb = StringIO.StringIO()
+    traceback.print_exc(file=tb)
+    print tb.getvalue()
diff --git a/TipAndDoc/tools/trac/conf/lab.tracignore b/TipAndDoc/tools/trac/conf/lab.tracignore
new file mode 100644 (file)
index 0000000..58b3b08
--- /dev/null
@@ -0,0 +1,3 @@
+.*
+lab.test
+test2
diff --git a/TipAndDoc/tools/trac/conf/trac.ini b/TipAndDoc/tools/trac/conf/trac.ini
new file mode 100644 (file)
index 0000000..df3599c
--- /dev/null
@@ -0,0 +1,197 @@
+# -*- coding: utf-8 -*-
+
+[attachment]
+render_unsafe_content = false
+max_size = 104857600
+
+[browser]
+downloadable_paths = /*
+hide_properties = svk:merge
+render_unsafe_content = false
+
+[changeset]
+wiki_format_messages = true
+max_diff_files = 64
+max_diff_bytes = 102400
+
+[components]
+trac.ticket.report.ReportModule = disabled
+graphviz.* = enabled
+tracrpc.* = enabled
+
+[graphviz]
+cache_dir = /var/tmp/graphviz
+out_format = png
+cache_manager = yes
+cache_max_size = 10000000
+cache_min_size = 1000000
+cache_max_count = 1000
+cache_min_count = 100
+
+[header_logo]
+src = /static/trac/trac_banner.png
+height = -1
+link = https://mitty.jp/trac/
+alt =
+width = -1
+
+[inherit]
+plugins_dir = /home/tools/trac/plugins
+templates_dir = /home/tools/trac/templates
+
+[intertrac]
+# -- エイリアスの設定例:
+t = trac
+# -- 外部の Trac へのリンク:
+trac.title = Edgewall's Trac for Trac
+trac.url = http://trac.edgewall.org
+
+trac-hacks.title = Trac Hacks - Plugins Macros etc. - Trac
+trac-hacks.url = http://trac-hacks.org
+
+[logging]
+log_type = none
+log_level = DEBUG
+log_format = 
+log_file = trac.log
+
+[milestone]
+stats_provider = DefaultTicketGroupStatsProvider
+
+[mimeviewer]
+enscript_modes = text/x-dylan:dylan:4
+enscript_path = enscript
+max_preview_size = 262144
+mime_map = text/x-dylan:dylan,text/x-idl:ice,text/x-ada:ads:adb:php:tmpl:xml:css
+php_path = php
+pygments_default_style = trac
+pygments_modes = 
+tab_width = 4
+
+[notification]
+admit_domains =
+always_notify_owner = false
+always_notify_reporter = false
+always_notify_updater = false
+ignore_domains =
+mime_encoding = base64
+smtp_always_bcc =
+smtp_always_cc =
+smtp_default_domain =
+smtp_enabled = false
+smtp_from = trac@localhost
+smtp_from_name =
+smtp_password =
+smtp_port = 25
+smtp_replyto = trac@localhost
+smtp_server = localhost
+smtp_subject_prefix = __default__
+smtp_user =
+ticket_subject_template = $prefix #$ticket.id: $summary
+use_public_cc = false
+use_short_addr = false
+use_tls = false
+
+[project]
+admin =
+admin_trac_url = 
+descr = 
+footer = Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a>
+icon = common/trac.ico
+name = 
+url = 
+
+[query]
+default_anonymous_query = status!=closed&cc~=$USER
+default_query = status!=closed&owner=$USER
+items_per_page = 100
+
+[report]
+items_per_page = 100
+items_per_page_rss = 0
+
+[revisionlog]
+default_log_limit = 100
+
+[roadmap]
+stats_provider = DefaultTicketGroupStatsProvider
+
+[search]
+min_query_length = 3
+
+[svn]
+branches = trunk,branches/*
+tags = tags/*
+
+[ticket]
+default_priority = major
+default_type = task
+restrict_owner = true
+workflow = ConfigurableTicketWorkflow
+
+[ticket-workflow]
+accept = new,reopened -> assigned
+accept.name = 着手する
+accept.operations = set_owner_to_self
+accept.permissions = TICKET_MODIFY
+apply = new,assigned -> deploy
+apply.name = 適用する
+apply.operations = set_owner
+apply.permissions = TICKET_MODIFY
+leave = * -> *
+leave.default = 1
+leave.name = 更新しない
+leave.operations = leave_status
+reassign = new,assigned,reopened -> new
+reassign.name = 担当者変更
+reassign.operations = set_owner
+reassign.permissions = TICKET_MODIFY
+reopen = closed -> reopened
+reopen.name = 差し戻す
+reopen.operations = del_resolution
+reopen.permissions = TICKET_CREATE
+fail = deploy -> reopened
+fail.name = 未完成
+fail.operations = set_owner
+fail.permissions = TICKET_MODIFY
+resolve = new,assigned,deploy -> closed
+resolve.name = 解決にする
+resolve.operations = set_resolution
+resolve.permissions = TICKET_MODIFY
+
+[timeline]
+abbreviated_messages = true
+changeset_collapse_events = false
+changeset_long_messages = true
+changeset_show_files = 5
+default_daysback = 14
+newticket_formatter = oneliner
+ticket_show_details = true
+
+[trac]
+authz_file = /home/tools/passwd/svn-authz.lab
+authz_module_name =
+auto_reload = true
+base_url =
+check_auth_ip = false
+database = sqlite:db/trac.db
+default_charset = UTF-8
+default_handler = WikiModule
+default_timezone =
+htdocs_location = /static/trac
+ignore_auth_case = false
+mainnav = wiki,timeline,roadmap,browser,tickets,newticket,search
+metanav = login,logout,prefs,help,about
+permission_policies = AuthzSourcePolicy, DefaultPermissionPolicy, LegacyAttachmentPolicy
+permission_store = DefaultPermissionStore
+repository_dir = 
+repository_type = svn
+secure_cookies = true
+show_email_addresses = false
+timeout = 20
+use_base_url_for_redirect = false
+
+[wiki]
+ignore_missing_pages = true
+render_unsafe_content = false
+split_page_names = false
diff --git a/TipAndDoc/tools/trac/contrib/trac-svn-hook b/TipAndDoc/tools/trac/contrib/trac-svn-hook
new file mode 100644 (file)
index 0000000..3a17eb1
--- /dev/null
@@ -0,0 +1,219 @@
+#!/bin/sh
+#
+# = trac-svn-hook =
+# 
+#  Purpose:: this script is meant to be called from the Subversion hooks 
+#            for notifying Trac when changesets are added or modified.
+#
+#  Scope:: The http://trac.edgewall.org/wiki/TracRepositoryAdmin page
+#          describes how to directly call the relevant trac-admin commands
+#          from the Subversion hooks. In most cases this should be enough,
+#          however this script should make troubleshooting easier and 
+#          has support for notifying multiple Trac environments.
+#
+#  Usage:: copy this script to some central place, for example in your
+#          TRAC_ENV or TRAC_PARENT_ENV folder
+#          **Be sure to read the Configuration Notes section below first**
+#          then fill in the variables listed below the Configuration section.
+#
+# For each Subversion repository $REPOS that has to be monitored by 
+# your Trac environment(s), you need to modify the hooks in order to
+# call the present script:
+#
+# Add this to your `$REPOS/hooks/post-commit` script:
+#
+#     /path/to/trac-svn-hook $REPOS $REV
+#
+# If you allow revision property editing in `$REPOS/hooks/pre-revprop-change`,
+# then you can let Trac know about modified changesets by adding the following
+# lines to the `$REPOS/hooks/post-revprop-change` script:
+#
+#     if [ "$PROPNAME" = "svn:log" -o "$PROPNAME" = "svn:author" ]; then
+#         /path/to/trac-svn-hook $REPOS $REV $USER $PROPNAME
+#     fi
+#
+# See also http://svnbook.red-bean.com/en/1.5/svn.reposadmin.create.html#svn.reposadmin.create.hooks
+#
+#  Platform:: Unix or Cygwin.
+# 
+# On Windows, if you have Cygwin installed, you can also use this
+# script instead of the `trac-svn-hook.cmd`.
+# In your `post-commit.bat` and `post-revprop-change.bat` hooks, call
+# this script using:
+#
+#     bash /path/to/trac-svn-hook "%1" "%2" "%3" "%4"
+#
+# -----------------------------------------------------------------------------
+#
+# == Configuration
+#
+# Uncomment and adapt to your local setup:
+#
+# export TRAC_ENV=/path/to/trac-env:/path/to/another/trac-env
+# export PATH=/path/to/python/bin:$PATH
+# export LD_LIBRARY_PATH=/path/to/python/lib:$LD_LIBRARY_PATH
+#
+# -----------------------------------------------------------------------------
+#
+# == Configuration Notes
+#
+# As a preliminary remark, you should be aware that Subversion usually
+# run the hooks in a very minimal environment.
+# This is why we have to be very explicit about where to find things.
+# 
+# According to http://subversion.apache.org/faq.html#hook-debugging,
+# one useful method for getting the post-commit hook to work is to call
+# the hook manually from a shell, as the user(s) which will end up running 
+# the hook (e.g. wwwrun, www-data, nobody). For example:
+#
+#     env - $REPOS/hooks/post-commit $REPOS 1234
+#
+# or:
+#
+#     env - $REPOS/hooks/post-revprop-change $REPOS 1234 nobody svn:log
+#
+# 
+# The environment variables that have to be set in this script are
+# TRAC_ENV, PATH and eventually LD_LIBRARY_PATH.
+#
+#  TRAC_ENV:: the path(s) to the Trac environment(s)
+#
+# In case you need to maintain more than one environment in sync with
+# the repository (using a different scope or not), simply specify more
+# than one path, using the ":" path separator (or ";" if the script is
+# used on Windows with Cygwin's bash - in this case also don't forget to 
+# enclose the list of paths in quotes, e.g. TRAC_ENV="path1;path2").
+# 
+# Note that if you have to maintain multiple repositories and multiple Trac
+# environments, and you have some non-trivial mapping between repositories
+# and Trac environments, then you can leave the TRAC_ENV setting out of
+# this file and put it directly in your post-commit and post-revprop-change
+# hooks, so that the changes to each repositories are notified to the 
+# appropriate environments (don't forget to export TRAC_ENV in this case).
+#
+#  PATH:: the folder containing the trac-admin script
+#
+# This folder is typically the same as your Python installation bin/ folder.
+# If this is /usr/bin, then you probably don't need to put it in the PATH. 
+#
+# Note that if you're using a python program installed in a non-default 
+# location (such as /usr/local or a virtual environment), then you need 
+# to add it to the PATH as well.
+#
+#  LD_LIBRARY_PATH:: folder(s) containing additional required libraries
+#
+# You may also need to setup the LD_LIBRARY_PATH accordingly. 
+# The same goes for any custom dependency, such as SQLite libraries or
+# SVN libraries: make sure everything is reachable.
+# For example, if you get errors like "global name 'sqlite' is not defined"
+# or similar, then make sure the LD_LIBRARY_PATH contains the path to all
+# the required libraries (libsqlite3.so in the above example).
+#
+#
+# -----------------------------------------------------------------------------
+#
+# == Examples
+#
+# === Minimal setup example ===
+#
+# Python is installed in /usr/bin, Trac was easy_install'ed.
+#
+# {{{
+# export TRAC_ENV=/srv/trac/the_trac_env
+# }}}
+#
+#
+# === Virtualenv setup example ===
+#
+# Here we're using a Trac installation set up using virtualenv
+# (http://pypi.python.org/pypi/virtualenv).
+#
+# In this example, the virtualenv is located in
+# /packages/trac/branches/trac-multirepos
+# and is based off a custom Python installation (/opt/python-2.4.4). 
+# We're also using a custom SQLite build (/opt/sqlite-3.3.8). 
+#
+# Note that virtualenv's activate script doesn't seem to care
+# about LD_LIBRARY_PATH and the only other thing it does and that
+# we need here is to set the PATH, we can as well do that ourselves:
+#
+# We also want to notify two Trac instances:
+#
+# {{{
+# export TRAC_ENV=/srv/trac/the_trac_env:/srv/trac/trac_other_trac_env
+# export PATH=/packages/trac/branches/trac-multirepos/bin:$PATH
+# export LD_LIBRARY_PATH=/opt/python-2.4.4/lib:/opt/sqlite-3.3.8/lib:$LD_LIBRARY_PATH
+# }}}
+#
+#
+# === Cygwin setup example ===
+#
+# {{{
+# export TRAC_ENV=C:/Workspace/local/trac/devel
+# export PYTHONPATH=C:/Workspace/src/trac/repos/multirepos
+# export PATH=/C/Dev/Python261/Scripts:$PATH
+# }}}
+#
+# -----------------------------------------------------------------------------
+#
+# This is the script itself, you shouldn't need to modify this part.
+
+# -- Command line arguments (cf. usage)
+
+REPOS="$1"
+REV="$2"
+USER="$3"
+PROPNAME="$4"
+
+# -- Foolproofing
+
+if [ -z "$REPOS" -o -z "$REV" ]; then
+    echo "Usage: $0 REPOS REV"
+    exit 2
+fi
+
+if ! python -V 2>/dev/null; then
+    echo "python is not in the PATH ($PATH), check PATH and LD_LIBRARY_PATH."
+    exit 2
+fi
+
+if [ -z "$TRAC_ENV" ]; then
+    echo "TRAC_ENV is not set."
+    exit 2
+fi
+
+# -- Feedback
+
+echo "----"
+
+if [ -z "$USER" -a -z "$PROPNAME" ]; then
+    EVENT="added"
+    echo "Changeset $REV was added in $REPOS"
+else
+    EVENT="modified"
+    echo "Changeset $REV was modified by $USER in $REPOS"
+fi
+
+# -- Call "trac-admin ... changeset ... $REPOS $REV" for each Trac environment
+
+ifs=$IFS
+IFS=:
+if [ -n "$BASH_VERSION" ]; then # we can use Bash syntax
+    if [[ ${BASH_VERSINFO[5]} = *cygwin ]]; then
+        IFS=";"
+    fi
+fi
+for env in $TRAC_ENV; do
+    if [ -r "$env/VERSION" ]; then
+        log=$env/log/svn-hooks-`basename $REPOS`.log
+        nohup sh <<EOF >> $log 2>&1 &
+            echo "Changeset $REV $EVENT"
+            trac-admin $env changeset $EVENT $REPOS $REV && \
+                echo "OK" || echo "FAILED: see the Trac log"
+EOF
+    else
+        echo "$env doesn't seem to be a Trac environment, skipping..."
+    fi
+done
+IFS=$ifs
+
diff --git a/TipAndDoc/tools/trac/htdocs/custom.css b/TipAndDoc/tools/trac/htdocs/custom.css
new file mode 100644 (file)
index 0000000..e150428
--- /dev/null
@@ -0,0 +1,56 @@
+.wikipage h1 {;
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: solid;
+    border-width: 0 0 0.3em 0.3em;
+    padding: 0.2em 0.4em;
+    /* cancel browser.css */
+    margin-right: 0;
+}
+
+.wikipage h2 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: solid;
+    border-width: 0 0 0.2em 0.6em;
+    padding: 0.2em 0.6em;
+}
+
+.wikipage h3 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: double;
+    border-width: 0 0 0.2em 1em;
+    padding: 0.2em 0.7em;
+}
+
+.wikipage h4 {
+    background-color: #ffffcc;
+    padding: 0.2em 0.6em;
+}
+
+.wikipage h5 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: solid;
+    border-width: 0 0 0 1em;
+    padding: 0.2em 0.4em;
+}
+
+.wikipage h6 {
+    background-color: #ffffcc;
+    border-color: yellow;
+    border-style: double;
+    border-width: 0 0 0 2em;
+    padding: 0.2em 0.4em;
+}
+
+/* expand edit text area */
+#edit #text {
+    min-height: 20em;
+}
+
+/* Quick search */
+#proj-search {
+    width: 20em;
+}
diff --git a/TipAndDoc/tools/trac/templates/site.html b/TipAndDoc/tools/trac/templates/site.html
new file mode 100644 (file)
index 0000000..d33d7c8
--- /dev/null
@@ -0,0 +1,11 @@
+<html xmlns="http://www.w3.org/1999/xhtml"
+      xmlns:xi="http://www.w3.org/2001/XInclude"
+      xmlns:py="http://genshi.edgewall.org/"
+      py:strip="">
+  <!--! Add site-specific style sheet -->
+  <head py:match="head" py:attrs="select('@*')">
+    ${select('*|comment()|text()')}
+    <link rel="stylesheet" type="text/css"
+          href="/static/htdocs/custom.css" />
+  </head>
+</html>
diff --git a/TipAndDoc/tools/www/svn/svnindex.css b/TipAndDoc/tools/www/svn/svnindex.css
new file mode 100644 (file)
index 0000000..c4330c1
--- /dev/null
@@ -0,0 +1,87 @@
+/* A sample style sheet for displaying the Subversion directory listing
+   that is generated by mod_dav_svn and "svnindex.xsl". */
+
+body{
+  margin: 0;
+  padding: 0;
+}
+
+a {
+  color: navy;
+}
+
+.footer {
+  margin-top: 8em;
+  padding: 0.5em 1em 0.5em;
+  border: 1px solid;
+  border-width: 1px 0;
+  clear: both;
+  border-color: rgb(30%,30%,50%) navy rgb(75%,80%,85%) navy;
+  background: rgb(88%,90%,92%);
+  font-size: 80%;
+}
+
+.svn {
+  margin: 3em;
+}
+
+.rev {
+  margin-right: 3px;
+  padding-left: 3px;
+  text-align: left;
+  font-size: 120%;
+}
+
+.dir a {
+  text-decoration: none;
+  color: black;
+}
+
+.file a {
+  text-decoration: none;
+  color: black;
+}
+
+.path {
+  margin: 3px;
+  padding: 3px;
+  background: #FFCC66;
+  font-size: 120%;
+}
+
+.updir {
+  margin: 3px;
+  padding: 3px;
+  margin-left: 3em;
+  background: #FFEEAA;
+}
+
+.file {
+  margin: 3px;
+  padding: 3px;
+  margin-left: 3em;
+  background: rgb(95%,95%,95%);
+}
+
+.file:hover {
+  margin: 3px;
+  padding: 3px;
+  margin-left: 3em;
+  background: rgb(100%,100%,90%);
+/*  border: 1px black solid; */
+}
+
+.dir {
+  margin: 3px;
+  padding: 3px;
+  margin-left: 3em;
+  background: rgb(90%,90%,90%);
+}
+
+.dir:hover {
+  margin: 3px;
+  padding: 3px;
+  margin-left: 3em;
+  background: rgb(100%,100%,80%);
+/*  border: 1px black solid; */
+}
diff --git a/TipAndDoc/tools/www/svn/svnindex.xsl b/TipAndDoc/tools/www/svn/svnindex.xsl
new file mode 100644 (file)
index 0000000..c9fc6af
--- /dev/null
@@ -0,0 +1,102 @@
+<?xml version="1.0"?>
+
+<!-- A sample XML transformation style sheet for displaying the Subversion
+  directory listing that is generated by mod_dav_svn when the "SVNIndexXSLT"
+  directive is used. -->
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <xsl:output method="html"/>
+
+  <xsl:template match="*"/>
+
+  <xsl:template match="svn">
+    <html>
+      <head>
+        <title>
+          <xsl:if test="string-length(index/@name) != 0">
+            <xsl:value-of select="index/@name"/>
+            <xsl:text>: </xsl:text>
+          </xsl:if>
+          <xsl:value-of select="index/@path"/>
+        </title>
+        <link rel="stylesheet" type="text/css" href="/static/svn/svnindex.css"/>
+      </head>
+      <body>
+        <div class="svn">
+          <xsl:apply-templates/>
+        </div>
+        <div class="footer">
+          <xsl:text>Powered by </xsl:text>
+          <xsl:element name="a">
+            <xsl:attribute name="href">
+              <xsl:value-of select="@href"/>
+            </xsl:attribute>
+            <xsl:text>Subversion</xsl:text>
+          </xsl:element>
+          <xsl:text> </xsl:text>
+          <xsl:value-of select="@version"/>
+        </div>
+      </body>
+    </html>
+  </xsl:template>
+
+  <xsl:template match="index">
+    <div class="rev">
+      <xsl:value-of select="@name"/>
+      <xsl:if test="@base">
+        <xsl:if test="@name">
+          <xsl:text>:&#xA0; </xsl:text>
+        </xsl:if>
+        <xsl:value-of select="@base" />
+      </xsl:if>
+      <xsl:if test="@rev">
+        <xsl:if test="@base | @name">
+          <xsl:text> &#x2014; </xsl:text>
+        </xsl:if>
+        <xsl:text>Revision </xsl:text>
+        <xsl:value-of select="@rev"/>
+      </xsl:if>
+    </div>
+    <div class="path">
+      <xsl:value-of select="@path"/>
+    </div>
+    <xsl:apply-templates select="updir"/>
+    <xsl:apply-templates select="dir"/>
+    <xsl:apply-templates select="file"/>
+  </xsl:template>
+
+  <xsl:template match="updir">
+    <div class="updir">
+      <xsl:text>[</xsl:text>
+      <xsl:element name="a">
+        <xsl:attribute name="href">..</xsl:attribute>
+        <xsl:text>Parent Directory</xsl:text>
+      </xsl:element>
+      <xsl:text>]</xsl:text>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="dir">
+    <div class="dir">
+      <xsl:element name="a">
+        <xsl:attribute name="href">
+          <xsl:value-of select="@href"/>
+        </xsl:attribute>
+        <xsl:value-of select="@name"/>
+        <xsl:text>/</xsl:text>
+      </xsl:element>
+    </div>
+  </xsl:template>
+
+  <xsl:template match="file">
+    <div class="file">
+      <xsl:element name="a">
+        <xsl:attribute name="href">
+          <xsl:value-of select="@href"/>
+        </xsl:attribute>
+        <xsl:value-of select="@name"/>
+      </xsl:element>
+    </div>
+  </xsl:template>
+
+</xsl:stylesheet>