Subversion Repositories DevTools

Rev

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

Rev 2548 Rev 2553
Line 350... Line 350...
350
}
350
}
351
 
351
 
352
 
352
 
353
sub getPkgDetailsByPVID
353
sub getPkgDetailsByPVID
354
{
354
{
355
    my ($pv_id) = @_;
355
    my (@plist) = @_;
356
    my (@row);
356
    my (@row);
357
 
357
 
358
    #
358
    #
359
    #   Only do once
359
    #   Only do once
360
    #
360
    #
361
    return if ( exists $Packages{$pv_id}{name} );
361
#    return if ( exists $Packages{$pv_id}{name} );
362
    
362
 
363
    # if we are not or cannot connect then return 0 as we have not found anything
363
    # if we are not or cannot connect then return 0 as we have not found anything
364
    connectRM(\$RM_DB) unless $RM_DB;
364
    connectRM(\$RM_DB) unless $RM_DB;
365
 
365
 
366
    my $m_sqlstr = "SELECT" .
366
    my $m_sqlstr = "SELECT" .
367
                        " pv.PV_ID, ".                                          #[0]
367
                        " pv.PV_ID, ".                                          #[0]
Line 372... Line 372...
372
                        " pv.PKG_ID," .                                         #[5]
372
                        " pv.PKG_ID," .                                         #[5]
373
                        " pv.MODIFIED_STAMP, ".                                 #[6]
373
                        " pv.MODIFIED_STAMP, ".                                 #[6]
374
                        " pv.CREATOR_ID  ".                                     #[7]
374
                        " pv.CREATOR_ID  ".                                     #[7]
375
                   " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv,".
375
                   " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv,".
376
                   "      RELEASE_MANAGER.PACKAGES pkg ".
376
                   "      RELEASE_MANAGER.PACKAGES pkg ".
377
                   " WHERE pv.PV_ID = \'$pv_id\' ".
377
                   " WHERE pv.PKG_ID = pkg.PKG_ID ".
378
                   "   AND pv.PKG_ID = pkg.PKG_ID" ;
378
                   "   AND pv.PV_ID in ( " . join(',', @plist) . "  )" ;
379
    my $sth = $RM_DB->prepare($m_sqlstr);
379
    my $sth = $RM_DB->prepare($m_sqlstr);
380
    if ( defined($sth) )
380
    if ( defined($sth) )
381
    {
381
    {
382
        if ( $sth->execute( ) )
382
        if ( $sth->execute( ) )
383
        {
383
        {
Line 389... Line 389...
389
                {
389
                {
390
                    print join (',',@row), "\n" if ($opt_verbose);
390
                    print join (',',@row), "\n" if ($opt_verbose);
391
 
391
 
392
                    my $pvid = $row[0];
392
                    my $pvid = $row[0];
393
                    $Packages{$pvid}{name} = $row[1];
393
                    $Packages{$pvid}{name} = $row[1];
-
 
394
                    next if ( exists $Packages{$pvid}{version} );
-
 
395
 
394
                    $Packages{$pvid}{version} = $row[2];
396
                    $Packages{$pvid}{version} = $row[2];
395
                    $Packages{$pvid}{locked} = $row[3];
397
                    $Packages{$pvid}{locked} = $row[3];
396
                    $row[4] =~ tr~\\/~/~;
398
                    $row[4] =~ tr~\\/~/~;
397
                    $Packages{$pvid}{vcstag} = $row[4];
399
                    $Packages{$pvid}{vcstag} = $row[4];
398
                    $Packages{$pvid}{pkgid} = $row[5];
400
                    $Packages{$pvid}{pkgid} = $row[5];
Line 476... Line 478...
476
            if ( $sth->rows )
478
            if ( $sth->rows )
477
            {
479
            {
478
#                print "--- Execute ROWS\n";
480
#                print "--- Execute ROWS\n";
479
                while ( @row = $sth->fetchrow_array )
481
                while ( @row = $sth->fetchrow_array )
480
                {
482
                {
-
 
483
                    $count++;
481
                    print join (',',@row), "\n" if ($opt_verbose);
484
                    print join (',',@row), "\n" if ($opt_verbose);
482
                    my $pvid = $row[0];
485
                    my $pvid = $row[0];
483
                    unless ( exists $Packages{$pvid}{name} )
486
                    unless ( exists $Packages{$pvid}{name} )
484
                    {
487
                    {
485
                        $Packages{$pvid}{name} = $row[1];
488
                        $Packages{$pvid}{name} = $row[1];
Line 523... Line 526...
523
                    }
526
                    }
524
 
527
 
525
 
528
 
526
                    if ( $opt_limit )
529
                    if ( $opt_limit )
527
                    {
530
                    {
528
                        last if ( $count++ > $opt_limit );
531
                        last if ( $count > $opt_limit );
529
                    }
532
                    }
530
                }
533
                }
531
            }
534
            }
532
#            print "--- Finish\n";
535
#            print "--- Finish\n";
533
            $sth->finish();
536
            $sth->finish();
Line 539... Line 542...
539
    }
542
    }
540
    else
543
    else
541
    {
544
    {
542
        Error("Prepare failure" );
545
        Error("Prepare failure" );
543
    }
546
    }
-
 
547
 
-
 
548
    Message ("Extract toplevel dependencies: $count rows");
544
}
549
}
545
 
550
 
546
#-------------------------------------------------------------------------------
551
#-------------------------------------------------------------------------------
547
# Function        : GetDepends
552
# Function        : GetDepends
548
#
553
#
549
# Description     :
554
# Description     :
550
#
555
#
551
# Inputs          : $pvid
556
# Inputs          : @plist          - list of pvid's to process
552
#
557
#
553
# Returns         :
558
# Returns         :
554
#
559
#
555
sub GetDepends
560
sub GetDepends
556
{
561
{
557
    my ($pv_id ) = @_;
562
    my (@plist) = @_;
558
 
563
 
559
    #
564
    #
560
    #   Ensure we have package information
565
    #   Ensure we have package information
561
    #
566
    #
562
    getPkgDetailsByPVID( $pv_id );
567
    getPkgDetailsByPVID( @plist );
563
    return if ( $Packages{$pv_id}{depend} );
568
#    return if ( $Packages{$pv_id}{depend} );
564
    $Packages{$pv_id}{depend} = 1;
569
#    $Packages{$pv_id}{depend} = 1;
565
 
570
 
566
    #
571
    #
567
    #   Now extract the package dependacies
572
    #   Now extract the package dependacies
568
    #   There may not be any
573
    #   There may not be any
569
    #
574
    #
570
    my $m_sqlstr = "SELECT ".
575
    my $m_sqlstr = "SELECT ".
571
                    " pd.PV_ID, ".
576
                    " pd.PV_ID, ".
572
                    " pd.DPV_ID " .
577
                    " pd.DPV_ID " .
573
                  " FROM    RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd ".
578
                  " FROM    RELEASE_MANAGER.PACKAGE_DEPENDENCIES pd ".
574
                  " WHERE pd.PV_ID = \'$pv_id\'";
579
                  " WHERE pd.PV_ID in ( " . join(',', @plist) . " )";
575
    my $sth = $RM_DB->prepare($m_sqlstr);
580
    my $sth = $RM_DB->prepare($m_sqlstr);
576
    if ( defined($sth) )
581
    if ( defined($sth) )
577
    {
582
    {
578
        if ( $sth->execute( ) )
583
        if ( $sth->execute( ) )
579
        {
584
        {
Line 892... Line 897...
892
sub LocateStrays
897
sub LocateStrays
893
{
898
{
894
    Message ("Locate indirectly referenced packages");
899
    Message ("Locate indirectly referenced packages");
895
    while ( $#StrayPackages >= 0 )
900
    while ( $#StrayPackages >= 0 )
896
    {
901
    {
-
 
902
#print "Strays Remaining: ", scalar @StrayPackages ,"\n";
-
 
903
 
-
 
904
        my @plist;
-
 
905
        while ( $#plist <= 200 && @StrayPackages )
-
 
906
        {
897
        my $pv_id = pop @StrayPackages;
907
            my $pv_id = pop @StrayPackages;
-
 
908
            next if ( exists $Packages{$pv_id}{done} );
-
 
909
            push @plist, $pv_id;
-
 
910
        }
-
 
911
 
-
 
912
        GetDepends(@plist) if @plist;
898
 
913
 
899
        next if ( exists $Packages{$pv_id}{done} );
914
        foreach ( @plist)
900
#print "... ",$#StrayPackages,"\n";
-
 
901
        GetDepends( $pv_id);
915
        {
902
        $Packages{$pv_id}{done} = 1;
916
            $Packages{$_}{done} = 1;
-
 
917
        }
903
    }
918
    }
904
}
919
}
905
 
920
 
906
#-------------------------------------------------------------------------------
921
#-------------------------------------------------------------------------------
907
# Function        : countPackages
922
# Function        : countPackages