Subversion Repositories DevTools

Rev

Rev 4625 | Rev 4698 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4625 dpurdie 1
########################################################################
2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
3
#
4
# Module name   : process_release_notes.pl
5
# Module type   : JATS Utility
6
# Compiler(s)   : Perl
7
# Environment(s): jats
8
#
9
# Description   : Poll RM and generate Release Notes as required
10
#                 Must run on the same machine as the package archive
11
#                 It directly manipulates the target package
12
#                 Requires access to the machines sudo mechism
13
#
14
# Usage         : See POD at the end of this file
15
#
16
#......................................................................#
17
 
18
require 5.008_002;
19
 
20
use strict;
21
use warnings;
22
use JatsError;
23
use JatsSystem;
24
use Getopt::Long;
25
use Pod::Usage;                             # required for help support
26
use File::Temp qw/ tempfile tempdir /;
27
use LWP::UserAgent;
28
use HTTP::Request::Common 'POST';
29
use Fcntl ':flock';
30
use FindBin;                                # Determine the current directory
31
 
32
use JatsEnv;
33
use JatsRmApi;
34
use FileUtils;
35
 
36
use DBI;
37
 
38
my $VERSION = "1.0.0";                      # Update this
39
my $GBE_DPKG = $ENV{GBE_DPKG};              # Sanitised by Jats
40
my $RM_DB;
41
my $tempdir;
42
my $sudoUtilsDir = '/home/releasem/sbin';
43
my $lockFile = '/tmp/JATSRN_LOCK';
44
my $scriptDir = "$FindBin::Bin";
45
 
46
#
47
#   Options
48
#
49
my $opt_verbose = 0;
50
my $opt_help = 0;
51
my $opt_age = 2;
52
my $opt_keepTemp = 0;
53
my $opt_status = 0;
54
my $opt_pvid;
55
 
56
#
57
#   Package information
58
#
59
my @Packages;
60
my @packageItems = qw( PV_ID RTAG_ID NAME VERSION PKG_ID PROJ_ID RNINFO);
61
my %rmConfig;
62
 
63
#-------------------------------------------------------------------------------
64
# Function        : Main Entry
65
#
66
# Description     :
67
#
68
# Inputs          :
69
#
70
# Returns         :
71
#
72
my $result = GetOptions (
73
                'help+'         => \$opt_help,          # flag, multiple use allowed
74
                'manual:3'      => \$opt_help,          # flag
75
                'verbose:+'     => \$opt_verbose,       # flag
76
                'age:i'         => \$opt_age,           # Number
77
                'keeptemp!'     => \$opt_keepTemp,      # flag
78
                'status+'       => \$opt_status,        # flag
79
                'pvid:i'        => \$opt_pvid,          # Number
80
                );
81
 
82
#
83
#   Process help and manual options
84
#
85
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
86
pod2usage(-verbose => 1)  if ($opt_help == 2);
87
pod2usage(-verbose => 2)  if ($opt_help > 2);
88
 
89
ErrorConfig( 'name'    =>'RelNotes', 
90
             'verbose' => $opt_verbose );
91
$opt_verbose-- if ($opt_verbose > 0);
92
#
93
#   Sanity Test
94
#
95
Error("Not running on a Unix System") unless ($ENV{GBE_UNIX});
96
Error("Sudo Utils not found: $sudoUtilsDir") unless ( -d $sudoUtilsDir);
97
Warning("Not running as a sutable user" ) unless ($ENV{USER} eq 'buildadm' || $ENV{USER} eq 'releasem');
98
EnvImport ('GBE_PERL');
99
 
100
#
101
#   Ensure only one instance is running
102
#   PerlMonks say to use $0 as the lock file, but that did not work.
103
#   Perhaps the file was open in an editor
104
#   Solution: Create my own file
105
#
106
open( FW, '>',$lockFile);
107
print FW '';
108
close FW;
109
 
110
open (my $self, '<', $lockFile) || Error("Couldn't open self: $!");
111
flock ($self, (LOCK_EX | LOCK_NB)) || Error("This script is already running");
112
 
