M2BZ

From Informatics

Jump to: navigation, search

Mantis to Bugzilla migration

Date 7/17/2008

not completed task. Here are the notes so far:

  • Implementaion on Afdev2 /var/www/html/bugzilla
  • ImageMagic needs to be installed (from source)
  • Perl modules need to be installed as required by the perl scripts
  • to dos: socket/MySQL connection problems
  • to dos: increase max_allowd_packet to IM
  • .htaccess file as not readable to world
  • change ownership of bugzilla to apache.apache

Here are the SQL statements that are needed to move from mantis to bugzilla. Incomplete!

This assumes Mysql on afdev2, one called bugs, the otherone mantis_dev

# copy user information
insert ignore into bugs.profiles (login_name, cryptpassword, realname) 
select email, password, realname from mantis_dev.mantis_user_table
;

# create mapping table for projects
create table mantis_dev.user_map 
select m.id as mantis_id, b.userid as bugs_id from mantis_dev.mantis_user_table m, bugs.profiles b
where m.email = b.login_name
;

# copy project information
insert ignore into bugs.products (name, description)
select name, description from mantis_dev.mantis_project_table
;

# create mapping table for projects
create table mantis_dev.project_map 
select m.id as mantis_id, b.id as bugs_id from mantis_dev.mantis_project_table m, bugs.products b
where m.name = b.name
;

#versions table
insert ignore into bugs.versions (value, product_id)
select version, bugs_id from mantis_dev.mantis_project_version_table v, mantis_dev.project_map p
where v.project_id = p.mantis_id
;

#components
insert into bugs.components (initialowner, product_id, name, initialqacontact, description)
select u.bugs_id as initialowner, p.bugs_id as product_id, c.category as name, 'baj2107@columbia.edu' as initialqacontact,  as description
from mantis_dev.user_map u, mantis_dev.project_map p, mantis_dev.mantis_project_category_table c where
c.project_id = p.mantis_id and
c.user_id = u.mantis_id
;

#=========================================================================
# bugs table
insert into bugs.bugs 
   (assigned_to, bug_severity, bug_status, creation_ts, delta_ts, short_desc, op_sys, priority, product_id, rep_platform, reporter, version, component_id, resolution)
select 
   u.bugs_id as assigned_to,
   b.severity as bug_severity,
   b.status as bug_status,
   b.date_submitted as creation_ts,
   b.last_updated as delta_ts,
   b.summary as short_desc,
   b.os as op_sys,
   b.priority as priority,
   p.bugs_id as product_id,
   b.platform as rep_platform,
   r.bugs_id as reporter,
   b.version as version,
   c.id as component_id,
   b.resolution as resolution
from mantis_dev.user_map u, mantis_dev.user_map r, mantis_dev.project_map p, mantis_dev.mantis_bug_table b, bugs.components c
where 
   b.handler_id = u.mantis_id and
   b.reporter_id = r.mantis_id and
   b.project_id = p.mantis_id and
   b.category = c.name
;

# update status
select distinct bug_status from bugs.bugs;

insert ignore into bugs.bug_status (value, sortkey, isactive) values 
   ('FEEDBACK',220,1),
   ('ACKNOWLEDGED',230,1),
   ('CONFIRMED',240,1);

# manually change field-descs.none.tmpl in bugzilla/templates/en/default/global

update bugs.bugs set bug_status = 'NEW' where bug_status = '-1';          # Mantis: undef
update bugs.bugs set bug_status = 'NEW' where bug_status = '10';          # Mantis: new
update bugs.bugs set bug_status = 'ASSIGNED' where bug_status = '50';     # Mantis: assigned
update bugs.bugs set bug_status = 'RESOLVED' where bug_status = '80';     # Mantis: resolved
update bugs.bugs set bug_status = 'CLOSED' where bug_status = '90';       # Mantis: closed
update bugs.bugs set bug_status = 'FEEDBACK' where bug_status = '20';     # Mantis: feedback, new to BUGS
update bugs.bugs set bug_status = 'ACKNOWLEDGED' where bug_status = '30'; # Mantis: acknowledged, new to BUGS
update bugs.bugs set bug_status = 'CONFIRMED' where bug_status = '40';    # Mantis: confirmed, new to BUGS

