diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2017-01-01 15:42:44 +0100 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2017-01-01 15:42:44 +0100 |
commit | a66f5cc34821f4094122b77bc06d293a8aaf176f (patch) | |
tree | 96bdc1de5ccb987d87c7d9086df9dfb9f0636f73 | |
parent | 4bf82a6369750e957ca7feb7972ea2657f87068c (diff) |
reporead: Only try to add maintainer if none exists
New split packages and packages added to testing add a new package to
the db but with the same pkgbase, so the same package relations apply to
both of them.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rw-r--r-- | devel/management/commands/reporead.py | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index 3ebd45c4..08853a32 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -30,6 +30,7 @@ from django.core.management.base import BaseCommand, CommandError from django.db import connections, router, transaction from django.db.utils import IntegrityError from django.utils.timezone import now +from django.contrib.auth.models import User from devel.utils import UserFinder from main.models import Arch, Package, PackageFile, Repo @@ -397,12 +398,16 @@ def db_update(archname, reponame, pkgs, force=False): populate_pkg(dbpkg, pkg, timestamp=timestamp) Update.objects.log_update(None, dbpkg) - packager = finder.find(pkg.packager) - if packager: - prel = PackageRelation(pkgbase=dbpkg.pkgbase, - user=packager, - type=PackageRelation.MAINTAINER) - prel.save() + maintainers = User.objects.filter( + package_relations__pkgbase=dbpkg.pkgbase, + package_relations__type=PackageRelation.MAINTAINER) + if not maintainers: + packager = finder.find(pkg.packager) + if packager: + prel = PackageRelation(pkgbase=dbpkg.pkgbase, + user=packager, + type=PackageRelation.MAINTAINER) + prel.save() except IntegrityError: |