113
#
114
#   Init parameters
115
#
116
$tempdir = tempdir('/tmp/JATSRN_XXXXXX',CLEANUP => !$opt_keepTemp);
117
Warning("Need to remove tempdir: " . DisplayPath($tempdir)) if $opt_keepTemp;
118
Verbose("Tempdir:" , DisplayPath($tempdir));
119
Verbose("scriptDir:" , DisplayPath($scriptDir));
120
 
121
#   Force GBE_ABT. Currently the Release Manager proxy password only works
122
#   When used in this mode
123
$ENV{GBE_ABT} = 1 unless defined $ENV{GBE_ABT};
124
 
125
#
126
#   User RW password, if provided
127
#
128
$ENV{GBE_RM_USERNAME} = $ENV{GBE_RM_USERNAME_RW} if (exists $ENV{GBE_RM_USERNAME_RW});
129
$ENV{GBE_RM_PASSWORD} = $ENV{GBE_RM_PASSWORD_RW} if (exists $ENV{GBE_RM_PASSWORD_RW});
130
 
131
if ($ENV{GBE_ABT} && $ENV{GBE_RM_USERNAME} && $ENV{GBE_RM_USERNAME} !~ m~]$~ )
132
{
133
    Verbose("Access RM database as proxy user");
134
    $ENV{GBE_RM_USERNAME} = $ENV{GBE_RM_USERNAME} . '[release_manager]'; 
135
}
136
 
137
#
138
#   Interogate the RM database and locate packages that need to be processed
139
#
140
$opt_pvid ? LocatePackagesByPvid() : LocatePackages();
141
Verbose("Package to process:" . scalar @Packages);
142
#DebugDumpData("Packages", \@Packages);
143
 
144
#
145
#   Process each found entry
146
#
147
foreach my $entry ( @Packages)
148
{
149
    GenerateReleaseNote( $entry);
150
}
151
 
152
unlink $lockFile;
153
exit 0;
154
 
155
#-------------------------------------------------------------------------------
156
# Function        : LocatePackages 
157
#
158
# Description     : Locate packages in need of Release Notes
159
#
160
# Inputs          : None
161
#
162
# Returns         : Nothing
163
#                   Populates the @Packages array
164
#
165
sub LocatePackages
166
{
167
 
168
    my $m_sqlstr =
169
            "SELECT * from
170
            (
171
                SELECT pv.pv_id, 
172
                       rc.rtag_id, 
173
                       pkg.pkg_name, 
174
                       pv.pkg_version, 
175
                       pv.pkg_id, 
176
                       rt.proj_id , 
177
                       pv.release_notes_info,
178
                       TRUNC(sysdate - pv.modified_stamp ) AS age , 
179
                       row_number() OVER (PARTITION BY pv.pv_id, pkg.pkg_name, pv.pkg_version ORDER BY rc.rtag_id) rn
180
                FROM release_manager.package_versions pv, 
181
                     release_manager.release_content rc, 
182
                     release_manager.packages pkg, 
183
                     release_manager.release_tags rt
184
                WHERE pv.pv_id = rc.pv_id
185
                AND pkg.pkg_id = pv.pkg_id
186
                AND rc.rtag_id = rt.rtag_id
187
                AND pv.pv_id IN (SELECT pv_id 
188
                                 FROM release_manager.package_versions 
189
                                 WHERE (release_notes_info IS null 
190
                                     OR release_notes_info like 'MSG:%' )
191
                                 AND pv.dlocked = 'Y'
192
                                 AND pv.modified_stamp > (sysdate - $opt_age)
193
                                 )
194
            )
195
            where rn = 1";
196
 
197
    populateArrayFromSql('LocatePackages', \@Packages, $m_sqlstr, \@packageItems);
198
#    DebugDumpData("Packages", \@Packages);
199
}
200
 
