Subversion Repositories DevTools

Rev

Rev 2026 | Blame | Compare with Previous | Last modification | View Log | RSS feed

#! perl
########################################################################
# Copyright ( C ) 2004 ERG Limited, All rights reserved
#
# Module name   : jats.sh
# Module type   : Makefile system
# Compiler(s)   : n/a
# Environment(s): jats
#
# Description   : Not sure
#
#
# Usage:
#
# Version   Who      Date        Description
#
#......................................................................#

require 5.006_001;
use strict;
use warnings;
use JatsError;
use JatsSystem;
use Getopt::Long;
use Pod::Usage;                             # required for help support
use JatsRmApi;
use JatsVersionUtils;

use DBI;

my $VERSION = "1.2.3";                      # Update this
my $opt_verbose = 1;
my $opt_help = 0;
my $opt_manual;
my $opt_rtag_id;
my $RM_DB;

#
#   Package information
#
my %Package;
my %Dnr;
my @StrayPackages;

#-------------------------------------------------------------------------------
# Function        : Main Entry
#
# Description     :
#
# Inputs          :
#
# Returns         :
#
my $result = GetOptions (
                "help+"         => \$opt_help,          # flag, multiple use allowed
                "manual"        => \$opt_manual,        # flag
                "verbose+"      => \$opt_verbose,       # flag
                "rtag=s"        => \$opt_rtag_id,       # string
                );

#
#   Process help and manual options
#
pod2usage(-verbose => 0, -message => "Version: $VERSION")  if ($opt_help == 1  || ! $result);
pod2usage(-verbose => 1)  if ($opt_help == 2 );
pod2usage(-verbose => 2)  if ($opt_manual || ($opt_help > 2));


my%pi;
my %data;

ErrorConfig( 'name'    =>'PLAY21' );
getStuffedEntried();

exit;


sub  getStuffedEntried
{
    my $foundDetails = 0;
    my (@row);

    # if we are not or cannot connect then return 0 as we have not found anything
    connectRM( \$RM_DB);

    # First get details from pv_id

    my $m_sqlstr = "select RELEASE_MANAGER.PACKAGE_VERSIONS.PV_ID, RELEASE_MANAGER.PACKAGE_VERSIONS.PKG_LABEL, RELEASE_MANAGER.PACKAGE_VERSIONS.SRC_PATH, RELEASE_MANAGER.PACKAGE_VERSIONS.PKG_VERSION " .
                    "from RELEASE_MANAGER.PACKAGE_VERSIONS, RELEASE_MANAGER.PACKAGE_METRICS " .
                    "where RELEASE_MANAGER.PACKAGE_VERSIONS.PV_ID = RELEASE_MANAGER.PACKAGE_METRICS.PV_ID and RELEASE_MANAGER.PACKAGE_METRICS.BRANCH_LIST is null";
    my $sth = $RM_DB->prepare($m_sqlstr);
    if ( defined($sth) )
    {
        if ( $sth->execute( ) )
        {
            if ( $sth->rows )
            {
                while ( @row = $sth->fetchrow_array )
                {
                    my $pvid = $row[0];
                    my $path = $row[2];
                    $path =~ s~\\~/~g;
                    my $label = $row[1];
                    my $version = $row[3];


                    #
                    #   Skip those where the source path is the vob root
                    #
                    my $count = $path =~ s~/~/~g;
                    next if ( $count <= 1 );

                    #
                    #   Skip those that arn't a ripple
                    #
                    my ( $major, $minor, $patch, $build, $raw_patch ) = SplitVersion( $version );
                    next if ( $build <= 0 );

                    $data{$pvid}{vn} = "$major, $minor, $patch, $build, $raw_patch";
                    $data{$pvid}{label} = $label;
                    $data{$pvid}{path} = $path;

                    if ( exists $pi{$path} )
                    {
                        $pi{$path}{count} ++;
                    }
                    else
                    {
                        $pi{$path}{count} = 1;
                        $pi{$path}{pvid} = $pvid;
                    }

#                    printf ("$major, $minor, $patch, $build, $raw_patch, $count : %40.40s %s\n", $label, $path);

#print "Data: @row\n";
                }
            }
            $sth->finish();
        }
    }
    else
    {
        Error("Prepare failure" );
    }


    #
    #   Now print out those that have only been rippled once
    #
    foreach my $path ( keys %pi )
    {
        next unless ( $pi{$path}{count} == 1 );
        my $pvid = $pi{$path}{pvid};

        my $label = $data{$pvid}{label};
        my $path =  $data{$pvid}{path};
        my $vn = $data{$pvid}{vn};

#        printf ("%-40.40s %s     - $vn\n", $label, $path);

#        print "jats.bat release -test -label=$label -path=$path\n";

        my $label_old = $label;
        $label_old =~ s~(...)(\.[a-z]+)$~000$2~;
        print "jats.bat CCdiff -old=$label_old -new=$label\n";


    }

}