summaryrefslogtreecommitdiffstats
path: root/aurweb/git
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2017-04-19 08:53:30 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2017-04-19 09:13:09 +0200
commit44858e06188946c0082bb09061fcfa6cbb33938b (patch)
treec52a51105fac66a08d0d936b28c60c04b6d051b2 /aurweb/git
parent15501972bce458ad7862786311ca8264f5f34081 (diff)
downloadaur-44858e06188946c0082bb09061fcfa6cbb33938b.tar.gz
aur-44858e06188946c0082bb09061fcfa6cbb33938b.tar.xz
Store dependency descriptions in a separate column
Split optional dependency descriptions from dependency names before storing them in the database and use a separate column to store the descriptions. This allows us to simplify and optimize the SQL queries in pkg_dependencies() as well as pkg_required(). Suggested-by: Florian Pritz <bluewind@xinu.at> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'aurweb/git')
-rwxr-xr-xaurweb/git/update.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/aurweb/git/update.py b/aurweb/git/update.py
index 532db92d..09a57ef0 100755
--- a/aurweb/git/update.py
+++ b/aurweb/git/update.py
@@ -52,10 +52,7 @@ def parse_dep(depstring):
depname = re.sub(r'(<|=|>).*', '', dep)
depcond = dep[len(depname):]
- if (desc):
- return (depname + ': ' + desc, depcond)
- else:
- return (depname, depcond)
+ return (depname, desc, depcond)
def create_pkgbase(conn, pkgbase, user):
@@ -141,12 +138,13 @@ def save_metadata(metadata, conn, user):
[deptype])
deptypeid = cur.fetchone()[0]
for dep_info in extract_arch_fields(pkginfo, deptype):
- depname, depcond = parse_dep(dep_info['value'])
+ depname, depdesc, depcond = parse_dep(dep_info['value'])
deparch = dep_info['arch']
conn.execute("INSERT INTO PackageDepends (PackageID, " +
- "DepTypeID, DepName, DepCondition, DepArch) " +
- "VALUES (?, ?, ?, ?, ?)",
- [pkgid, deptypeid, depname, depcond, deparch])
+ "DepTypeID, DepName, DepDesc, DepCondition, " +
+ "DepArch) VALUES (?, ?, ?, ?, ?, ?)",
+ [pkgid, deptypeid, depname, depdesc, depcond,
+ deparch])
# Add package relations (conflicts, provides, replaces).
for reltype in ('conflicts', 'provides', 'replaces'):
@@ -154,7 +152,7 @@ def save_metadata(metadata, conn, user):
[reltype])
reltypeid = cur.fetchone()[0]
for rel_info in extract_arch_fields(pkginfo, reltype):
- relname, relcond = parse_dep(rel_info['value'])
+ relname, _, relcond = parse_dep(rel_info['value'])
relarch = rel_info['arch']
conn.execute("INSERT INTO PackageRelations (PackageID, " +
"RelTypeID, RelName, RelCondition, RelArch) " +