wiki:MigrationTrac

## page was renamed from TheAnarcat/TracForAlternc?

Procedure

mantis import on cvs.alternc.org

  503  aptitude install mysql-server
  504  gunzip -c ~anarcat/alternc.sql.gz | mysql mantis

Trac setup

  509  mkdir /var/lib/trac
  510  trac-admin /var/lib/trac/alternc initenv
  513  ln -s /usr/share/trac/cgi-bin/trac.cgi /usr/lib/cgi-bin/
  514  mkdir /var/svn
  515  svnadmin create /var/svn/test
  516  trac-admin /var/lib/trac/alternc initenv
  518  mkdir /etc/trac/
  520  htpasswd -c /etc/trac/htpasswd anarcat
  521  apachectl graceful
  522  cd /etc/apache/conf.d/trac
  523  vim trac 
  534  /usr/sbin/apache-modconf apache enable mod_env
  535  apachectl graceful
  536  /etc/init.d/apache restart
  537  chown -R www-data /var/lib/trac/alternc/

import script

  518  aptitude install python-mysqldb
  528  vim mantis2trac.py  # setup the projects 
  529  python mantis2trac.py --db mantis -h localhost -u root -p ''  --tracenv /var/lib/trac/alternc/

current script config

PRODUCTS = [ 'AlternC' ]
PRODUCT_KEYWORDS = {'AlternC' : 'alternc'}

svn? no, darcs!

To be really useful, Trac must integrate into the VCS. Since alternc uses CVS with a Darcs bridge, it's only logical to use the  Trac+Darcs branch.

apt-get remove trac
aptitude install python-dev
wget http://peak.telecommunity.com/dist/ez_setup.py
python ez_setup.py
darcs get --partial http://darcs.arstecnica.it/trac+darcs
cd trac+darcs
python ./setup.py install
mkdir /var/lib/trac/alternc
mkdir darcs
cd darcs/
darcs get /darcs/alternc
cd alternc
echo unpull --disable >> _darcs/prefs/defaults
echo unrecord --disable >> _darcs/prefs/defaults
echo obliterate --disable >> _darcs/prefs/defaults
trac-admin /var/lib/trac/alternc initenv

(note: not aptitude, since we want to keep the dependencies)

This fails miserably:

Unable to parse "darcs changes" output: :1287:66: not well-formed (invalid token)

C'est le encoding qui est suspecte.

J'ai essaye iconv -f iso-8859-1 -t utf-8 _darcs/inventory mais ca plante juste plus loin:

  File "/usr/lib/python2.3/site-packages/sqlite/main.py", line 209, in _unicodeConvert
    converted_obj.append(item.encode(*self.con.encoding))
UnicodeEncodeError: 'ascii' codec can't encode character u'xe9' in position 109: ordinal not in range(128)

Current status

Some errors occurred while importing:
 * ERROR: unable to add ticket(#179) change "projection": "10" -> "50" (2004-04-30 02:56:57)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#179) change "summary": "Bug dans le gestionnaire de fichier" -> "problemes d'apostrophes" (2004-05-03 03:07:59)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#186) change "summary": "LISTE DE DIFFUSION  ET  SUPPRESSION D'UN DOMAINE" -> "liste de diffusion et suppresion d'un domaine" (2004-05-03 02:55:55)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#186) change "summary": "liste de diffusion et suppresion d'un domaine" -> "liste de diffusion non supprimees lors de la suppresion d'un domaine" (2004-11-10 23:26:19)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#221) change "projection": "10" -> "30" (2004-08-10 21:43:47)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#269) change "summary": "Pas de lien pour la gestion d'un utilisateur en root" -> "Certains utilisateurs n'apparaissent pas dans "Gerer les Membres" en mode 3 colonnes" (2004-11-10 23:01:48)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#292) change "summary": "traductions impossibles" -> "traductions incorrectes (probleme de relance d'apache)" (2004-11-10 23:20:01)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#301) change "summary": "la version de AlternC / rapport de bug" -> "afficher la version d'AlternC dans le bureau" (2004-10-30 22:21:52)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#427) change "summary": "Les seuls caracteres autorises pour le login sont a-z 0-9 et -" -> "Autoriser le tiret dans les noms d'usagers" (2005-05-02 16:51:03)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#429) change "summary": "pour les config d'apache" -> "utiliser mod-sqlinclude pour les config d'apache" (2005-05-02 17:01:23)
          The bug id, field name, and time must be unique
 * ERROR: unable to add ticket(#517) change "summary": "Le passage d'un domaine 'non gere par bind' a 'gere par bind' ne cree pas les "Redirection vers une ip"" -> "Le passage d'un domaine 'non gere par bind' a 'gere par bind' detruit les "Redirection vers une ip"" (2005-12-11 21:13:04)
          The bug id, field name, and time must be unique

Total tickets imported: 443
Total ticket comments:  787
Total ticket changes:   898

We also only import the alternc module. This is a real problem: we have many projects in mantis, and projects are much more isolated in trac. Maybe we want to import them all together.

The other problem is that we use bug hierarchy to group bugs for a "milestone" (a release in our language) and the converter doesn't recognize that. It wouldn't be too hard to convert manually, however.

-- TheAnarcat 2006-01-27