Subversion Repositories DevTools

Rev

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

Rev 361 Rev 363
Line 1257... Line 1257...
1257
# Returns         : Path to the config spec
1257
# Returns         : Path to the config spec
1258
#
1258
#
1259
sub create_config_spec
1259
sub create_config_spec
1260
{
1260
{
1261
    my ($config_file) = @_;
1261
    my ($config_file) = @_;
-
 
1262
 
-
 
1263
    #
-
 
1264
    #   Calc the path to a directory in the view which we really want to
-
 
1265
    #   consider as the base. Only want to see folders above this base.
-
 
1266
    #   Don't want to add elements above the base
-
 
1267
    #
-
 
1268
    my $basepath = ($opt_path) ? "\"${VOB_PREFIX}${opt_path}\""     : $ROOT_VOB;
-
 
1269
    my $elroot   = ($opt_path) ? "\"${VOB_PREFIX}${opt_path}/...\"" : '*';
-
 
1270
 
1262
    #
1271
    #
1263
    #   Create a config spec to be used to populate the view
1272
    #   Create a config spec to be used to populate the view
1264
    #       Do not branch directories
1273
    #       Do not branch directories
1265
    #       Do not extract files from lost+found
1274
    #       Do not extract files from lost+found
1266
    #
1275
    #
1267
    Verbose( "Create config spec");
1276
    Verbose( "Create config spec");
1268
    my @config;
1277
    my @config;
1269
    push @config, "element * CHECKEDOUT";
1278
    push @config, "element * CHECKEDOUT";
1270
    push @config, "element .../lost+found -none";
1279
    push @config, "element .../lost+found -none";
-
 
1280
 
-
 
1281
    #
-
 
1282
    #   Insert rules to prevent branching above the load path
-
 
1283
    #   This will be the root of the package
-
 
1284
    #
-
 
1285
    if ( $opt_path )
-
 
1286
    {
-
 
1287
        my $fulldir = $VOB_PREFIX;
-
 
1288
        my @parts = split ('/', $opt_path);
-
 
1289
        shift @parts;                                   # Skip first as its empty
-
 
1290
        pop @parts;                                     # Skip last as its the package
-
 
1291
        foreach my $dir ( @parts )
-
 
1292
        {
-
 
1293
            $fulldir .= "/$dir";
-
 
1294
            foreach (@opt_spec)
-
 
1295
            {
-
 
1296
                push @config, "element -dir \"$fulldir\" $_ -nocheckout";
-
 
1297
            }
-
 
1298
        }
-
 
1299
    }
-
 
1300
    else
-
 
1301
    {
-
 
1302
        foreach (@opt_spec)
-
 
1303
        {
-
 
1304
            push @config, "element -dir \"$ROOT_VOB\" $_ -nocheckout";
-
 
1305
        }
-
 
1306
    }
-
 
1307
 
-
 
1308
    #
-
 
1309
    #   General branching rules
-
 
1310
    #   Rule will apply to all following directives
-
 
1311
    #
-
 
1312
    if ( $opt_branch )
-
 
1313
    {
1271
    push @config, "element * .../$opt_branch/LATEST" if $opt_branch;
1314
        push @config, "element $elroot .../$opt_branch/LATEST";
-
 
1315
        push @config, "mkbranch $opt_branch";
-
 
1316
    }
-
 
1317
 
-
 
1318
    #
-
 
1319
    #   Rules to extract elements within the load path
-
 
1320
    #
1272
    foreach (@opt_spec)
1321
    foreach (@opt_spec)
1273
    {
1322
    {
1274
        my $data = "element * $_";
1323
        push @config, "element $elroot $_";
1275
        $data .= " -mkbranch $opt_branch" if $opt_branch;
-
 
1276
        push @config, $data;
-
 
1277
    }
1324
    }
1278
 
1325
 
1279
    #
1326
    #
-
 
1327
    #   KLUDGE ALERT
1280
    #   Packages SHOULD be labled to the root.
1328
    #   Packages SHOULD be labled to the root.
1281
    #   Do not extend this list fix the package - fix the labels in the VOB.
1329
    #   Do not extend this list fix the package - fix the labels in the VOB.
1282
    #
1330
    #
1283
    if ( $opt_latest_root )
1331
    if ( $opt_latest_root )
1284
    {
1332
    {
1285
        push @config, "element -directory $ROOT_VOB .../$opt_latest_root/LATEST";
1333
        push @config, "element -dir $ROOT_VOB .../$opt_latest_root/LATEST";
-
 
1334
        push @config, "element -dir $ROOT_VOB .../mass_dev2/LATEST";
1286
        push @config, "element -directory $ROOT_VOB .../mass_dev/LATEST";
1335
        push @config, "element -dir $ROOT_VOB .../mass_dev/LATEST";
1287
        push @config, "element -directory $ROOT_VOB /main/LATEST";
1336
        push @config, "element -dir $ROOT_VOB /main/LATEST";
1288
    }
1337
    }
1289
 
1338
 
1290
    #
1339
    #
1291
    #   Do not branch directories above the load path
1340
    #   Handle file(directory) addition
1292
    #   Load only the version on /main
1341
    #   Need a rule to allow /main/0 to be visible
1293
    #       UNIX: Don't play with the /vobs (won't work)
1342
    #   Need to ensure that we don't "see" the entire VOB, just below the load path
1294
    #
1343
    #
1295
    if ( $opt_branch )
1344
    unless ($GBE_ABT)
1296
    {
1345
    {
1297
        if ( $opt_path )
-
 
1298
        {
1346
        #
1299
            my $fulldir = $VOB_PREFIX;
1347
        #   Ensure that we have more than just the VOB root
-
 
1348
        #   If we only have the VOB root then we will get all top level entries
1300
            my @parts = split ('/', $opt_path);
1349
        #   in the vob - and this is not good.
1301
            shift @parts;
1350
        #
1302
            foreach my $dir ( @parts )
1351
        #   Comment out the rule so that the user can use if they must
1303
            {
1352
        #
1304
                $fulldir .= "/$dir";
1353
        my $count = ($elroot =~ tr~/~~);
1305
                push @config, "element -dir $fulldir /main/LATEST"
1354
        my $prefix = ( $count <= 2 ) ? '# ' : '';
1306
            }
1355
 
1307
        }
1356
        #
-
 
1357
        #   Ensure that element-0 is visible (unless autobuilder)
1308
        else
1358
        #   Note: mkbranch rule will modify this rule
1309
        {
1359
        #
1310
            push @config, "element -dir $ROOT_VOB /main/LATEST";
1360
        push @config, $prefix . "element $elroot /main/0";
1311
        }
-
 
1312
    }
1361
    }
1313
 
1362
 
1314
    #
1363
    #
1315
    #   Branch rule:
-
 
1316
    #   Need /main/0 to allow files to be added to the view
-
 
1317
    #   Will get a lot of stuff, so take care not to label it all
-
 
1318
    #
-
 
1319
    push @config, "element * /main/0 -mkbranch $opt_branch" if $opt_branch;
-
 
1320
 
-
 
1321
    #
-
 
1322
    #   Load rule
1364
    #   Load rule
1323
    #   Use ROOT_VOB, unless the user has specified a path
-
 
1324
    #   Quote the path so that spaces will be correcly handled
1365
    #   Quote the path so that spaces will be correcly handled
1325
    #
1366
    #
1326
    push @config, "load $ROOT_VOB" unless $opt_path;
1367
    push @config, "load $basepath";
-
 
1368
 
1327
    push @config, "load \"$VOB_PREFIX$opt_path\"" if $opt_path;
1369
Message ("Config Spec", @config );
1328
 
1370
 
1329
    FileCreate ($config_file, \@config);
1371
    FileCreate ($config_file, \@config);
1330
    return $config_file;
1372
    return $config_file;
1331
}
1373
}
1332
 
1374