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

  Server: cvs.openpkg.org                  Name:   Ralf S. Engelschall
  Root:   /e/openpkg/cvs                   Email:  [EMAIL PROTECTED]
  Module: openpkg-src                      Date:   11-Jun-2003 16:47:43
  Branch: OPENPKG_1_STABLE                 Handle: 2003061115474200

  Modified files:           (Branch: OPENPKG_1_STABLE)
    openpkg-src/openpkg-tool
                            openpkg-build.pl openpkg-index.pl
                            openpkg-tool.spec openpkg.1 openpkg.pod

  Log:
    MFC: all latest changes since last merge

  Summary:
    Revision    Changes     Path
    1.39.2.7    +276 -161   openpkg-src/openpkg-tool/openpkg-build.pl
    1.11.2.4    +13 -7      openpkg-src/openpkg-tool/openpkg-index.pl
    1.27.2.9    +2  -2      openpkg-src/openpkg-tool/openpkg-tool.spec
    1.4.2.2     +9  -6      openpkg-src/openpkg-tool/openpkg.1
    1.10.2.4    +8  -5      openpkg-src/openpkg-tool/openpkg.pod
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/openpkg-tool/openpkg-build.pl
  ============================================================================
  $ cvs diff -u -r1.39.2.6 -r1.39.2.7 openpkg-build.pl
  --- openpkg-src/openpkg-tool/openpkg-build.pl 21 Mar 2003 14:49:14 -0000      
1.39.2.6
  +++ openpkg-src/openpkg-tool/openpkg-build.pl 11 Jun 2003 14:47:42 -0000      
