Subversion Repositories gelsvn

Rev

Rev 68 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 68 Rev 71
Line 101... Line 101...
101
  $self->{'coexistence'}         = $makeco;
101
  $self->{'coexistence'}         = $makeco;
102
  $self->{'project_file_list'}   = {};
102
  $self->{'project_file_list'}   = {};
103
  $self->{'ordering_cache'}      = {};
103
  $self->{'ordering_cache'}      = {};
104
  $self->{'handled_scopes'}      = {};
104
  $self->{'handled_scopes'}      = {};
105
  $self->{'generate_ins'}        = $genins;
105
  $self->{'generate_ins'}        = $genins;
-
 
106
  $self->{'scoped_basedir'}      = undef;
106
 
107
 
107
  if (defined $$exclude[0]) {
108
  if (defined $$exclude[0]) {
108
    my($type) = $self->{'wctype'};
109
    my($type) = $self->{'wctype'};
109
    if (!defined $self->{'exclude'}->{$type}) {
110
    if (!defined $self->{'exclude'}->{$type}) {
110
      $self->{'exclude'}->{$type} = [];
111
      $self->{'exclude'}->{$type} = [];
Line 212... Line 213...
212
          else {
213
          else {
213
            $name =~ s/^\(\s*//;
214
            $name =~ s/^\(\s*//;
214
            $name =~ s/\s*\)$//;
215
            $name =~ s/\s*\)$//;
215
 
216
 
216
            ## Replace any *'s with the default name
217
            ## Replace any *'s with the default name
-
 
218
            if ($name =~ /\*/) {
217
            my($def) = $self->get_default_workspace_name();
219
              $name = $self->fill_type_name(
218
            $name = $self->fill_type_name($name, $def);
220
                                    $name,
-
 
221
                                    $self->get_default_workspace_name());
-
 
222
            }
219
 
223
 
220
            $self->{'workspace_name'} = $name;
224
            $self->{'workspace_name'} = $name;
221
          }
225
          }
222
        }
226
        }
223
        $self->{$self->{'type_check'}} = 1;
227
        $self->{$self->{'type_check'}} = 1;
Line 249... Line 253...
249
        $error = "Invalid subtraction name: $values[1]";
253
        $error = "Invalid subtraction name: $values[1]";
250
        $status = 0;
254
        $status = 0;
251
      }
255
      }
252
    }
256
    }
253
    elsif ($values[0] eq 'component') {
257
    elsif ($values[0] eq 'component') {
254
      if ($values[1] eq 'exclude') {
-
 
255
        ($status, $error) = $self->parse_exclude($ih, $values[2]);
-
 
256
      }
-
 
257
      else {
-
 
258
        ($status, $error) = $self->parse_scope($ih,
258
      ($status, $error) = $self->parse_scope($ih,
259
                                               $values[1],
259
                                             $values[1],
260
                                               $values[2],
260
                                             $values[2],
261
                                               \%validNames);
261
                                             \%validNames);
262
      }
-
 
263
    }
262
    }
264
    else {
263
    else {
265
      $error = "Unrecognized line: $line";
264
      $error = "Unrecognized line: $line";
266
      $status = 0;
265
      $status = 0;
267
    }
266
    }
Line 342... Line 341...
342
 
341
 
343
  return 0, 'Unable to open ' . $file;
342
  return 0, 'Unable to open ' . $file;
344
}
343
}
345
 
344
 
346
 
345
 
-
 
346
sub parse_scope {
-
 
347
  my($self)        = shift;
-
 
348
  my($fh)          = shift;
-
 
349
  my($name)        = shift;
-
 
350
  my($type)        = shift;
-
 
351
  my($validNames)  = shift;
-
 
352
  my($flags)       = shift;
-
 
353
  my($elseflags)   = shift;
-
 
354
 
-
 
355
  if ($name eq 'exclude') {
-
 
356
    return $self->parse_exclude($fh, $type);
-
 
357
  }
-
 
358
  else {
-
 
359
    return $self->SUPER::parse_scope($fh, $name, $type,
-
 
360
                                     $validNames, $flags, $elseflags);
-
 
361
  }
-
 
362
}
-
 
363
 
