Page MenuHomeSoftware Heritage

D301.id1001.diff
No OneTemporary

D301.id1001.diff

diff --git a/swh/indexer/storage/__init__.py b/swh/indexer/storage/__init__.py
--- a/swh/indexer/storage/__init__.py
+++ b/swh/indexer/storage/__init__.py
@@ -8,6 +8,8 @@
import dateutil.parser
import psycopg2
+from collections import defaultdict
+
from swh.storage.common import db_transaction_generator, db_transaction
from swh.storage.exc import StorageDBError
from .db import Db
@@ -292,15 +294,20 @@
list: dictionaries with the following keys:
- id (bytes)
- - licenses ([str]): associated licenses for that content
"""
db = self.db
db.store_tmp_bytea(ids, cur)
+ d = defaultdict(list)
for c in db.content_fossology_license_get_from_temp():
license = dict(zip(db.content_fossology_license_cols, c))
- yield converters.db_to_fossology_license(license)
+
+ id_ = license['id']
+ d[id_].append(converters.db_to_fossology_license(license))
+
+ for id_, facts in d.items():
+ yield {id_: facts}
@db_transaction
def content_fossology_license_add(self, licenses,
diff --git a/swh/indexer/storage/converters.py b/swh/indexer/storage/converters.py
--- a/swh/indexer/storage/converters.py
+++ b/swh/indexer/storage/converters.py
@@ -129,7 +129,6 @@
def db_to_fossology_license(license):
return {
- 'id': license['id'],
'licenses': license['licenses'],
'tool': {
'id': license['tool_id'],

File Metadata

Mime Type
text/plain
Expires
Thu, Jul 3, 3:41 PM (1 w, 6 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3230208

Event Timeline