201
#-------------------------------------------------------------------------------
202
# Function        : LocatePackagesByPvid 
203
#
204
# Description     : Locate one package, as specified by its PVID
205
#                   This mode is only used in testing  
206
#
207
# Inputs          : Global: $opt_pvid 
208
#
209
# Returns         : Populate the @Packages array
210
#
211
sub LocatePackagesByPvid
212
{
213
    #   Extract: PV_ID RTAG_ID NAME VERSION PKG_ID PROJ_ID RNINFO AGE 
214
    my $m_sqlstr = "
215
                SELECT pv.pv_id, 
216
                       rc.rtag_id, 
217
                       pkg.pkg_name, 
218
                       pv.pkg_version, 
219
                       pv.pkg_id, 
220
                       rt.proj_id, 
221
                       pv.release_notes_info
222
                FROM release_manager.package_versions pv, 
223
                     release_manager.release_content rc, 
224
                     release_manager.packages pkg, 
225
                     release_manager.release_tags rt
226
                WHERE pv.pv_id = rc.pv_id
227
                AND pkg.pkg_id = pv.pkg_id
228
                AND rc.rtag_id = rt.rtag_id
229
                AND pv.pv_id = $opt_pvid
230
                ";
231
 
232
    populateArrayFromSql('LocatePackagesByPvid', \@Packages, $m_sqlstr, \@packageItems);
233
    #DebugDumpData("Packages", \@Packages);
234
}
235
 
236
#-------------------------------------------------------------------------------
237
# Function        : GenerateReleaseNote  
238
#
239
# Description     : Generate One Release Note
240
#                   Invoke several JATS utilities to do the hard work
241
#
242
# Inputs          : $entry          - Hash of useful infomation
243
#
244
# Returns         : Nothing
245
#                   Will exit on error
246
#
247
sub GenerateReleaseNote
248
{
249
    my ($entry) = @_;
250
    my $outfile;
251
    my $rv;
252
    my @args;
253
 
254
    #DebugDumpData("Entry", $entry);
255
    Message("-------------------- $entry->{NAME}, $entry->{VERSION}") if $opt_status || $opt_verbose;
256
 
257
    my $pkgBase = catdir($GBE_DPKG, $entry->{NAME}, $entry->{VERSION});
258
    Verbose("Processing: $pkgBase");
259
    unless (-d $pkgBase) {
260
        Warning("Package not in archive: $pkgBase");
261
        return;
262
    }
263
 
264
    #
265
    #   Make the target Package Version Writable and Ensure that the doc directory
266
    #   exists. This is done via a script that is invoked with SUDO, partially to
267
    #   interwork with the existing system  
268
    #
269
    runSudoCommand('make_writable', 'dpkg_archive', $entry->{NAME},$entry->{VERSION});
270
    runSudoCommand('make_docFolder', 'dpkg_archive', $entry->{NAME},$entry->{VERSION}, 'doc');
271
 
272
    #
273
    #   Get the basic data required for the Release Note
274
    #   jats jats_get_releasenote_data.pl -pvid=1002782
275
    #
276
    $outfile = catdir($tempdir, join('_',$entry->{NAME},$entry->{VERSION})) . '.xml';
277
    $rv = localTool('jats_get_releasenote_data', '-verbose', $opt_verbose, '-pvid', $entry->{PV_ID}, '-outfile', $outfile );
278
 
279
    #
280
    #   Generate the actual release note and update the Release Manager
281
    #   jats jats_gen_releasenote.pl -releasenote=mcrdemo_1.2.3157.cr.xml -UpdateRmFiles
282
    unless ($rv)
283
    {
284
        $rv = localTool('jats_gen_releasenote.pl', '-verbose', $opt_verbose, '-UpdateRmFiles', '-releasenote', $outfile);
285
    }
286
 
287
    #
288
    #   Release note complete - or failed
289
    #       Make the target PackageVersion ReadOnly
290
    #       Signal End of Package Processing - which will trigger blat
291
    #
292
    #   Do this even if we have a Release Note Failure
293
    #
294
    runSudoCommand('make_readonly', 'dpkg_archive', $entry->{NAME},$entry->{VERSION});
295
 
296
    #    make_release_changed 
297
    #       archive=archive-path 
4632 dpurdie 298
    #       pkg_name="package-name" 
299
    #       pkg_version="package-version" 
4625 dpurdie 300
    #       rtag_id=release-tag-id 
301
    #       pkg_id=package-id 
302
    #       pv_id=package-version-id 
303
    #       proj_id=project-id 
304
    #       mode_id=change-mode-id (1 pkg added, 2 pkg removed, 3 pkg released)
305
    #
4632 dpurdie 306
    #   Note: The ReleasedPackagereport tool parses the make_released_changed entries
307
    #         It requires quotes on the pkg_name and pkg_version for correct parsing
308
    #
4625 dpurdie 309
    push @args, 'archive=dpkg_archive';
310
    push @args, 'mode_id=3';
4632 dpurdie 311
    push @args, 'pkg_name="'    . $entry->{NAME} . '"';
312
    push @args, 'pkg_version="' . $entry->{VERSION} . '"';
4625 dpurdie 313
    push @args, 'rtag_id='     . $entry->{RTAG_ID};
314
    push @args, 'pkg_id='      . $entry->{PKG_ID};
315
    push @args, 'pv_id='       . $entry->{PV_ID};
316
    push @args, 'proj_id='     . $entry->{PROJ_ID};
317
 
318
    runSudoCommand('make_release_changed', @args);
319
 
320
    #
321
    #   Email interested users
322
    #
323
    notifyInterestedUsers($entry);
324
 
325
    Error ("Did not generate Release Note: $entry->{NAME}, $entry->{VERSION}") if ($rv);
326
}
327
 
