diff options
author | Johannes Löthberg <johannes@kyriasis.com> | 2017-01-02 11:32:40 +0100 |
---|---|---|
committer | Johannes Löthberg <johannes@kyriasis.com> | 2017-01-02 15:05:37 +0100 |
commit | 72ddf3b134a21896f40c94e8a9c7173f4274b7fe (patch) | |
tree | 9ea9633228c64017dde44c7de2e9f292034a032b | |
parent | 174fb4612d72d52f518d5bd23aaecb2f525d45c4 (diff) |
reporead: Check if package exists in other repo before adoptingrelease_2017-01-02
Auto-adoption should only happen on new packages, so rebuilds of
orphaned packages pushed to staging shouldn't cause them to be adopted.
Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
-rw-r--r-- | devel/management/commands/reporead.py | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/devel/management/commands/reporead.py b/devel/management/commands/reporead.py index 08853a32..70526bfd 100644 --- a/devel/management/commands/reporead.py +++ b/devel/management/commands/reporead.py @@ -398,16 +398,18 @@ def db_update(archname, reponame, pkgs, force=False): populate_pkg(dbpkg, pkg, timestamp=timestamp) Update.objects.log_update(None, dbpkg) - 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() + 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: |