Subversion Repositories DevTools

Rev

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

Rev 2393 Rev 2401
Line 272... Line 272...
272
my $rippleCount = 0;
272
my $rippleCount = 0;
273
my $svnRepo;
273
my $svnRepo;
274
my $processCount = 0;
274
my $processCount = 0;
275
my $processTotal = 0;
275
my $processTotal = 0;
276
my $recentCount = 0;
276
my $recentCount = 0;
-
 
277
my $packageReLabelCount = 0;
277
 
278
 
278
our $GBE_RM_URL;
279
our $GBE_RM_URL;
279
my $UNIX = $ENV{'GBE_UNIX'};
280
my $UNIX = $ENV{'GBE_UNIX'};
280
 
281
 
281
my $result = GetOptions (
282
my $result = GetOptions (
Line 1790... Line 1791...
1790
 
1791
 
1791
    #
1792
    #
1792
    #   Create CC view
1793
    #   Create CC view
1793
    #   Import into Subversion View
1794
    #   Import into Subversion View
1794
    #
1795
    #
1795
    $data->{ViewRoot} = $opt_name ? $opt_name : "$cc_label";
1796
    $rv = extractFilesFromClearCase( $data, $cc_path, $cc_label );
1796
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
-
 
1797
 
-
 
1798
    if ( $opt_preserveProjectBase )
-
 
1799
    {
-
 
1800
        my $cc_vob = $cc_path;
-
 
1801
        $cc_vob =~ s~^/~~;
-
 
1802
        $cc_vob =~ s~/.*~~;
-
 
1803
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
-
 
1804
        Message ("Preserving Project Base");
-
 
1805
    }
-
 
1806
    $data->{ViewPath} =~  tr~/~/~s;
-
 
1807
 
-
 
1808
    if ( $opt_reuse && -d $data->{ViewPath}  )
-
 
1809
    {
-
 
1810
        Message ("Reusing view: $cc_label");
-
 
1811
    }
-
 
1812
    else
-
 
1813
    {
-
 
1814
        my @args;
-
 
1815
        push (@args, '-view', $opt_name ) if ( defined $opt_name );
-
 
1816
        $rv = JatsToolPrint ( 'jats_ccrelease', '-extractfiles', '-root=.' , '-noprefix',
-
 
1817
                    "-label=$cc_label" ,
-
 
1818
                    "-path=$cc_path",
-
 
1819
                    @args
-
 
1820
                    );
1797
    return $rv if ( $rv );
1821
 
-
 
1822
        if ( $rv == 10 ) {
-
 
1823
            $data->{errStr} = 'No Files in the extracted view';
-
 
1824
            $data->{errCode} = '0';
-
 
1825
            return 2;
-
 
1826
        }
-
 
1827
        elsif ( $rv == 11 ) {
-
 
1828
            $data->{errStr} = 'Label not found';
-
 
1829
            $data->{errCode} = 'L';
-
 
1830
            return 2;
-
 
1831
        }
-
 
1832
 
-
 
1833
        unless ( -d $data->{ViewPath}  )
-
 
1834
        {
-
 
1835
            $data->{errStr} = 'Failed to extract files from CC';
-
 
1836
            return 2;
-
 
1837
        }
-
 
1838
    }
-
 
1839
 
-
 
1840
 
1798
 
1841
    #
1799
    #
1842
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1800
    #   Some really ugly packages make use of a Jats feature called 'SetProjectBase'
1843
    #   Detect such packages as we will need to handle them differently
1801
    #   Detect such packages as we will need to handle them differently
1844
    #   Can't really handle it on the fly
1802
    #   Can't really handle it on the fly
Line 2356... Line 2314...
2356
    {
2314
    {
2357
        next if ( $versions{$entry}{Scanned} );
2315
        next if ( $versions{$entry}{Scanned} );
2358
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2316
        Warning ("(E) INTERNAL ERROR. Package Not Processed: " . GetVname($entry) );
2359
    }
2317
    }
2360
 
2318
 
-
 
2319
    Message ("Packages Relabled: $packageReLabelCount") if ( $packageReLabelCount );
2361
    Message ("All Done");
2320
    Message ("All Done");
2362
}
2321
}
2363
 
2322
 
2364
#-------------------------------------------------------------------------------
2323
#-------------------------------------------------------------------------------
-
 
2324
# Function        : extractFilesFromClearCase
-
 
2325
#
-
 
2326
# Description     : Extract files from ClearCase
-
 
