summaryrefslogtreecommitdiffstats
path: root/git-interface
diff options
context:
space:
mode:
authorLukas Fleischer <lfleischer@archlinux.org>2015-06-14 11:51:50 +0200
committerLukas Fleischer <lfleischer@archlinux.org>2015-06-14 17:58:56 +0200
commit3bc44963280758f9e057943081e0b7a2f5541aff (patch)
tree74cd9ea39093bab5c91ce9b8ff9d4f76ac403b33 /git-interface
parentfb42ec696cac974ea87e9a24ba009b58a7fe2c13 (diff)
downloadaur-3bc44963280758f9e057943081e0b7a2f5541aff.tar.gz
aur-3bc44963280758f9e057943081e0b7a2f5541aff.tar.xz
git-update: Fix parsing of versioned optdepends
Fixes FS#43649. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
Diffstat (limited to 'git-interface')
-rwxr-xr-xgit-interface/git-update.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index d87fac7f..ebed491d 100755
--- a/git-interface/git-update.py
+++ b/git-interface/git-update.py
@@ -36,6 +36,16 @@ def extract_arch_fields(pkginfo, field):
return values
+def parse_dep(depstring):
+ dep, _, desc = depstring.partition(': ')
+ depname = re.sub(r'(<|=|>).*', '', dep)
+ depcond = dep[len(depname):]
+
+ if (desc):
+ return (depname + ': ' + desc, depcond)
+ else:
+ return (depname, depcond)
+
def save_srcinfo(srcinfo, db, cur, user):
# Obtain package base ID and previous maintainer.
pkgbase = srcinfo._pkgbase['pkgname']
@@ -89,8 +99,7 @@ def save_srcinfo(srcinfo, db, cur, user):
[deptype])
deptypeid = cur.fetchone()[0]
for dep_info in extract_arch_fields(pkginfo, deptype):
- depname = re.sub(r'(<|=|>).*', '', dep_info['value'])
- depcond = dep_info['value'][len(depname):]
+ depname, depcond = parse_dep(dep_info['value'])
deparch = dep_info['arch']
cur.execute("INSERT INTO PackageDepends (PackageID, " +
"DepTypeID, DepName, DepCondition, DepArch) " +
@@ -103,8 +112,7 @@ def save_srcinfo(srcinfo, db, cur, user):
[reltype])
reltypeid = cur.fetchone()[0]
for rel_info in extract_arch_fields(pkginfo, reltype):
- relname = re.sub(r'(<|=|>).*', '', rel_info['value'])
- relcond = rel_info['value'][len(relname):]
+ relname, relcond = parse_dep(rel_info['value'])
relarch = rel_info['arch']
cur.execute("INSERT INTO PackageRelations (PackageID, " +
"RelTypeID, RelName, RelCondition, RelArch) " +