347
sub parse_exclude {
364
sub parse_exclude {
348
  my($self)        = shift;
365
  my($self)        = shift;
349
  my($fh)          = shift;
366
  my($fh)          = shift;
350
  my($typestr)     = shift;
367
  my($typestr)     = shift;
351
  my($status)      = 0;
368
  my($status)      = 0;
352
  my($errorString) = 'Unable to process exclude';
369
  my($errorString) = 'Unable to process exclude';
-
 
370
  my($negated)     = undef;
353
 
371
 
354
  if ($typestr eq $self->get_default_component_name()) {
372
  if ($typestr eq $self->get_default_component_name()) {
355
    $typestr = $self->{'wctype'};
373
    $typestr = $self->{'wctype'};
356
  }
374
  }
357
 
375
 
358
  my(@exclude) = ();
376
  my(@exclude) = ();
359
  my(%types)   = ();
377
  my(%types)   = ();
360
  @types{split(/\s*,\s*/, $typestr)} = ();
378
  @types{split(/\s*,\s*/, $typestr)} = ();
361
 
379
 
362
 
-
 
363
  ## If there is a negation at all, add our
380
  ## If there is a negation at all, add our
364
  ## current type, it may be removed below
381
  ## current type, it may be removed below
365
  if ($typestr =~ /!/) {
382
  if ($typestr =~ /!/) {
-
 
383
    $negated = 1;
366
    $types{$self->{wctype}} = 1;
384
    $types{$self->{wctype}} = 1;
367
 
385
 
368
    ## Process negated exclusions
386
    ## Process negated exclusions
369
    foreach my $key (keys %types) {
387
    foreach my $key (keys %types) {
370
      if ($key =~ /^!(\w+)/) {
388
      if ($key =~ /^!\s*(\w+)/) {
371
        ## Remove the negated key
389
        ## Remove the negated key
372
        delete $types{$key};
390
        delete $types{$key};
373
 
391
 
374
        ## Then delete the key that was negated in the exclusion.
392
        ## Then delete the key that was negated in the exclusion.
375
        delete $types{$1};
393
        delete $types{$1};
Line 393... Line 411...
393
          $errorString = undef;
411
          $errorString = undef;
394
        }
412
        }
395
        last;
413
        last;
396
      }
414
      }
397
      else {
415
      else {
-
 
416
        if (defined $self->{'scoped_basedir'}) {
-
 
417
          $line = $self->{'scoped_basedir'} . '/' . $line;
-
 
418
        }
398
        push(@exclude, $line);
419
        push(@exclude, $line);
399
      }
420
      }
400
    }
421
    }
401
 
422
 
402
    foreach my $type (keys %types) {
423
    foreach my $type (keys %types) {
Line 405... Line 426...
405
      }
426
      }
406
      push(@{$self->{'exclude'}->{$type}}, @exclude);
427
      push(@{$self->{'exclude'}->{$type}}, @exclude);
407
    }
428
    }
408
  }
429
  }
409
  else {
430
  else {
-
 
431
    if ($negated) {
410
    ($status, $errorString) = $self->parse_scope($fh,
432
      ($status, $errorString) = $self->SUPER::parse_scope($fh,
411
                                                 'exclude',
433
                                                          'exclude',
412
                                                 $typestr,
434
                                                          $typestr,
413
                                                 \%validNames);
435
                                                          \%validNames);
-
 
436
    }
-
 
437
    else {
-
 
438
      ## If this exclude block didn't match the current type and the
-
 
439
      ## exclude wasn't negated, we need to eat the exclude block so that
-
 
440
      ## these lines don't get included into the workspace.
-
 
441
      while(<$fh>) {
-
 
442
        my($line) = $self->preprocess_line($fh, $_);
-
 
443
 
-
 
444
        if ($line =~ /^}(.*)$/) {
-
 
445
          if (defined $1 && $1 ne '') {
-
 
446
            $status = 0;
-
 
447
            $errorString = "Trailing characters found: '$1'";
-
 
448
          }
-
 
449
          else {
-
 
450
            $status = 1;
-
 
451
            $errorString = undef;
-
 
452
          }
-
 
453
          last;
-
 
454
        }
-
 
455
      }
-
 
456
    }
414
  }
457
  }
415
 
458
 
416
  return $status, $errorString;
459
  return $status, $errorString;
417
}
460
}
418
 
461
 
Line 448... Line 491...
448
      $$flags{'cmdline'} =~ s/\$PWD(\W)/$dir$1/g;
491
      $$flags{'cmdline'} =~ s/\$PWD(\W)/$dir$1/g;
449
      $$flags{'cmdline'} =~ s/\$PWD$/$dir/;
492
      $$flags{'cmdline'} =~ s/\$PWD$/$dir/;
450
    }
493
    }
451
 
494
 
452
    ## Go back to the previous directory and add the directory contents
495
    ## Go back to the previous directory and add the directory contents
453
    ($status, $error) = $self->handle_scoped_unknown($type, $flags, '.');
496
    ($status, $error) = $self->handle_scoped_unknown(undef, $type, $flags, '.');
454
  }
497
  }
455
 
498
 
456
  $self->{'handled_scopes'}->{$type} = undef;
499
  $self->{'handled_scopes'}->{$type} = undef;
457
  return $status, $error;
500
  return $status, $error;
458
}
501
}
459
 
502
 
460
 
503
 
