OpenPKG CVS Repository
  http://cvs.openpkg.org/
  ____________________________________________________________________________

  Server: cvs.openpkg.org                  Name:   Michael van Elst
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   18-Dec-2002 11:34:35
  Branch: HEAD                             Handle: 2002121810343500

  Modified files:
    openpkg-src/openpkg-tool openpkg-build.pl

  Log:
    fix interpreter for conditions (OR was AND)
    make XML parser evaluate parameters (parameters and deps were ignored)
    keep order of goals passed on command line
    perl-bugoid workaround
    minor cleanups

  Summary:
    Revision    Changes     Path
    1.15        +30 -20     openpkg-src/openpkg-tool/openpkg-build.pl
  ____________________________________________________________________________

  Index: openpkg-src/openpkg-tool/openpkg-build.pl
  ============================================================
  $ cvs diff -u -r1.14 -r1.15 openpkg-build.pl
  --- openpkg-src/openpkg-tool/openpkg-build.pl 11 Dec 2002 15:51:04 -0000      1.14
  +++ openpkg-src/openpkg-tool/openpkg-build.pl 18 Dec 2002 10:34:35 -0000      1.15
  @@ -122,13 +122,13 @@
               die "FATAL: stack underflow in: $cond\n" if scalar(@s)<2;
               my($a) = pop @s;
               my($b) = pop @s;
  -            push @s, $a && $b;
  +            push @s, $a || $b;
           } elsif ($_ eq '!') {
               die "FATAL: stack underflow in: $cond\n" if scalar(@s)<1;
               my($a) = pop @s;
               push @s, !$a;
           } else {
  -            push @s, $with->{$_} eq 'yes';
  +            push @s, ($with->{$_} eq 'yes') ? 1 : 0;
           }
       }
       die "FATAL: stack underflow in: $cond\n" if scalar(@s)<1;
  @@ -138,6 +138,21 @@
       return $res;
   }
   
  +sub with_list ($$) {
  +    my($bags,$with) = @_;
  +    my($bag,$li);
  +    my(@out);
  +
  +    foreach $bag (@$bags) {
  +        next unless conditional($bag->{'cond'}, $with);
  +        foreach $li (@{$bag->{'rdf:bag'}}) {
  +            push @out, @{$li->{'rdf:li'}};
  +        }
  +    }
  +
  +    return \@out;
  +}
  +
   ##########################################################################
   
   my($RPM,$RPM_PRIV,$RPM_NPRIV,$CURL,$PROG);
  @@ -341,15 +356,16 @@
   sub parse_options ($) {
       my($l) = @_;
       $l = join("\n",@$l) if ref $l;
  -    return unless $l =~ s/.*Options://;
  +    return unless $l =~ s/.*Options//;
       my(%with) = $l =~ /--define\s*'(\S+)\s+(\S+?)'/g;
       return \%with;
   }
   
   sub override_options ($$$) {
       my($old, $new, $reg) = @_;
  -    while (my ($k,$v) = each %$new) {
  -        $old->{$k} = $v if exists $old->{$k} || $k =~ /^$reg$/;
  +
  +    foreach my $k (keys %$new) {
  +        $old->{$k} = $new->{$k} if exists $old->{$k} || $k =~ /^$reg$/;
       }
   }
   
  @@ -617,15 +633,9 @@
                   release  => $release,
                   platform => xel($_->{'Platform'}),
                   prefix   => xel($_->{'Prefixes'}),
  -                depends  =>
  -                    ( $_->{'BuildPreReq'}->[0]->{'rdf:bag'}->[0]->{'rdf:li'}
  -                    || [] ),
  -                keeps    =>
  -                    ( $_->{'PreReq'}->[0]->{'rdf:bag'}->[0]->{'rdf:li'}
  -                    || [] ),
  -                conflicts =>
  -                    ( $_->{'Conflicts'}->[0]->{'rdf:bag'}->[0]->{'rdf:li'}
  -                    || [] ),
  +                depends  => with_list($_->{'BuildPreReq'}, $with),
  +                keeps    => with_list($_->{'PreReq'}, $with),
  +                conflicts => with_list($_->{'Conflicts'}, $with),
                   desc     => xel($_->{'Description'})
               };
               $rec->{OPTIONS} = parse_options($rec->{desc});
  @@ -1017,7 +1027,7 @@
                   }
                   push @deps, $t;
               } else {
  -                print "# $target->{name} searches for a frood called '$_'\n";
  +                print "# $target->{name} searches a frood called '$_'\n";
                   push(@{$env->{fatal}},vsn($target));
                   target_setstatus($target,'UNDEF',4);
                   push @$clist, $target;
  @@ -1086,8 +1096,10 @@
                   push @todo, '^'.quotemeta($_).'$';
               }
           }
  -        $pattern = join('|',@todo);
  -        @todo = grep(/$pattern/, keys %{$env->{repository}});
  +        @todo = map {
  +            my($p) = $_;
  +            grep(/$p/, keys %{$env->{repository}})
  +        } @todo;
       } else {
           @todo = grep {
                       my($n) = $_;
  @@ -1096,7 +1108,6 @@
                   } keys %{$env->{repository}};
       }
   
  -
       #
       # chose sources for goals from repository
       #
  @@ -1429,8 +1440,7 @@
   } else {
       if (@{$env->{fatal}}) {
           die "FATAL errors occured while building:\n",
  -            join ',',
  -                @{$env->{fatal}},
  +            join (',', @{$env->{fatal}}),
               "\n";
       }
   
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to