summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLukas Fleischer <archlinux@cryptocrack.de>2015-01-08 09:12:25 +0100
committerLukas Fleischer <archlinux@cryptocrack.de>2015-01-08 09:18:40 +0100
commited7fb91f41241f62b22faf355aa0d00b3c980342 (patch)
tree6168d3b129c3c3030a5a47191f5fc4a5229bb85d /scripts
parent492a5db229500337308c2e1d9489729cb5aa579b (diff)
downloadaurweb-ed7fb91f41241f62b22faf355aa0d00b3c980342.tar.xz
git-update.py: Reject blacklisted packages
Reject commits adding packages which are in the official repositories already. Fixes FS#43371. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/git-integration/git-update.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/scripts/git-integration/git-update.py b/scripts/git-integration/git-update.py
index b20c0a2..15a731c 100755
--- a/scripts/git-integration/git-update.py
+++ b/scripts/git-integration/git-update.py
@@ -176,6 +176,14 @@ walker = repo.walk(sha1_new, pygit2.GIT_SORT_TOPOLOGICAL)
if sha1_old != "0000000000000000000000000000000000000000":
walker.hide(sha1_old)
+db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
+ passwd=aur_db_pass, db=aur_db_name,
+ unix_socket=aur_db_socket, buffered=True)
+cur = db.cursor()
+
+cur.execute("SELECT Name FROM PackageBlacklist")
+blacklist = [row[0] for row in cur.fetchall()]
+
for commit in walker:
if not '.SRCINFO' in commit.tree:
die_commit("missing .SRCINFO", commit.id)
@@ -211,6 +219,10 @@ for commit in walker:
die_commit('invalid package name: %s' % (pkginfo['pkgname']),
commit.id)
+ if pkginfo['pkgname'] in blacklist:
+ die_commit('package is blacklisted: %s' % (pkginfo['pkgname']),
+ commit.id)
+
if not re.match(r'(?:http|ftp)s?://.*', pkginfo['url']):
die_commit('invalid URL: %s' % (pkginfo['url']), commit.id)
@@ -223,11 +235,8 @@ srcinfo_raw = repo[repo[sha1_new].tree['.SRCINFO'].id].data.decode()
srcinfo_raw = srcinfo_raw.split('\n')
srcinfo = aurinfo.ParseAurinfoFromIterable(srcinfo_raw)
-db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
- passwd=aur_db_pass, db=aur_db_name,
- unix_socket=aur_db_socket, buffered=True)
-cur = db.cursor()
save_srcinfo(srcinfo, db, cur, user)
+
db.close()
with open(git_dir + '/description', 'w') as f: