home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1998 April / VPR9804A.ISO / TurboLinux / base / compare_comps.pl next >
Encoding:
Perl Script  |  1997-11-16  |  931 b   |  51 lines

  1. #!/usr/bin/perl
  2.  
  3. open(ifp,"find ../RPMS/ -name \"*.i386.rpm\" |");
  4. $pkgyes=0;
  5. $pkgno=0;
  6. while(<ifp>) {
  7.     chop;
  8.     $fullpath=$_;
  9.     @fields=split(/\//,$fullpath);
  10.     $filename=$fields[2];
  11.     @g=split(/-/,$filename);
  12.     $pkgindex=($#g - 2);
  13.     $pkgbasename=$g[0];
  14.     for ($i=1; $i <= $pkgindex;$i++) {
  15.     $pkgbasename .= "-";
  16.     $pkgbasename .= $g[$i];
  17.     }
  18.     $pkgbasename =~ s/\+/\\\+/g;
  19.     $found=0;
  20.     open(cfp,"comps");
  21.     while(<cfp>) {
  22.     chop;
  23.     if ($_ =~ m/$pkgbasename/) {
  24.         $found=1;
  25.     }
  26. #    open(gfp,"grep '$pkgbasename' comps |");
  27. #    $lines=0;
  28. #    while(<gfp>) {
  29. #        $lines++;
  30. #    }
  31. #    close gfp;
  32. #    if ($lines > 0) {
  33. #        $found=1;
  34. #    }
  35.     
  36.     }
  37.     close cfp;
  38.     if (!($found)) {
  39.     print "Not found in comps: [$pkgbasename]\n";
  40.     $pkgno++;
  41.     } else {
  42.     print "FOUND in comps: [$pkgbasename]\n";
  43.     $pkgyes++;
  44.     }
  45. }
  46. close ifp;
  47. print "[$pkgyes] packages ARE in comps\n";
  48. print "[$pkgno] packages are NOT in comps\n";
  49.  
  50.  
  51.