Subversion Repositories DevTools

Rev

Rev 4552 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4552 Rev 4612
Line 46... Line 46...
46
use DBI;
46
use DBI;
47
 
47
 
48
my $VERSION = "1.0.0";                                      # Update this. Inserted into meta data field
48
my $VERSION = "1.0.0";                                      # Update this. Inserted into meta data field
49
 
49
 
50
# User options
50
# User options
51
my $opt_verbose = 1;
51
my $opt_verbose = 0;
52
my $opt_help = 0;
52
my $opt_help = 0;
53
my $opt_archive;
53
my $opt_archive;
54
my $archive_tag;
54
my $archive_tag;
55
my $opt_pname;
55
my $opt_pname;
56
my $opt_pversion;
56
my $opt_pversion;
57
my $opt_release_note;
57
my $opt_release_note;
58
my $opt_pvid;
58
my $opt_pvid;
59
my $opt_outname;
59
my $opt_outname;
60
my $opt_updateRmFiles;
60
my $opt_updateRmFiles;
-
 
61
my $opt_workingDir;
61
 
62
 
62
#   Global vars
63
#   Global vars
63
our $GBE_HOSTNAME;
64
our $GBE_HOSTNAME;
64
our $GBE_TOOLS;
65
our $GBE_TOOLS;
65
my $DPKG_ROOT;
66
my $DPKG_ROOT;
66
my $DPKG_DOC;
67
my $DPKG_DOC;
67
my $JATS_RN;
68
my $JATS_RN;
-
 
69
my $OUT_ROOT;
68
 
70
 
69
 
71
 
70
#
72
#
71
#   Structure to translate -archive=xxx option to archive variable
73
#   Structure to translate -archive=xxx option to archive variable
72
#   These are the various dpkg_archives known to JATS
74
#   These are the various dpkg_archives known to JATS
Line 92... Line 94...
92
    my $result = GetOptions (
94
    my $result = GetOptions (
93
                    "help+"         => \$opt_help,              # flag, multiple use allowed
95
                    "help+"         => \$opt_help,              # flag, multiple use allowed
94
                    "manual:3"      => \$opt_help,              # flag, set value
96
                    "manual:3"      => \$opt_help,              # flag, set value
95
                    "verbose:+"     => \$opt_verbose,           # flag, increment
97
                    "verbose:+"     => \$opt_verbose,           # flag, increment
96
                    "archive=s"     => \$opt_archive,           # string
98
                    "archive=s"     => \$opt_archive,           # string
97
#                    "pname=s"       => \$opt_pname,            # string
-
 
98
#                    "pversion=s"    => \$opt_pversion,         # string
-
 
99
                    "releasenote=s" => \$opt_release_note,      # string
99
                    "releasenote=s" => \$opt_release_note,      # string
100
                    "UpdateRmFiles" =>  \$opt_updateRmFiles     # flag
100
                    "UpdateRmFiles" => \$opt_updateRmFiles,     # flag
-
 
101
                    "WorkDir=s"     => \$opt_workingDir,        # String
101
                    );
102
                    );
102
 
103
 
103
    #
104
    #
104
    #   Process help and manual options
105
    #   Process help and manual options
105
    #
106
    #
106
    pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
107
    pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
107
    pod2usage(-verbose => 1)  if ($opt_help == 2 );
108
    pod2usage(-verbose => 1)  if ($opt_help == 2 );
108
    pod2usage(-verbose => 2)  if ($opt_help > 2);
109
    pod2usage(-verbose => 2)  if ($opt_help > 2);
109
 
110
 
110
    ErrorConfig( 'name'    =>'GenRn', 'verbose' => $opt_verbose );
111
    ErrorConfig( 'name'    =>'GenRn', 'verbose' => $opt_verbose );
-
 
112
    InitFileUtils();
111
 
113
 
112
    #
114
    #
113
    #   Needed EnvVars
115
    #   Needed EnvVars
114
    #
116
    #
115
    EnvImport ('GBE_HOSTNAME');
117
    EnvImport ('GBE_HOSTNAME');
Line 120... Line 122...
120
 
122
 
121
 
123
 
122
    #
124
    #
123
    #   Sanity Check
125
    #   Sanity Check
124
    #
126
    #
125
#    Error("Package Name not provided") unless $opt_pname;
-
 
126
#    Error("Package Version not provided") unless $opt_pversion;
-
 
127
    Error("Release Note data not provided") unless $opt_release_note;
127
    Error("Release Note data not provided") unless $opt_release_note;
128
    Error("Release Note data not found") unless -f $opt_release_note;
128
    Error("Release Note data not found") unless -f $opt_release_note;
-
 
129
    if (defined $opt_workingDir)
-
 
130
    {
-
 
131
        $opt_workingDir = FullPath($opt_workingDir);
-
 
132
        Error("Working directory is not a directory") unless -d $opt_workingDir;
-
 
133
        Error("Working directory is writable") unless -w $opt_workingDir;
-
 
134
    }
129
    
135
    
130
 
136
 
131
    #
137
    #
132
    #   Determine the target archive
138
    #   Determine the target archive
133
    #   The default archive is GBE_DPKG, but this may be changed
139
    #   The default archive is GBE_DPKG, but this may be changed
Line 150... Line 156...
150
    #
156
    #
151
    $DPKG_ROOT = catdir($DPKG_ROOT, $opt_pname, $opt_pversion);
157
    $DPKG_ROOT = catdir($DPKG_ROOT, $opt_pname, $opt_pversion);
152
    Verbose ("Package Path: ", DisplayPath($DPKG_ROOT) );
