/[dehs]/trunk/dehs_pg.php
ViewVC logotype

Diff of /trunk/dehs_pg.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 123 by atomo64-guest, Mon Mar 24 17:51:34 2008 UTC revision 131 by atomo64-guest, Fri Apr 18 23:47:44 2008 UTC
# Line 185  function db_add($initial='') { Line 185  function db_add($initial='') {
185              $filename=$dirs['sources_dir'] . "/$dist/$section/Sources.gz";              $filename=$dirs['sources_dir'] . "/$dist/$section/Sources.gz";
186              print "\nI'm parsing $dist/$section => Sources.gz\n";              print "\nI'm parsing $dist/$section => Sources.gz\n";
187              # 1 Pacchetto - 2 versione - 3 np - 4 Directory - 5 md5              # 1 Pacchetto - 2 versione - 3 np - 4 Directory - 5 md5
188              $regexp="/Package:\s($initial.*)[^a]Binary:\s(.+)[^a]Version:\s(\d+:)?(.+)[^a]Priority.+Maintainer:.+<([^>]+)>[^a].+Directory:\s(.+)[^a]Files:.+\s(\S+)\s(\d+)\s" . '\1\S+' . "\.diff\.gz[^a](Uploaders:\s(.+)[^a])?/Ssi";              $regexp="/Package:\s($initial.*)[^a]Binary:\s(.+)[^a]Version:\s(\d+:)?(.+)[^a]Priority.+Maintainer:.+<([^>]+)>[^a].+Directory:\s(.+)[^a]Files:.+\s(\S{32})\s(\d+)\s" . '\1\S+' . "\.diff\.gz[^a](Uploaders:\s(.+)[^a])?(Dm-Upload-Allowed:\s(.+)[^a])?(Homepage:\s(.+)[^a])?(Vcs-Browser:\s(.+)[^a])?(Vcs-([A-Z][a-z]+):\s(.+)[^a])?(Checksums-\S+:\s(.+)[^a])?/Ssi";
189              $zp = gzopen($filename, "r") or die_status("Could not open $filename");              $zp = gzopen($filename, "r") or die_status("Could not open $filename");
190              $extracted=tempnam("/tmp/", "$dist_$section_Sources");              $extracted=tempnam("/tmp/", "$dist_$section_Sources");
191              exec("gzip -c -d $filename > $extracted");              exec("gzip -c -d $filename > $extracted");
# Line 208  function db_add($initial='') { Line 208  function db_add($initial='') {
208                              $matches[10]=pg_escape_string($matches[10]);                              $matches[10]=pg_escape_string($matches[10]);
209                          }                          }
210                          @pg_exec($db,"INSERT INTO pkgs_atsrc (name,dist) VALUES ('$matches[1]','$dist')") OR die_status("Temp table pkgs_atsrc query error");                          @pg_exec($db,"INSERT INTO pkgs_atsrc (name,dist) VALUES ('$matches[1]','$dist')") OR die_status("Temp table pkgs_atsrc query error");
211                          $rst=@pg_exec($db, "INSERT INTO pkgs (name,version,dversionmangled,maint,dir,md5_atsource,bytes,dist,section,uploaders) VALUES ('$matches[1]','$matches[4]','$matches[4]','$matches[5]','$matches[6]','$matches[7]','$matches[8]','$dist','$section','$matches[10]')");                          $rst=@pg_exec($db, "INSERT INTO pkgs (name,version,dversionmangled,maint,dir,md5_atsource,bytes,dist,section,uploaders,homepage,vcs_browser,vcs_type,vcs) VALUES ('$matches[1]','$matches[4]','$matches[4]','$matches[5]','$matches[6]','$matches[7]','$matches[8]','$dist','$section','$matches[10]','$matches[14]','$matches[16]','$matches[18]','$matches[19]')");
212                          if (!$rst) {                          if (!$rst) {
213                              $rsql=pg_exec($db, "SELECT pkgs.version FROM pkgs WHERE name='$matches[1]' AND dist='$dist';");                              $rsql=pg_exec($db, "SELECT pkgs.version FROM pkgs WHERE name='$matches[1]' AND dist='$dist';");
214                              $version = $matches[4]; // just for safety                              $version = $matches[4]; // just for safety
# Line 222  function db_add($initial='') { Line 222  function db_add($initial='') {
222                                  // and reset wwiz_type                                  // and reset wwiz_type
223                                  $extra = ",wwiz_type=NULL";                                  $extra = ",wwiz_type=NULL";
224                              }                              }
225                              $rst=@pg_exec($db, "UPDATE pkgs SET name='$matches[1]',version='$matches[4]'$extra,maint='$matches[5]',dir='$matches[6]',md5_atsource='$matches[7]',bytes='$matches[8]',dist='$dist',section='$section',uploaders='$matches[10]' WHERE name='$matches[1]' AND dist='$dist'") OR die_status("\nDb adding error =>" . pg_last_error() . "\n");                              $rst=@pg_exec($db, "UPDATE pkgs SET name='$matches[1]',version='$matches[4]'$extra,maint='$matches[5]',dir='$matches[6]',md5_atsource='$matches[7]',bytes='$matches[8]',dist='$dist',section='$section',uploaders='$matches[10]',homepage='$matches[14]',vcs_browser='$matches[16]',vcs_type='$matches[18]',vcs='$matches[19]' WHERE name='$matches[1]' AND dist='$dist'") OR die_status("\nDb adding error =>" . pg_last_error() . "\n");
226                          }                          }
227                          $bin_names=split(",", $matches[2]);                          $bin_names=split(",", $matches[2]);
228                          foreach ($bin_names as $bin_name) {                          foreach ($bin_names as $bin_name) {
# Line 422  function db_popcon($initial='') { Line 422  function db_popcon($initial='') {
422      $filename=$dirs[popcon_dir] . "/popcon.db";      $filename=$dirs[popcon_dir] . "/popcon.db";
423      $popcon_db = dba_open("$filename", 'r-', 'db4');      $popcon_db = dba_open("$filename", 'r-', 'db4');
424    
425      $rsql = pg_exec($dbconn, "SELECT name FROM pkgs");      $rsql = pg_exec($db, "SELECT name FROM pkgs");
426    
427      while ($res_array=pg_fetch_array($rsql)) {      while ($res_array=pg_fetch_array($rsql)) {
428          $package = $res_array['name'];          $package = $res_array['name'];
429    
430          if (!dba_exists('p:' .  $package)) {          if (!dba_exists('si:' .  $package, $popcon_db)) {
431              continue;              continue;
432          }          }
433    
434          $inst = dba_fetch("pi:$package", $popcon_db);          $inst = dba_fetch("si:$package", $popcon_db);
435          $vote = dba_fetch("pv:$package", $popcon_db);          $vote = dba_fetch("sv:$package", $popcon_db);
436    
437          @pg_exec($db, "UPDATE pkgs SET pop_inst='$inst',pop_vote='$vote' WHERE name='$package'");          @pg_exec($db, "UPDATE pkgs SET pop_inst='$inst',pop_vote='$vote' WHERE name='$package'");
438      }      }
# Line 443  function db_popcon($initial='') { Line 443  function db_popcon($initial='') {
443  function dl_popcon() {  function dl_popcon() {
444      global $dirs,$dbconn;      global $dirs,$dbconn;
445    
446      $localtempfile=$dirs[popcon_dir] . "/popcon.db.new";      $localtempdir=$dirs[popcon_dir] . "/new";
447        dir_ctrl($localtempdir);
448    
449      $localfile=$dirs[popcon_dir] . "/popcon.db";      $localfile=$dirs[popcon_dir] . "/popcon.db";
450      $remotefile='http://qa.debian.org/data/popcon/popcon.db';      $remotefile='http://qa.debian.org/data/popcon/popcon.db';
451    
452      $return = 0;      $return = 0;
453      $output = null;      $output = null;
454      exec('/usr/bin/wget -qNc -O'.escapeshellarg($localtempfile).' ' . escapeshellarg($remotefile), $output, $return);      exec('cd ' . escapeshellarg($localtempdir) . ' && ' .
455             '/usr/bin/wget -qNc ' . escapeshellarg($remotefile), $output, $return);
456    
457      if ($return != 0) {      if ($return != 0) {
458          echo __FUNCTION__ . "wget exited with status $return!\n";          echo __FUNCTION__ . "wget exited with status $return!\n";
459          return false;          return false;
460      }      }
461    
462      return copy($localtempfile, $localfile);      return copy($localtempdir . '/popcon.db', $localfile);
463  }  }
464  function is_updated ($up_vers,$debian_vers, $dversionAsIs = false) {  function is_updated ($up_vers,$debian_vers, $dversionAsIs = false) {
465      if ($up_vers=='') return 1;      if ($up_vers=='') return 1;

Legend:
Removed from v.123  
changed lines
  Added in v.131

  ViewVC Help
Powered by ViewVC 1.1.5