Author: neronus-guest
Date: 2008-05-30 15:04:35 +0000 (Fri, 30 May 2008)
New Revision: 868

Modified:
   udd/src/packages_gatherer.py
   udd/src/setup-db.sql
Log:
* Added GRANTs to setup-db.sql
* modified packages_gatherer to unpack contents of Packages.gz files, so that
  apt_pkg is used - this greatly improved performance


Modified: udd/src/packages_gatherer.py
===================================================================
--- udd/src/packages_gatherer.py        2008-05-30 15:01:18 UTC (rev 867)
+++ udd/src/packages_gatherer.py        2008-05-30 15:04:35 UTC (rev 868)
@@ -1,11 +1,12 @@
 #/usr/bin/env python
-# Last-Modified: <Thu May 29 21:00:51 2008>
+# Last-Modified: <Fri May 30 15:03:14 2008>
 
 import debian_bundle.deb822
 import gzip
 import os
 import sys
 import aux
+import tempfile
 from aux import ConfigException
 
 # A mapping from the architecture names to architecture IDs
@@ -59,7 +60,7 @@
     raise ConfigException, "Configuration error in " + cfg_path +": " + 
e.message
 
   if not src_name in config:
-    raise ConfigException, "Source %s not specified in " + cfg_path
+    raise ConfigException, "Source %s not specified in %s" %(src_name, 
cfg_path)
   src_cfg = config[src_name]
 
   if not 'directory' in src_cfg:
@@ -101,11 +102,16 @@
       path = os.path.join(src_cfg['directory'], part, 'binary-' + arch, 
'Packages.gz')
       try:
        aux.print_debug("Reading file " + path)
+       # Copy content from gzipped file to temporary file, so that apt_pkg is
+       # used by debian_bundle
+       tmp = tempfile.NamedTemporaryFile()
        file = gzip.open(path)
-       lines = aux.BufferedLineReader(file, 1024*1024*4)
+       tmp.write(file.read())
+       file.close()
+       tmp.seek(0)
        aux.print_debug("Importing from " + path)
-       import_packages(conn, lines)
-       file.close()
+       import_packages(conn, open(tmp.name))
+       tmp.close()
       except IOError, (e, message):
        print "Could not read packages from %s: %s" % (path, message)
 

Modified: udd/src/setup-db.sql
===================================================================
--- udd/src/setup-db.sql        2008-05-30 15:01:18 UTC (rev 867)
+++ udd/src/setup-db.sql        2008-05-30 15:04:35 UTC (rev 868)
@@ -1,4 +1,4 @@
-CREATE TABLE pkgs (pkg_id serial, name text, distr_id int, arch_id int, 
version text, sec_id int);
+CREATE TABLE pkgs (pkg_id serial, name text, distr_id int, arch_id int, 
version text, src_id int);
 CREATE TABLE sources (src_id serial, name text, upload_date timestamp, 
uploader_key int, maintainer int, build_archs int, version text, distr_id int);
 CREATE TABLE distr_ids (distr_id serial, name text);
 CREATE TABLE arch_ids (arch_id serial, name text);


_______________________________________________
Collab-qa-commits mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/collab-qa-commits

Reply via email to