158
    Verbose ("Package Path: ", DisplayPath($DPKG_ROOT) );
153
    Error ("Package not found in archive", $DPKG_ROOT) unless -d $DPKG_ROOT;
159
    Error ("Package not found in archive", $DPKG_ROOT) unless -d $DPKG_ROOT;
154
 
160
 
-
 
161
    #   OUT_ROOT is really only used for testing
-
 
162
    #   Needs to mimic $DPKG_ROOT
-
 
163
    $OUT_ROOT = defined($opt_workingDir) ? $opt_workingDir : $DPKG_ROOT; 
-
 
164
    Verbose2 ("Output Path: $OUT_ROOT" );
-
 
165
 
155
    #
166
    #
156
    #   Locate the release note data file
167
    #   Locate the release note data file
157
    #   This was created as a prerequisite to the build
168
    #   This was created as a prerequisite to the build
158
    #   Note: windows requires '/' in the file list
169
    #   Note: windows requires '/' in the file list
159
    #
170
    #
Line 190... Line 201...
190
    Verbose("Note Name: $opt_outname");
201
    Verbose("Note Name: $opt_outname");
191
    
202
    
192
    #
203
    #
193
    #   Create output directory within the package
204
    #   Create output directory within the package
194
    #
205
    #
195
    $DPKG_DOC = catdir($DPKG_ROOT, 'doc');
206
    $DPKG_DOC = catdir($OUT_ROOT, 'doc');
196
    mkpath($DPKG_DOC, 0, 0775);
207
    mkpath($DPKG_DOC, 0, 0775);
197
 
208
 
198
    #
209
    #
199
    #   Merge the Release Note and the various file lists into a single
210
    #   Merge the Release Note and the various file lists into a single
200
    #   XML file. Keep the file local
211
    #   XML file. Keep the file local
Line 305... Line 316...
305
    #   Write out sections of XML
316
    #   Write out sections of XML
306
    #       Want control over the output order
317
    #       Want control over the output order
307
    #       Use lots of attributes and only elements for arrays
318
    #       Use lots of attributes and only elements for arrays
308
    #       Save as one attribute per line - for readability
319
    #       Save as one attribute per line - for readability
309
    #
320
    #
310
    $outXmlFile = catdir($DPKG_ROOT,"built.files.$GBE_HOSTNAME.xml");
321
    $outXmlFile = catdir($OUT_ROOT,"built.files.$GBE_HOSTNAME.xml");
311
 
322
 
312
    Verbose2('Meta File', $outXmlFile);
323
    Verbose2('Meta File', $outXmlFile);
313
    my $xs = XML::Simple->new( NoAttr =>0, AttrIndent => 1 );
324
    my $xs = XML::Simple->new( NoAttr =>0, AttrIndent => 1 );
314
 
325
 
315
    open (my $XML, '>', $outXmlFile) || Error ("Cannot create output file: $outXmlFile", $!);
326
    open (my $XML, '>', $outXmlFile) || Error ("Cannot create output file: $outXmlFile", $!);
Line 391... Line 402...
391
sub updateRmFiles
402
sub updateRmFiles
392
{
403
{
393
    my $eCount = 0;
404
    my $eCount = 0;
394
    #
405
    #
395
    #   If in use the the autobuilder - which it should be, then
406
    #   If in use the the autobuilder - which it should be, then
-
 
407
    #   modify the user name to access RM with a proxy user. This is the
396
    #   modify the user name
408
    #   same method used in the 'buildtool'
397
    #
409
    #
398
    #$ENV{GBE_RM_LOCATION} = 'jdbc:oracle:thin:@auperaora07:1521:RELMANU1';
-
 
399
    #$ENV{GBE_RM_USERNAME} = 'build_user'; 
-
 
400
    #$ENV{GBE_RM_PASSWORD} = 'frog123';
-
 
401
 
-
 
402
    $ENV{GBE_RM_LOCATION} = 'jdbc:oracle:thin:@auperaora07:1521:RELMANU1';
-
 
403
    $ENV{GBE_RM_USERNAME} = 'release_manager'; 
410
    if ($ENV{GBE_ABT} && $ENV{GBE_RM_USERNAME} && $ENV{GBE_RM_USERNAME} !~ m~]$~ )
404
    $ENV{GBE_RM_PASSWORD} = 'release_manager';
-
 
405
 
-
 
406
    if ($ENV{ABT})
-
 
407
    {
411
    {
-
 
412
        Verbose("Access RM database as proxy user");
408
        $ENV{GBE_RM_USERNAME} = $ENV{GBE_RM_USERNAME} . '[release_manager]'; 
413
        $ENV{GBE_RM_USERNAME} = $ENV{GBE_RM_USERNAME} . '[release_manager]'; 
409
    }
414
    }
410
 
415
 
411
    #
416
    #
412
    #   Read in the release note data base
417
    #   Read in the release note data base
Line 506... Line 511...
506
#
511
#
507
sub updateRmFilesDelete
512
sub updateRmFilesDelete
508
{
513
{
509
    executeRmQuery(
514
    executeRmQuery(
510
        'updateRmFilesDelete',
515
        'updateRmFilesDelete',
511
        'delete from release_components where pv_id=' . $opt_pvid
516
        'delete from release_manager.release_components where pv_id=' . $opt_pvid
512
        );
517
        );
513
}
518
}
514
 
519
 
515
#-------------------------------------------------------------------------------
520
#-------------------------------------------------------------------------------
516
# Function        : updateRmNoteInfo 
521
# Function        : updateRmNoteInfo