Subversion Repositories DevTools

Rev

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

Rev 2553 Rev 2635
Line 180... Line 180...
180
my ($pcount, $vcount) = countPackages();
180
my ($pcount, $vcount) = countPackages();
181
print "Directly referenced Packages: $pcount Versions: $vcount\n";
181
print "Directly referenced Packages: $pcount Versions: $vcount\n";
182
LocateStrays() unless ($opt_quick);
182
LocateStrays() unless ($opt_quick);
183
($pcount, $vcount) = countPackages();
183
($pcount, $vcount) = countPackages();
184
print "Indirectly referenced Packages: $pcount Versions: $vcount\n";
184
print "Indirectly referenced Packages: $pcount Versions: $vcount\n";
-
 
185
getSourcePaths();
185
processData();
186
processData();
186
outputData();
187
outputData();
187
 
188
 
188
if ( $opt_verbose > 1 )
189
if ( $opt_verbose > 1 )
189
{
190
{
Line 388... Line 389...
388
                while ( @row = $sth->fetchrow_array )
389
                while ( @row = $sth->fetchrow_array )
389
                {
390
                {
390
                    print join (',',@row), "\n" if ($opt_verbose);
391
                    print join (',',@row), "\n" if ($opt_verbose);
391
 
392
 
392
                    my $pvid = $row[0];
393
                    my $pvid = $row[0];
-
 
394
                    my $pkgid = $row[5];
393
                    $Packages{$pvid}{name} = $row[1];
395
                    $Packages{$pvid}{name} = $row[1];
394
                    next if ( exists $Packages{$pvid}{version} );
396
                    next if ( exists $Packages{$pvid}{version} );
395
 
397
 
396
                    $Packages{$pvid}{version} = $row[2];
398
                    $Packages{$pvid}{version} = $row[2];
397
                    $Packages{$pvid}{locked} = $row[3];
399
                    $Packages{$pvid}{locked} = $row[3];
398
                    $row[4] =~ tr~\\/~/~;
400
                    $row[4] =~ tr~\\/~/~;
399
                    $Packages{$pvid}{vcstag} = $row[4];
401
                    $Packages{$pvid}{vcstag} = $row[4];
400
                    $Packages{$pvid}{pkgid} = $row[5];
402
                    $Packages{$pvid}{pkgid} = $pkgid;
401
#                    $Packages{$pvid}{tlp} = 1;
403
#                    $Packages{$pvid}{tlp} = 1;
402
                    ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version}, $Packages{$pvid}{name} );
404
                    ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version}, $Packages{$pvid}{name} );
403
                    $Suffixes{$Packages{$pvid}{suffix}}++;
405
                    $Suffixes{$Packages{$pvid}{suffix}}++;
404
                    $Packages{$pvid}{Age} = ($now - str2time( $row[6] )) / (60 * 60 * 24);
406
                    $Packages{$pvid}{Age} = ($now - str2time( $row[6] )) / (60 * 60 * 24);
405
                    $Packages{$pvid}{Creator} = $row[7];
407
                    $Packages{$pvid}{Creator} = $row[7];
-
 
408
 
-
 
409
                    $AllPackages{$pkgid}{essential} = 1;
406
                }
410
                }
407
            }
411
            }
408
#            print "--- Finish\n";
412
#            print "--- Finish\n";
409
            $sth->finish();
413
            $sth->finish();
410
        }
414
        }
Line 483... Line 487...
483
                    $count++;
487
                    $count++;
484
                    print join (',',@row), "\n" if ($opt_verbose);
488
                    print join (',',@row), "\n" if ($opt_verbose);
485
                    my $pvid = $row[0];
489
                    my $pvid = $row[0];
486
                    unless ( exists $Packages{$pvid}{name} )
490
                    unless ( exists $Packages{$pvid}{name} )
487
                    {
491
                    {
-
 
492
                        my $pkgid = $row[5];
488
                        $Packages{$pvid}{name} = $row[1];
493
                        $Packages{$pvid}{name} = $row[1];
489
                        $Packages{$pvid}{version} = $row[2];
494
                        $Packages{$pvid}{version} = $row[2];
490
                        $Packages{$pvid}{locked} = $row[3];
495
                        $Packages{$pvid}{locked} = $row[3];
491
                        $row[4] =~ tr~\\/~/~;
496
                        $row[4] =~ tr~\\/~/~;
492
                        $Packages{$pvid}{vcstag} = $row[4];
497
                        $Packages{$pvid}{vcstag} = $row[4];
493
                        $Packages{$pvid}{pkgid} = $row[5];
498
                        $Packages{$pvid}{pkgid} = $pkgid;
494
                        $Packages{$pvid}{tlp} = 1;
499
                        $Packages{$pvid}{tlp} = 1;
495
                        ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version}, $Packages{$pvid}{name} );
500
                        ($Packages{$pvid}{suffix}, $Packages{$pvid}{fullVersion},$Packages{$pvid}{isaRipple} ) = massageVersion( $Packages{$pvid}{version}, $Packages{$pvid}{name} );
