diff options
Diffstat (limited to 'devel/management/commands')
-rw-r--r-- | devel/management/commands/pgp_import.py | 2 | ||||
-rw-r--r-- | devel/management/commands/rematch_developers.py | 4 | ||||
-rw-r--r-- | devel/management/commands/reporead.py | 3 | ||||
-rw-r--r-- | devel/management/commands/reporead_inotify.py | 17 |
4 files changed, 14 insertions, 12 deletions
diff --git a/devel/management/commands/pgp_import.py b/devel/management/commands/pgp_import.py index 7a124f77..8eb06d50 100644 --- a/devel/management/commands/pgp_import.py +++ b/devel/management/commands/pgp_import.py @@ -7,7 +7,7 @@ Import keys and signatures from a given GPG keyring. Usage: ./manage.py pgp_import <keyring_path> """ -from collections import namedtuple, OrderedDict +from collections import OrderedDict from datetime import datetime import logging from pytz import utc diff --git a/devel/management/commands/rematch_developers.py b/devel/management/commands/rematch_developers.py index bbb43df0..8636002a 100644 --- a/devel/management/commands/rematch_developers.py +++ b/devel/management/commands/rematch_developers.py @@ -59,7 +59,7 @@ def match_packager(finder): user = finder.find(packager) if user: mapping[packager] = user - logger.debug(" found user %s" % user.username) + logger.debug(" found user %s", user.username) matched_count += 1 for packager_str, user in mapping.items(): @@ -85,7 +85,7 @@ def match_flagrequest(finder): user = finder.find_by_email(user_email) if user: mapping[user_email] = user - logger.debug(" found user %s" % user.username) + logger.debug(" found user %s", user.username) matched_count += 1 for user_email, user in mapping.items(): diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index c97c2384..92d745bd 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -338,7 +338,8 @@ def update_common(archname, reponame, pkgs, sanity_check=True): # necessary to guard against simultaneous updates. with transaction.atomic(): # force the transaction dirty, even though we will only do reads - transaction.set_dirty() + # https://github.com/django/django/blob/3c447b108ac70757001171f7a4791f493880bf5b/docs/releases/1.3.txt#L606 + #transaction.set_dirty() repository = Repo.objects.get(name__iexact=reponame) architecture = Arch.objects.get(name=archname) diff --git a/devel/management/commands/reporead_inotify.py b/devel/management/commands/reporead_inotify.py index 1422ae26..fadcb881 100644 --- a/devel/management/commands/reporead_inotify.py +++ b/devel/management/commands/reporead_inotify.py @@ -35,6 +35,7 @@ logging.basicConfig( stream=sys.stderr) logger = logging.getLogger() + class Command(BaseCommand): help = "Watch database files and run an update when necessary." args = "[path_template]" @@ -73,16 +74,16 @@ class Command(BaseCommand): directories we need to watch for database updates. It then validates and passes these on to the various pyinotify pieces as necessary and finally builds and returns a notifier object.''' - transaction.commit_manually() - arches = Arch.objects.filter(agnostic=False) - repos = Repo.objects.all() - transaction.set_dirty() + with transaction.atomic(): + arches = Arch.objects.filter(agnostic=False) + repos = Repo.objects.all() + arch_path_map = {arch: None for arch in arches} all_paths = set() total_paths = 0 for arch in arches: - combos = ({ 'repo': repo.name.lower(), 'arch': arch.name } - for repo in repos) + combos = ({'repo': repo.name.lower(), 'arch': arch.name} + for repo in repos) # take a python format string and generate all unique combinations # of directories from it; using set() ensures we filter it down paths = {self.path_template % values for values in combos} @@ -97,7 +98,7 @@ class Command(BaseCommand): # template mapped to only one architecture if total_paths != len(all_paths): raise CommandError('path template did not uniquely ' - 'determine architecture for each file') + 'determine architecture for each file') # A proper atomic replacement of the database as done by rsync is type # IN_MOVED_TO. repo-add/remove will finish with a IN_CLOSE_WRITE. @@ -131,7 +132,7 @@ class Database(object): def _start_update_countdown(self): self.update_thread = threading.Timer(self.delay, self.update) logger.info('Starting %.1f second countdown to update %s', - self.delay, self.path) + self.delay, self.path) self.update_thread.start() def queue_for_update(self, mtime): |