summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2016-05-17 19:03:39 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2016-05-18 09:22:44 +0200
commitb2e97cdd1ee804468b2dd601eafda9574c05a3a7 (patch)
treed46b255a6a6bfb60e24c92eda609fe584ba88794
parent1e5578b92df39579e590bbfd4bd01ebb42eaafe0 (diff)
downloadaurweb-b2e97cdd1ee804468b2dd601eafda9574c05a3a7.tar.xz
Add repository information to official providers
When updating the list of packages provided by the official repositories, also save the repository names.
-rw-r--r--schema/aur-schema.sql1
-rwxr-xr-xscripts/aurblup.py8
-rw-r--r--upgrading/4.3.0.txt6
3 files changed, 13 insertions, 2 deletions
diff --git a/schema/aur-schema.sql b/schema/aur-schema.sql
index 0804ac3..ea19d46 100644
--- a/schema/aur-schema.sql
+++ b/schema/aur-schema.sql
@@ -310,6 +310,7 @@ CREATE TABLE PackageBlacklist (
CREATE TABLE OfficialProviders (
ID INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
Name VARCHAR(64) NOT NULL,
+ Repo VARCHAR(64) NOT NULL,
Provides VARCHAR(64) NOT NULL,
PRIMARY KEY (ID)
) ENGINE = InnoDB;
diff --git a/scripts/aurblup.py b/scripts/aurblup.py
index 325ef3d..9e11e43 100755
--- a/scripts/aurblup.py
+++ b/scripts/aurblup.py
@@ -20,6 +20,7 @@ servers = config.get('aurblup', 'servers').split(' ')
blacklist = set()
providers = set()
+repomap = dict()
h = pyalpm.Handle("/", db_path)
for sync_db in sync_dbs:
@@ -33,9 +34,11 @@ for sync_db in sync_dbs:
blacklist.add(pkg.name)
[blacklist.add(x) for x in pkg.replaces]
providers.add((pkg.name, pkg.name))
+ repomap[(pkg.name, pkg.name)] = repo.name
for provision in pkg.provides:
provisionname = re.sub(r'(<|=|>).*', '', provision)
providers.add((pkg.name, provisionname))
+ repomap[(pkg.name, provisionname)] = repo.name
db = mysql.connector.connect(host=aur_db_host, user=aur_db_user,
passwd=aur_db_pass, db=aur_db_name,
@@ -54,8 +57,9 @@ 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])
+ repo = repomap[(pkg, provides)]
+ cur.execute("INSERT INTO OfficialProviders (Name, Repo, Provides) "
+ "VALUES (%s, %s, %s)", [pkg, repo, provides])
for pkg, provides in oldproviders.difference(providers):
cur.execute("DELETE FROM OfficialProviders "
"WHERE Name = %s AND Provides = %s", [pkg, provides])
diff --git a/upgrading/4.3.0.txt b/upgrading/4.3.0.txt
index 34b19a2..f7f3e08 100644
--- a/upgrading/4.3.0.txt
+++ b/upgrading/4.3.0.txt
@@ -9,3 +9,9 @@ ALTER TABLE Users ADD COLUMN OwnershipNotify TINYINT(1) NOT NULL DEFAULT 1;
----
ALTER TABLE Users MODIFY LastLoginIPAddress VARCHAR(45) NULL DEFAULT NULL;
----
+
+3. Add a new column to store repository information of official providers:
+
+----
+ALTER TABLE OfficialProviders ADD COLUMN Repo VARCHAR(64) NOT NULL;
+----