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:   15-Jan-2003 13:56:31
  Branch: HEAD                             Handle: 2003011512563100

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

  Log:
    dependency list is now recursive and handles vitual dependencies

  Summary:
    Revision    Changes     Path
    1.35        +57 -11     openpkg-src/openpkg-tool/openpkg-build.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/openpkg-tool/openpkg-build.pl
  ============================================================================
  $ cvs diff -u -r1.34 -r1.35 openpkg-build.pl
  --- openpkg-src/openpkg-tool/openpkg-build.pl 15 Jan 2003 12:15:46 -0000      1.34
  +++ openpkg-src/openpkg-tool/openpkg-build.pl 15 Jan 2003 12:56:31 -0000      1.35
  @@ -401,8 +401,9 @@
   # compute list of package names from dependency list
   #
   sub depends2pkglist ($) {
  -    my($deps) = @_;
  -    return map { $_->{name} } @$deps;
  +    my($t) = @_;
  +    my(%d) = unique_map($t->{depends}, $t->{keeps});
  +    return (keys %d);
   }
   
   #
  @@ -482,8 +483,8 @@
           foreach (@vers) {
               foreach $t (@{$r->{$pkg}->{$_}}) {
                   next unless $i->{$t->{name}};
  -                next unless $t->{depends};
  -                foreach (depends2pkglist($t->{depends})) {
  +                next unless $t->{depends} || $t->{keeps};
  +                foreach (depends2pkglist($t)) {
                       unless ($dep{$_}{$t->{name}}) {
                           $dep{$_}{$t->{name}} = 1;
                           push @{$dlist{$_}}, $t;
  @@ -1521,17 +1522,62 @@
   
   sub build_deps ($$) {
       my($pattern, $env) = @_;
  -    my($todo);
  +    my($todo,@list,$list,@out);
   
       $todo = search_pattern($pattern, $env);
   
  -    $env->{revdep} = get_revdep($env, $env->{repository});
  +    #
  +    # unfold target names into real targets
  +    #
  +    @list = map {
  +            map {
  +                map {
  +                    $_->{name}
  +                } @$_
  +            } values %{$env->{repository}->{$_}}
  +        } @$todo;
  +
  +    #
  +    # also add target name
  +    #
  +    push @list, @$todo;
  +
  +    #
  +    # strip duplicates
  +    #
  +    @list = keys %{ { map { $_ => 1 } @list } };
  +
  +    #
  +    # cache reverse dependencies
  +    #
  +    unless ($env->{revdep}) {
  +        $env->{revdep} = get_revdep($env, $env->{repository});
  +    }
   
  -    return [ map {
  -        $env->{revdep}->{$_}
  -        ? ( @{$env->{revdep}->{$_}} )
  -        : ( )
  -    } @$todo ];
  +    #
  +    # map targets into list of dependency names
  +    #
  +    @list = map { $env->{revdep}->{$_}
  +                ? ( @{$env->{revdep}->{$_}} )
  +                : ( )
  +            } @list;
  +
  +    @out = @list;
  +
  +    #
  +    # recurse over dependencies
  +    #
  +    foreach (@list) {
  +
  +        # avoiding cycles
  +        next if $env->{builddeps}->{$_->{name}};
  +        $env->{builddeps}->{$_->{name}} = 1;
  +
  +        $list = build_deps($_->{name}, $env);
  +        push @out, @$list;
  +    }
  +
  +    return \@out;
   }
   
   #######################################################################
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to