diff options
author | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-02-04 22:32:50 -0500 |
---|---|---|
committer | Luke Shumaker <lukeshu@sbcglobal.net> | 2017-02-04 22:32:50 -0500 |
commit | 8e742b884e38d15b874cb506d8674b46c72ca960 (patch) | |
tree | 1dc0bc9072de5e217b6e478a5fd298473046972d /devel | |
parent | 58fc4756e9822d39f224a8773209e306349146e0 (diff) | |
parent | ea3160d4149a18cb070bec788d57fd6c8ec0da84 (diff) |
Merge branch 'archweb-generic' into lukeshu/netbootlukeshu/netboot
Diffstat (limited to 'devel')
-rw-r--r-- | devel/management/commands/reporead.py | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index 7b963c28..c97c2384 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 @@ -401,10 +402,19 @@ def db_update(archname, reponame, pkgs, force=False): with transaction.atomic(): populate_pkg(dbpkg, pkg, timestamp=timestamp) Update.objects.log_update(None, dbpkg) - prel = PackageRelation(pkgbase=dbpkg.pkgbase, - user=dbpkg.packager, - type=PackageRelation.MAINTAINER) - prel.save() + + if not Package.objects.filter( + pkgname=pkg.name).exclude(id=dbpkg.id).exists(): + if not User.objects.filter( + package_relations__pkgbase=dbpkg.pkgbase, + package_relations__type=PackageRelation.MAINTAINER + ).exists(): + packager = finder.find(pkg.packager) + if packager: + prel = PackageRelation(pkgbase=dbpkg.pkgbase, + user=packager, + type=PackageRelation.MAINTAINER) + prel.save() except IntegrityError: |