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   : Display the currently released version of ALL packages
#                 that are a part of a given release
#
#                 Detect missing builds for solaris10_sparc32
#
#                 Currently hard coded to Beijing Release-2
#
#                 Saves results in a file.
#
# Usage:
#
# Version   Who      Date        Description
#
#......................................................................#

require 5.006_001;
use strict;
use warnings;
use JatsError;
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 $opt_rtag_id = 5702;     # Beijing Release-1
my $RM_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
                "rtagid=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));

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

Error ("No RTAGID specified") unless ( $opt_rtag_id );

getPkgDetailsByRTAG_ID($opt_rtag_id);
exit;


sub getPkgDetailsByRTAG_ID
{
    my ($RTAG_ID) = @_;
    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 pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.PKG_LABEL, pv.SRC_PATH, pv.BUILD_TYPE" .
                    " FROM RELEASE_CONTENT rc, PACKAGE_VERSIONS pv, PACKAGES pkg" .
                    " WHERE rc.RTAG_ID = $RTAG_ID AND rc.PV_ID = pv.PV_ID AND pv.PKG_ID = pkg.PKG_ID";
    my $sth = $RM_DB->prepare($m_sqlstr);
    if ( defined($sth) )
    {
        if ( $sth->execute( ) )
        {
            if ( $sth->rows )
            {
                while ( @row = $sth->fetchrow_array )
                {
                    my %DATA;
                    $DATA{pv_id}            = $row[0];
                    my $name = $DATA{name}             = $row[1];
                    my $ver = $DATA{version}          = $row[2];
                    my $label =                     $row[3] || '';
                    my $path = $row[4] || '';


                    $path =~ tr~\\/~/~s;
#print "$row[5] --";
#printf ( "%40s %15s %50s %s\n",  $name, $ver, $label, $path);
#printf ( "copy e:\\%s\\%s .\n",  $name, $ver, $label, $path);

                    #
                    #   Construct archive path
                    #
                    my $found;
                    foreach my $var ( 'GBE_DPKG', 'GBE_DPLY' )
                    {
                        my $pkg_dir="$ENV{$var}/${name}/${ver}";
                        if ( -d $pkg_dir )
                        {
                            $found = $pkg_dir;
                            last;
                        }
                    }
                    print "Package Not found: $name $ver\n" unless $found;
                    if ( $found )
                    {
                        if ( -f "$found/built.solaris10_x86" )
                        {
                            print "Build not found: $name $ver, $label\n" unless -f "$found/built.solaris10_sparc32";
                        }
                    }

                }

            }
            $sth->finish();
        }
    }
    else
    {
        Error("Prepare failure" );
    }
}