Verified Commit 0947a712 authored by Max Rees's avatar Max Rees

Support bz_field (cf_package) with multiple packages (comma separated)

parent d2f1c520
......@@ -254,28 +254,33 @@ def populate_bugs(conf, db, pkgids):
for bug in bz_bugs:
if not bug[field].strip():
continue
sdir = bug[field].split("/", maxsplit=1)
if len(sdir) < 2:
logging.error(
"Bug %d: invalid %r: %s", bug["id"], field, bug[field],
)
continue
_repo, pkg = sdir
pkgid = pkgids.get(pkg)
if not pkgid:
logging.warning(
"Bug #%d: unknown package %r",
bug["id"], bug[field],
)
sdirs = bug[field].split(", ")
if not any(sdirs):
continue
for sdir in sdirs:
sdir = sdir.split("/", maxsplit=1)
if len(sdir) < 2:
logging.error(
"Bug %d: invalid %r: %s", bug["id"], field, bug[field],
)
continue
_repo, pkg = sdir
pkgid = pkgids.get(pkg)
if not pkgid:
logging.warning(
"Bug #%d: unknown package %r",
bug["id"], bug[field],
)
continue
buglinks.append(apkvitrine.models.Buglink(bug["id"], pkgid))
bugs.append(apkvitrine.models.Bug(
bug["id"], bug["summary"], ",".join(bug["keywords"]),
datetime.datetime.strptime(
bug["last_change_time"], BZ_DATE_FORMAT,
).strftime("%s"),
))
buglinks.append(apkvitrine.models.Buglink(bug["id"], pkgid))
apkvitrine.models.Bug.insertmany(db, bugs)
apkvitrine.models.Buglink.insertmany(db, buglinks)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment