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

  Server: cvs.openpkg.org                  Name:   Michael van Elst
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-re                       Date:   20-Nov-2002 17:29:14
  Branch: HEAD                             Handle: 2002112016291400

  Modified files:
    openpkg-re              openpkg-build

  Log:
    retrieve option list from index for new targets

  Summary:
    Revision    Changes     Path
    1.36        +32 -12     openpkg-re/openpkg-build
  ____________________________________________________________________________

  Index: openpkg-re/openpkg-build
  ============================================================
  $ cvs diff -u -r1.35 -r1.36 openpkg-build
  --- openpkg-re/openpkg-build  20 Nov 2002 16:05:19 -0000      1.35
  +++ openpkg-re/openpkg-build  20 Nov 2002 16:29:14 -0000      1.36
  @@ -323,9 +323,16 @@
   }
   
   sub get_with ($;$) {
  -    my($pkg,$fn) = @_;
  -    my(@l) = defined $fn ? `$RPM_NPRIV -qi -p $fn` : `$RPM_NPRIV -qi $pkg`;
  -    my(%with);
  +    my($t,$fn) = @_;
  +    my(@l,%with);
  +
  +    if (exists $t->{desc}) {
  +        @l = split(/\n+/, $t->{desc});
  +    } elsif (defined $fn) {
  +        @l = `$RPM_NPRIV -qi -p $fn`;
  +    } else {
  +        @l = `$RPM_NPRIV -qi $t->{name}`;
  +    }
   
       %with = map { /--define\s*'(\S+)\s+(\S+?)'/ } @l;
   
  @@ -382,7 +389,7 @@
   
           my($section);
           my($name,$version);
  -        my($href,$release);
  +        my($href,$release,$desc);
           my(@prereq,@bprereq);
           my(@provides,@conflicts,$rec);
           my($tag,$cond,$body);
  @@ -398,6 +405,7 @@
                   $href      = $1;
                   $name      = undef;
                   $release   = undef;
  +                $desc      = '';
                   @prereq    = ();
                   @bprereq   = ();
                   @provides  = ();
  @@ -406,11 +414,16 @@
               next unless defined $href;
   
               ($tag,$cond,$body) = /<(\/?[\w:]+)\s*(?:cond="([^"]+)")?>([^<]*)/;
  -            next unless $tag;
   
  -            $useit = conditional($cond,$with);
  +            $useit = defined $tag && conditional($cond,$with);
   
  -            if ($tag eq 'PreReq') {
  +            if ($tag eq 'Description') {
  +                $section = 'description';
  +            } elsif ($tag eq '/Description') {
  +                $section = undef;
  +            } elsif ($section eq 'description') {
  +                $desc .= $_;
  +            } elsif ($tag eq 'PreReq') {
                   $section = 'prereq' if $useit;
               } elsif ($tag eq '/PreReq') {
                   $section = undef;
  @@ -461,7 +474,8 @@
                           depends   => [ @bprereq ],
                           keeps     => [ @prereq ],
                           conflicts => [ @conflicts ],
  -                        href      => $href
  +                        href      => $href,
  +                        desc      => $desc
                       };
   
                       foreach (@provides) {
  @@ -499,7 +513,8 @@
                   release  => $_->{'Release'}->[0],
                   depends  => $_->{'BuildPreReq'}->[0]->{'rdf:bag'}->[0]->{'rdf:li'},
                   keeps    => $_->{'PreReq'}->[0]->{'rdf:bag'}->[0]->{'rdf:li'},
  -                href     => $_->{'href'}
  +                href     => $_->{'href'},
  +                desc     => $_->{'Description'}->[0]
               };
   
               foreach (@provides) {
  @@ -653,7 +668,7 @@
       my($k,$v);
   
       unless ($target->{OPTIONS}) {
  -        $target->{OPTIONS} = get_with($target->{'name'});
  +        $target->{OPTIONS} = get_with($target);
       }
       $iwith = $target->{OPTIONS};
   
  @@ -675,7 +690,7 @@
       my($k,$v);
   
       unless ($target->{OPTIONS}) {
  -        $target->{OPTIONS} = get_with($target->{'name'});
  +        $target->{OPTIONS} = get_with($target);
       }
       $iwith = $target->{OPTIONS};
   
  @@ -943,7 +958,7 @@
       my($t, $fn) = @_;
       my(%target) = %$t;
   
  -    $target{OPTIONS} = get_with($t->{name}, $fn);
  +    $target{OPTIONS} = get_with($t, $fn);
   
       return \%target;
   }
  @@ -959,6 +974,11 @@
           while (($k,$v) = each %$new) {
               $old->{$k} = $v if exists $old->{$k};
           }
  +        $old = {
  +            map { $_ => $old->{$_} }
  +            grep { $old->{$_} !~ /\%/ }
  +            keys %$old
  +        };
       } else {
           $old = $new;
       }
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to