# update severity
select distinct bug_severity from bugs.bugs;

# too complicated to implement
#insert ignore into bugs.bug_severity (value, sortkey, isactive) values 
#   ('text',670,1),
#   ('tweak',640,1)

update bugs.bugs set bug_severity = 'blocker' where bugs.bug_severity = '80';     # Mantis: block
update bugs.bugs set bug_severity = 'critical' where bugs.bug_severity = '70';    # Mantis: crash
update bugs.bugs set bug_severity = 'major' where bugs.bug_severity = '60';       # Mantis: major
update bugs.bugs set bug_severity = 'minor' where bugs.bug_severity = '50';       # Mantis: minor
update bugs.bugs set bug_severity = 'minor' where bugs.bug_severity = '40';       # Mantis: tweak
update bugs.bugs set bug_severity = 'minor' where bugs.bug_severity = '30';       # Mantis: text
update bugs.bugs set bug_severity = 'trivial' where bugs.bug_severity = '20';     # Mantis: trivial
update bugs.bugs set bug_severity = 'enhancement' where bugs.bug_severity = '10'; # Mantis: feature
update bugs.bugs set bug_severity = 'enhancement' where bugs.bug_severity = '0';  # Mantis: undefined

# update priority
select distinct priority from bugs.bugs;
update bugs.bugs set priority = 'P1' where bugs.priority = '60';     # Mantis: immediate
update bugs.bugs set priority = 'P1' where bugs.priority = '50';     # Mantis: urgent
update bugs.bugs set priority = 'P2' where bugs.priority = '40';     # Mantis: high
update bugs.bugs set priority = 'P3' where bugs.priority = '30';     # Mantis: normal
update bugs.bugs set priority = 'P4' where bugs.priority = '20';     # Mantis: low
update bugs.bugs set priority = 'P5' where bugs.priority = '10';     # Mantis: none


# Resolution
select distinct resolution from bugs.bugs;
update bugs.bugs set resolution =  where bugs.resolution = '10';               # Mantis: open
update bugs.bugs set resolution = 'FIXED' where bugs.resolution = '20';          # Mantis: fixed
update bugs.bugs set resolution = 'INVALID' where bugs.resolution = '40';        # Mantis: unable to duplicate
update bugs.bugs set resolution = 'WONTFIX' where bugs.resolution = '50';        # Mantis: not fixable
update bugs.bugs set resolution = 'DUPLICATE' where bugs.resolution = '60';      # Mantis: duplicate
update bugs.bugs set resolution = 'WORKSFORME' where bugs.resolution = '70';     # Mantis: not an issue
update bugs.bugs set resolution = 'SUSPENDED' where bugs.resolution = '80';      # Mantis: suspended
update bugs.bugs set resolution = 'WONTFIX' where bugs.resolution = '90';        # Mantis: WONT'fix
update bugs.bugs set bug_status = 'REOPENED' where bugs.resolution = '30'        # Mantis: reopened => open status, plus bug_status = reopened
update bugs.bugs set resoltuion =  where bugs.resolution = '30'                # Mantis: reopened => open status, plus bug_status = reopened


# ================== END OF BUGS =========================================


Here is a link to a file I used as a starting point File:M2bz pl.txt


And this is the local config file for Bugzilla:


# If you are using Apache as your web server, Bugzilla can create .htaccess
# files for you that will instruct Apache not to serve files that shouldn't
# be accessed from the web (like your local configuration data and non-cgi
# executable files).  For this to work, the directory your Bugzilla
# installation is in must be within the jurisdiction of a <Directory> block
# in the httpd.conf file that has 'AllowOverride Limit' in it.  If it has
# 'AllowOverride All' or other options with Limit, that's fine.
# (Older Apache installations may use an access.conf file to store these
# <Directory> blocks.)
# If this is set to 1, Bugzilla will create these files if they don't exist.
# If this is set to 0, Bugzilla will not create these files.
$create_htaccess = 1;

