summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2008-11-23 01:54:35 -0600
committerDusty Phillips <buchuki@gmail.com>2008-11-25 18:12:14 -0500
commit789b5445cf9b3f2e67911dfd6aee4e836708aa05 (patch)
tree820883d6657871b14d36aa10937aba7e673dd8e3
parent0dbde37b205694d8d86306557e132b2ee8eb9999 (diff)
reporead: force load of package list from database
Rather than load one package at a time and put unnecessary load on the database, load them all at once upfront since we are going to need 99% of them anyway. This shifts the burden of work from the database to the python script itself. Signed-off-by: Dan McGee <dan@archlinux.org>
-rwxr-xr-xscripts/reporead.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/scripts/reporead.py b/scripts/reporead.py
index 54fc3faa..99042014 100755
--- a/scripts/reporead.py
+++ b/scripts/reporead.py
@@ -45,7 +45,7 @@ sys.path[0] = archweb_app_path
import settings
setup_environ(settings)
from cStringIO import StringIO
-from logging import WARNING,INFO
+from logging import WARNING,INFO,DEBUG
from main.models import Arch, Package, Repo
class SomethingFishyException(Exception):
@@ -161,6 +161,10 @@ def db_update(archname, pkgs):
repository = Repo.objects.get(name__iexact=pkgs[0].repo)
architecture = Arch.objects.get(name__iexact=archname)
dbpkgs = Package.objects.filter(arch=architecture, repo=repository)
+ # It makes sense to fully evaluate our DB query now because we will
+ # be using 99% of the objects in our "in both sets" loop. Force eval
+ # by calling len() on the QuerySet.
+ dblist = list(dbpkgs)
now = datetime.now()
# go go set theory!
@@ -291,7 +295,7 @@ def parse_repo(repopath):
if not os.path.exists(repopath):
logger.error("Could not read file %s", repopath)
- logger.info("Reading repo tarfile")
+ logger.info("Reading repo tarfile %s", repopath)
filename = os.path.split(repopath)[1]
rindex = filename.rindex('.db.tar.gz')
reponame = filename[:rindex]