Subversion Repositories DevTools

Rev

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
########################################################################
5710 dpurdie 2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
392 dpurdie 3
#
4
# Module name   : jats.sh
5
# Module type   : Makefile system
6
# Compiler(s)   : n/a
7
# Environment(s): jats
8
#
9
# Description   : Get all packages-versions
10
#                 Determine all extensions
11
#
12
#
13
#......................................................................#
14
 
15
require 5.006_001;
16
use strict;
17
use warnings;
18
use JatsError;
19
use JatsSystem;
20
use Getopt::Long;
21
use Pod::Usage;                             # required for help support
22
use JatsRmApi;
23
 
24
use DBI;
25
 
26
my $VERSION = "1.2.3";                      # Update this
27
my $opt_verbose = 1;
28
my $opt_help = 0;
29
my $opt_manual;
30
my $RM_DB;
31
 
32
#
33
#   Package information
34
#
35
my %Packages;
36
my %Extensions;
37
 
38
#-------------------------------------------------------------------------------
39
# Function        : Main Entry
40
#
41
# Description     :
42
#
43
# Inputs          :
44
#
45
# Returns         :
46
#
47
my $result = GetOptions (
48
                "help+"         => \$opt_help,          # flag, multiple use allowed
49
                "manual"        => \$opt_manual,        # flag
50
                "verbose+"      => \$opt_verbose,       # flag
51
                );
52
 
53
#
54
#   Process help and manual options
55
#
56
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
57
pod2usage(-verbose => 1)  if ($opt_help == 2 );
58
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
59
 
60
 
61
ErrorConfig( 'name'    =>'PLAY23' );
62
getPkgDetailsByRTAG_ID();
63
DebugDumpData("Extensions", \%Extensions );
64
exit;
65
 
66
sub getPkgDetailsByRTAG_ID
67
{
68
    my $foundDetails = 0;
69
    my (@row);
70
 
71
    # if we are not or cannot connect then return 0 as we have not found anything
72
    connectRM(\$RM_DB);
73
 
74
    # First get all packages that are referenced in a Release
75
    # This will only get the top level packages
76
    # From non-archived releases
77
 
78
    my $m_sqlstr = "SELECT DISTINCT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION" .
79
                   " FROM RELEASE_MANAGER.RELEASE_CONTENT rc, RELEASE_MANAGER.PACKAGE_VERSIONS pv,".
80
                   "      RELEASE_MANAGER.PACKAGES pkg" .
81
                   " WHERE rc.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID" ;
82
    my $sth = $RM_DB->prepare($m_sqlstr);
83
    if ( defined($sth) )
84
    {
85
        if ( $sth->execute( ) )
86
        {
87
            print "--- Execute\n";
88
            if ( $sth->rows )
89
            {
90
                print "--- Execute ROWS\n";
91
                while ( @row = $sth->fetchrow_array )
92
                {
93
                    print "Data: @row\n";
94
                    my %data;
95
                    my $pvid = $row[0];
96
                    $data{name} = $row[1];
97
                    $data{version} = $row[2];
98
 
99
                    $Packages{$pvid} = \%data;
100
 
101
                    my $version = $row[2];
102
                    if ( $version =~ m~\.([a-zA-Z]+)$~ )
103
                    {
104
                        $Extensions{$1}++;
105
                    }
106
 
107
                }
108
            }
109
            print "--- Finish\n";
110
            $sth->finish();
111
        }
112
        else
113
        {
114
            Error("Execute failure: $m_sqlstr", $sth->errstr() );
115
        }
116
    }
117
    else
118
    {
119
        Error("Prepare failure" );
120
    }
121
}
122
 
123