2327
#                   May take a while as we handle nasty errors
-
 
2328
#
-
 
2329
# Inputs          : $data           - Hash of good stuff from newPackageVersionBody
-
 
2330
#                   $cc_path
-
 
2331
#                   $cc_label
-
 
2332
#
-
 
2333
# Returns         : exit code
-
 
2334
#                   Sets up
-
 
2335
#                       $data->{errStr}
-
 
2336
#                       $data->{errCode}
-
 
2337
#                   As per newPackageVersionBody
-
 
2338
#
-
 
2339
sub extractFilesFromClearCase
-
 
2340
{
-
 
2341
    my ($data, $cc_path, $cc_label) = @_;
-
 
2342
    my $tryCount = 0;
-
 
2343
    my $rv = 99;
-
 
2344
 
-
 
2345
    $data->{ViewRoot} = $opt_name ? $opt_name : "$cc_label";
-
 
2346
    $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
-
 
2347
    
-
 
2348
    if ( $opt_preserveProjectBase )
-
 
2349
    {
-
 
2350
        my $cc_vob = $cc_path;
-
 
2351
        $cc_vob =~ s~^/~~;
-
 
2352
        $cc_vob =~ s~/.*~~;
-
 
2353
        $data->{ViewPath} =  $data->{ViewRoot} . '/' . $cc_vob;
-
 
2354
        Message ("Preserving Project Base");
-
 
2355
    }
-
 
2356
    $data->{ViewPath} =~  tr~/~/~s;
-
 
2357
 
-
 
2358
    if ( $opt_reuse && -d $data->{ViewPath}  )
-
 
2359
    {
-
 
2360
        Message ("Reusing view: $cc_label");
-
 
2361
        return 0;
-
 
2362
    }
-
 
2363
 
-
 
2364
    while ( $rv == 99 ) {
-
 
2365
        my @args;
-
 
2366
        push (@args, '-view', $opt_name ) if ( defined $opt_name );
-
 
2367
        $rv = JatsToolPrint ( 'jats_ccrelease', '-extractfiles', '-root=.' , '-noprefix',
-
 
2368
                    "-label=$cc_label" ,
-
 
2369
                    "-path=$cc_path",
-
 
2370
                    @args
-
 
2371
                    );
-
 
2372
 
-
 
2373
        if ( $rv == 10 ) {
-
 
2374
 
-
 
2375
            #
-
 
2376
            #   No files found
-
 
2377
            #   If this is the first time then try really hard to find them
-
 
2378
            #
-
 
2379
            unless ( $tryCount++ )
-
 
2380
            {
-
 
2381
                $packageReLabelCount++;
-
 
2382
                $rv = JatsToolPrint('cc2svn_labeldirs',
-
 
2383
                                        '-vob', $cc_path,
-
 
2384
                                        $cc_label,
-
 
2385
                                        );
-
 
2386
                $data->{DirsLabled} = 100 + $rv;
-
 
2387
 
-
 
2388
                #
-
 
2389
                #   Second attempt - massage the users path
-
 
2390
                #   We should have labled up to the VOB root so lets
-
 
2391
                #   just use the VOB and not the path
-
 
2392
                #
-
 
2393
                $cc_path =~ s~^/~~;
-
 
2394
                $cc_path =~ s~/.*~~;
-
 
2395
                $cc_path = '/' . $cc_path;
-
 
2396
                $data->{ViewPath} =  $data->{ViewRoot} . $cc_path;
-
 
2397
                redo;
-
 
2398
            }
-
 
2399
 
-
 
2400
            $data->{errStr}  = 'No Files in the extracted view';
-
 
2401
            $data->{errCode} = '0';
-
 
2402
            return 2;
-
 
2403
        }
-
 
2404
        elsif ( $rv == 11 ) {
-
 
2405
            $data->{errStr} = 'Label not found';
-
 
2406
            $data->{errCode} = 'L';
-
 
2407
            return 2;
-
 
2408
        }
-
 
2409
 
-
 
2410
        unless ( -d $data->{ViewPath}  )
-
 
2411
        {
-
 
2412
            $data->{errStr} = 'Failed to extract files from CC';
-
 
2413
            return 2;
-
 
2414
        }
-
 
2415
 
-
 
2416
        #
-
 
2417
        #   Looks good
-
 
2418
        #
-
 
2419
        return 0;
-
 
2420
    };
-
 
2421
 
-
 
2422
    $data->{errStr}  = 'No Files in the extracted view after labeling dirs';
-
 
2423
    $data->{errCode} = '0';
-
 
2424
    return 2;
-
 
2425
 
-
 
2426
}
-
 