# This is the group your web server runs as.
# If you have a Windows box, ignore this setting.
# If you do not have access to the group your web server runs under,
# set this to "". If you do set this to "", then your Bugzilla installation
# will be _VERY_ insecure, because some files will be world readable/writable,
# and so anyone who can get local access to your machine can do whatever they
# want. You should only have this set to "" if this is a testing installation
# and you cannot set this up any other way. YOU HAVE BEEN WARNED!
# If you set this to anything other than "", you will need to run checksetup.pl
# asroot, or as a user who is a member of the specified group.
$webservergroup = 'apache';

# What SQL database to use. Default is mysql. List of supported databases
# can be obtained by listing Bugzilla/DB directory - every module corresponds
# to one supported database and the name corresponds to a driver name.
$db_driver = 'mysql';

# The DNS name of the host that the database server runs on.
$db_host = 'afdev2.c2b2.columbia.edu';

# The name of the database
$db_name = 'bugs';

# Who we connect to the database as.
$db_user = 'bugs';

# Enter your database password here. It's normally advisable to specify
# a password for your bugzilla database user.
# If you use apostrophe (') or a backslash (\) in your password, you'll
# need to escape it by preceding it with a '\' character. (\') or (\)
# (Far simpler just not to use those characters.)
$db_pass = 'Berndadmin007';

# Sometimes the database server is running on a non-standard port. If that's
# the case for your database server, set this to the port number that your
# database server is running on. Setting this to 0 means "use the default
# port for my database server."
$db_port = 0;

# MySQL Only: Enter a path to the unix socket for MySQL. If this is
# blank, then MySQL's compiled-in default will be used. You probably
# want that.
$db_sock = ;

# Should checksetup.pl try to verify that your database setup is correct?
# (with some combinations of database servers/Perl modules/moonphase this
# doesn't work)
$db_check = 1;

# With the introduction of a configurable index page using the
# template toolkit, Bugzilla's main index page is now index.cgi.
# Most web servers will allow you to use index.cgi as a directory
# index, and many come preconfigured that way, but if yours doesn't
# then you'll need an index.html file that provides redirection
# to index.cgi. Setting $index_html to 1 below will allow
# checksetup.pl to create one for you if it doesn't exist.
# NOTE: checksetup.pl will not replace an existing file, so if you
#       wish to have checksetup.pl create one for you, you must
#       make sure that index.html doesn't already exist
$index_html = 0;

# For some optional functions of Bugzilla (such as the pretty-print patch
# viewer), we need the cvs binary to access files and revisions.
# Because it's possible that this program is not in your path, you can specify
# its location here.  Please specify the full path to the executable.
$cvsbin = '/usr/bin/cvs';

# For some optional functions of Bugzilla (such as the pretty-print patch
# viewer), we need the interdiff binary to make diffs between two patches.
# Because it's possible that this program is not in your path, you can specify
# its location here.  Please specify the full path to the executable.
$interdiffbin = '/usr/bin/interdiff';

# The interdiff feature needs diff, so we have to have that path.
# Please specify the directory name only; do not use trailing slash.
$diffpath = '/usr/bin';
             

I also made changes in bugzilla\template\en\default\gloabal\field-descs.none.tmpl (see notes above):