328
#-------------------------------------------------------------------------------
329
# Function        : localTool 
330
#
331
# Description     : Run a jats tool from the same directory as this script 
332
#
333
# Inputs          : $name           - Name of the script
334
#                   ...             - Arguments for the command
335
#
336
# Returns         : 
337
#
338
sub localTool
339
{
340
    my $cmd = shift;
341
    $cmd .= '.pl' unless ( $cmd =~ m~\.pl$~i );
342
    $cmd = catdir($scriptDir, $cmd);
343
    Error ("Command not found: $cmd") unless -f $cmd;
344
 
345
    return System ( '--NoShell', $::GBE_PERL, $cmd, @_ );
346
}
347
 
348
 
349
#-------------------------------------------------------------------------------
350
# Function        : notifyInterestedUsers  
351
#
352
# Description     : A user can register interest in a package (name) being built in a 
353
#                   specific Project 
354
#                   Perhaps this should be done by the build tool, but at the moment 
355
#                   this release note generation process is really a part of the build
356
#
357
#                   NOTE: Similar code exists in the RM web server to handle manually
358
#                         released packages.
359
#                   
360
# Inputs          : $entry          - Hash of useful infomation
361
#
362
# Returns         : 
363
#
364
sub notifyInterestedUsers
365
{
366
    my ($entry) = @_;
367
    my @userList;
368
 
369
    #
370
    #   Determine interested users
371
    #
372
    my $m_sqlstr = "SELECT U.user_email, prj.proj_name, rt.rtag_name, pkg.pkg_name, pv.pkg_version ,pv.pv_id, rt.rtag_id
373
        FROM PACKAGE_INTEREST PI, 
374
             PACKAGES PKG, 
375
             PACKAGE_VERSIONS PV, 
376
             USERS U,
377
             RELEASE_TAGS RT, 
378
             PROJECTS PRJ 
379
        WHERE PKG.PKG_ID = PI.PKG_ID 
380
          AND RT.RTAG_ID = $entry->{RTAG_ID}
381
          AND PV.PV_ID = $entry->{PV_ID}
382
          AND PV.PKG_ID = PKG.PKG_ID 
383
          AND PRJ.PROJ_ID = RT.PROJ_ID 
384
          AND PRJ.PROJ_ID = PI.PROJ_ID 
385
          AND U.USER_ID = PI.USER_ID";
386
 
387
    my @items = qw( USER_EMAIL PROJ_NAME RTAG_NAME PKG_NAME PKG_VERSION PV_ID RTAG_ID );
388
 
389
    populateArrayFromSql('notifyInterestedUsers', \@userList, $m_sqlstr, \@items);
390
 
391
    #
392
    #   Do we have something to do
393
    #
394
    return unless (@userList);
395
    #DebugDumpData("userList", \@userList);
396
 
397
    #   Ensure we have basic emailing information
398
    #
399
    getRmConfig();
400
 
401
    #
402
    #   Send Email to all the required users
403
    #   Note: This emailer requires a sendmail utility
404
    #
405
    foreach my $entry ( @userList)
406
    {
407
        #$entry->{USER_EMAIL} = 'dpurdie@vixtechnology.com';
408
        #Debug0("Sending email to David Purdie indead of real user");
409
 
410
        my $subject = "Package Release Notification: $entry->{PKG_NAME} $entry->{PKG_VERSION}";
411
        my $content = "Version <a href='http://bms:8002/ManagerSuite/Release_Manager/fixed_issues.asp?pv_id=$entry->{PV_ID}&rtag_id=$entry->{RTAG_ID}'>$entry->{PKG_VERSION}</a> of Package $entry->{PKG_NAME} in Project $entry->{PROJ_NAME} on Release Branch $entry->{RTAG_NAME} has been released.";
412
           $content .= "<p>Package Link: http://bms:8002/ManagerSuite/Release_Manager/fixed_issues.asp?pv_id=$entry->{PV_ID}&rtag_id=$entry->{RTAG_ID}";
413
           $content .= "<p>You have received this email as a result of your interest in this package. If you do not wish to receive further emails then remove your package interest from the notifications area in Release Manager.";
414
 
415
 
416
        my $req = POST( 'mailto:' . $entry->{USER_EMAIL},
417
            From         => $rmConfig{'BUILD FAILURE MAIL SENDER'},
418
            CC           => 'buildadm@vixtechnology.com',
419
            Date         => scalar localtime,
420
            Subject      => $subject,
421
            Content_Type => qq(text/html),
422
            Content      => $content,
423
        );
424
 
425
        my $response = LWP::UserAgent->new->request($req);
426
        if ($response->code != 202)
427
        {
428
            Warning("Email Send Error: $response->code");
429
            #DebugDumpData("Response", \$response);
430
        }
431
    }
432
}
433
 
