williamr/buglist_to_mediawiki.pl
author Simon Howkins <simonh@symbian.org>
Fri, 06 Nov 2009 12:10:52 +0000
changeset 99 5adea361d896
parent 21 36e05c0da8f7
child 261 d01a4084d621
permissions -rw-r--r--
Bug 881: "Automatic creation of release note content broken by config change" Added a new option to allow the caller to specify where the publish location is. Minor improvements to formatting of output. Turned on warnings, and fixed most of those that appeared. Greatly simplified the checking of the script arguments. Removed code which was noted to be unnecessary, and was. Declared some variables more closely to the code that uses them.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
     1
#! perl
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
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    19
my $line;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    20
my $header = 1;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    21
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    22
while ($line =<>)
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    23
  {
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    24
  chomp $line;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    25
  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
    26
  
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    27
  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
    28
  
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    29
  if ($header)
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    30
    {
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    31
    print "{|\n";   # start of table
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    32
    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
    33
    $header = 0;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    34
    next;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    35
    }
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    36
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    37
  # row with a bug id
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    38
  my $id = shift @columns;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    39
  $id = sprintf "[http://developer.symbian.org/bugs/show_bug.cgi?id=%s Bug %s]", $id, $id;
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    40
  unshift @columns, $id;   
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    41
  
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    42
  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
    43
  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
    44
  }
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    45
36e05c0da8f7 Trivial script to convert a "copied" bugzilla bug listing into a Mediawiki table
William Roberts <williamr@symbian.org>
parents:
diff changeset
    46
print "|}\n";