[%# 1.0@bugzilla.org %]

[%# The contents of this file are subject to the Mozilla Public
  # License Version 1.1 (the "License"); you may not use this file
  # except in compliance with the License. You may obtain a copy of
  # the License at http://www.mozilla.org/MPL/
  #
  # Software distributed under the License is distributed on an "AS
  # IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  # implied. See the License for the specific language governing
  # rights and limitations under the License.
  #
  # The Original Code is the Bugzilla Bug Tracking System.
  #
  # The Initial Developer of the Original Code is Netscape Communications
  # Corporation. Portions created by Netscape are
  # Copyright (C) 1998 Netscape Communications Corporation. All
  # Rights Reserved.
  #
  # Contributor(s): Gervase Markham <gerv@gerv.net>
  #%]

[%# Remember to PROCESS rather than INCLUDE this template. %]

[% PROCESS global/variables.none.tmpl %]

[% field_descs = { "[Bug creation]"       => "[$terms.Bug creation]",
                   "actual_time"          => "Actual Hours"
                   "alias"                => "Alias",
                   "assigned_to"          => "Assignee",
                   "blocked"              => "Blocks",
                   "bug_file_loc"         => "URL",
                   "bug_id"               => "$terms.Bug ID",
                   "bug_severity"         => "Severity",
                   "bug_status"           => "Status",
                   "changeddate"          => "Changed",
                   "cc"                   => "CC",
                   "classification"       => "Classification",
                   "cclist_accessible"    => "CC list accessible?",
                   "component_id"         => "Component ID",
                   "component"            => "Component",
                   "creation_ts"          => "$terms.Bug Creation time",
                   "deadline"             => "Deadline",
                   "delta_ts"             => "Changed",
                   "dependson"            => "Depends on",
                   "dup_id"               => "Duplicate",
                   "estimated_time"       => "Orig. Est.",
                   "everconfirmed"        => "Ever confirmed?",
                   "groupset"             => "Groupset",
                   "keywords"             => "Keywords",
                   "newcc"                => "CC",
                   "op_sys"               => "OS",
                   "opendate"             => "Opened",
                   "percentage_complete"  => "%Complete",
                   "priority"             => "Priority",
                   "product_id"           => "Product ID",
                   "product"              => "Product",
                   "qa_contact"           => "QA Contact",
                   "remaining_time"       => "Hours Left",
                   "rep_platform"         => "Hardware",
                   "reporter"             => "Reporter",
                   "reporter_accessible"  => "Reporter accessible?",
                   "resolution"           => "Resolution",
                   "setting"              => "Setting",
                   "settings"             => "Settings",
                   "short_desc"           => "Summary",
                   "status_whiteboard"    => "Whiteboard",
                   "target_milestone"     => "Target Milestone",
                   "version"              => "Version",
                   "votes"                => "Votes",
                   "work_time"            => "Hours Worked"} %]

[%# Also include any custom fields or fields which don't have a
    Description here, by copying their Description from the
    database. If you want to override this for your language
    or your installation, just use a hook. %]

[% USE Bugzilla %]
[% FOREACH bz_field = Bugzilla.get_fields() %]
  [% SET field_descs.${bz_field.name} = bz_field.description
     IF !field_descs.${bz_field.name}.defined %]
[% END %]

[% field_types = { ${constants.FIELD_TYPE_UNKNOWN}       => "Unknown Type",
                   ${constants.FIELD_TYPE_FREETEXT}      => "Free Text",
                   ${constants.FIELD_TYPE_SINGLE_SELECT} => "Drop Down" } %]

[% status_descs = { "UNCONFIRMED" => "UNCONFIRMED",
                    "NEW"         => "NEW",
		    "FEEDBACK"    => "FEEDBACK",
                    "ACKNOWLEDGED" => "ACKNOWLEDGED",
                    "CONFIRMED"   => "CONFIRMED",
                    "ASSIGNED"    => "ASSIGNED",
                    "REOPENED"    => "REOPENED",
                    "RESOLVED"    => "RESOLVED",
                    "VERIFIED"    => "VERIFIED",
                    "CLOSED"      => "CLOSED" } %]

[% resolution_descs = { "FIXED"      => "FIXED",
                        "INVALID"    => "INVALID",
                        "WONTFIX"    => "WONTFIX",
                        "DUPLICATE"  => "DUPLICATE",
                        "WORKSFORME" => "WORKSFORME",
                        "MOVED"      => "MOVED",
                        "---"        => "---",
                        " "          => " " } %]

[% MACRO get_resolution(res) GET resolution_descs.$res || res %]

[% Hook.process("end") %]
Personal tools