Skip to content

Commit 6018577

Browse files
committed
#517 - update nexB/purldb to aboutcode-org/purldb
Signed-off-by: Chin Yeung Li <tli@nexb.com>
1 parent 02389be commit 6018577

File tree

209 files changed

+2883
-1607
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+2883
-1607
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ Changelog
44
Next Release
55
----------------
66

7-
- Improve web template for API web page https://github.com/nexB/purldb/issues/132
7+
- Improve web template for API web page https://github.com/aboutcode-org/purldb/issues/132
88
- The API endpoints for ``approximate_directory_content_index``,
99
``approximate_directory_structure_index``, ``exact_file_index``,
1010
``exact_package_archive_index``, ``cditems``, ``on_demand_queue`` have been
1111
removed.
1212
- The `/api/collect/` and `/api/collect/index_packages/` API endpoints have been
1313
updated such that Package scan and processing requests made with purls with
1414
versions are processed ahead of those made with versionless purls.
15-
https://github.com/nexB/purldb/issues/502
15+
https://github.com/aboutcode-org/purldb/issues/502
1616
- The `/api/scan_queue/` endpoint has been updated.
1717
`/api/scan_queue/get_next_download_url/` now returns a `webhook_url`, where
1818
the purldb scan worker will submit results. This is a URL to the
1919
`/api/scan_queue/index_package_scan/` endpoint.
2020
`/api/scan_queue/update_status/` is now an action on a ScannableURI.
21-
https://github.com/nexB/purldb/issues/504
21+
https://github.com/aboutcode-org/purldb/issues/504
2222

2323

2424
v5.0.0
@@ -27,11 +27,11 @@ v5.0.0
2727
- Add `/api/docs` Swagger API documentation for API endpoints.
2828
- Add `/api/from_purl/purl2git` endpoint to get a git repo for a purl.
2929
- Add `/api/to_purl/go` endpoint to get a purl from a golang import string or a package string in go.mod.
30-
- Support indexing of PURLs listed in https://github.com/nexB/purldb/issues/326,
31-
https://github.com/nexB/purldb/issues/327, https://github.com/nexB/purldb/issues/328,
32-
https://github.com/nexB/purldb/issues/329 and https://github.com/nexB/purldb/issues/356.
33-
- Support ``addon_pipelines`` for symbol and string collection in ``/api/collect`` endpoint. https://github.com/nexB/purldb/pull/393
34-
- Store ``source_symbols`` and ``source_strings`` in ``extra_data`` field. https://github.com/nexB/purldb/pull/351
30+
- Support indexing of PURLs listed in https://github.com/aboutcode-org/purldb/issues/326,
31+
https://github.com/aboutcode-org/purldb/issues/327, https://github.com/aboutcode-org/purldb/issues/328,
32+
https://github.com/aboutcode-org/purldb/issues/329 and https://github.com/aboutcode-org/purldb/issues/356.
33+
- Support ``addon_pipelines`` for symbol and string collection in ``/api/collect`` endpoint. https://github.com/aboutcode-org/purldb/pull/393
34+
- Store ``source_symbols`` and ``source_strings`` in ``extra_data`` field. https://github.com/aboutcode-org/purldb/pull/351
3535

3636

3737
v3.0.0

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
FROM --platform=linux/amd64 python:3.12-slim
55

6-
LABEL org.opencontainers.image.source="https://github.com/nexB/purldb"
6+
LABEL org.opencontainers.image.source="https://github.com/aboutcode-org/purldb"
77
LABEL org.opencontainers.image.description="PurlDB"
88
LABEL org.opencontainers.image.licenses="Apache-2.0"
99

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# purldb is a trademark of nexB Inc.
44
# SPDX-License-Identifier: Apache-2.0
55
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6-
# See https://github.com/nexB/purldb for support or download.
6+
# See https://github.com/aboutcode-org/purldb for support or download.
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

NOTICE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
# See https://www.apache.org/licenses/LICENSE-2.0 for the license text.
88
# See https://creativecommons.org/licenses/by-sa/4.0/legalcode for the license text.
99
#
10-
# See https://github.com/nexB/purldb for support or download.
10+
# See https://github.com/aboutcode-org/purldb for support or download.
1111
# See https://aboutcode.org for more information about nexB OSS projects.
1212
#

clearcode/management/commands/clearload.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# purldb is a trademark of nexB Inc.
44
# SPDX-License-Identifier: Apache-2.0
55
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6-
# See https://github.com/nexB/purldb for support or download.
6+
# See https://github.com/aboutcode-org/purldb for support or download.
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

clearcode/management/commands/clearsync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# purldb is a trademark of nexB Inc.
44
# SPDX-License-Identifier: Apache-2.0
55
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6-
# See https://github.com/nexB/purldb for support or download.
6+
# See https://github.com/aboutcode-org/purldb for support or download.
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