434
 
435
#-------------------------------------------------------------------------------
436
# Function        : getRmConfig 
437
#
438
# Description     : Get Basic config from Release Manager
439
#                   Only do it once
440
#
441
#                   Just need:
442
#                       'BUILD FAILURE MAIL SENDER'
443
#                       'MAIL SERVER'
444
#
445
# Inputs          : None
446
#
447
# Returns         : Populates a global hash
448
#
449
sub getRmConfig
450
{
451
    return if keys(%rmConfig) > 0;
452
    my $m_sqlstr = "SELECT * from BUILD_SERVICE_CONFIG";
453
 
454
    performSqlQueryCallback('getRmConfig', 
455
                            $m_sqlstr, 
456
                            sub { 
457
                                my ($pRow) = @_;
458
                                $rmConfig{ $pRow->[0] } = $pRow->[1];
459
                                }
460
                            );
461
#DebugDumpData("rmConfig", \%rmConfig);
462
}
463
 
464
 
465
#-------------------------------------------------------------------------------
466
# Function        : runSudoCommand 
467
#
468
# Description     : Run a Unix command as root via the sodo system
469
#                   Requires that target commands be available
470
#                   Requires sudo to be configured to allow this user to run them
471
#
472
# Notes           : The sudoers file on the archive server needs to be configured to allow:
473
#                       This user to run programs from /home/releasem/sbin without a password
474
#                       The users sudo credentials must not timeout (or be used)
475
#
476
# Inputs          : prog            - Command to run
477
#                   arguments       - Command arguments
478
#
479
# Returns         : Nothing 
480
#
481
sub runSudoCommand
482
{
483
    my ($prog, @arguments) = @_;
484
    my $cmd;
485
    my $rv;
486
 
487
    #
488
    #   Construct command
489
    #
490
    $cmd = catdir($sudoUtilsDir, $prog);
491
    $rv = System('--NoShell','sudo','-n', $cmd, @arguments);
492
    Warning("SudoCmd Result: $prog: $rv") if ($rv);
493
}
494
 
