Subversion Repositories DevTools

Rev

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

########################################################################
# Copyright (C) 1998-2012 Vix Technology, All rights reserved
#
# Module name   : jats_rm_play24.pl
# Module type   : Makefile system
# Compiler(s)   : n/a
# Environment(s): jats
#
# Description   : Get data on one package - without dependencies
#
#
#......................................................................#

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 DBI;

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

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

#
#   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));


ErrorConfig( 'name'    =>'PLAY25' );


getBoms();
exit 0;

GetDepends(480269);
GetDepends(860874);


sub GetDepends
{
    my ($pv_id ) = @_;
    my $found = 0;
    my @rows;

    connectRM(\$RM_DB) unless $RM_DB;
    #
    #   Now extract the package dependacies
    #
    my $m_sqlstr = "SELECT ".
                  "        pv.PV_ID,".
                  "        pkg.PKG_NAME, ".
                  "        pv.PKG_VERSION, ".
                  "        pv.DLOCKED,".
                  "        release_manager.PK_RMAPI.return_vcs_tag(pv.PV_ID),".
                  "        pv.PKG_ID,".
                  "        pv.MODIFIED_STAMP" .
                  " FROM  ".
                  "         RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd, ".
                  "         RELEASE_MANAGER.PACKAGE_VERSIONS pv ".
                  "         ,RELEASE_MANAGER.PACKAGES pkg" .
                  " WHERE ".
                  #"         pv.PV_ID = \'$pv_id\' " .
                  "         pd.PV_ID(+) = \'$pv_id\' " .
                  "         AND pd.DPV_ID = pv.PV_ID" .
                  "         AND pv.PKG_ID = pkg.PKG_ID" .
                  "";
$m_sqlstr =~ s~\s+~ ~g;
print "\n\n$m_sqlstr\n";
    my $sth = $RM_DB->prepare($m_sqlstr);
    if ( defined($sth) )
    {
        if ( $sth->execute( ) )
        {
            if ( $sth->rows )
            {
                while ( my @row = $sth->fetchrow_array )
                {
                    print "-- @row\n";
                    $found = 1;
                }
            }
            $sth->finish();
        }
        else
        {
            Error("GetDepends:Execute failure: $m_sqlstr", $sth->errstr() );
        }
    }
    else
    {
        Error("GetDepends:Prepare failure" );
    }

    unless ( $found )
    {
        Warning("No Package Version data for: $pv_id");
    }
}

my %AllBoms;
#-------------------------------------------------------------------------------
# Function        : getBoms
#
# Description     : Get all the os_id's associated with a BOMID
#                   Also get base_env_id's where they exist
#
# Inputs          : $bom_id             - BOM to process
#
# Returns         :
#
sub getBoms
{
    my $foundDetails = 0;
    my (@row);
    Verbose ("getBoms");
    connectDM(\$DM_DB) unless ($DM_DB);

    my $m_sqlstr = "SELECT distinct ".
                        "p.PROJ_ID,".
                        "p.PROJ_NAME".
#                        "br.BRANCH_ID,".
#                        "bm.BOM_ID".
                   " FROM DEPLOYMENT_MANAGER.DM_PROJECTS p, " .
                         "DEPLOYMENT_MANAGER.BRANCHES br, ".
                         "DEPLOYMENT_MANAGER.BOMS bm ".
                   " WHERE p.PROJ_ID = br.PROJ_ID ".
                      "AND br.BRANCH_ID = bm.BRANCH_ID";

    my $sth = $DM_DB->prepare($m_sqlstr);
    if ( defined($sth) )
    {
        if ( $sth->execute( ) )
        {
            if ( $sth->rows )
            {
                while ( @row = $sth->fetchrow_array )
                {
print "$row[0]    # $row[1]\n";
                    $foundDetails = 1;
                }
            }
            $sth->finish();
        }
        else
        {
            Error("getBoms:Execute failure: $m_sqlstr" );
        }
    }
    else
    {
        Error("getBoms:Prepare failure" );
    }

    Error("getBoms:No OS Information Found" ) unless $foundDetails;

#    DebugDumpData("AllBoms", \%AllBoms );
}