diff options
author | Lukas Fleischer <lfleischer@archlinux.org> | 2016-05-17 19:07:41 +0200 |
---|---|---|
committer | Lukas Fleischer <lfleischer@archlinux.org> | 2016-05-18 09:22:44 +0200 |
commit | d273ee5eb20ecb6e97d5d6cd8a1f493e3652b584 (patch) | |
tree | b01ea13779a418a2b62b51e5c028e976951a1a8d /git-interface | |
parent | b2e97cdd1ee804468b2dd601eafda9574c05a3a7 (diff) | |
download | aurweb-d273ee5eb20ecb6e97d5d6cd8a1f493e3652b584.tar.xz |
Use the official provider list to detect duplicates
Instead of automatically adding packages from the official binary
repositories to the package blacklist, use the official provider list to
prevent users from uploading duplicates.
This does not only result in reduced disk usage but also has a nice
visible side effect. The error messages printed by the update hook now
look like
error: package already provided by [community]: powerline-fonts
instead of
error: package is blacklisted: powerline-fonts
which was confusing to most end users.
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface')
-rwxr-xr-x | git-interface/git-update.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py index e54e0e6..2c24e72 100755 --- a/git-interface/git-update.py +++ b/git-interface/git-update.py @@ -331,12 +331,18 @@ pkgbase_id = cur.fetchone()[0] if cur.rowcount == 1 else 0 cur.execute("SELECT Name FROM PackageBlacklist") blacklist = [row[0] for row in cur.fetchall()] +cur.execute("SELECT Name, Repo FROM OfficialProviders") +providers = dict(cur.fetchall()) + for pkgname in srcinfo.utils.get_package_names(metadata): pkginfo = srcinfo.utils.get_merged_package(pkgname, metadata) pkgname = pkginfo['pkgname'] if pkgname in blacklist and not privileged: die('package is blacklisted: {:s}'.format(pkgname)) + if pkgname in providers and not privileged: + repo = providers[pkgname] + die('package already provided by [{:s}]: {:s}'.format(repo, pkgname)) cur.execute("SELECT COUNT(*) FROM Packages WHERE Name = %s AND " + "PackageBaseID <> %s", [pkgname, pkgbase_id]) |