495
#-------------------------------------------------------------------------------
496
# Function        : performSqlQueryCallback 
497
#
498
# Description     : Perform a general Sql query and invoke a user function for
499
#                   each row of results
500
#
501
# Inputs          : $fname                  - Name of query for error reporting
502
#                   $m_sqlstr               - Query string
503
#                   $f_process              - Function called for each row in the result
504
#                                             Use closure to have callback modify other data
505
#
506
# Returns         : Number of rows found
507
#
508
sub performSqlQueryCallback
509
{
510
    my ($fname, $m_sqlstr, $f_process ) = @_;
511
    my $found = 0;
512
 
513
    #
514
    #   Connect to the database - once
515
    #
516
    connectRM(\$RM_DB, $opt_verbose) unless $RM_DB;
517
 
518
    $m_sqlstr =~ s~\s+~ ~g;
519
    Verbose3("SQL:", $m_sqlstr);
520
    my $sth = $RM_DB->prepare($m_sqlstr);
521
    if ( defined($sth) )
522
    {
523
        if ( $sth->execute( ) )
524
        {
525
            if ( $sth->rows )
526
            {
527
                while ( my @row = $sth->fetchrow_array )
528
                {
529
                    $found++;
530
                    &$f_process(\@row);
531
                }
532
            }
533
            $sth->finish();
534
        }
535
        else
536
        {
537
            Error("$fname:Execute failure: $m_sqlstr", $sth->errstr() );
538
        }
539
    }
540
    else
541
    {
542
        Error("$fname:Prepare failure" );
543
    }
544
 
545
    unless ( $found )
546
    {
547
        Verbose("$fname:No data found");
548
    }
549
    return $found;
550
}
551
 
552
#-------------------------------------------------------------------------------
553
# Function        : populateArrayFromSql 
554
#
555
# Description     : Issue an SQL query and push the results into an array of hashes
556
#                   where each row from the query is a hash and the entire result is an 
557
#                   array 
558
#
559
# Inputs          :     name                - For error reporting
560
#                       pArray              - Ref to the output array
561
#                       sql                 - Sql to process
562
#                       pItems              - Array of tems to extract
563
#                                             Must match the SQL SELECT arguments
564
#                                             Item names starting with '-' do not end up in the
565
#                                             generated XML
566
# Returns         : 
567
#
568
sub populateArrayFromSql
569
{
570
    my ($fname, $pArray, $m_sqlstr, $pItems) = @_;
571
 
572
    performSqlQueryCallback($fname, 
573
                            $m_sqlstr, 
574
                            sub { 
575
                                my ($pRow) = @_;
576
                                my %entry;
577
                                push @{$pArray}, populateHash( \%entry, $pRow, $pItems);
578
                                }
579
                            );
580
#DebugDumpData("populateArrayFromSql", $pArray);
581
}
582
 
583
#-------------------------------------------------------------------------------
584
# Function        : populateHash 
585
#
586
# Description     : Put an array of data items into a hash
587
#
588
# Inputs          : pHash           - ref to output hash
589
#                   pRow            - Ref to the row data 
590
#                   pItems          - Ref to an hash array of entry names
591
#
592
# Returns         : pHash
593
#
594
sub populateHash
595
{
596
    my ($pHash, $pRow, $pItems) = @_;
597
 
598
    foreach my $item ( @{$pItems} ) {
599
        my $data = shift @{$pRow};
600
 
601
        if (defined $data)
602
        {
603
            $data =~ s~^\s+~~;
604
            $data =~ s~\s+$~~;
605
 
606
            #
607
            #   Store in hash
608
            #
609
            $pHash->{$item} = $data;
610
        }
611
    }
612
    return $pHash;
613
}
614
 
