Пример #1
0
 /**
  * Parse the content of all RPM repository for Provides
  *
  * @param TableRpm      $rpmtable   the table to write to
  * @param TableRpmRepo  $rpmrepo    the table to read from
  * @param Array         $crit       array for repo selection
  *
  * @return integer number of parsed line
  */
 public static function readProvides(TablePackagist $pkgtable, TableRpmRepo $rpmrepo, array $crit)
 {
     $tot = 0;
     $result = array();
     foreach ($rpmrepo->request($crit) as $row) {
         self::readOneProv($rpmrepo, $row, $result);
     }
     if (count($result)) {
         $pkgtable->truncate();
         foreach ($result as $rpm => $pkg) {
             $input = array('rpmname' => $rpm, 'pkgname' => $pkg);
             try {
                 if ($pkgtable->add($input)) {
                     $tot++;
                 }
             } catch (Exception $e) {
                 # ignore duplicate key for now
                 # ex pimple/pimple provided by php-pimple1 and php-pimple
             }
         }
     }
     self::log("Write {$tot} packagist packages");
     return $tot;
 }