williamr/buglist_to_mediawiki.pl
author Simon Howkins <simonh@symbian.org>
Thu, 13 May 2010 12:34:20 +0100
changeset 261 d01a4084d621
parent 21 36e05c0da8f7
child 267 2251fde91223
permissions -rw-r--r--
Extended to put the preferred column headings into the table. Also made a few other simplifications.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
261
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
     1
#! perl -w
21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     2
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     3
# Copyright (c) 2009 Symbian Foundation Ltd
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     4
# This component and the accompanying materials are made available
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     5
# under the terms of the License "Eclipse Public License v1.0"
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     6
# which accompanies this distribution, and is available
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     7
# at the URL "http://www.eclipse.org/legal/epl-v10.html".
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     8
#
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     9
# Initial Contributors:
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    10
# Symbian Foundation Ltd - initial contribution.
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    11
# 
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    12
# Contributors:
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    13
#
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    14
# Description:
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    15
# Convert tab-separated buglist into Mediawiki table
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    16
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    17
use strict;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    18
261
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    19
print "{|\n";   # start of table
21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
261
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    21
while (my $line = <>)
21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
  {
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
  chomp $line;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
  my @columns = split /\t/, $line;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
  
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    26
  next if scalar @columns < 2;    # skip dubious looking lines
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
  
261
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    28
  if ($. == 1)
21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
    {
261
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    30
    # First line of file = table headings
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    31
    my %preferredHeadings =
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    32
      (
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    33
      bug_id => "ID",
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    34
      bug_severity => "Severity",
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    35
      reporter => "Reporter",
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    36
      bug_status => "Status",
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    37
      product => "Package",
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    38
      short_desc => "Title",
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    39
      );
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    40
    @columns = map { $preferredHeadings{$_} || $_ } @columns;
21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
    print "! ", join(" !! ", @columns), "\n";
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
    next;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    43
    }
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    44
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
  # row with a bug id
261
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    46
d01a4084d621 Extended to put the preferred column headings into the table.
Simon Howkins <simonh@symbian.org>
parents: 21
diff changeset
    47
  $columns[0] = "[http://developer.symbian.org/bugs/show_bug.cgi?id=$columns[0] Bug$columns[0]]";
21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    48
  
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    49
  print "|-\n"; # row separator
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    50
  print "| ", join(" || ", @columns), "\n";
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    51
  }
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    52
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    53
print "|}\n";