Rev 5710 | Blame | Compare with Previous | Last modification | View Log | RSS feed
#! perl######################################################################### COPYRIGHT - VIX IP PTY LTD ("VIX"). ALL RIGHTS RESERVED.## Module name : jats.sh# Module type : Makefile system# Compiler(s) : n/a# Environment(s): jats## Description : Determine all packages (where version end in .mas)##......................................................................#require 5.006_001;use strict;use warnings;use JatsError;use JatsSystem;use Getopt::Long;use Pod::Usage; # required for help supportuse JatsRmApi;use DBI;my $VERSION = "1.2.3"; # Update thismy $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));ErrorConfig( 'name' =>'PLAY18b' );getPkgDetails();foreach my $name ( sort keys %Package ){# print "$name ($Package{$name})\n";print "$name\n";}#DebugDumpData ("Package", \%Package );exit;sub getPkgDetails{my $foundDetails = 0;my (@row);# Connect to the databaseconnectRM( \$RM_DB)unless $RM_DB;# First get details from pv_idmy $m_sqlstr = "SELECT DISTINCT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.PKG_LABEL, pv.SRC_PATH" ." FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg" ." WHERE pv.PKG_VERSION like '%.mas' 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 $pv_id = $row[0];my $name = $row[1];my $ver = $row[2];my $label = $row[3] || '';my $path = $row[4] || '';$Package{$name}++;$path =~ tr~\\/~/~s;#print "$name, $ver\n";}}else{Error("No Data" );}$sth->finish();}else{Error ("May be an execute error", $m_sqlstr, $sth->errstr());}}else{Error("Prepare failure" );}}