summaryrefslogtreecommitdiffstats
path: root/git-interface/git-update.py
diff options
context:
space:
mode:
Diffstat (limited to 'git-interface/git-update.py')
-rwxr-xr-xgit-interface/git-update.py33
1 files changed, 16 insertions, 17 deletions
diff --git a/git-interface/git-update.py b/git-interface/git-update.py
index 5efc9b1..c1113a3 100755
--- a/git-interface/git-update.py
+++ b/git-interface/git-update.py
@@ -7,7 +7,8 @@ import pygit2
import re
import sys
-import aurinfo
+import srcinfo.parse
+import srcinfo.utils
config = configparser.RawConfigParser()
config.read(os.path.dirname(os.path.realpath(__file__)) + "/../conf/config")
@@ -50,7 +51,7 @@ def parse_dep(depstring):
def save_srcinfo(srcinfo, db, cur, user):
# Obtain package base ID and previous maintainer.
- pkgbase = srcinfo._pkgbase['pkgname']
+ pkgbase = srcinfo['pkgbase']
cur.execute("SELECT ID, MaintainerUID FROM PackageBases "
"WHERE Name = %s", [pkgbase])
(pkgbase_id, maintainer_uid) = cur.fetchone()
@@ -70,8 +71,8 @@ def save_srcinfo(srcinfo, db, cur, user):
cur.execute("DELETE FROM Packages WHERE PackageBaseID = %s",
[pkgbase_id])
- for pkgname in srcinfo.GetPackageNames():
- pkginfo = srcinfo.GetMergedPackage(pkgname)
+ for pkgname in srcinfo.utils.get_package_names(srcinfo):
+ pkginfo = srcinfo.utils.get_merged_package(pkgname, srcinfo)
if 'epoch' in pkginfo and int(pkginfo['epoch']) > 0:
ver = '{:d}:{:s}-{:s}'.format(int(pkginfo['epoch']),
@@ -246,25 +247,23 @@ for commit in walker:
die_commit("maximum blob size (250kB) exceeded", str(commit.id))
srcinfo_raw = repo[commit.tree['.SRCINFO'].id].data.decode()
- srcinfo_raw = srcinfo_raw.split('\n')
- ecatcher = aurinfo.CollectionECatcher()
- srcinfo = aurinfo.ParseAurinfoFromIterable(srcinfo_raw, ecatcher)
- errors = ecatcher.Errors()
+ (srcinfo, errors) = srcinfo.parse.parse_srcinfo(srcinfo_raw)
if errors:
sys.stderr.write("error: The following errors occurred "
"when parsing .SRCINFO in commit\n")
sys.stderr.write("error: {:s}:\n".format(str(commit.id)))
for error in errors:
- sys.stderr.write("error: line {:d}: {:s}\n".format(*error))
+ for err in error['error']
+ sys.stderr.write("error: line {:d}: {:s}\n".format(error['line'], err))
exit(1)
- srcinfo_pkgbase = srcinfo._pkgbase['pkgname']
+ srcinfo_pkgbase = srcinfo['pkgbase']
if not re.match(repo_regex, srcinfo_pkgbase):
die_commit('invalid pkgbase: {:s}'.format(srcinfo_pkgbase),
str(commit.id))
- for pkgname in srcinfo.GetPackageNames():
- pkginfo = srcinfo.GetMergedPackage(pkgname)
+ for pkgname in set(srcinfo['packages'].keys()):
+ pkginfo = srcinfo.utils.get_merged_package(pkgname, srcinfo)
for field in ('pkgver', 'pkgrel', 'pkgname'):
if field not in pkginfo:
@@ -307,23 +306,23 @@ if sha1_old not in ("0000000000000000000000000000000000000000", sha1_new):
# Read .SRCINFO from the HEAD commit.
srcinfo_raw = repo[repo[sha1_new].tree['.SRCINFO'].id].data.decode()
-srcinfo_raw = srcinfo_raw.split('\n')
-srcinfo = aurinfo.ParseAurinfoFromIterable(srcinfo_raw)
+srcinfo = srcinfo.parse.parse_srcinfo(srcinfo_raw)
# Ensure that the package base name matches the repository name.
-srcinfo_pkgbase = srcinfo._pkgbase['pkgname']
+srcinfo_pkgbase = srcinfo['pkgbase']
if srcinfo_pkgbase != pkgbase:
die('invalid pkgbase: {:s}, expected {:s}'.format(srcinfo_pkgbase, pkgbase))
# Ensure that packages are neither blacklisted nor overwritten.
+pkgbase = srcinfo['pkgbase']
cur.execute("SELECT ID FROM PackageBases WHERE Name = %s", [pkgbase])
pkgbase_id = cur.fetchone()[0] if cur.rowcount == 1 else 0
cur.execute("SELECT Name FROM PackageBlacklist")
blacklist = [row[0] for row in cur.fetchall()]
-for pkgname in srcinfo.GetPackageNames():
- pkginfo = srcinfo.GetMergedPackage(pkgname)
+for pkgname in srcinfo.utils.get_package_names(srcinfo):
+ pkginfo = srcinfo.utils.get_merged_package(pkgname, srcinfo)
pkgname = pkginfo['pkgname']
if pkgname in blacklist and not privileged: