summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-10-21 18:41:43 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-10-21 22:05:42 +0200
commit16765d553233e50b326456393108729b1f3828bf (patch)
tree66b695fe8595d0212723267eeb775b4dc234dd63 /scripts
parent4411a55ec9a131619e8e8f33c2fe2b8d3da21ee2 (diff)
downloadaur-16765d553233e50b326456393108729b1f3828bf.tar.gz
aur-16765d553233e50b326456393108729b1f3828bf.tar.xz
Track providers in the official repositories
Maintain a list of virtual provisions of packages from the official binary package repositories. The list can be updated using the aurblup script, e.g. via a cronjob. This allows for adding proper links to package dependencies: If an AUR package depends on a package from the official repositories (or on a name provided by a package from the official repositories), add a link to the corresponding archweb package details page. If an AUR package depends on another AUR package (or on a name provided by another AUR package), add a link to the corresponding aurweb package details page. Otherwise, just display the name and do not add a link at all. Fixes FS#46549. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/aurblup.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/scripts/aurblup.py b/scripts/aurblup.py
index d6d0c3cd..5397528e 100755
--- a/scripts/aurblup.py
+++ b/scripts/aurblup.py
@@ -18,6 +18,7 @@ sync_dbs = config.get('aurblup', 'sync-dbs').split(' ')
servers = config.get('aurblup', 'servers').split(' ')
blacklist = set()
+providers = set()
h = pyalpm.Handle("/", db_path)
for sync_db in sync_dbs:
@@ -30,6 +31,8 @@ for sync_db in sync_dbs:
for pkg in repo.pkgcache:
blacklist.add(pkg.name)
[blacklist.add(x) for x in pkg.replaces]
+ providers.add((pkg.name, pkg.name))
+ [providers.add((pkg.name, x)) for x in pkg.provides]
db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
passwd=aur_db_pass, db=aur_db_name,
@@ -44,5 +47,15 @@ for pkg in blacklist.difference(oldblacklist):
for pkg in oldblacklist.difference(blacklist):
cur.execute("DELETE FROM PackageBlacklist WHERE Name = %s", [pkg])
+cur.execute("SELECT Name, Provides FROM OfficialProviders")
+oldproviders = set(cur.fetchall())
+
+for pkg, provides in providers.difference(oldproviders):
+ cur.execute("INSERT INTO OfficialProviders (Name, Provides) "
+ "VALUES (%s, %s)", [pkg, provides])
+for pkg, provides in oldproviders.difference(providers):
+ cur.execute("DELETE FROM OfficialProviders "
+ "WHERE Name = %s AND Provides = %s", [pkg, provides])
+
db.commit()
db.close()