Subversion Repositories DevTools

Rev

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

Rev Author Line No. Line
392 dpurdie 1
#! perl
2
########################################################################
3
# Copyright ( C ) 2004 ERG Limited, All rights reserved
4
#
5
# Module name   : jats.sh
6
# Module type   : Makefile system
7
# Compiler(s)   : n/a
8
# Environment(s): jats
9
#
10
# Description   : Display the currently released version of ALL packages
11
#                 that are a part of a given release
12
#
13
#                 Detect missing builds for solaris10_sparc32
14
#
15
#                 Currently hard coded to Beijing Release-2
16
#
17
#                 Saves results in a file.
18
#
19
# Usage:
20
#
21
# Version   Who      Date        Description
22
#
23
#......................................................................#
24
 
25
require 5.006_001;
26
use strict;
27
use warnings;
28
use JatsError;
29
use Getopt::Long;
30
use Pod::Usage;                             # required for help support
31
use JatsRmApi;
32
 
33
use DBI;
34
 
35
my $VERSION = "1.2.3";                      # Update this
36
my $opt_verbose = 1;
37
my $opt_help = 0;
38
my $opt_manual;
39
my $opt_rtag_id = 5702;     # Beijing Release-1
40
my $RM_DB;
41
 
42
#-------------------------------------------------------------------------------
43
# Function        : Main Entry
44
#
45
# Description     :
46
#
47
# Inputs          :
48
#
49
# Returns         :
50
#
51
my $result = GetOptions (
52
                "help+"     => \$opt_help,          # flag, multiple use allowed
53
                "manual"    => \$opt_manual,        # flag
54
                "verbose+"  => \$opt_verbose,       # flag
55
                "rtagid=s"  => \$opt_rtag_id,       # string
56
                );
57
 
58
#
59
#   Process help and manual options
60
#
61
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
62
pod2usage(-verbose => 1)  if ($opt_help == 2 );
63
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
64
 
65
ErrorConfig( 'name'    =>'PLAY15' );
66
 
67
Error ("No RTAGID specified") unless ( $opt_rtag_id );
68
 
69
getPkgDetailsByRTAG_ID($opt_rtag_id);
70
exit;
71
 
72
 
73
sub getPkgDetailsByRTAG_ID
74
{
75
    my ($RTAG_ID) = @_;
76
    my $foundDetails = 0;
77
    my (@row);
78
 
79
    # if we are not or cannot connect then return 0 as we have not found anything
80
    connectRM(\$RM_DB);
81
 
82
    # First get details from pv_id
83
 
84
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.PKG_LABEL, pv.SRC_PATH, pv.BUILD_TYPE" .
85
                    " FROM RELEASE_CONTENT rc, PACKAGE_VERSIONS pv, PACKAGES pkg" .
86
                    " WHERE rc.RTAG_ID = $RTAG_ID AND rc.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID";
87
    my $sth = $RM_DB->prepare($m_sqlstr);
88
    if ( defined($sth) )
89
    {
90
        if ( $sth->execute( ) )
91
        {
92
            if ( $sth->rows )
93
            {
94
                while ( @row = $sth->fetchrow_array )
95
                {
96
                    my %DATA;
97
                    $DATA{pv_id}            = $row[0];
98
                    my $name = $DATA{name}             = $row[1];
99
                    my $ver = $DATA{version}          = $row[2];
100
                    my $label =                     $row[3] || '';
101
                    my $path = $row[4] || '';
102
 
103
 
104
                    $path =~ tr~\\/~/~s;
105
#print "$row[5] --";
106
#printf ( "%40s %15s %50s %s\n",  $name, $ver, $label, $path);
107
#printf ( "copy e:\\%s\\%s .\n",  $name, $ver, $label, $path);
108
 
109
                    #
110
                    #   Construct archive path
111
                    #
112
                    my $found;
113
                    foreach my $var ( 'GBE_DPKG', 'GBE_DPLY' )
114
                    {
115
                        my $pkg_dir="$ENV{$var}/${name}/${ver}";
116
                        if ( -d $pkg_dir )
117
                        {
118
                            $found = $pkg_dir;
119
                            last;
120
                        }
121
                    }
122
                    print "Package Not found: $name $ver\n" unless $found;
123
                    if ( $found )
124
                    {
125
                        if ( -f "$found/built.solaris10_x86" )
126
                        {
127
                            print "Build not found: $name $ver, $label\n" unless -f "$found/built.solaris10_sparc32";
128
                        }
129
                    }
130
 
131
                }
132
 
133
            }
134
            $sth->finish();
135
        }
136
    }
137
    else
138
    {
139
        Error("Prepare failure" );
140
    }
141
}
142