Changeset View
Changeset View
Standalone View
Standalone View
swh/indexer/fossology_license.py
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | except subprocess.CalledProcessError: | ||||
'licenses': [], | 'licenses': [], | ||||
'path': path, | 'path': path, | ||||
} | } | ||||
class MixinFossologyLicenseIndexer: | class MixinFossologyLicenseIndexer: | ||||
"""Mixin fossology license indexer. | """Mixin fossology license indexer. | ||||
See :class:`ContentFossologyLicenseIndexer` and | See :class:`FossologyLicenseIndexer` and | ||||
:class:`FossologyLicenseRangeIndexer` | :class:`FossologyLicenseRangeIndexer` | ||||
""" | """ | ||||
ADDITIONAL_CONFIG = { | ADDITIONAL_CONFIG = { | ||||
'workdir': ('str', '/tmp/swh/indexer.fossology.license'), | 'workdir': ('str', '/tmp/swh/indexer.fossology.license'), | ||||
'tools': ('dict', { | 'tools': ('dict', { | ||||
'name': 'nomos', | 'name': 'nomos', | ||||
'version': '3.1.0rc2-31-ga2cbb8c', | 'version': '3.1.0rc2-31-ga2cbb8c', | ||||
▲ Show 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | def persist_index_computations(self, results, policy_update): | ||||
policy_update ([str]): either 'update-dups' or 'ignore-dups' to | policy_update ([str]): either 'update-dups' or 'ignore-dups' to | ||||
respectively update duplicates or ignore them | respectively update duplicates or ignore them | ||||
""" | """ | ||||
self.idx_storage.content_fossology_license_add( | self.idx_storage.content_fossology_license_add( | ||||
results, conflict_update=(policy_update == 'update-dups')) | results, conflict_update=(policy_update == 'update-dups')) | ||||
class ContentFossologyLicenseIndexer( | class FossologyLicenseIndexer( | ||||
MixinFossologyLicenseIndexer, DiskIndexer, ContentIndexer): | MixinFossologyLicenseIndexer, DiskIndexer, ContentIndexer): | ||||
"""Indexer in charge of: | """Indexer in charge of: | ||||
- filtering out content already indexed | - filtering out content already indexed | ||||
- reading content from objstorage per the content's id (sha1) | - reading content from objstorage per the content's id (sha1) | ||||
- computing {license, encoding} from that content | - computing {license, encoding} from that content | ||||
- store result in storage | - store result in storage | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |