summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-09-26 11:09:35 -0500
committerDan McGee <dan@archlinux.org>2009-09-26 11:09:35 -0500
commitc272173d8f5afc96e3230dae796bed2f8d1a0e89 (patch)
tree3749fc4541e96dc59135bce921c236073a89a625 /scripts
parentd47f4da6f89577fa1b11f2cf542aec49fbaef921 (diff)
reporead: do all DB updates in one transaction
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/reporead.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/scripts/reporead.py b/scripts/reporead.py
index 361d0dbb..daed1f0b 100755
--- a/scripts/reporead.py
+++ b/scripts/reporead.py
@@ -39,11 +39,14 @@ from datetime import datetime
from django.core.management import setup_environ
# mung the sys path to get to django root dir, no matter
# where we are called from
+# TODO this is so fricking ugly
archweb_app_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
os.chdir(archweb_app_path)
sys.path[0] = archweb_app_path
import settings
setup_environ(settings)
+# the transaction import must be below where we set up our db stuff...
+from django.db import transaction
from cStringIO import StringIO
from logging import WARNING,INFO,DEBUG
from main.models import Arch, Package, Repo
@@ -335,6 +338,7 @@ def parse_repo(repopath):
return pkgs
+@transaction.commit_on_success
def main(argv=None):
"""
Parses repo.db.tar.gz file and returns exit status.