461
sub handle_scoped_unknown {
504
sub handle_scoped_unknown {
462
  my($self)   = shift;
505
  my($self)   = shift;
-
 
506
  my($fh)     = shift;
463
  my($type)   = shift;
507
  my($type)   = shift;
464
  my($flags)  = shift;
508
  my($flags)  = shift;
465
  my($line)   = shift;
509
  my($line)   = shift;
466
  my($status) = 1;
510
  my($status) = 1;
467
  my($error)  = undef;
511
  my($error)  = undef;
468
  my($dupchk) = undef;
512
  my($dupchk) = undef;
469
 
513
 
-
 
514
  if ($line =~ /^\w+.*{/) {
-
 
515
    if (defined $fh) {
-
 
516
      my(@values) = ();
-
 
517
      my($tc) = $self->{$self->{'type_check'}};
-
 
518
      $self->{$self->{'type_check'}} = 1;
-
 
519
      ($status, $error, @values) = $self->parse_line($fh, $line);
-
 
520
      $self->{$self->{'type_check'}} = $tc;
-
 
521
    }
-
 
522
    else {
-
 
523
      $status = 0;
-
 
524
      $error  = 'Unhandled line: ' . $line;
-
 
525
    }
-
 
526
    return $status, $error;
-
 
527
  }
-
 
528
 
470
  if ($type eq $aggregated) {
529
  if ($type eq $aggregated) {
471
    $line = $self->{'scoped_basedir'} . ($line ne '.' ? "/$line" : '');
530
    $line = $self->{'scoped_basedir'} . ($line ne '.' ? "/$line" : '');
472
    my(%dup) = ();
531
    my(%dup) = ();
473
    @dup{@{$self->{'project_files'}}} = ();
532
    @dup{@{$self->{'project_files'}}} = ();
474
    $dupchk = \%dup;
533
    $dupchk = \%dup;
Line 501... Line 560...
501
        }
560
        }
502
      }
561
      }
503
      @files = @acceptable;
562
      @files = @acceptable;
504
    }
563
    }
505
 
564
 
506
    if (defined $dupchk) {
565
    foreach my $file (@files) {
507
      foreach my $file (@files) {
566
      if (!$self->excluded($file)) {
508
        if (exists $$dupchk{$file}) {
567
        if (defined $dupchk && exists $$dupchk{$file}) {
509
          $self->warning("Duplicate mpc file ($file) added by an " .
568
          $self->warning("Duplicate mpc file ($file) added by an " .
510
                         'aggregate workspace.  It will be ignored.');
569
                         'aggregate workspace.  It will be ignored.');
511
        }
570
        }
512
        else {
571
        else {
513
          $self->{'scoped_assign'}->{$file} = $flags;
572
          $self->{'scoped_assign'}->{$file} = $flags;
514
          push(@{$self->{'project_files'}}, $file);
573
          push(@{$self->{'project_files'}}, $file);
515
        }
574
        }
516
      }
575
      }
517
    }
576
    }
518
    else {
-
 
519
      foreach my $file (@files) {
-
 
520
        $self->{'scoped_assign'}->{$file} = $flags;
-
 
521
        push(@{$self->{'project_files'}}, $file);
-
 
522
      }
-
 
523
    }
-
 
524
  }
577
  }
525
  else {
578
  else {
526
    if ($line =~ /\.$wsext$/) {
579
    if ($line =~ /\.$wsext$/) {
527
      ## An aggregated workspace within an aggregated workspace.
580
      ## An aggregated workspace within an aggregated workspace.
528
      ($status, $error) = $self->aggregated_workspace($line);
581
      ($status, $error) = $self->aggregated_workspace($line);
529
    }
582
    }
530
    else {
583
    else {
-
 
584
      if (!$self->excluded($line)) {
531
      if (defined $dupchk && exists $$dupchk{$line}) {
585
        if (defined $dupchk && exists $$dupchk{$line}) {
532
        $self->warning("Duplicate mpc file ($line) added by an " .
586
          $self->warning("Duplicate mpc file ($line) added by an " .
533
                       'aggregate workspace.  It will be ignored.');
587
                         'aggregate workspace.  It will be ignored.');
534
      }
588
        }
535
      else {
589
        else {
536
        $self->{'scoped_assign'}->{$line} = $flags;
590
          $self->{'scoped_assign'}->{$line} = $flags;
537
        push(@{$self->{'project_files'}}, $line);
591
          push(@{$self->{'project_files'}}, $line);
-
 
592
        }
538
      }
593
      }
539
    }
594
    }
540
  }
595
  }
541
  $self->{'handled_scopes'}->{$type} = 1;
596
  $self->{'handled_scopes'}->{$type} = 1;
542
 
597
 
Line 555... Line 610...
555
      my(@f) = $self->generate_default_file_list(
610
      my(@f) = $self->generate_default_file_list(
556
                         $file,
611
                         $file,
557
                         $self->{'exclude'}->{$self->{'wctype'}});
612
                         $self->{'exclude'}->{$self->{'wctype'}});
558
      $self->search_for_files(\@f, $array, $impl);
613
      $self->search_for_files(\@f, $array, $impl);
559
      if ($impl) {
614
      if ($impl) {
-
 
615
        $file =~ s/^\.\///;
560
        unshift(@$array, $file);
616
        unshift(@$array, $file);
561
      }
617
      }
562
    }
618
    }
563
    else {
619
    else {
564
      if ($file =~ /\.mpc$/) {
620
      if ($file =~ /\.mpc$/) {
-
 
621
        $file =~ s/^\.\///;
565
        unshift(@$array, $file);
622
        unshift(@$array, $file);
566
      }
623
      }
567
    }
624
    }
568
  }
625
  }
569
}
626
}