496
                        $Suffixes{$Packages{$pvid}{suffix}}++;
501
                        $Suffixes{$Packages{$pvid}{suffix}}++;
-
 
502
                        $AllPackages{$pkgid}{essential} = 1;
497
 
503
 
498
                        push @StrayPackages, $pvid;
504
                        push @StrayPackages, $pvid;
499
                    }
505
                    }
500
 
506
 
501
                    my $rtag_id = $row[6];
507
                    my $rtag_id = $row[6];
Line 650... Line 656...
650
    {
656
    {
651
        Error("GetAllPackageNames:Prepare failure" );
657
        Error("GetAllPackageNames:Prepare failure" );
652
    }
658
    }
653
}
659
}
654
 
660
 
-
 
661
#-------------------------------------------------------------------------------
-
 
662
# Function        : getSourcePaths
-
 
663
#
-
 
664
# Description     : Get source paths for all packages
-
 
665
#                   Really only want those not in SVN
-
 
666
#
-
 
667
# Inputs          : Globals
-
 
668
#
-
 
669
# Returns         : Globals
-
 
670
#
-
 
671
sub getSourcePaths
-
 
672
{
-
 
673
    Message("Get source paths for all packages");
-
 
674
    # if we are not or cannot connect then return 0 as we have not found anything
-
 
675
    connectRM(\$RM_DB) unless $RM_DB;
-
 
676
 
-
 
677
    #
-
 
678
    #   Process on blocks for speed
-
 
679
    #
-
 
680
    my @needed;
-
 
681
    foreach my $pkgid ( keys %AllPackages, 0 )
-
 
682
    {
-
 
683
        if ( $pkgid )
-
 
684
        {
-
 
685
            next unless ( exists $AllPackages{$pkgid}{essential} );
-
 
686
            next if ( $AllPackages{$pkgid}{inSvn} );
-
 
687
            $AllPackages{$pkgid}{essential} = 2;
-
 
688
            push @needed, $pkgid;
-
 
689
#print "= $pkgid, $AllPackages{$pkgid}{name}\n";
-
 
690
        }
-
 
691
 
-
 
692
        #
-
 
693
        #   Have enough for a query
-
 
694
        #
-
 
695
        if ( scalar @needed > 100 || ! $pkgid )
-
 
696
        {
-
 
697
            #
-
 
698
            #   Now extract all the source paths
-
 
699
            #
-
 
700
            my $m_sqlstr = "SELECT UNIQUE" .
-
 
701
                        " pv.PKG_ID, ".                                     #[0]
-
 
702
                        " pv.SRC_PATH, ".                                   #[1]
-
 
703
                        " pv.VCS_TYPE_ID ".                                 #[2]
-
 
704
                        " FROM RELEASE_MANAGER.PACKAGE_VERSIONS pv".
-
 
705
                        " WHERE pv.PKG_ID in (" . join(',', @needed) . ")";
-
 
706
 
-
 
707
            my $sth = $RM_DB->prepare($m_sqlstr);
-
 
708
            if ( defined($sth) )
-
 
709
            {
-
 
710
                if ( $sth->execute( ) )
-
 
711
                {
-
 
712
                    if ( $sth->rows )
-
 
713
                    {
-
 
714
                        while ( my @row = $sth->fetchrow_array )
-
 
715
                        {
-
 
716
#print "--- @row\n";
-
 
717
                            my $pkgid = $row[0];
-
 
718
                            my $type = $row[2] || '2';
-
 
719
                            if ( $row[1] )
-
 
720
                            {
-
 
721
                                #
-
 
722
                                #   Trivial cleanup
-
 
723
                                #
-
 
724
                                my $path = '/' . $row[1];   # Force initial /
-
 
725
                                $path =~ tr~\\/~/~s;        # Force / and single /
-
 
726
                                $path =~ s~/+$~~;           # Remove Trailing /
-
 
727
                                $AllPackages{$pkgid}{srcPath}{$path}++;
-
 
728
                            }
-
 
729
                        }
-
 
730
                    }
-
 
731
                    $sth->finish();
-
 
732
                }
-
 
733
                else
-
 
734
                {
-
 
735
                Error("getSourcePaths:Execute failure" );
-
 
736
                }
-
 
737
            }
-
 
738
            else
-
 
739
            {
-
 
740
                Error("getSourcePaths:Prepare failure" );
-
 
741
            }
-
 
742
 
-
 
743
            #
-
 
744
            #   Reset the list
-
 
745
            #
-
 
746
            @needed = ();
-
 
747
        }
-
 
748
    }
-
 
749
}
-
 
750
 
655
 
751
 
656
#-------------------------------------------------------------------------------
752
#-------------------------------------------------------------------------------
657
# Function        : massageVersion
753
# Function        : massageVersion
658
#
754
#
659
# Description     : Process a version number and return usful bits
755
# Description     : Process a version number and return usful bits