Subversion Repositories DevTools

Rev

Rev 331 | Rev 359 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 331 Rev 351
Line 276... Line 276...
276
#foreach my $name ( sort keys %Package )
276
#foreach my $name ( sort keys %Package )
277
#{
277
#{
278
#    foreach my $ver ( sort keys %{$Package{$name}} )
278
#    foreach my $ver ( sort keys %{$Package{$name}} )
279
#    {
279
#    {
280
#
280
#
281
#        my $label = $Package{$name}{$ver}{label} || '';
-
 
282
#        my $path = $Package{$name}{$ver}{path} || '';
281
#        my $tag = $Package{$name}{$ver}{vcstag} || '';
283
#
282
#
284
#        printf ("%30s %15s %45s %s\n", $name, $ver, $label, $path );
283
#        printf ("%30s %15s %s\n", $name, $ver, $tag );
285
#    }
284
#    }
286
#}
285
#}
287
 
286
 
288
#
287
#
289
#   Generate output files
288
#   Generate output files
Line 303... Line 302...
303
foreach my $name ( sort keys %Package )
302
foreach my $name ( sort keys %Package )
304
{
303
{
305
    foreach my $ver ( sort keys %{$Package{$name}} )
304
    foreach my $ver ( sort keys %{$Package{$name}} )
306
    {
305
    {
307
 
306
 
308
        my $label = $Package{$name}{$ver}{label} || '';
-
 
309
        my $path = $Package{$name}{$ver}{path} || '';
307
        my $vcstag = $Package{$name}{$ver}{vcstag};
310
        my $mtest = exists ($Package{$name}{$ver}{build} ) || '0';
308
        my $mtest = exists ($Package{$name}{$ver}{build} ) || '0';
311
        my @reason1;            # can't extract files
309
        my @reason1;            # can't extract files
312
        my @reason2;            # Others
310
        my @reason2;            # Others
-
 
311
        push @reason1, 'No VCS Info' unless ( $vcstag );
-
 
312
        if ( $vcstag =~ m~^CC::(.*?)(::(.+))?$~ )
313
 
313
        {
-
 
314
            my $path = $1;
-
 
315
            my $label = $2;
314
        push @reason1, 'No Label' unless ( $label );
316
            push @reason1, 'No Label' unless ( $label );
315
        push @reason1, 'Bad Label, N/A' if ( $label =~ s~^N/A$~~i || $label  =~ s~^na$~~i );
317
            push @reason1, 'Bad Label, N/A' if ( $label =~ s~^N/A$~~i || $label  =~ s~^na$~~i );
316
 
318
 
317
        push @reason1, 'No Source Path' unless ( $path );
319
            push @reason1, 'No Source Path' unless ( $path );
318
        push @reason1, 'Bad Path, N/A' if ( $path =~ m~^N/A$~i || $path  =~ m~^na$~i );
320
            push @reason1, 'Bad Path, N/A' if ( $path =~ m~^N/A$~i || $path  =~ m~^na$~i );
319
        push @reason1, 'Bad Path, dpkg' if ( $path =~ m~^/dpkg_archive~ || $path  =~ m~^dpkg_archive~ );
321
            push @reason1, 'Bad Path, dpkg' if ( $path =~ m~^/dpkg_archive~ || $path  =~ m~^dpkg_archive~ );
320
        push @reason1, 'Bad Path, http' if ( $path =~ m~^http:~i );
322
            push @reason1, 'Bad Path, http' if ( $path =~ m~^http:~i );
321
        push @reason1, 'Bad Path, Drive' if ( $path =~ m~^[A-Za-z]\:~ );
323
            push @reason1, 'Bad Path, Drive' if ( $path =~ m~^[A-Za-z]\:~ );
322
        push @reason1, 'Bad Path, UNC' if ( $path =~ m~^//~ );
324
            push @reason1, 'Bad Path, UNC' if ( $path =~ m~^//~ );
323
        push @reason1, 'Bad Path, Relative' unless ( $path =~ m~^/~ );
325
            push @reason1, 'Bad Path, Relative' unless ( $path =~ m~^/~ );
-
 
326
        }
324
 
327
 
325
 
328
 
326
        push @reason2, 'No Build System' unless ( exists ($Package{$name}{$ver}{build} ) );
329
        push @reason2, 'No Build System' unless ( exists ($Package{$name}{$ver}{build} ) );
327
 
330
 
328
        unless ( @reason1 )
331
        unless ( @reason1 )
329
        {
332
        {
330
            my $vname = "$name $ver";
333
            my $vname = "$name $ver";
331
            $vname =~ s~ ~_~g;
334
            $vname =~ s~ ~_~g;
332
            $vname =~ s~__~~g;
335
            $vname =~ s~__~~g;
333
 
336
 
334
            print JE "jats extract -extractfiles \"-view=$vname\" \"-label=$label\" \"-path=$path\" -root=. -noprefix\n";
337
            print JE "jats jats_vcsrelease -extractfiles \"-view=$vname\" \"-label=$vcstag\" -root=. -noprefix\n";
335
        }
338
        }
336
 
339
 
337
        if ( @reason1 || @reason2 )
340
        if ( @reason1 || @reason2 )
338
        {
341
        {
339
            $Package{$name}{$ver}{bad_extract} = [@reason1, @reason2];
342
            $Package{$name}{$ver}{bad_extract} = [@reason1, @reason2];
340
            printf ST "%40s %20s %50s (%s) %s\n", $name, $ver, $label, $mtest, $path ;
343
            printf ST "%40s %20s (%s) %s\n", $name, $ver, $mtest, $vcstag ;
341
        }
344
        }
342
    }
345
    }
343
}
346
}
344
 
347
 
345
close (JE);
348
close (JE);
Line 477... Line 480...
477
 
480
 
478
#-------------------------------------------------------------------------------
481
#-------------------------------------------------------------------------------
479
# Function        : getOSIDforBOMID
482
# Function        : getOSIDforBOMID
480
#
483
#
481
# Description     : Get all the os_id's associated with a BOMID
484
# Description     : Get all the os_id's associated with a BOMID
-
 
485
#                   Also get base_env_id's where they exist
482
#
486
#
483
# Inputs          : $bom_id             - BOM to process
487
# Inputs          : $bom_id             - BOM to process
484
#
488
#
485
# Returns         :
489
# Returns         :
486
#
490
#
Line 488... Line 492...
488
sub getOSIDforBOMID
492
sub getOSIDforBOMID
489
{
493
{
490
    my ($bom_id) = @_;
494
    my ($bom_id) = @_;
491
    my $foundDetails = 0;
495
    my $foundDetails = 0;
492
    my (@row);
496
    my (@row);
493
Verbose ("getOSIDforBOMID");
497
    Verbose ("getOSIDforBOMID");
494
    connectDM(\$DM_DB) unless ($DM_DB);
498
    connectDM(\$DM_DB) unless ($DM_DB);
495
 
499
 
496
    my $m_sqlstr = "SELECT distinct os.OS_ID, os.OS_NAME, nn.NODE_NAME, obe.BASE_ENV_ID " .
500
    my $m_sqlstr = "SELECT distinct os.OS_ID, os.OS_NAME, nn.NODE_NAME, obe.BASE_ENV_ID " .
497
                   " FROM DEPLOYMENT_MANAGER.OPERATING_SYSTEMS os, DEPLOYMENT_MANAGER.BOM_CONTENTS bc, DEPLOYMENT_MANAGER.NETWORK_NODES nn, DEPLOYMENT_MANAGER.OS_BASE_ENV obe" .
501
                   " FROM DEPLOYMENT_MANAGER.OPERATING_SYSTEMS os, " .
-
 
502
                         "DEPLOYMENT_MANAGER.BOM_CONTENTS bc, ".
-
 
503
                         "DEPLOYMENT_MANAGER.NETWORK_NODES nn, ".
-
 
504
                         "DEPLOYMENT_MANAGER.OS_BASE_ENV obe" .
-
 
505
                   " WHERE bc.BOM_ID = $bom_id ".
-
 
506
                      "AND bc.NODE_ID = os.NODE_ID ".
498
                   " WHERE bc.BOM_ID = $bom_id AND bc.NODE_ID = os.NODE_ID AND nn.NODE_ID = os.NODE_ID AND obe.OS_ID = os.OS_ID ";
507
                      "AND nn.NODE_ID = os.NODE_ID ".
-
 
508
                      "AND obe.OS_ID (+) = os.OS_ID ";
499
 
509
 
500
    my $sth = $DM_DB->prepare($m_sqlstr);
510
    my $sth = $DM_DB->prepare($m_sqlstr);
501
    if ( defined($sth) )
511
    if ( defined($sth) )
502
    {
512
    {
503
        if ( $sth->execute( ) )
513
        if ( $sth->execute( ) )
Line 508... Line 518...
508
                {
518
                {
509
                    Verbose ("OS_ID: ".join (',',@row) );
519
                    Verbose ("OS_ID: ".join (',',@row) );
510
                    $os_id_list{$row[0]}{os_name} = $row[1];
520
                    $os_id_list{$row[0]}{os_name} = $row[1];
511
                    $os_id_list{$row[0]}{node_name} = $row[2];
521
                    $os_id_list{$row[0]}{node_name} = $row[2];
512
 
522
 
-
 
523
                    if ( defined $row[3] )
-
 
524
                    {
513
                    $os_env_list{$row[3]}{needed} = 1;
525
                        $os_env_list{$row[3]}{needed} = 1;
514
                    $os_env_list{$row[3]}{os_id}{$row[0]} = 1;
526
                        $os_env_list{$row[3]}{os_id}{$row[0]} = 1;
-
 
527
                    }
515
 
528
 
516
                    $foundDetails = 1;
529
                    $foundDetails = 1;
517
                }
530
                }
518
            }
531
            }
519
            $sth->finish();
532
            $sth->finish();
Line 674... Line 687...
674
 
687
 
675
    connectRM(\$RM_DB) unless ($RM_DB);
688
    connectRM(\$RM_DB) unless ($RM_DB);
676
 
689
 
677
    # First get details from pv_id
690
    # First get details from pv_id
678
 
691
 
679
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.PKG_LABEL, pv.SRC_PATH, pv.IS_DEPLOYABLE, pbi.BSA_ID, pbi.BM_ID, PV_DESCRIPTION" .
692
    my $m_sqlstr = "SELECT pv.PV_ID, pkg.PKG_NAME, pv.PKG_VERSION, pv.IS_DEPLOYABLE, pbi.BSA_ID, pbi.BM_ID, PV_DESCRIPTION, release_manager.PK_RMAPI.return_vcs_tag($PV_ID)" .
680
                    " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg, RELEASE_MANAGER.PACKAGE_BUILD_INFO pbi" .
693
                    " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv, RELEASE_MANAGER.PACKAGES pkg, RELEASE_MANAGER.PACKAGE_BUILD_INFO pbi" .
681
                    " WHERE pv.PV_ID = \'$PV_ID\' AND pv.PKG_ID = pkg.PKG_ID AND pv.PV_ID = pbi.PV_ID (+) ";
694
                    " WHERE pv.PV_ID = \'$PV_ID\' AND pv.PKG_ID = pkg.PKG_ID AND pv.PV_ID = pbi.PV_ID (+) ";
682
 
695
 
683
    my $sth = $RM_DB->prepare($m_sqlstr);
696
    my $sth = $RM_DB->prepare($m_sqlstr);
684
    if ( defined($sth) )
697
    if ( defined($sth) )
Line 690... Line 703...
690
                while ( @row = $sth->fetchrow_array )
703
                while ( @row = $sth->fetchrow_array )
691
                {
704
                {
692
                    my $pv_id       = $row[0];
705
                    my $pv_id       = $row[0];
693
                    my $name        = $row[1];
706
                    my $name        = $row[1];
694
                    my $ver         = $row[2];
707
                    my $ver         = $row[2];
695
                    my $label       = $row[3] || '';
708
                    my $deployable  = $row[3];
696
                    my $path        = $row[4] || '';
709
                    my $build_info  = $row[4] || '';
697
                    my $deployable  = $row[5];
-
 
698
                    my $build_info  = $row[6] || '';
710
                    my $build_mach  = $row[5] || '';
699
                    my $build_mach  = $row[7] || '';
711
                    my $description = $row[6] || '';
700
                    my $description = $row[8] || '';
712
                    my $vcstag      = $row[7] || '';
701
 
713
 
702
                    #
714
                    #
703
                    #   BSA_ID: 1:debug, 2:prod, 3:debug+prod, 4:Java1.4 5: Java 1.5
715
                    #   BSA_ID: 1:debug, 2:prod, 3:debug+prod, 4:Java1.4 5: Java 1.5
704
                    #   BM_ID : 1:solaris, 2:win32, 3: linux, 4:generic
716
                    #   BM_ID : 1:solaris, 2:win32, 3: linux, 4:generic
705
                    #
717
                    #
Line 729... Line 741...
729
                        Verbose2( "    Ignoring: $PV_ID, $name, $ver, $build_mach ,$build_info, $patch\n");
741
                        Verbose2( "    Ignoring: $PV_ID, $name, $ver, $build_mach ,$build_info, $patch\n");
730
                        $ignore{$name}++;
742
                        $ignore{$name}++;
731
                        last;
743
                        last;
732
                    }
744
                    }
733
 
745
 
734
                    $path =~ tr~\\/~/~;
746
                    $vcstag =~ tr~\\/~/~;
735
 
747
 
736
                    $Package{$name}{$ver}{pvid} = $PV_ID;
748
                    $Package{$name}{$ver}{pvid} = $PV_ID;
737
                    $Package{$name}{$ver}{done} = 1;
749
                    $Package{$name}{$ver}{done} = 1;
738
                    $Package{$name}{$ver}{base} = 1;
750
                    $Package{$name}{$ver}{base} = 1;
739
                    $Package{$name}{$ver}{deployable} = 1 if ($deployable);
751
                    $Package{$name}{$ver}{deployable} = 1 if ($deployable);
740
                    $Package{$name}{$ver}{label} = $label;
-
 
741
                    $Package{$name}{$ver}{path} = $path;
-
 
742
                    $Package{$name}{$ver}{build}{$build_mach} = $build_info if $build_mach;
752
                    $Package{$name}{$ver}{build}{$build_mach} = $build_info if $build_mach;
743
                    $Package{$name}{$ver}{description} = $description;
753
                    $Package{$name}{$ver}{description} = $description;
-
 
754
                    $Package{$name}{$ver}{vcstag} = $vcstag;
744
 
755
 
745
                    GetDepends( $pv_id, $name, $ver );
756
                    GetDepends( $pv_id, $name, $ver );
746
 
757
 
747
                }
758
                }
748
            }
759
            }
