Subversion Repositories DevTools

Rev

Go to most recent revision | Details | 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   : Determine packages with silly conflicting names
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
 
31
#
32
#   Package information
33
#
34
my %Names;
35
my $total = 0;
36
 
37
#-------------------------------------------------------------------------------
38
# Function        : Main Entry
39
#
40
# Description     :
41
#
42
# Inputs          :
43
#
44
# Returns         :
45
#
46
my $result = GetOptions (
47
                "help+"         => \$opt_help,          # flag, multiple use allowed
48
                "manual"        => \$opt_manual,        # flag
49
                "verbose+"      => \$opt_verbose,       # flag
50
                );
51
 
52
#
53
#   Process help and manual options
54
#
55
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
56
pod2usage(-verbose => 1)  if ($opt_help == 2 );
57
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));
58
 
59
 
60
ErrorConfig( 'name'    =>'PLAY23' );
61
getPkgDetailsByRTAG_ID();
62
#DebugDumpData("Names", \%Names );
63
 
64
foreach my $entry ( keys %Names )
65
{
66
    my @data = @{$Names{$entry}};
67
    if ( $#data >= 1 )
68
    {
69
        print "Potentially Conflicting Names --- @data\n";
70
    }
71
}
72
print "Package Names: $total\n";
73
 
74
exit;
75
 
76
sub getPkgDetailsByRTAG_ID
77
{
78
    my $foundDetails = 0;
79
    my (@row);
80
 
81
    # if we are not or cannot connect then return 0 as we have not found anything
82
    connectRM(\$RM_DB);
83
 
84
    # First get all packages that are referenced in a Release
85
 
86
    my $m_sqlstr = "SELECT DISTINCT pkg.PKG_NAME" .
87
                   " FROM RELEASE_MANAGER.RELEASE_CONTENT rc, RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" .
88
                   " WHERE rc.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID" .
89
                   " order by pkg.PKG_NAME";
90
    my $sth = $RM_DB->prepare($m_sqlstr);
91
    if ( defined($sth) )
92
    {
93
        if ( $sth->execute( ) )
94
        {
95
            print "--- Execute\n";
96
            if ( $sth->rows )
97
            {
98
                print "--- Execute ROWS\n";
99
                while ( @row = $sth->fetchrow_array )
100
                {
101
                    print "Data: @row\n";
102
                    my %data;
103
                    my $name = $row[0];
104
                    my $cname = uc($name);
105
                    $cname =~ s~ ~~g;
106
                    $cname =~ s~-~~g;
107
                    $cname =~ s~_~~g;
108
                    push @{$Names{$cname}}, $name;
109
                    $total++;
110
                }
111
            }
112
            print "--- Finish\n";
113
            $sth->finish();
114
        }
115
        else
116
        {
117
            Error("Execute failure: $m_sqlstr" );
118
        }
119
    }
120
    else
121
    {
122
        Error("Prepare failure" );
123
    }
124
}
125