2427
 
-
 
2428
#-------------------------------------------------------------------------------
2365
# Function        : detectProjectBaseUsage
2429
# Function        : detectProjectBaseUsage
2366
#
2430
#
2367
# Description     : Detect and report usage of the SetProjectBase directive
2431
# Description     : Detect and report usage of the SetProjectBase directive
2368
#
2432
#
2369
# Inputs          : $data               - Ref to a hash of bits
2433
# Inputs          : $data               - Ref to a hash of bits
Line 3270... Line 3334...
3270
            push @text, '|';
3334
            push @text, '|';
3271
            push @text, 'Subversion';
3335
            push @text, 'Subversion';
3272
            push @text, 'Trunk used' if exists $svnData{branches}{trunk} ;
3336
            push @text, 'Trunk used' if exists $svnData{branches}{trunk} ;
3273
            push @text, 'Labels: ' . scalar keys %{$svnData{tags}} ;
3337
            push @text, 'Labels: ' . scalar keys %{$svnData{tags}} ;
3274
            push @text, 'Branches: ' . scalar keys %{$svnData{branches}} ;
3338
            push @text, 'Branches: ' . scalar keys %{$svnData{branches}} ;
-
 
3339
            push @text, 'Relabled Packages : ' . $packageReLabelCount;
3275
        }
3340
        }
3276
 
3341
 
3277
        push @text, '';
3342
        push @text, '';
3278
        my $text = join '\l', @text;
3343
        my $text = join '\l', @text;
3279
        $text =~ s~\|\\l~|~g;
3344
        $text =~ s~\|\\l~|~g;
Line 3306... Line 3371...
3306
        push @text, '|{N: Not Locked';
3371
        push @text, '|{N: Not Locked';
3307
        push @text, 'b: Bad Singleton';
3372
        push @text, 'b: Bad Singleton';
3308
        push @text, 'B: Bad VCS Tag';
3373
        push @text, 'B: Bad VCS Tag';
3309
        push @text, 'D: DeadWood';
3374
        push @text, 'D: DeadWood';
3310
        push @text, 'E: Essential Release Version';
3375
        push @text, 'E: Essential Release Version';
-
 
3376
        push @text, 'F: Package directories labled';
3311
        push @text, 'G: Glued into Version Tree';
3377
        push @text, 'G: Glued into Version Tree';
3312
        push @text, 'L: Label not in VOB';
3378
        push @text, 'L: Label not in VOB';
3313
        push @text, 'r: Recent version';
3379
        push @text, 'r: Recent version';
3314
        push @text, 'R: Ripple';
3380
        push @text, 'R: Ripple';
3315
        push @text, 'S: Splitpoint';
3381
        push @text, 'S: Splitpoint';
Line 3392... Line 3458...
3392
        $stateText .= 'T' if (exists $versions{$entry}{Tip} );
3458
        $stateText .= 'T' if (exists $versions{$entry}{Tip} );
3393
        $stateText .= 'V' if (exists $versions{$entry}{isSvn} );
3459
        $stateText .= 'V' if (exists $versions{$entry}{isSvn} );
3394
        $stateText .= '+' if (exists $versions{$entry}{svnVersion} );
3460
        $stateText .= '+' if (exists $versions{$entry}{svnVersion} );
3395
        $stateText .= '0' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq '0');
3461
        $stateText .= '0' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq '0');
3396
        $stateText .= 'L' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq 'L');
3462
        $stateText .= 'L' if (exists $versions{$entry}{data}{errCode} && $versions{$entry}{data}{errCode} eq 'L');
-
 
3463
        $stateText .= 'F' if ($versions{$entry}{data}{DirsLabled});
3397
 
3464
 
3398
 
3465
 
3399
#        $stateText .= 's' if (exists $versions{$entry}{branchPoint} );
3466
#        $stateText .= 's' if (exists $versions{$entry}{branchPoint} );
3400
#        $stateText .= ' T='. $versions{$entry}{threadId} if (exists $versions{$entry}{threadId});
3467
#        $stateText .= ' T='. $versions{$entry}{threadId} if (exists $versions{$entry}{threadId});
3401
#        $stateText .= ' EssentalPath' if (exists $versions{$entry}{EssentialPath});
3468
#        $stateText .= ' EssentalPath' if (exists $versions{$entry}{EssentialPath});