clearcode/management/commands/store_scans.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
# purldb is a trademark of nexB Inc.
44
# SPDX-License-Identifier: Apache-2.0
55
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6-
# See https://github.com/nexB/purldb for support or download.
6+
# See https://github.com/aboutcode-org/purldb for support or download.
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

1010
from clearcode.store_scans import store_scancode_scans_from_cd_items
1111
from minecode.management.commands import VerboseCommand
1212

13+
1314
class Command(VerboseCommand):
1415
help = 'Store scancode scans in git repositories'
1516

@@ -19,4 +20,5 @@ def add_arguments(self, parser):
1920
parser.add_argument('--count', type=int, default=0)
2021

2122
def handle(self, *args, **options):
22-
store_scancode_scans_from_cd_items(work_dir=options['work_dir'], github_org=options['github_org'], count=options['count'])
23+
store_scancode_scans_from_cd_items(
24+
work_dir=options['work_dir'], github_org=options['github_org'], count=options['count'])

clearindex/harvest.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# purldb is a trademark of nexB Inc.
44
# SPDX-License-Identifier: Apache-2.0
55
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6-
# See https://github.com/nexB/purldb for support or download.
6+
# See https://github.com/aboutcode-org/purldb for support or download.
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

@@ -85,7 +85,8 @@ def create_from_harvest(package_scan={}, files_data=[], cditem_path=''):
8585
'source_packages',
8686
)
8787

88-
package_data = {field_name: package_scan.get(field_name) for field_name in fields}
88+
package_data = {field_name: package_scan.get(
89+
field_name) for field_name in fields}
8990

9091
stringify_null_purl_fields(package_data)
9192

@@ -98,7 +99,8 @@ def create_from_harvest(package_scan={}, files_data=[], cditem_path=''):
9899

99100
download_url = package_data.get('download_url')
100101
if not download_url:
101-
logger.error('Null `download_url` value for `package_data`: {}'.format(package_data))
102+
logger.error(
103+
'Null `download_url` value for `package_data`: {}'.format(package_data))
102104
return
103105

104106
# This ugly block is needed until https://github.com/nexB/packagedb/issues/14
@@ -119,9 +121,11 @@ def create_from_harvest(package_scan={}, files_data=[], cditem_path=''):
119121
new_package_data=package_data,
120122
replace=False
121123
)
122-
package.append_to_history('Updated package from CDitem harvest: {}'.format(cditem_path))
124+
package.append_to_history(
125+
'Updated package from CDitem harvest: {}'.format(cditem_path))
123126

124-
logger.info('Merged package data from scancode harvest: {}'.format(package))
127+
logger.info(
128+
'Merged package data from scancode harvest: {}'.format(package))
125129

126130
except Package.DoesNotExist:
127131
try:
@@ -132,15 +136,19 @@ def create_from_harvest(package_scan={}, files_data=[], cditem_path=''):
132136
new_package_data=package_data,
133137
replace=False
134138
)
135-
package.append_to_history('Updated package from CDitem harvest: {}'.format(cditem_path))
139+
package.append_to_history(
140+
'Updated package from CDitem harvest: {}'.format(cditem_path))
136141

137-
logger.info('Merged package data from scancode harvest: {}'.format(package))
142+
logger.info(
143+
'Merged package data from scancode harvest: {}'.format(package))
138144

139145
except Package.DoesNotExist:
140146
package = Package.objects.create(**package_data)
141-
package.append_to_history('Created package from CDitem harvest: {}'.format(cditem_path))
147+
package.append_to_history(
148+
'Created package from CDitem harvest: {}'.format(cditem_path))
142149

143-
logger.info('Created package from scancode harvest: {}'.format(package))
150+
logger.info(
151+
'Created package from scancode harvest: {}'.format(package))
144152

145153
# Now, add resources to the Package.
146154
for f in files_data:
@@ -179,7 +187,8 @@ def map_scancode_harvest(cditem):
179187
try:
180188
harvest_data = cditem.data
181189
except ValueError:
182-
err_msg = 'CDitemError: empty content field for CDitem: {}'.format(cditem.path)
190+
err_msg = 'CDitemError: empty content field for CDitem: {}'.format(
191+
cditem.path)
183192
logger.error(err_msg)
184193

185194
cditem.map_error = err_msg
@@ -198,7 +207,8 @@ def map_scancode_harvest(cditem):
198207
download_url = package_scan.get('download_url')
199208
if not download_url:
200209
purl = package_scan.get('purl')
201-
err_msg = 'CDitemError: empty download_url for package: {}'.format(purl)
210+
err_msg = 'CDitemError: empty download_url for package: {}'.format(
211+
purl)
202212
logger.error(err_msg)
203213

204214
cditem.map_error = err_msg