Line 1062... Line 1073...
1062
        foreach my $build ( @build )
1073
        foreach my $build ( @build )
1063
        {
1074
        {
1064
            $more = 1;
1075
            $more = 1;
1065
            delete $BuildList{$build};
1076
            delete $BuildList{$build};
1066
            my ($name, $ver) = split $;, $build;
1077
            my ($name, $ver) = split $;, $build;
1067
 
-
 
1068
            my $label = $Package{$name}{$ver}{label} || '';
-
 
1069
            my $path  = $Package{$name}{$ver}{path} || '';
1078
            my $vcstag = $Package{$name}{$ver}{vcstag} || '';
1070
            $Package{$name}{$ver}{buildorder}  = $level;
1079
            $Package{$name}{$ver}{buildorder}  = $level;
1071
 
1080
 
1072
            printf BI "Build(%2d): %40s %15s %-55s %s\n", $level, $name, $ver, $label, $path;
1081
            printf BI "Build(%2d): %40s %15s %s\n", $level, $name, $ver, $vcstag;
1073
        }
1082
        }
1074
 
1083
 
1075
        #
1084
        #
1076
        #   Delete dependencies
1085
        #   Delete dependencies
1077
        #
1086
        #
Line 1252... Line 1261...
1252
            my $pv_id_ref = $rm_base . $pv_id;
