Commits

jonas  committed 14e938b

Removed obsolete Trac 0.6 upgrade script.

  • Participants
  • Parent commits d5104b6
  • Branches trunk

Comments (0)

Files changed (4)

 include AUTHORS ChangeLog COPYING INSTALL MANIFEST.in README README.tracd RELEASE setup.cfg THANKS UPGRADE
 include scripts/trac-admin
 include scripts/tracd
-include scripts/tracdb2env
 include scripts/trac-postinstall.py
 include scripts/*.1
 include scripts/rpm-install.sh

File scripts/tracdb2env

-#!/usr/bin/env python
-import os
-import sys
-import sqlite
-import ConfigParser
-from trac.env import Environment
-
-additional_config = \
-(('notification', 'smtp_enabled', 'false'),
- ('notification', 'smtp_server', 'localhost'),
- ('notification', 'smtp_replyto', 'trac@localhost'),
- ('logging', 'log_type', 'none'),
- ('logging', 'log_file', 'trac.log'),
- ('logging', 'log_level', 'DEBUG'),
- ('attachment', 'max_size', '262144'),
- ('trac', 'default_charset', 'iso-8859-15'),
- ('trac', 'database', 'sqlite:db/trac.db'))
-
-def db2env(db_path, env_path):
-    env = Environment(env_path, create=1)
-    # Open the databases
-    old_cnx = sqlite.connect(db_path)
-    new_cnx = env.get_db_cnx()
-    old_cursor = old_cnx.cursor()
-    new_cursor = new_cnx.cursor()
-    convert_config(env, old_cursor)
-    convert_db(old_cursor, new_cursor)
-    new_cursor.execute("INSERT INTO system VALUES('database_version', '7')")
-    new_cnx.commit()
-
-def convert_config(env, old_cursor):
-    old_cursor.execute('SELECT section, name, value FROM config')
-    while 1:
-        row = old_cursor.fetchone()
-        if not row:
-            break
-        row = [row[0], row[1], row[2]]
-        if row[0] == 'general':
-            row[0] = 'trac'
-        if row[1] == 'database_version':
-            continue
-        env.set_config(row[0], row[1], row[2])
-    for v in additional_config:
-        env.set_config(*v)
-    env.save_config()
-
-def to_utf8(row):
-    x = []
-    for v in row:
-        if type(v) == type(''):
-            try:
-                u = unicode(v, 'utf-8')
-                x.append(v)
-            except UnicodeError:
-                u = unicode(v, 'iso-8859-15')
-                x.append(u.encode('utf-8'))
-        else:
-            x.append(v)
-    return x
-
-def copy_tuples(table, from_cursor, to_cursor, fields='*'):
-    from_cursor.execute('SELECT %s FROM %s' % (fields, table))
-    while 1:
-        row = from_cursor.fetchone()
-        if not row:
-            break
-        row = to_utf8(row)
-        if fields == '*':
-            to_cursor.execute('INSERT INTO %s VALUES(%s)' \
-                              % (table, ', '.join(['%s'] * len(row))), *row)
-        else:
-            to_cursor.execute('INSERT INTO %s (%s) VALUES(%s)' \
-                              % (table, fields,
-                                 ', '.join(['%s'] * len(row))), *row)
-
-def convert_db(old_cursor, new_cursor):
-    copy_tuples('revision', old_cursor, new_cursor)
-    copy_tuples('node_change', old_cursor, new_cursor)
-    copy_tuples('auth_cookie', old_cursor, new_cursor)
-    copy_tuples('enum', old_cursor, new_cursor)
-    copy_tuples('ticket_change', old_cursor, new_cursor)
-    copy_tuples('permission', old_cursor, new_cursor)
-    copy_tuples('component', old_cursor, new_cursor)
-    copy_tuples('milestone', old_cursor, new_cursor, "name, time")
-    new_cursor.execute("UPDATE milestone SET descr=''")
-    copy_tuples('version', old_cursor, new_cursor)
-    copy_tuples('report', old_cursor, new_cursor,
-                'id,author,title,sql')
-    copy_tuples('ticket', old_cursor, new_cursor,
-                'id,time,changetime,component,severity,priority,'
-                'owner,reporter,cc,url,version,milestone,status,'
-                'resolution,summary,description')
-    copy_tuples('wiki', old_cursor, new_cursor,
-                'name,version,time,author,ipnr,text')
-
-if __name__ == '__main__':
-    if len(sys.argv) != 3:
-        print >> sys.stderr, 'Usage: %s <db-file> <env-dir>\n' % sys.argv[0]
-        print >> sys.stderr, \
-              'Creates a new Trac environment and initializes it with ' \
-              'information\nfrom an existing pre 0.7 trac database.'
-        print >> sys.stderr
-        sys.exit(1)
-    db2env(sys.argv[1], sys.argv[2])
-    print >> sys.stderr, 'Environment successfully created.'

File scripts/tracdb2env.1

-.\" You can view this file with:
-.\" nroff -man [filename]
-.\"
-.TH tracdb2env 1
-.SH NAME
-tracdb2env \- Tool to convert old Trac databases to Trac environments.
-.Sh SYNOPSIS
-.TP
-\fBtracdb2env\fP <\fIdb-file\fP> <\fIenv-dir\fP>
-.SH OVERVIEW
-
-Starting with version 0.7 Trac stores project specific information in project
-environment directories instead of in database files. \fBtracdb2env\fP can extract
-information from an old database file and insert that into a newly created
-project environment directory.
-
-Trac is a minimalistic web-based software project management and bug/issue
-tracking system. It provides an interface to the Subversion revision control
-systems, an integrated wiki, flexible issue tracking and convenient report
-facilities.
-
-Documentation for Trac in general, including detailed usage explanations
-and tutorials can be be found in the Trac wiki at
-http://trac.edgewall.org/.
-
-Run `tracdb2env -h' to access the built-in tool documentation.
                                         self.install_dir)
         if copied:
             self.outfiles.append(ofile)
-        ofile, copied = self.copy_file(os.path.join(self.build_dir,
-                                                     'tracdb2env'),
-                                        self.install_dir)
-        if copied:
-            self.outfiles.append(ofile)
             
         cgi_dir = os.path.join(self.install_data, 'share', 'trac', 'cgi-bin')
         if not os.path.exists(cgi_dir):
       scripts=[_p('scripts/trac-admin'),
                _p('scripts/trac-postinstall.py'),
                _p('scripts/tracd'),
-               _p('scripts/tracdb2env'),
                _p('cgi-bin/trac.cgi'),
                _p('cgi-bin/trac.fcgi')],
       cmdclass = {'install': my_install,