1.39.2.7
  @@ -103,7 +103,7 @@
           } elsif (my($opt,$val) = /^\-([$go])\s*(.*?)\s*$/) {
               $val = 1 unless defined $val;
               if (exists $env->{$opt}) {
  -                $env->{$opt} = " $val";
  +                $env->{$opt} .= " $val";
               } else {
                   $env->{$opt} = $val;
               }
  @@ -275,7 +275,7 @@
           template => $q[1],
           platform => '',
           prefix   => $q[4],
  -        optreg   => '(?:'.join('|', map { "\Qwith_$_\E" } @g).')'
  +        optreg   => '(?:'.join('|', map { "\Quse_$_\E" } @g).')'
           };
   }
   
  @@ -403,11 +403,11 @@
   # convert parser output to dependency records
   #
   sub depend_list ($) {
  -    my($deps) = @_;
  -    foreach (@$deps) {
  -        $_ = parse_depends($_);
  +    my($dl) = @_;
  +    foreach (@$dl) {
  +        $_->{value} = parse_depends($_->{value});
       }
  -    return $deps;
  +    return $dl;
   }
   
   #
  @@ -513,8 +513,8 @@
       foreach $pkg (keys %dep) {
           $rev{$pkg} = [
               sort {
  -                $dep{$a->{name}}{$b->{name}} ||
  -                -$dep{$b->{name}}{$a->{name}} ||
  +                $dep{$b->{name}}{$a->{name}} ||
  +                -$dep{$a->{name}}{$b->{name}} ||
                   $a->{name} cmp $b->{name}
               } @{$dlist{$pkg}}
           ];
  @@ -552,18 +552,6 @@
   }
   
   #
  -# merge any number of options together
  -#
  -sub combine_options {
  -    my($old) = shift;
  -    my($new) = { %$old };
  -    foreach (grep { defined $_ } @_) {
  -        override_options($new,$_,''),
  -    }
  -    return $new;
  -}
  -
  -#
   # pull in OPTIONS for a package or an RPM file
   #
   sub get_with ($;$) {
  @@ -642,19 +630,22 @@
   }
   
   #
  -# grep XML Bag against condition
  -# return as flat list
  +# convert conditional XML Bag into flat list
   #
  -sub xwith ($$) {
  -    my($bags,$with) = @_;
  +sub xwith ($) {
  +    my($bags) = @_;
       my($bag,$li,$el);
       my(@out);
   
       foreach $bag (@$bags) {
  -        next unless conditional($bag->{'cond'}, $with);
           foreach $li (@{$bag->{'rdf:bag'}}) {
               $el = $li->{'resource'} || $li->{'rdf:li'};
  -            push @out, @$el;
  +            foreach (@$el) {
  +                push @out, {
  +                    cond   => $bag->{'cond'},
  +                    value  => $_
  +                };
  +            }
           }
       }
   
  @@ -662,18 +653,19 @@
   }
   
   #
  -# grep simple parser bag against condition
  -# return as flat list
  +# convert simple parser Bag into flat list
   #
  -sub swith ($$$) {
  -    my($bags,$name,$with) = @_;
  +sub swith ($$) {
  +    my($bags,$name) = @_;
       my($cond);
       my(@out);
   
       foreach $cond (keys %$bags) {
  -        next unless conditional($cond, $with);
  -        if (exists $bags->{$cond}->{$name}) {
  -            push @out, @{$bags->{$cond}->{$name}};
  +        foreach (@{$bags->{$cond}->{$name}}) {
  +            push @out, {
  +                cond  => $cond,
  +                value => $_
  +            };
           }
       }
   
  @@ -686,8 +678,8 @@
       return $l =~ /(?:^|\s)\Q$p\E(?:\s|$)/;
   }
   
  -sub simple_text_parser ($$$$$$) {
  -    my($fh,$url,$with,$map,$pfmatch,$installed) = @_;
  +sub simple_text_parser ($$$$$) {
  +    my($fh,$url,$map,$pfmatch,$installed) = @_;
       my(@include);
   
       my($section);
  @@ -698,7 +690,7 @@
       my($rec);
       my($tag,$cond,$attrname,$attrval,$body);
       my($usecond);
  -    my($options, $mywith);
  +    my($options);
   
       print "# using simple text parser\n";
   
  @@ -730,7 +722,7 @@
   
           next unless defined $href;
   
  -        ($tag,$cond,$attrname,$attrval,$body) = /
  +        ($tag,$cond,$attrname,$attrval,$body) = m{
               <
               (\/?[\w:]+)
               \s*
  @@ -740,7 +732,7 @@
               (.*?)
               (?:<\/\1>)?
               $
  -            /mx;
  +            }mx;
   
           if ($tag eq 'Description') {
               $usecond = $cond;
  @@ -825,13 +817,11 @@
                       defined $_->{with}
                   } @provides;
   
  -                unless (grep($_->{name} eq $name, @provides)) {
  -                    push(@provides, {
  -                        name    => $name,
  -                        version => $version,
  -                        release => $release
  -                    });
  -                }
  +                push(@provides, {
  +                    name    => $name,
  +                    version => $version,
  +                    release => $release
  +                });
   
                   $options = %options
                       ? { %options }
  @@ -839,13 +829,6 @@
   
                   if ($options) {
                       my(@t) = get_targets($installed->{$name},sub { 1; });
  -                    $mywith = combine_options(
  -                        $options,
  -                        @t ? get_with($t[0]) : undef,
  -                        $with
  -                    );
  -                } else {
  -                    $mywith = $with;
                   }
   
                   eval {
  @@ -854,11 +837,11 @@
                           name      => $name,
                           version   => $version,
                           release   => $release,
  -                        depends   => depend_list(swith($bags,'bprereq',$mywith)),
  -                        keeps     => depend_list(swith($bags,'prereq',$mywith)),
  -                        conflicts => swith($bags,'conflicts',$mywith),
  -                        source    => swith($bags,'source',$mywith),
  -                        nosource  => swith($bags,'nosource',$mywith),
  +                        depends   => depend_list(swith($bags,'bprereq')),
  +                        keeps     => depend_list(swith($bags,'prereq')),
  +                        conflicts => swith($bags,'conflicts'),
  +                        source    => swith($bags,'source'),
  +                        nosource  => swith($bags,'nosource'),
                           desc      => $desc,
                           platform  => $platform,
                           prefix    => $prefix,
  @@ -882,14 +865,14 @@
       return [EMAIL PROTECTED];
   }
   
  -sub xml_parser ($$$$$$) {
  -    my($fh, $url, $with, $map, $pfmatch, $installed) = @_;
  +sub xml_parser ($$$$$) {
  +    my($fh, $url, $map, $pfmatch, $installed) = @_;
       my(@include);
   
       my($xml,$rep,$sub);
       my($provides,@provides,%options,$rec);
       my($href,$name,$version,$release,$desc);
  -    my($options, $mywith);
  +    my($options);
   
       print "# using XML parser\n";
   
  @@ -925,13 +908,11 @@
               defined $_->{with}
           } @provides;
   
  -        unless (grep($_->{name} eq $name, @provides)) {
  -            push(@provides, {
  -                name    => $name,
  -                version => $version,
  -                release => $release
  -            });
  -        }
  +        push(@provides, {
  +            name    => $name,
  +            version => $version,
  +            release => $release
  +        });
   
           $desc = xel($_->{'Description'});
           $options = %options
  @@ -940,14 +921,7 @@
   
           if ($options) {
               my(@t) = get_targets($installed->{$name},sub { 1; });
  -            $mywith = combine_options(
  -                $options,
  -                @t ? get_with($t[0]) : undef,
  -                $with
  -            );
  -        } else {
  -            $mywith = $with;
  -        } 
  +        }
   
           eval {
               $rec = {
  @@ -957,11 +931,11 @@
                   release   => $release,
                   platform  => xel($_->{'Platform'}),
                   prefix    => xel($_->{'Prefixes'}),
  -                depends   => depend_list(xwith($_->{'BuildPreReq'}, $mywith)),
  -                keeps     => depend_list(xwith($_->{'PreReq'}, $mywith)),
  -                conflicts => xwith($_->{'Conflicts'}, $mywith),
  -                source    => xwith($_->{'Source'}, $mywith),
  -                nosource  => xwith($_->{'NoSource'}, $mywith),
  +                depends   => depend_list(xwith($_->{'BuildPreReq'})),
  +                keeps     => depend_list(xwith($_->{'PreReq'})),
  +                conflicts => xwith($_->{'Conflicts'}),
  +                source    => xwith($_->{'Source'}),
  +                nosource  => xwith($_->{'NoSource'}),
                   desc      => $desc,
                   OPTIONS   => $options,
                   DEFOPTS   => { %$options }
  @@ -1025,9 +999,10 @@
   # fetch index from file or URL
   # recursively fetch sub-indexes
   #
  -sub get_index ($$$$$$) {
  -    my($url,$fn,$with,$noxml,$pfmatch,$installed) = @_;
  +sub get_index ($$$$$) {
  +    my($url,$fn,$noxml,$pfmatch,$installed) = @_;
       my(%map,$include);
  +    my($parser);
   
       open_index($url,$fn);
   
  @@ -1038,13 +1013,8 @@
           $noxml = 1 if $@;
       }
   
  -    if ($noxml) {
  -        $include = simple_text_parser(\*RFH, $url, $with,
  -                                      \%map, $pfmatch, $installed);
  -    } else {
  -        $include = xml_parser(\*RFH, $url, $with,
  -                              \%map, $pfmatch, $installed);
  -    }
  +    $parser = $noxml ? \&simple_text_parser : \&xml_parser;
  +    $include = $parser->(\*RFH, $url, \%map, $pfmatch, $installed);
   
       close(RFH)
           or die "FATAL: an I/O error occured\n";
  @@ -1056,7 +1026,7 @@
       foreach (@$include) {
           my($submap);
           my($suburl,$subfn) = relurl($url,$fn,$_);
  -        $submap = get_index($suburl,$subfn,$with,$noxml,$pfmatch,$installed);
  +        $submap = get_index($suburl,$subfn,$noxml,$pfmatch,$installed);
           while (my($name,$vmap) = each %$submap) {
               while (my($vs,$recs) = each %$vmap) {
                   push @{$map{$name}->{$vs}}, @$recs;
  @@ -1091,25 +1061,32 @@
   }
   
   #
  +# check if target record describes a source package
  +#
  +sub is_source ($) {
  +    my($t) = @_;
  +    return !(defined $t->{'prefix'});
  +}
  +
  +#
   # there can be multiple sources for a target release
   #
  -sub chose_source ($$$$@) {
  -    my($env, $name, $select, $vmap, @vers) = @_;
  -    my(@recs,@nrecs,$rec,%nam);
  +sub chose_source ($$$$$) {
  +    my($env, $name, $select, $vmap, $cond) = @_;
  +    my(@vers,@recs,@nrecs,$rec,%nam);
   
  +    @vers = get_versions($vmap, sub { 1; });
       return unless @vers;
   
  -    @recs = grep {
  -                $env->{sourceonly} ? (
  -                    !(defined $_->{'prefix'})
  -                ) : (
  -                    !(defined $_->{'prefix'}) || (
  -                       defined $_->{'platform'} &&
  -                       $_->{'platform'} eq $env->{config}->{platform} &&
  -                       $_->{'prefix'} eq $env->{config}->{prefix}
  -                    )
  +    @recs = map { $_->[1] } grep {
  +                my($v,$t) = @$_;
  +                is_source($t) ||
  +                ( !$env->{sourceonly} &&
  +                  $t->{'platform'} eq $env->{config}->{platform} &&
  +                  $t->{'prefix'} eq $env->{config}->{prefix} &&
  +                  $cond->($v)
                   )
  -            } map { @{$vmap->{$_}} } @vers;
  +            } map { [ $_, @{$vmap->{$_}} ] } @vers;
       return unless @recs;
   
       if (defined $select) {
  @@ -1192,52 +1169,94 @@
   }
   
   #
  -# see wether target has conflicts in map
  +# lookup target in map
   #
  -sub target_conflicts ($$) {
  +sub target_lookup ($$) {
       my($target, $map) = @_;
  -    my($t);
  +    my($vmap,$vers);
   
  -    foreach (@{$target->{conflicts}}) {
  -        $t = find_target($_, $map);
  -        return $t if $t;
  +    $vmap = $map->{$target->{name}};
  +    return unless $vmap;
  +    $vers = $vmap->{vs($target)};
  +    return unless $vers && @$vers;
  +    return $vers->[0];
  +}
  +
  +#
  +# retrieve conditional target attributes in map
  +#
  +sub target_attribute ($$$) {
  +    my($target, $env, $attr) = @_;
  +    my($with)   = $env->{with};
  +    my($optreg) = $env->{config}->{optreg};
  +    my($name)   = $target->{name};
  +    my(@out);
  +
  +    return unless $target;
  +
  +    my(%mywith) = %{$target->{OPTIONS}};
  +    override_options(\%mywith, name_with($name, $with), $optreg);
  +
  +    foreach (@{$target->{$attr}}) {
  +        next unless conditional($_->{'cond'}, \%mywith);
  +        push @out, $_->{'value'};
       }
  +    return [EMAIL PROTECTED];
  +}
   
  -    return;
  +#
  +# see wether target has conflicts
  +#
  +sub target_conflicts ($$) {
  +    my($target, $env) = @_;
  +    return target_attribute($target, $env, 'conflicts');
   }
   
   #
  -# retrieve build dependencies for target in map
  +# retrieve build dependencies for target
   #
   sub target_depends ($$) {
  -    my($target, $map) = @_;
  -    my($vmap,$vers);
  +    my($target, $env) = @_;
  +    return target_attribute($target, $env, 'depends');
  +}
   
  -    die "FATAL: ",vsn($target)," not in depend map\n"
  -        unless
  -        ( $vmap = $map->{$target->{name}} ) &&
  -        ( defined $target->{version}      ) &&
  -        ( $vers = $vmap->{vs($target)}    ) &&
  -        @$vers;
  +#
  +# retrieve runtime dependencies for target
  +#
  +sub target_keeps ($$) {
  +    my($target, $env) = @_;
  +    return target_attribute($target, $env, 'keeps');
  +}
   
  -    return $vers->[0]->{depends};
  +#
  +# retrieve source list for target
  +#
  +sub target_source ($$) {
  +    my($target, $env) = @_;
  +    return target_attribute($target, $env, 'source');
   }
   
   #
  -# retrieve runtime dependencies for target in map
  +# retrieve nosource list for target
   #
  -sub target_keeps ($$) {
  -    my($target, $map) = @_;
  -    my($vmap,$vers);
  +sub target_nosource ($$) {
  +    my($target, $env) = @_;
  +    return target_attribute($target, $env, 'nosource');
  +}
   
  -    die "FATAL: ",vsn($target)," not in keep map\n"
  -        unless
  -        ( $vmap = $map->{$target->{name}} ) &&
  -        ( defined $target->{version}      ) &&
  -        ( $vers = $vmap->{vs($target)}    ) &&
  -        @$vers;
  +#
  +# check wether target conflicts against map
  +#
  +sub target_has_conflicts ($$$) {
  +    my($target, $map, $env) = @_;
  +    my($conflicts, $t);
   
  -    return $vers->[0]->{keeps};
  +    $conflicts = target_conflicts($target, $env);
  +    foreach (@$conflicts) {
  +        my($t) = find_target($_, $map);
  +        return $t if $t;
  +    }
  +    return;
   }
   
   #
  @@ -1293,6 +1312,42 @@
   }
   
   #
  +# filter package options
  +#
  +sub filter_name_with ($$$) {
  +    my($name, $with, $global) = @_;
  +    my(@keys);
  +
  +    if ($global) {
  +        push(@keys, grep { !/::/ } keys %$with);
  +    }
  +    push(@keys, grep { /::/ } keys %$with);
  +
  +    return {
  +        map {
  +            my($k) = $_;
  +            $k !~ /::/ || $k =~ s/^\Q$name\E:://
  +            ? ( $k => $with->{$_} )
  +            : ( )
  +        } @keys
  +    };
  +}
  +
  +#
  +# filter out package relevant options
  +#
  +sub name_with ($$) {
  +    filter_name_with($_[0],$_[1],1);
  +}
  +
  +#
  +# filter out package specific options
  +#
  +sub name_only_with ($$) {
  +    filter_name_with($_[0],$_[1],0);
  +}
  +
  +#
   # check wether installed package matches
   # build options
   #
  @@ -1301,6 +1356,12 @@
       my($iwith);
       my($k,$v);
   
  +    if ($target->{GOAL}) {
  +        $with = name_with($target->{name}, $with);
  +    } else {
  +        $with = name_only_with($target->{name}, $with);
  +    }
  +
       $iwith = $target->{OPTIONS};
       while (($k,$v) = each %$with) {
           if (exists $iwith->{$k}) {
  @@ -1332,13 +1393,55 @@
       my($k,$v);
   
       return unless defined $iwith;
  +    $with = name_with($target->{name}, $with);
       while (($k,$v) = each %$with) {
  -        if (!exists $iwith->{$k} && $k !~ $c->{optreg}) {
  +        unless ($k =~ /^$c->{optreg}$/ || exists $iwith->{$k}) {
               print "# ATTENTION: $target->{name} ignores option '$k'\n";
           }
       }
   }
   
  +#
  +# add dependency as build option
  +#
  +sub depend_option ($$$) {
  +    my($target,$dep,$env) = @_;
  +    my($with,$opt,$relmap,@t,$t);
  +    my($pro) = depends2provides($dep);
  +    my($conflict) = 0;
  +
  +    return 1 unless defined $pro->{with};
  +
  +    my($val) = defined $pro->{version} ? $pro->{version} : 'yes';
  +
  +    $with = $env->{with};
  +    $opt  = $pro->{prefix}.'::'.$pro->{with};
  +    if (defined $with->{$opt} && $with->{$opt} ne $val) {
  +        print "# ",vsn($target),
  +            " has conflicting requirement $opt = $with->{$opt} != $val\n";
  +        $conflict = 1;
  +    }
  +
  +    $relmap = $env->{built}->{$pro->{prefix}} ||
  +              $env->{installed}->{$pro->{prefix}};
  +    @t = get_targets($relmap, sub { 1; });
  +    foreach $t (@t) {
  +        $with = $t->{OPTIONS};
  +        $opt  = $pro->{with};
  +        if (defined $with->{$opt} && $with->{$opt} ne $val) {
  +            print "# ",vsn($t),
  +                " has conflicting requirement $opt = $with->{$opt} != $val\n";
  +            $conflict = 1;
  +        }
  +    }
  +
  +    return 0 if $conflict;
  +                  
  +    print "# ",vsn($target)," adds option $opt = $val\n";
  +    $with->{$opt} = $val;
  +    return 1;
  +}
  +
   ############################################################################
   
   #
  @@ -1411,7 +1514,7 @@
       # avoid repository packages that would install 'new' (i.e.
       # are not an upgrade of an existing package)
       #
  -    $t = chose_source($env, $name, undef, $r, get_versions($r, $cond));
  +    $t = chose_source($env, $name, undef, $r, $cond);
       if ($t) {
           if (!$tdef || (
               $why = target_better($env, $t, $env->{installed}) &&
  @@ -1446,14 +1549,14 @@
           return;
       }
   
  -    if ($t = target_conflicts($target, $env->{installed})) {
  +    if ($t = target_has_conflicts($target, $env->{installed}, $env)) {
           target_setstatus($target,'CONFLICT',4);
           push(@$clist,$target);
           print "# $target->{name} conflicts with ",vsn($t),"\n";
           return;
       }
   
  -    if ($t = target_conflicts($target, $env->{built})) {
  +    if ($t = target_has_conflicts($target, $env->{built}, $env)) {
           target_setstatus($target,'CONFLICT',4);
           push(@$clist,$target);
           print "# $target->{name} conflicts with ",vsn($t),"\n";
  @@ -1478,7 +1581,7 @@
           } elsif ($why = target_better($env, $target, $env->{installed})) {
               target_setstatus($target,'UPDATE',3);
               print "# rebuilding $target->{name} ($why)\n";
  -        } elsif ($target->{GOAL} && !target_suitable($t, $env->{with})) {
  +        } elsif (!target_suitable($t, $env->{with})) {
               target_setstatus($target,'MISMATCH',2);
               print "# rebuilding $target->{name} (parameter mismatch)\n";
           } else {
  @@ -1504,8 +1607,8 @@
       push(@{$env->{built}->{$target->{name}}->{vs($target)}}, $target);
       $target->{LIMBO} = 1;
   
  -    $d = target_depends($target, $env->{repository});
  -    $k = target_keeps($target, $env->{repository});
  +    $d = target_depends(target_lookup($target, $env->{repository}), $env);
  +    $k = target_keeps(target_lookup($target, $env->{repository}), $env);
   
       #
       # recurse over dependencies
  @@ -1539,6 +1642,16 @@
                   } else {
                       print "# $target->{name} requires ".vsn($t)." for $_\n";
                   }
  +
  +                unless (depend_option($t, $d{$_}, $env)) {
  +                    print "# $target->{name} has conflicting requirement\n";
  +                    push(@{$env->{fatal}},vsn($target));
  +                    target_setstatus($target,'UNDEF',4);
  +                    push @$clist, $target;
  +                    $conflict = 1;
  +                    next;
  +                }
  +
                   push @deps, $t;
               } else {
                   print "# $target->{name} searches a frood called '$_'\n";
  @@ -1561,9 +1674,14 @@
       $target->{WHY} = $target->{STATUS};
       push(@$list, $target);
       $target->{LIMBO} = 0;
  +     
  +    # remember new options
  +    override_options($target->{OPTIONS},
  +                     name_with($target->{name}, $env->{with}),
  +                     '');
   
  -    foreach (@{$target->{nosource}}) {
  -        my($p) = $target->{source}->[$_];
  +    foreach (@{target_nosource($target,$env)}) {
  +        my($p) = target_source($target,$env)->[$_];
           $p =~ s/.*\///;
           print "# ATTENTION: unpackaged source $_: $p\n";
       }
  @@ -1645,7 +1763,7 @@
   sub build_list ($$) {
       my($pattern, $env) = @_;
       my(@goals,@targets,@keeps,@conflicts,@bonly,$t);
  -    my($name,$select,$r,$i,@vers);
  +    my($name,$select,$r,$i);
       my($todo,%keep);
   
       $todo = search_pattern($pattern, $env);
  @@ -1668,16 +1786,12 @@
           #
           #unless ($env->{upgrade}) {
           #    $i = $env->{installed}->{$name};
  -        #    if (@vers = get_versions($i, sub { 1; })) {
  -        #        $t = chose_source($env, $name, $select, $i, @vers);
  -        #    }
  +        #    $t = chose_source($env, $name, $select, $i, sub { 1; });
           #}
   
           unless ($t) {
               $r = $env->{repository}->{$name};
  -            if (@vers = get_versions($r, sub { 1; })) {
  -                $t = chose_source($env, $name, $select, $r, @vers);
  -            }
  +            $t = chose_source($env, $name, $select, $r, sub { 1; });
           }
   
           if ($t) {
  @@ -1827,13 +1941,12 @@
   # then map the result to --define command line arguments
   # suitable for rpm
   #
  -sub make_defines ($$$$$) {
  -    my($old, $new, $def, $c, $isgoal) = @_;
  +sub make_defines ($$$$) {
  +    my($old, $new, $def, $c) = @_;
       my($with);
   
       $old = {} unless $old;
       $def = {} unless $def;
  -    $new = {} unless $isgoal;
   
       #
       # override old parameters with new parameters
  @@ -1870,7 +1983,7 @@
   sub print_list1 ([EMAIL PROTECTED]) {
       my($list,$c,$uncond,$with,$ignore) = @_;
       my($spkg,$bpkg,$ppkg);
  -    my($opt);
  +    my($mywith, $opt);
       my($cmd1, $cmd2, $mark);
   
       $mark = '::::';
  @@ -1883,17 +1996,17 @@
           # rebuild binary package IF
           #
           # 'unconditional' option
  +        # OR target is tagged as rebuilding
           # OR there is no binary package
           # OR dependency check found that installed package is not suitable
           # OR existing binary package doesn't satisfy wanted options
           #
           $cmd1 = undef;
  -        if ($uncond || !-f $bpkg ||
  -            !target_suitable(binary_target($_, $bpkg),$with)) {
  +        if ($uncond || $_->{REBUILD} || !-f $bpkg ||
  +            !target_suitable(binary_target($_, $bpkg), $mywith)) {
   
  -            $opt = make_defines($_->{OPTIONS}, $with,
  -                                $_->{DEFOPTS}, $c,
  -                                $_->{GOAL});
  +            $opt = make_defines($_->{OPTIONS}, $mywith,
  +                                $_->{DEFOPTS}, $c);
   
               #
               # proxy packages are rebuilt from their maste
  @@ -2092,7 +2205,6 @@
   $repository     = get_index(
                       $url.'00INDEX.rdf',
                       $opt_f,
  -                    ($opt_W ? undef : \%with),
                       $opt_X,
                       $config->{platform},
                       $installed);
  @@ -2114,8 +2226,7 @@
       sourceonly => ($opt_u ||
                      $opt_U ||
                      $opt_z ||
  -                   $opt_Z ||
  -                   scalar(%with) > 0 )
  +                   $opt_Z)
   };
   
   if ($opt_L) {
  @@ -2133,12 +2244,16 @@
           print_status($installed,{},$list,$bonly,$clist);
       } else {
           if (@{$env->{fatal}}) {
  -            die "FATAL errors occured while building:\n",
  +            die "FATAL: errors occured while building:\n",
                   join (',', @{$env->{fatal}}),
                   "\n";
           }
   
  -        print_list1($list,$config,$opt_a || $opt_u || $opt_U,\%with,$opt_i);
  +        print_list1($list,
  +                    $config,
  +                    $opt_a || $opt_u || $opt_U,
  +                    $env->{with},
  +                    $opt_i);
           print_list2($bonly,$config) unless $opt_K;
       }
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/openpkg-tool/openpkg-index.pl
  ============================================================================
  $ cvs diff -u -r1.11.2.3 -r1.11.2.4 openpkg-index.pl
  --- openpkg-src/openpkg-tool/openpkg-index.pl 19 Mar 2003 10:46:14 -0000      
1.11.2.3
  +++ openpkg-src/openpkg-tool/openpkg-index.pl 11 Jun 2003 14:47:42 -0000      
1.11.2.4
  @@ -126,7 +126,8 @@
   sub vsub ($$) {
       my($var,$v) = @_;
   
  -    $v =~ s/\%\{([^}]+)\}/exists $var->{$1} ? $var->{$1} : '%{'.$1.'}'/emg;
  +    $v =~ s/\%\{([^}]+)\}/
  +        exists $var->{$1} ? $var->{$1} : '%{'.$1.'}'/emg;
   
       return $v;
   }
  @@ -197,7 +198,7 @@
       my($s,$ovar) = @_;
       my(%evar,%var);
       my(@term, $term);
  -    my(%attr);
  +    my(%attr,%avar);
       my($l, $v, $cond, $d, $p);
       my($re,@defs);
   
  @@ -251,7 +252,7 @@
       %var  = ();
       $cond = '';
       foreach $l (split(/\n/, $s)) {
  -        $v = vsub(\%var,$l);
  +        $v = vsub(\%avar, vsub(\%var, $l));
   
           if (($p) = $v =~ /^\#if\s+(.*?)\s*$/) {
               #
  @@ -360,6 +361,7 @@
               # store attribute=value for current condition
               #
               push @{$attr{$1}->{$cond}}, commasep($1,$2);
  +            $avar{lc($1)} = $2 if $cond eq '';
           }
       }
   
  @@ -972,11 +974,15 @@
   
   xml_head($fh, $opt_r);
   foreach $prefix (@ARGV) {
  -    die "FATAL: $prefix is not a directory\n" unless -d $prefix;
  -    if ($opt_i) {
  -        $list = list_rpmdir($prefix);
  +    if (-d $prefix) {
  +        if ($opt_i) {
  +            $list = list_rpmdir($prefix);
  +        } else {
  +            $list = list_specdir($prefix);
  +        }
       } else {
  -        $list = list_specdir($prefix);
  +        $list = [ $prefix ];
  +        $prefix = dirname($prefix);
       }
       write_index($fh, $prefix, $opt_r, $opt_p, $list, $opt_C ? \%cache : undef);
   }
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/openpkg-tool/openpkg-tool.spec
  ============================================================================
  $ cvs diff -u -r1.27.2.8 -r1.27.2.9 openpkg-tool.spec
  --- openpkg-src/openpkg-tool/openpkg-tool.spec        21 Mar 2003 14:49:14 -0000     
 1.27.2.8
  +++ openpkg-src/openpkg-tool/openpkg-tool.spec        11 Jun 2003 14:47:42 -0000     
 1.27.2.9
  @@ -32,8 +32,8 @@
   Distribution: OpenPKG [PLUS]
   Group:        Bootstrapping
   License:      GPL
  -Version:      1.20030321
  -Release:      1.20030321
  +Version:      1.20030611
  +Release:      1.20030611
   
   #   list of sources
   Source0:      openpkg.sh
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/openpkg-tool/openpkg.1
  ============================================================================
  $ cvs diff -u -r1.4.2.1 -r1.4.2.2 openpkg.1
  --- openpkg-src/openpkg-tool/openpkg.1        19 Mar 2003 10:46:14 -0000      1.4.2.1
  +++ openpkg-src/openpkg-tool/openpkg.1        11 Jun 2003 14:47:42 -0000      1.4.2.2
  @@ -129,7 +129,7 @@
   .\" ========================================================================
   .\"
   .IX Title "OPENPKG 1"
  -.TH OPENPKG 1 "2003-02-28" "openpkg-tool" "OpenPKG Maintainance"
  +.TH OPENPKG 1 "2003-04-25" "openpkg-tool" "OpenPKG Maintainance"
   .SH "NAME"
   \&\fBopenpkg\fR \- \fBOpenPKG\fR maintainance utility
   .SH "VERSION"
  @@ -175,7 +175,7 @@
   .SH "DESCRIPTION"
   .IX Header "DESCRIPTION"
   \&\fBopenpkg\fR is a frontend utility for maintaining an \fBOpenPKG\fR instance.
  -It currenty provides indexing of \s-1RPM\s0 files (\fBopenpkg index\fR) and
  +It currently provides indexing of \s-1RPM\s0 files (\fBopenpkg index\fR) and
   automated recursive from-scratch installation and updating of existing
   \&\s-1RPM\s0 packages (\fBopenpkg build\fR).
   .SH "COMMANDS"
  @@ -369,12 +369,15 @@
   are matched.
   .IP "\fB\-D\fR\fIvar\fR=\fIval\fR" 4
   .IX Item "-Dvar=val"
  -Specify configuration options for all selected packages. This can be
  -either \fB\-D\fR\f(CW\*(C`with_\*(C'\fR\fIxxx\fR\f(CW\*(C`=\*(C'\fR\fIyyy\fR or 
just \fB\-D\fR\f(CW\*(C`with_\*(C'\fR\fIxxx\fR, the
  -latter is equivalent to a 
\fB\-D\fR\f(CW\*(C`with_\*(C'\fR\fIxxx\fR\f(CW\*(C`=\*(C'\fR\f(CW\*(C`yes\*(C'\fR. The 
parameters
  +Specify configuration options for selected packages. This can be
  +either \fB\-D\fR\fIwith_xxx\fR=\fIyyy\fR or just \fB\-D\fR\fIwith_xxx\fR, the
  +latter is equivalent to a \fB\-D\fR\fIwith_xxx\fR=\fIyes\fR. The parameters
   are matched against selected packages that are already installed. If
  -they do indicate a change the package is rebuild. There can be multiple
  +they do indicate a change, the package is rebuild. There can be multiple
   \&\fB\-D\fR options.
  +.Sp
  +If the option name is prefixed with a package name followed by two colons
  +then it applies only to the specified package. E.g. 
\fB\-D\fR\fIgcc::with_binutils\fR.
   .IP "\fB\-E\fR \fIname\fR" 4
   .IX Item "-E name"
   Ignore a package with the specified \fIname\fR. This can be used to avoid
  @@ .
  patch -p0 <<'@@ .'
  Index: openpkg-src/openpkg-tool/openpkg.pod
  ============================================================================
  $ cvs diff -u -r1.10.2.3 -r1.10.2.4 openpkg.pod
  --- openpkg-src/openpkg-tool/openpkg.pod      19 Mar 2003 10:46:14 -0000      
1.10.2.3
  +++ openpkg-src/openpkg-tool/openpkg.pod      11 Jun 2003 14:47:42 -0000      
1.10.2.4
  @@ -75,7 +75,7 @@
   =head1 DESCRIPTION
   
   B<openpkg> is a frontend utility for maintaining an B<OpenPKG> instance.
  -It currenty provides indexing of RPM files (B<openpkg index>) and
  +It currently provides indexing of RPM files (B<openpkg index>) and
   automated recursive from-scratch installation and updating of existing
   RPM packages (B<openpkg build>).
   
  @@ -312,12 +312,15 @@
   
   =item B<-D>I<var>=I<val>
   
  -Specify configuration options for all selected packages. This can be
  -either B<-D>C<with_>I<xxx>C<=>I<yyy> or just B<-D>C<with_>I<xxx>, the
  -latter is equivalent to a B<-D>C<with_>I<xxx>C<=>C<yes>. The parameters
  +Specify configuration options for selected packages. This can be
  +either B<-D>I<with_xxx>=I<yyy> or just B<-D>I<with_xxx>, the
  +latter is equivalent to a B<-D>I<with_xxx>=I<yes>. The parameters
   are matched against selected packages that are already installed. If
  -they do indicate a change the package is rebuild. There can be multiple
  +they do indicate a change, the package is rebuild. There can be multiple
   B<-D> options.
  +
  +If the option name is prefixed with a package name followed by two colons
  +then it applies only to the specified package. E.g. B<-D>I<gcc::with_binutils>.
   
   =item B<-E> I<name>
   
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to