1261
            my $pv_id_ref = $rm_base . $pv_id;
1253
               $pv_id_ref .= "&rtag_id=" . $opt_rtag_id if ($opt_rtag_id && !$stray);
1262
               $pv_id_ref .= "&rtag_id=" . $opt_rtag_id if ($opt_rtag_id && !$stray);
1254
            my $pv_id_str = "<a href=\"$pv_id_ref\" TARGET=\"_blank\">$pv_id</a>";
1263
            my $pv_id_str = "<a href=\"$pv_id_ref\" TARGET=\"_blank\">$pv_id</a>";
1255
 
1264
 
1256
            printf DP "<tr>${tdr}Pvid:</td><td>%s</td></tr>\n", $pv_id_str;
1265
            printf DP "<tr>${tdr}Pvid:</td><td>%s</td></tr>\n", $pv_id_str;
1257
            printf DP "<tr>${tdr}Label:</td><td>%s</td></tr>\n", $Package{$name}{$ver}{label} || 'NoneProvided';
1266
            printf DP "<tr>${tdr}VcsTag:</td><td>%s</td></tr>\n", $Package{$name}{$ver}{vcstag} || 'NoneProvided';
1258
            printf DP "<tr>${tdr}Path:</td><td>%s</td></tr>\n", $Package{$name}{$ver}{path}  || 'NoneProvided';
