@@ -463,6 +463,19 @@ def enrich_source_package(d, dl, fd, file_name, primary_purpose):
)
+def set_package_identity(d, dl, fd):
+ """Set name, version and PURL of a download that names a package.
+
+ Fetchers of package registries (crate, gomod, npm) know which package
+ a URL downloads, see FetchMethod.package_identity() in bitbake.
+ """
+ identity = fd.method.package_identity(fd, d)
+ if identity:
+ dl.name = identity["name"]
+ dl.software_packageVersion = identity["version"]
+ dl.software_packageUrl = identity["purl"]
+
+
def add_download_files(d, objset):
inputs = set()
release_date = get_release_date(d)
@@ -528,6 +541,7 @@ def add_download_files(d, objset):
)
enrich_source_package(d, dl, fd, file_name, primary_purpose)
+ set_package_identity(d, dl, fd)
if release_date is not None:
dl.releaseTime = release_date