Skip to content

Commit

Permalink
Support sending source PURLs to purldb
Browse files Browse the repository at this point in the history
Signed-off-by: Ayan Sinha Mahapatra <[email protected]>
  • Loading branch information
AyanSinhaMahapatra committed Mar 1, 2024
1 parent 5980255 commit 2611659
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scanpipe/pipes/purldb.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,11 +295,19 @@ def get_unique_unresolved_purls(project):
def populate_purldb_with_discovered_packages(project, logger=logger.info):
"""Add DiscoveredPackage to PurlDB."""
discoveredpackages = project.discoveredpackages.all()
packages = [{"purl": pkg.purl} for pkg in discoveredpackages]
packages_to_populate = []
for pkg in discoveredpackages:
package = {"purl": pkg.purl}
if pkg.source_packages:
package["source_purl"] = pkg.source_packages
packages_to_populate.append(package)

logger(f"Populating PurlDB with {len(packages):,d} PURLs from DiscoveredPackage")
logger(
f"Populating PurlDB with {len(packages_to_populate):,d}"
f" PURLs from DiscoveredPackage"
)
feed_purldb(
packages=packages,
packages=packages_to_populate,
chunk_size=100,
logger=logger,
)
Expand Down

0 comments on commit 2611659

Please sign in to comment.