615
#-------------------------------------------------------------------------------
616
#   Documentation
617
#
618
 
619
=pod
620
 
621
=for htmltoc    SYSUTIL::
622
 
623
=head1 NAME
624
 
625
process_release_notes - Create Release Notes for newly created packages
626
 
627
=head1 SYNOPSIS
628
 
629
 jats process_release_notes [options]
630
 
631
 Options:
632
    -help              - Brief help message
633
    -help -help        - Detailed help message
634
    -man               - Full documentation
635
    -verbose           - Display additional progress messages
636
    -pvid=nn           - PVID of package to process(test mode)
637
    -age=nn            - Examine packages created in last n days
638
    -keeptemp          - Keep the temp workspace
639
    -status            - Display status
640
 
641
=head1 OPTIONS
642
 
643
=over 8
644
 
645
=item B<-help>
646
 
647
Print a brief help message and exits.
648
 
649
=item B<-help -help>
650
 
651
Print a detailed help message with an explanation for each option.
652
 
653
=item B<-man>
654
 
655
Prints the manual page and exits.
656
 
657
=item B<-pvid=nn>
658
 
659
This option bypasses the normal mechanism of determining packages to be processed and 
660
will process just the specified package. This is normally only used to test the operation 
661
of the subsystem.
662
 
663
=item B<-age=nn>
664
 
665
This option control the period of time period used in determing which packages to process. 
666
 
667
The number is in days. The default value is 2 days.
668
 
669
=item B<-keeptemp>
670
 
671
If this option is specified, then the temporary directory created in the processing will be 
672
retained. The user is responsible for deleting the directory.
673
 
674
This option is normally only used in testing.
675
 
676
=item B<-status>
677
 
678
When set, this option will cause the program to display the package name and version of each
679
package being processed.
680
 
681
=back
682
 
683
=head1 DESCRIPTION
684
 
685
This utility program is apart of the Package Release process. It is an interim solution.
686
 
687
The script is designed to be run as a cron jon on the dpkg_archive server.
688
 
689
It will scan the Release Manager database for packages that have been release, but do 
690
not yet have release notes. For each package it will then generate a Release Note by: 
691
 
692
=over 4
693
 
694
=item *
695
 
696
Invoke jats_get_releasenote_data to:
697
 
698
Extract relevent information from
699
 
700
=over 4
701
 
702
=item *
703
 
704
The Release Manager database
705
 
706
=item *
707
 
708
the ClearQuest database (now conatined within the Release Manager database)
709
 
710
=item *
711
 
712
the Jira Issue server 
713
 
714
=back
715
 
716
and create and XML file.
717
 
718
=item *
719
 
720
Invoke jats_gen_releasenote to:
721
 
722
=over 4
723
 
724
=item *
725
 
726
Process the the XML file created above, and package list info found within the new package. 
727
 
728
If no package informationis found then the utility will create a package list, but this is 
729
much slower than having it created by the package builder.
730
 
731
=item *
732
 
733
Create an XML file containing all the package information
734
 
735
=item *
736
 
737
Create an HTML based Release Note, from the XML file. This file could also be used to create a Release note in another format if required. 
738
 
739
=item *
740
 
741
Transfer these two files into the package in dpkg_archive
742
 
743
=item *
744
 
745
Insert the packages file list into the Release Manager database.
746
 
747
=back
748
 
749
=item *
750
 
751
Make the package read-only. This will trigger any post-install processing of the 
752
package. This is only required for packages that form a part of the build system.
753
 
754
=item *
755
 
756
Flag that the package has been released. This may tigger the BLAT package file transfer process 
757
and the package will be transferred to remote sites.
758
 
759
=item *
760
 
761
Determine the users that have registered interest in being informed when the package is released. 
762
It will then email these users.
763
 
764
=back
765
 
766
=head1 EXAMPLE
767
 
768
=head2 process_release_notes
769
 
770
This will perform a single scan of the Release Manager database and generate Release Notes as required.
771
 
772
=cut
773