clearindex/management/commands/run_clearindex.py

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# purldb is a trademark of nexB Inc.
44
# SPDX-License-Identifier: Apache-2.0
55
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6-
# See https://github.com/nexB/purldb for support or download.
6+
# See https://github.com/aboutcode-org/purldb for support or download.
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

@@ -118,8 +118,10 @@ def handle(self, *args, **options):
118118
logger.info('Graceful exit of the map loop.')
119119
break
120120

121-
mappable_definitions = CDitem.objects.mappable_definitions()[:MAP_BATCH_SIZE]
122-
mappable_scancode_harvests = CDitem.objects.mappable_scancode_harvests()[:MAP_BATCH_SIZE]
121+
mappable_definitions = CDitem.objects.mappable_definitions()[
122+
:MAP_BATCH_SIZE]
123+
mappable_scancode_harvests = CDitem.objects.mappable_scancode_harvests()[
124+
:MAP_BATCH_SIZE]
123125

124126
try:
125127
if not mappable_definitions and not mappable_scancode_harvests:
@@ -187,7 +189,7 @@ def get_coords_des_and_lic_from_def(definition):
187189
return definition.get('coordinates', {}), definition.get('described', {}), definition.get('licensed', {})
188190

189191

190-
#CD_TYPES_WITH_SOURCE = ('debsrc', 'npm', 'sourcearchive',)
192+
# CD_TYPES_WITH_SOURCE = ('debsrc', 'npm', 'sourcearchive',)
191193

192194

193195
def get_or_create_package_from_cditem_definition(cditem):
@@ -197,7 +199,8 @@ def get_or_create_package_from_cditem_definition(cditem):
197199
definition = cditem.data
198200
if not definition:
199201
raise Exception('No data available for this definition')
200-
coordinates, described, licensed = get_coords_des_and_lic_from_def(definition)
202+
coordinates, described, licensed = get_coords_des_and_lic_from_def(
203+
definition)
201204

202205
download_url = described.get('urls', {}).get('download', '')
203206
if not download_url:
@@ -219,15 +222,17 @@ def get_or_create_package_from_cditem_definition(cditem):
219222
name = coordinates.get('name')
220223
version = coordinates.get('revision')
221224
package_type = coordinates.get('type')
222-
converted_package_type = PACKAGE_TYPES_BY_CD_TYPE.get(package_type) or package_type
225+
converted_package_type = PACKAGE_TYPES_BY_CD_TYPE.get(
226+
package_type) or package_type
223227
# TODO: Source packages need to be updated for clearlydefined, link source packages to binary packages
224228
hashes = described.get('hashes', {})
225229
sha1 = hashes.get('sha1')
226230
sha256 = hashes.get('sha256')
227231
homepage_url = described.get('projectWebsite')
228232
release_date = described.get('releaseDate')
229233
declared_license = licensed.get('declared')
230-
normalized_license_expression = licensing.get_normalized_expression(declared_license)
234+
normalized_license_expression = licensing.get_normalized_expression(
235+
declared_license)
231236
copyrights = get_parties_from_licensed(licensed)
232237
copyrights = '\n'.join(copyrights)
233238
definition_mining_level = 0
@@ -257,7 +262,8 @@ def get_or_create_package_from_cditem_definition(cditem):
257262
)
258263
# log history if package was created
259264
if created:
260-
package.append_to_history('Created package from CDitem definition: {}'.format(cditem.path))
265+
package.append_to_history(
266+
'Created package from CDitem definition: {}'.format(cditem.path))
261267

262268
else:
263269
# TODO: This is temporary until we fold clearindex into minecode mapping
@@ -283,7 +289,8 @@ def get_or_create_package_from_cditem_definition(cditem):
283289
replace=True
284290
)
285291
package = existing_package
286-
package.append_to_history('Updated package from CDitem definition: {}'.format(cditem.path))
292+
package.append_to_history(
293+
'Updated package from CDitem definition: {}'.format(cditem.path))
287294

288295
return package
289296

@@ -303,7 +310,8 @@ def create_download_url_from_coords(coord):
303310

304311
package_type = PACKAGE_TYPES_BY_CD_TYPE.get(ptype)
305312
if not package_type:
306-
raise Exception('Unsupported ClearlyDefined package type: {}'.format(ptype))
313+
raise Exception(
314+
'Unsupported ClearlyDefined package type: {}'.format(ptype))
307315

308316
get_urls = PACKAGE_TYPES_WITH_GET_URLS.get(package_type)
309317
if get_urls:

clearindex/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# purldb is a trademark of nexB Inc.
44
# SPDX-License-Identifier: Apache-2.0
55
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
6-
# See https://github.com/nexB/purldb for support or download.
6+
# See https://github.com/aboutcode-org/purldb for support or download.
77
# See https://aboutcode.org for more information about nexB OSS projects.
88
#
99

0 commit comments

Comments
 (0)