-
 
1259
 
1267
 
1260
            my $order = 'Not Built';
1268
            my $order = 'Not Built';
1261
            my @machs;
1269
            my @machs;
1262
 
1270
 
1263
            if ( exists($Package{$name}{$ver}{build}) )
1271
            if ( exists($Package{$name}{$ver}{build}) )
Line 1807... Line 1815...
1807
    {
1815
    {
1808
        s~[\r\n]+$~~;
1816
        s~[\r\n]+$~~;
1809
        Verbose2 ($_);
1817
        Verbose2 ($_);
1810
        next unless ( $_ );
1818
        next unless ( $_ );
1811
 
1819
 
1812
        my ($view, $label, $path);
1820
        my ($view, $vcstag);
1813
        if ( m{(\s"-view=([^"]+)")|(\s-view=(\S+))} )
1821
        if ( m{(\s"-view=([^"]+)")|(\s-view=(\S+))} )
1814
        {
1822
        {
1815
            $view = $2 || $4;
1823
            $view = $2 || $4;
1816
        }
1824
        }
1817
 
1825
 
1818
        if ( m{(\s"-label=([^"]+)")|(\s-label=(\S+))} )
1826
        if ( m{(\s"-label=([^"]+)")|(\s-label=(\S+))} )
1819
        {
1827
        {
1820
            $label = $2 || $4;
1828
            $vcstag = $2 || $4;
1821
        }
1829
        }
1822
 
1830
 
1823
        if ( m{(\s"-path=([^"]+)")|(\s-path=(\S+))} )
-
 
1824
        {
-
 
1825
            $path = $2 || $4;
-
 
1826
        }
-
 
1827
 
1831
 
1828
        Error "Bad file format in line: $_" unless ( $view && $label );
1832
        Error "Bad file format in line: $_" unless ( $view && $vcstag );
1829
        Error "Duplicate view name: $view" if ( exists $extract{$view} );
1833
        Error "Duplicate view name: $view" if ( exists $extract{$view} );
1830
        push @extract_order, $view;
1834
        push @extract_order, $view;
1831
        $extract{$view}{label} = $label;
-
 
1832
        $extract{$view}{path} = $path;
1835
        $extract{$view}{vcstag} = $vcstag;
1833
    }
1836
    }
1834
    close FH;
1837
    close FH;
1835
 
1838
 
1836
    #
1839
    #
1837
    #   Log the file processing
1840
    #   Log the file processing
Line 1843... Line 1846...
1843
    #
1846
    #
1844
    #   Process each entry
1847
    #   Process each entry
1845
    #
1848
    #
1846
    foreach my $view ( @extract_order )
1849
    foreach my $view ( @extract_order )
1847
    {
1850
    {
1848
        my $label = $extract{$view}{label};
-
 
1849
        my $path = $extract{$view}{path};
1851
        my $vcstag = $extract{$view}{vcstag};
1850
        if ( $opt_test )
1852
        if ( $opt_test )
1851
        {
1853
        {
1852
            Verbose ("view($view) label($label) path($path)");
1854
            Verbose ("view($view) vcstag($vcstag)");
1853
            print FH "view($view) label($label) path($path) : TEST\n";
1855
            print FH "view($view) vcstag($vcstag) : TEST\n";
1854
        }
1856
        }
1855
        else
1857
        else
1856
        {
1858
        {
1857
            my $rv = JatsCmd ('extract', '-extractfiles', "-view=$view", "-label=$label", "-path=$path", "-root=.", "-noprefix");
1859
            my $rv = JatsCmd ('jats_vcsrelease', '-extractfiles', "-view=$view", "-label=$vcstag", "-root=.", "-noprefix");
1858
            print FH "$view : SUCCESS\n" unless $rv;
1860
            print FH "$view : SUCCESS\n" unless $rv;
1859
            print FH "$view : ERROR\n" if $rv;
1861
            print FH "$view : ERROR\n" if $rv;
1860
        }
1862
        }
1861
    }
1863
    }
1862
    close FH;
1864
    close FH;