summaryrefslogtreecommitdiffstats
path: root/git-interface/git-update.py
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-08-01 20:14:25 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-08-04 13:04:44 +0200
commit415a2c836df9094ddac555d5ed967ac11e48907e (patch)
treec9dbd1763146ca839d93635170b4a8801e2ec042 /git-interface/git-update.py
parent573715afd9f7e56e34be07f983055f938351d990 (diff)
downloadaur-415a2c836df9094ddac555d5ed967ac11e48907e.tar.gz
aur-415a2c836df9094ddac555d5ed967ac11e48907e.tar.xz
git-update: Notify privileged users of forced uploads
Show a warning when a Trusted User or a developer creates a package that is blacklisted or already provided by an official package. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface/git-update.py')
-rwxr-xr-xgit-interface/git-update.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index 2c24e720..41b38a6c 100755
--- a/git-interface/git-update.py
+++ b/git-interface/git-update.py
@@ -202,6 +202,7 @@ repo = pygit2.Repository(repo_path)
user = os.environ.get("AUR_USER")
pkgbase = os.environ.get("AUR_PKGBASE")
privileged = (os.environ.get("AUR_PRIVILEGED", '0') == '1')
+warn_or_die = warn if privileged else die
if len(sys.argv) == 2 and sys.argv[1] == "restore":
if 'refs/heads/' + pkgbase not in repo.listall_references():
@@ -338,11 +339,11 @@ 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:
+ if pkgname in blacklist:
+ warn_or_die('package is blacklisted: {:s}'.format(pkgname))
+ if pkgname in providers:
repo = providers[pkgname]
- die('package already provided by [{:s}]: {:s}'.format(repo, pkgname))
+ warn_or_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])