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:   26-Jun-2003 14:04:43
  Branch: HEAD                             Handle: 2003062613044300

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

  Log:
    parse installed dependencies and rely on these to trigger updates to
    reverse dependencies

  Summary:
    Revision    Changes     Path
    1.87        +41 -23     openpkg-src/openpkg-tool/openpkg-build.pl
  ____________________________________________________________________________

  patch -p0 <<'@@ .'
  Index: openpkg-src/openpkg-tool/openpkg-build.pl
  ============================================================================
  $ cvs diff -u -r1.86 -r1.87 openpkg-build.pl
  --- openpkg-src/openpkg-tool/openpkg-build.pl 26 Jun 2003 11:00:38 -0000      1.86
  +++ openpkg-src/openpkg-tool/openpkg-build.pl 26 Jun 2003 12:04:43 -0000      1.87
  @@ -420,27 +420,28 @@
   #
   sub get_installed () {
       my(%map);
  -    my(@l) = run("$RPM --provides -qa");
  -    my($p);
  +    my(@l,$p);
       my($nam,$val,%options);
  -    my($vs,$rec,@provides);
  +    my($vs,$rec,@list);
       my($name,$version,$release);
  +    my($req);
   
  -    @provides = ();
  +    @l = run("$RPM --provides -qa");
  +    @list = ();
       foreach (@l) {
  -        $p = parse_provides($_);
  +        next unless $p = parse_provides($_);
   
           # is this an option ?
           if (defined $p->{with}) {
               $options{$p->{prefix}}->{$p->{with}} = $p->{version};
  -            push @provides, $p;
  +            push @list, $p;
               next;
           }
   
           # is this a virtual target ?
           $vs = vs($p);
           if ($vs eq '') {
  -            push @provides,$p;
  +            push @list,$p;
               next;
           }
   
  @@ -448,7 +449,7 @@
           $version = defined $p->{version} ? $p->{version} : '*';
           $release = defined $p->{release} ? $p->{release} : '*';
   
  -        push(@provides, {
  +        push(@list, {
               name    => $name,
               version => $version,
               release => $release
  @@ -459,18 +460,20 @@
               name       => $name,
               version    => $version,
               release    => $release,
  -            PROXY      => $p->{proxy}
  +            PROXY      => $p->{proxy},
  +            depends    => [],
  +            keeps      => []
           };
   
  -        foreach (@provides) {
  +        foreach (@list) {
               push @{$map{$_->{name}}->{vs($_)}}, $rec;
           }
   
  -        @provides = ();
  +        @list = ();
       }
   
  -    if (@provides) {
  -        print "# ATTENTION: ",scalar(@provides)," froods found\n"
  +    if (@list) {
  +        print "# ATTENTION: ",scalar(@list)," froods found\n"
       }
   
       #
  @@ -485,6 +488,27 @@
           }
       }
   
  +    @l = run("$RPM --qf '%{NAME} %{VERSION} %{RELEASE}[ .%{REQUIRENAME} 
.%{REQUIREFLAGS:depflags} .%{REQUIREVERSION}]\n' -qa");
  +    @list = ();
  +    foreach (@l) {
  +        ($name,$version,$release,$req) = /^(\S+)\s+(\S+)\s+(\S+)\s*(.*?)\s*$/;
  +        while ($req =~ /\.(\S+)\s+\.(\S*)\s+\.(\S*)/g) {
  +            $p = parse_depends("$1 $2 $3");
  +            next if $p->{name} =~ /^rpmlib\(/;
  +
  +            $vs = vs({ version => $version, release => $release});
  +            $p = { cond => '', value => $p };
  +            foreach $rec (@{$map{$name}->{$vs}}) {
  +                push @{$rec->{depends}}, $p;
  +                push @{$rec->{keeps}}, $p;
  +            }
  +        }
  +    }
  +
  +    if (@list) {
  +        print "# ATTENTION: ",scalar(@list)," fnords found\n"
  +    }
  +
       return \%map;
   }
   
  @@ -496,7 +520,7 @@
       my($env, $i) = @_;
       my($r) = $env->{'repository'};
       my($pkg, %dep, %dlist, %rev);
  -    my(@vers,$t,$t1,$t2,$with,$name);
  +    my(@vers,$t,$t1,$with,$name);
       my($d,$k,%d,$old,%name);
   
       print "# computing reverse dependencies\n";
  @@ -509,21 +533,15 @@
           }
   
           #
  -        # get forward dependencies from repository packages
  -        # but blend in options from installed packages
  +        # get forward dependencies from installed packages
           #
           # dep{a}{b} is true if b depends directly on a
           # dlist{a}  is list of packages that depend on a
           #
  -        @vers = get_versions($r->{$pkg}, sub { 1; });
  +        @vers = get_versions($i->{$pkg}, sub { 1; });
           foreach (@vers) {
  -            foreach $t (@{$r->{$pkg}->{$_}}) {
  +            foreach $t (@{$i->{$pkg}->{$_}}) {
                   $with = get_with($t);
  -                $t2 = find_target($t->{name}, $i);
  -                if ($t2) {
  -                    $with = { %$with };
  -                    override_options($with, get_with($t2), '');
  -                }
                   $d = target_attribute($t, $env, 'depends', $with);
                   $k = target_attribute($t, $env, 'keeps', $with);
                   next unless @$d || @$k;
  @@ .
______________________________________________________________________
The OpenPKG Project                                    www.openpkg.org
CVS Repository Commit List                     [EMAIL PROTECTED]

Reply via email to