Subversion Repositories DevTools

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1271 dpurdie 1
########################################################################
2
# Copyright (C) 1998-2012 Vix Technology, All rights reserved
3
#
4
# Module name   : jats_rm_play24.pl
5
# Module type   : Makefile system
6
# Compiler(s)   : n/a
7
# Environment(s): jats
8
#
9
# Description   : Get data on one package - without dependencies
10
#
11
#
12
#......................................................................#
13
 
14
require 5.006_001;
15
use strict;
16
use warnings;
17
use JatsError;
18
use JatsSystem;
19
use Getopt::Long;
20
use Pod::Usage;                             # required for help support
21
use JatsRmApi;
22
 
23
use DBI;
24
 
25
my $VERSION = "1.2.3";                      # Update this
26
my $opt_verbose = 1;
27
my $opt_help = 0;
28
my $opt_manual;
29
my $RM_DB;
30
my $DM_DB;
31
 
32
#-------------------------------------------------------------------------------
33
# Function        : Main Entry
34
#
35
# Description     :
36
#
37
# Inputs          :
38
#
39
# Returns         :
40
#
41
my $result = GetOptions (
42
                "help+"         => \$opt_help,          # flag, multiple use allowed
43
                "manual"        => \$opt_manual,        # flag
44
                "verbose+"      => \$opt_verbose,       # flag
45
                );
46
 
47
#
48
#   Process help and manual options
49
#
50
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
51
pod2usage(-verbose => 1)  if ($opt_help == 2 );
52
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
53
 
54
 
55
ErrorConfig( 'name'    =>'PLAY25' );
56
 
57
 
58
getBoms();
59
exit 0;
60
 
61
GetDepends(480269);
62
GetDepends(860874);
63
 
64
 
65
sub GetDepends
66
{
67
    my ($pv_id ) = @_;
68
    my $found = 0;
69
    my @rows;
70
 
71
    connectRM(\$RM_DB) unless $RM_DB;
72
    #
73
    #   Now extract the package dependacies
74
    #
75
    my $m_sqlstr = "SELECT ".
76
                  "        pv.PV_ID,".
77
                  "        pkg.PKG_NAME, ".
78
                  "        pv.PKG_VERSION, ".
79
                  "        pv.DLOCKED,".
80
                  "        release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID),".
81
                  "        pv.PKG_ID,".
82
                  "        pv.MODIFIED_STAMP" .
83
                  " FROM  ".
84
                  "         RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd, ".
85
                  "         RELEASE_MANAGER.PACKAGE_VERSIONS pv ".
86
                  "         ,RELEASE_MANAGER.PACKAGES pkg" .
87
                  " WHERE ".
88
                  #"         pv.PV_ID = \'$pv_id\' " .
89
                  "         pd.PV_ID(+) = \'$pv_id\' " .
90
                  "         AND pd.DPV_ID = pv.PV_ID" .
91
                  "         AND pv.PKG_ID = pkg.PKG_ID" .
92
                  "";
93
$m_sqlstr =~ s~\s+~ ~g;
94
print "\n\n$m_sqlstr\n";
95
    my $sth = $RM_DB->prepare($m_sqlstr);
96
    if ( defined($sth) )
97
    {
98
        if ( $sth->execute( ) )
99
        {
100
            if ( $sth->rows )
101
            {
102
                while ( my @row = $sth->fetchrow_array )
103
                {
104
                    print "-- @row\n";
105
                    $found = 1;
106
                }
107
            }
108
            $sth->finish();
109
        }
110
        else
111
        {
112
            Error("GetDepends:Execute failure: $m_sqlstr", $sth->errstr() );
113
        }
114
    }
115
    else
116
    {
117
        Error("GetDepends:Prepare failure" );
118
    }
119
 
120
    unless ( $found )
121
    {
122
        Warning("No Package Version data for: $pv_id");
123
    }
124
}
125
 
126
my %AllBoms;
127
#-------------------------------------------------------------------------------
128
# Function        : getBoms
129
#
130
# Description     : Get all the os_id's associated with a BOMID
131
#                   Also get base_env_id's where they exist
132
#
133
# Inputs          : $bom_id             - BOM to process
134
#
135
# Returns         :
136
#
137
sub getBoms
138
{
139
    my $foundDetails = 0;
140
    my (@row);
141
    Verbose ("getBoms");
142
    connectDM(\$DM_DB) unless ($DM_DB);
143
 
144
    my $m_sqlstr = "SELECT distinct ".
145
                        "p.PROJ_ID,".
146
                        "p.PROJ_NAME".
147
#                        "br.BRANCH_ID,".
148
#                        "bm.BOM_ID".
149
                   " FROM DEPLOYMENT_MANAGER.DM_PROJECTS p, " .
150
                         "DEPLOYMENT_MANAGER.BRANCHES br, ".
151
                         "DEPLOYMENT_MANAGER.BOMS bm ".
152
                   " WHERE p.PROJ_ID = br.PROJ_ID ".
153
                      "AND br.BRANCH_ID = bm.BRANCH_ID";
154
 
155
    my $sth = $DM_DB->prepare($m_sqlstr);
156
    if ( defined($sth) )
157
    {
158
        if ( $sth->execute( ) )
159
        {
160
            if ( $sth->rows )
161
            {
162
                while ( @row = $sth->fetchrow_array )
163
                {
164
print "$row[0]    # $row[1]\n";
165
                    $foundDetails = 1;
166
                }
167
            }
168
            $sth->finish();
169
        }
170
        else
171
        {
172
            Error("getBoms:Execute failure: $m_sqlstr" );
173
        }
174
    }
175
    else
176
    {
177
        Error("getBoms:Prepare failure" );
178
    }
179
 
180
    Error("getBoms:No OS Information Found" ) unless $foundDetails;
181
 
182
#    DebugDumpData("AllBoms", \%AllBoms );
183
}
184
 
185