mirror of
https://git.yoctoproject.org/poky
synced 2026-01-29 21:08:42 +01:00
Revert "spdx: Update for bitbake changes"
This reverts part of commit 4859cdf97fd9a260036e148e25f0b78eb393df1e. Modification of meta/classes/create-spdx-2.2.bbclass is not backported, so no need to consider it. In the commit, it updates spdx according to bitbake change. But the bitbake commit * 2515fbd10 fetch: Drop multiple branch/revision support for single git urls doesn't backport for scarthgap. So revert the other parts of the commit 4859cdf97fd9a260036e148e25f0b. (From OE-Core rev: f3bfb98d1cf928678d9931308c116e9e6ec64ba5) Signed-off-by: Kai Kang <kai.kang@windriver.com> Signed-off-by: Steve Sakoman <steve@sakoman.com>
This commit is contained in:
@@ -356,77 +356,78 @@ def add_download_files(d, objset):
|
|||||||
for download_idx, src_uri in enumerate(urls):
|
for download_idx, src_uri in enumerate(urls):
|
||||||
fd = fetch.ud[src_uri]
|
fd = fetch.ud[src_uri]
|
||||||
|
|
||||||
file_name = os.path.basename(fetch.localpath(src_uri))
|
for name in fd.names:
|
||||||
if oe.patch.patch_path(src_uri, fetch, "", expand=False):
|
file_name = os.path.basename(fetch.localpath(src_uri))
|
||||||
primary_purpose = oe.spdx30.software_SoftwarePurpose.patch
|
if oe.patch.patch_path(src_uri, fetch, "", expand=False):
|
||||||
else:
|
primary_purpose = oe.spdx30.software_SoftwarePurpose.patch
|
||||||
primary_purpose = oe.spdx30.software_SoftwarePurpose.source
|
else:
|
||||||
|
primary_purpose = oe.spdx30.software_SoftwarePurpose.source
|
||||||
|
|
||||||
if fd.type == "file":
|
if fd.type == "file":
|
||||||
if os.path.isdir(fd.localpath):
|
if os.path.isdir(fd.localpath):
|
||||||
walk_idx = 1
|
walk_idx = 1
|
||||||
for root, dirs, files in os.walk(fd.localpath, onerror=walk_error):
|
for root, dirs, files in os.walk(fd.localpath, onerror=walk_error):
|
||||||
dirs.sort()
|
dirs.sort()
|
||||||
files.sort()
|
files.sort()
|
||||||
for f in files:
|
for f in files:
|
||||||
f_path = os.path.join(root, f)
|
f_path = os.path.join(root, f)
|
||||||
if os.path.islink(f_path):
|
if os.path.islink(f_path):
|
||||||
# TODO: SPDX doesn't support symlinks yet
|
# TODO: SPDX doesn't support symlinks yet
|
||||||
continue
|
continue
|
||||||
|
|
||||||
file = objset.new_file(
|
file = objset.new_file(
|
||||||
objset.new_spdxid(
|
objset.new_spdxid(
|
||||||
"source", str(download_idx + 1), str(walk_idx)
|
"source", str(download_idx + 1), str(walk_idx)
|
||||||
),
|
),
|
||||||
os.path.join(
|
os.path.join(
|
||||||
file_name, os.path.relpath(f_path, fd.localpath)
|
file_name, os.path.relpath(f_path, fd.localpath)
|
||||||
),
|
),
|
||||||
f_path,
|
f_path,
|
||||||
purposes=[primary_purpose],
|
purposes=[primary_purpose],
|
||||||
)
|
)
|
||||||
|
|
||||||
inputs.add(file)
|
inputs.add(file)
|
||||||
walk_idx += 1
|
walk_idx += 1
|
||||||
|
|
||||||
|
else:
|
||||||
|
file = objset.new_file(
|
||||||
|
objset.new_spdxid("source", str(download_idx + 1)),
|
||||||
|
file_name,
|
||||||
|
fd.localpath,
|
||||||
|
purposes=[primary_purpose],
|
||||||
|
)
|
||||||
|
inputs.add(file)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
file = objset.new_file(
|
dl = objset.add(
|
||||||
objset.new_spdxid("source", str(download_idx + 1)),
|
oe.spdx30.software_Package(
|
||||||
file_name,
|
_id=objset.new_spdxid("source", str(download_idx + 1)),
|
||||||
fd.localpath,
|
creationInfo=objset.doc.creationInfo,
|
||||||
purposes=[primary_purpose],
|
name=file_name,
|
||||||
)
|
software_primaryPurpose=primary_purpose,
|
||||||
inputs.add(file)
|
software_downloadLocation=oe.spdx_common.fetch_data_to_uri(
|
||||||
|
fd, name
|
||||||
else:
|
),
|
||||||
dl = objset.add(
|
|
||||||
oe.spdx30.software_Package(
|
|
||||||
_id=objset.new_spdxid("source", str(download_idx + 1)),
|
|
||||||
creationInfo=objset.doc.creationInfo,
|
|
||||||
name=file_name,
|
|
||||||
software_primaryPurpose=primary_purpose,
|
|
||||||
software_downloadLocation=oe.spdx_common.fetch_data_to_uri(
|
|
||||||
fd, fd.names[0]
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if fd.method.supports_checksum(fd):
|
|
||||||
# TODO Need something better than hard coding this
|
|
||||||
for checksum_id in ["sha256", "sha1"]:
|
|
||||||
expected_checksum = getattr(
|
|
||||||
fd, "%s_expected" % checksum_id, None
|
|
||||||
)
|
)
|
||||||
if expected_checksum is None:
|
)
|
||||||
continue
|
|
||||||
|
|
||||||
dl.verifiedUsing.append(
|
if fd.method.supports_checksum(fd):
|
||||||
oe.spdx30.Hash(
|
# TODO Need something better than hard coding this
|
||||||
algorithm=getattr(oe.spdx30.HashAlgorithm, checksum_id),
|
for checksum_id in ["sha256", "sha1"]:
|
||||||
hashValue=expected_checksum,
|
expected_checksum = getattr(
|
||||||
|
fd, "%s_expected" % checksum_id, None
|
||||||
)
|
)
|
||||||
)
|
if expected_checksum is None:
|
||||||
|
continue
|
||||||
|
|
||||||
inputs.add(dl)
|
dl.verifiedUsing.append(
|
||||||
|
oe.spdx30.Hash(
|
||||||
|
algorithm=getattr(oe.spdx30.HashAlgorithm, checksum_id),
|
||||||
|
hashValue=expected_checksum,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
inputs.add(dl)
|
||||||
|
|
||||||
return inputs
|
return inputs
|
||||||
|
|
||||||
|
|||||||
@@ -239,6 +239,6 @@ def fetch_data_to_uri(fd, name):
|
|||||||
uri = uri + "://" + fd.host + fd.path
|
uri = uri + "://" + fd.host + fd.path
|
||||||
|
|
||||||
if fd.method.supports_srcrev():
|
if fd.method.supports_srcrev():
|
||||||
uri = uri + "@" + fd.revision
|
uri = uri + "@" + fd.revisions[name]
|
||||||
|
|
||||||
return uri
|
return uri
|
||||||
|
|||||||
Reference in New Issue
Block a user