releasing/cbrtools/perl/ModNotes
changeset 602 3145852acc89
equal deleted inserted replaced
600:6d08f4a05d93 602:3145852acc89
       
     1 #!perl
       
     2 # Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 # All rights reserved.
       
     4 # This component and the accompanying materials are made available
       
     5 # under the terms of the License "Eclipse Public License v1.0"
       
     6 # which accompanies this distribution, and is available
       
     7 # at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 # 
       
     9 # Initial Contributors:
       
    10 # Nokia Corporation - initial contribution.
       
    11 # 
       
    12 # Contributors:
       
    13 # 
       
    14 # Description:
       
    15 # 
       
    16 #
       
    17 
       
    18 use strict;
       
    19 use FindBin;
       
    20 use lib "$FindBin::Bin";
       
    21 use Getopt::Long;
       
    22 use IniData;
       
    23 use EnvDb;
       
    24 use RelData;
       
    25 use CommandController;
       
    26 
       
    27 
       
    28 #
       
    29 # Globals.
       
    30 #
       
    31 
       
    32 my $verbose = 0;
       
    33 my $iniData = IniData->New();
       
    34 my $commandController = CommandController->New($iniData, 'ModNotes');
       
    35 my $comp;
       
    36 my $notesSrc;
       
    37 my $ver;
       
    38 
       
    39 
       
    40 #
       
    41 # Main.
       
    42 #
       
    43 
       
    44 ProcessCommandLine();
       
    45 ModNotes();
       
    46 
       
    47 
       
    48 #
       
    49 # Subs.
       
    50 #
       
    51 
       
    52 sub ProcessCommandLine {
       
    53   Getopt::Long::Configure ("bundling");
       
    54   my $help;
       
    55   GetOptions('h' => \$help, 'v+' => \$verbose);
       
    56 
       
    57   if ($help) {
       
    58     Usage(0);
       
    59   }
       
    60 
       
    61   $comp = shift @ARGV;
       
    62   $notesSrc = shift @ARGV;
       
    63   $ver = shift @ARGV;
       
    64 
       
    65   unless (defined $comp and defined $notesSrc and $#ARGV == -1) {
       
    66     print "Error: Invalid arguments\n";
       
    67     Usage(1);
       
    68   }
       
    69 
       
    70   unless (defined $ver) {
       
    71     my $envDb = EnvDb->Open($iniData, $verbose);
       
    72     $ver = $envDb->Version($comp);
       
    73     unless (defined $ver) {
       
    74       die "Error: Version not specified and $comp not currently installed\n";
       
    75     }
       
    76   }
       
    77 }
       
    78 
       
    79 sub Usage {
       
    80   my $exitCode = shift;
       
    81 
       
    82   Utils::PrintDeathMessage($exitCode, "\nUsage: modnotes [options] <component> <notes_source_file> [<version>]
       
    83 
       
    84 options:
       
    85 
       
    86 -h  help
       
    87 -v  verbose output (-vv very verbose)\n");
       
    88 }
       
    89 
       
    90 sub ModNotes {
       
    91   my $relData = RelData->Open($iniData, $comp, $ver, $verbose);
       
    92   $relData->UpdateNotes($notesSrc);
       
    93   print "Release notes for $comp $ver updated\n";
       
    94 }
       
    95 
       
    96 
       
    97 __END__
       
    98 
       
    99 =head1 NAME
       
   100 
       
   101 ModNotes - Modifies the release notes of a release that has already been made.
       
   102 
       
   103 =head1 SYNOPSIS
       
   104 
       
   105   modnotes [options] <component> <notes_source_file> [<version>]
       
   106 
       
   107 options:
       
   108 
       
   109   -h  help
       
   110   -v  verbose output (-vv very verbose)
       
   111 
       
   112 =head1 DESCRIPTION
       
   113 
       
   114 Occasionally release are made using the wrong release notes source. Also, sometimes mistakes in the source are spotted after the release has been made. C<ModNotes> may be used to rectify these problems after a release has been made. Unless a version is explicitly specified, the release notes of the currently installed version will be modified.
       
   115 
       
   116 =head1 KNOWN BUGS
       
   117 
       
   118 None.
       
   119 
       
   120 =head1 COPYRIGHT
       
   121 
       
   122  Copyright (c) 2000-2009 Nokia Corporation and/or its subsidiary(-ies).
       
   123  All rights reserved.
       
   124  This component and the accompanying materials are made available
       
   125  under the terms of the License "Eclipse Public License v1.0"
       
   126  which accompanies this distribution, and is available
       
   127  at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
   128  
       
   129  Initial Contributors:
       
   130  Nokia Corporation - initial contribution.
       
   131  
       
   132  Contributors:
       
   133  
       
   134  Description:
       
   135  
       
   136 
       
   137 =cut