diff options
-rw-r--r-- | classes/blackduck-upload.bbclass | 17 | ||||
-rw-r--r-- | classes/fossology-python.bbclass | 26 | ||||
-rw-r--r-- | classes/spdx-common.bbclass | 27 | ||||
-rw-r--r-- | conf/layer.conf | 2 | ||||
-rw-r--r-- | recipes-devtools/python/python3-patch/0001-PATCH-setup.py-switch-to-setuptools.patch | 24 | ||||
-rwxr-xr-x | recipes-devtools/python/python3-patch_1.16.bb | 4 |
6 files changed, 64 insertions, 36 deletions
diff --git a/classes/blackduck-upload.bbclass b/classes/blackduck-upload.bbclass index b40efeb..8ce637a 100644 --- a/classes/blackduck-upload.bbclass +++ b/classes/blackduck-upload.bbclass @@ -22,9 +22,9 @@ do_bd_upload[network] = "1" WAIT_TIME ?= "20" python () { - + pn = d.getVar('PN') #If not for target, won't creat spdx. - if bb.data.inherits_class('nopackages', d): + if bb.data.inherits_class('nopackages', d) and not pn.startswith('gcc-source'): return pn = d.getVar('PN') @@ -47,7 +47,8 @@ python () { return # We just archive gcc-source for all the gcc related recipes - if d.getVar('BPN') in ['gcc', 'libgcc']: + if d.getVar('BPN') in ['gcc', 'libgcc'] \ + and not pn.startswith('gcc-source'): bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn) return @@ -65,9 +66,9 @@ python () { def hasTask(task): return bool(d.getVarFlag(task, "task", False)) and not bool(d.getVarFlag(task, "noexec", False)) - if d.getVar('PACKAGES'): + if d.getVar('PACKAGES') or pn.startswith('gcc-source'): # Some recipes do not have any packaging tasks - if hasTask("do_package_write_rpm") or hasTask("do_package_write_ipk") or hasTask("do_package_write_deb"): + if hasTask("do_package_write_rpm") or hasTask("do_package_write_ipk") or hasTask("do_package_write_deb") or pn.startswith('gcc-source'): d.appendVarFlag('do_bd_upload', 'depends', ' synopsys-native:do_populate_sysroot') d.appendVarFlag('do_bd_upload', 'depends', ' %s:do_spdx_creat_tarball' % pn) d.appendVarFlag('do_synopsys_detect', 'depends', ' %s:do_bd_upload' % pn) @@ -78,7 +79,9 @@ python () { python do_bd_upload(){ import logging, shutil,time - if bb.data.inherits_class('nopackages', d): + pn = d.getVar( 'PN') + #If not for target, won't creat spdx. + if bb.data.inherits_class('nopackages', d) and not pn.startswith('gcc-source'): return logger = logging.getLogger() @@ -170,7 +173,7 @@ do_synopsys_detect () { echo "Upload OSS to blackduck server." } addtask do_spdx_creat_tarball after do_patch -addtask do_bd_upload after do_patch +addtask do_bd_upload after do_spdx_creat_tarball addtask do_synopsys_detect do_build[recrdeptask] += "do_synopsys_detect" do_populate_sdk[recrdeptask] += "do_synopsys_detect" diff --git a/classes/fossology-python.bbclass b/classes/fossology-python.bbclass index 7cd9ed2..b20af92 100644 --- a/classes/fossology-python.bbclass +++ b/classes/fossology-python.bbclass @@ -37,11 +37,11 @@ python () { create_folder_lock = Lock() + pn = d.getVar('PN') #If not for target, won't creat spdx. - if bb.data.inherits_class('nopackages', d): + if bb.data.inherits_class('nopackages', d) and not pn.startswith('gcc-source'): return - pn = d.getVar('PN') assume_provided = (d.getVar("ASSUME_PROVIDED") or "").split() if pn in assume_provided: for p in d.getVar("PROVIDES").split(): @@ -61,8 +61,9 @@ python () { return # We just archive gcc-source for all the gcc related recipes - if d.getVar('BPN') in ['gcc', 'libgcc']: - bb.debug(1, 'spdx: There is bug in scan of %s is, do nothing' % pn) + if d.getVar('BPN') in ['gcc', 'libgcc'] \ + and not pn.startswith('gcc-source'): + bb.debug(1, 'archiver: %s is excluded, covered by gcc-source' % pn) return spdx_outdir = d.getVar('SPDX_OUTDIR') @@ -88,9 +89,9 @@ python () { def hasTask(task): return bool(d.getVarFlag(task, "task", False)) and not bool(d.getVarFlag(task, "noexec", False)) - if d.getVar('PACKAGES'): + if d.getVar('PACKAGES') or pn.startswith('gcc-source'): # Some recipes do not have any packaging tasks - if hasTask("do_package_write_rpm") or hasTask("do_package_write_ipk") or hasTask("do_package_write_deb"): + if hasTask("do_package_write_rpm") or hasTask("do_package_write_ipk") or hasTask("do_package_write_deb") or pn.startswith('gcc-source'): d.appendVarFlag('do_foss_upload', 'depends', ' %s:do_spdx_creat_tarball' % pn) d.appendVarFlag('do_schedule_jobs', 'depends', ' %s:do_foss_upload' % pn) d.appendVarFlag('do_get_report', 'depends', ' %s:do_schedule_jobs' % pn) @@ -198,8 +199,7 @@ def create_folder(d, foss, token, folder_name): create_folder_lock.release() if folder.name != folder_name: bb.error("Folder %s couldn't be created" % folder_name) - else: - return folder + return folder python do_schedule_jobs(){ import os @@ -207,8 +207,9 @@ python do_schedule_jobs(){ import time import logging + pn = d.getVar( 'PN') #If not for target, won't creat spdx. - if bb.data.inherits_class('nopackages', d): + if bb.data.inherits_class('nopackages', d) and not pn.startswith('gcc-source'): return logger = logging.getLogger() @@ -245,7 +246,6 @@ python do_schedule_jobs(){ fossology_server = d.getVar('FOSSOLOGY_SERVER') token = d.getVar('TOKEN') foss = Fossology(fossology_server, token, "fossy") - pn = d.getVar('PN') if d.getVar('FOLDER_NAME', False): folder_name = d.getVar('FOLDER_NAME') @@ -349,8 +349,9 @@ python do_get_report(){ report_id = None report = None + pn = d.getVar('PN') #If not for target, won't creat spdx. - if bb.data.inherits_class('nopackages', d): + if bb.data.inherits_class('nopackages', d) and not pn.startswith('gcc-source'): return logger = logging.getLogger() @@ -362,7 +363,6 @@ python do_get_report(){ fossology_server = d.getVar('FOSSOLOGY_SERVER') token = d.getVar('TOKEN') foss = Fossology(fossology_server, token, "fossy") - pn = d.getVar('PN') if d.getVar('FOLDER_NAME', False): folder_name = d.getVar('FOLDER_NAME') @@ -434,7 +434,7 @@ python do_get_report(){ while i < 20: i += 1 try: - report, name = foss.download_report(report_id) + report, name = foss.download_report(report_id, wait_time=wait_time*2) except TryAgain: bb.warn("SPDX file is still not ready, try again.") time.sleep(wait_time) diff --git a/classes/spdx-common.bbclass b/classes/spdx-common.bbclass index cb97c5b..a845f7f 100644 --- a/classes/spdx-common.bbclass +++ b/classes/spdx-common.bbclass @@ -31,9 +31,15 @@ def excluded_package(d, pn): if p != pn: pn = p break - if d.getVar('BPN') in ['gcc', 'libgcc']: - #bb.debug(1, 'spdx: There is a bug in the scan of %s, skip it.' % pn) + # We just archive gcc-source for all the gcc related recipes + if d.getVar('BPN') in ['gcc', 'libgcc'] \ + and not pn.startswith('gcc-source'): + bb.debug(1, 'archiver: %s is excluded, covered by gcc-source' % pn) return True + # TARGET_SYS in ARCHIVER_ARCH will break the stamp for gcc-source in multiconfig + if pn.startswith('gcc-source'): + d.setVar('ARCHIVER_ARCH', "allarch") + # The following: do_fetch, do_unpack and do_patch tasks have been deleted, # so avoid archiving do_spdx here. # -native is for the host aka during the build @@ -65,12 +71,6 @@ def get_tar_name(d, suffix): get the name of tarball """ - # Make sure we are only creating a single tarball for gcc sources - #if (d.getVar('SRC_URI') == ""): - # return - # For the kernel archive, srcdir may just be a link to the - # work-shared location. Use os.path.realpath to make sure - # that we archive the actual directory and not just the link. if suffix: filename = '%s-%s.tar.gz' % (d.getVar('PF'), suffix) else: @@ -84,12 +84,6 @@ def spdx_create_tarball(d, srcdir, suffix, ar_outdir): """ import tarfile, shutil - # Make sure we are only creating a single tarball for gcc sources - #if (d.getVar('SRC_URI') == ""): - # return - # For the kernel archive, srcdir may just be a link to the - # work-shared location. Use os.path.realpath to make sure - # that we archive the actual directory and not just the link. srcdir = os.path.realpath(srcdir) bb.utils.mkdirhier(ar_outdir) @@ -142,6 +136,11 @@ def spdx_get_src(d): bb.utils.mkdirhier(src_dir) if bb.data.inherits_class('kernel',d): share_src = d.getVar('STAGING_KERNEL_DIR') + if pn.startswith('gcc-source'): + gcc_source_path = d.getVar('TMPDIR') + "/work-shared" + gcc_pv = d.getVar('PV') + gcc_pr = d.getVar('PR') + share_src = gcc_source_path + "/gcc-" + gcc_pv + "-" + gcc_pr + "/gcc-" + gcc_pv + "/" cmd_copy_share = "cp -rf " + share_src + "/* " + src_dir + "/" cmd_copy_kernel_result = os.popen(cmd_copy_share).read() bb.note("cmd_copy_kernel_result = " + cmd_copy_kernel_result) diff --git a/conf/layer.conf b/conf/layer.conf index 41a48a6..ad5ce9b 100644 --- a/conf/layer.conf +++ b/conf/layer.conf @@ -9,4 +9,4 @@ BBFILE_COLLECTIONS += "spdxscanner" BBFILE_PATTERN_spdxscanner = "^${LAYERDIR}/" BBFILE_PRIORITY_spdxscanner = "6" -LAYERSERIES_COMPAT_spdxscanner = "master kirkstone" +LAYERSERIES_COMPAT_spdxscanner = "master kirkstone langdale" diff --git a/recipes-devtools/python/python3-patch/0001-PATCH-setup.py-switch-to-setuptools.patch b/recipes-devtools/python/python3-patch/0001-PATCH-setup.py-switch-to-setuptools.patch new file mode 100644 index 0000000..13eafeb --- /dev/null +++ b/recipes-devtools/python/python3-patch/0001-PATCH-setup.py-switch-to-setuptools.patch @@ -0,0 +1,24 @@ +From 314be675a933ed262687b25ea70f23d3454e3651 Mon Sep 17 00:00:00 2001 +From: Patrick Vogelaar <patrick.vogelaar@belden.com> +Date: Thu, 1 Feb 2024 10:59:45 +0100 +Subject: [PATCH] setup.py: switch to setuptools + +In Python 3.10, 'distutils' has been deprecated and is slated for +removal in Python 3.12. + +Switch from 'distutils.core' to 'setuptools'. This also allows for the +'wheel' binary archive format to be built with 'setup.py bdist_wheel'. +--- + setup.py | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/setup.py b/setup.py +index 0307afd..1289f25 100644 +--- a/setup.py ++++ b/setup.py +@@ -1,4 +1,4 @@ +-from distutils.core import setup ++from setuptools import setup + + setup( + name='patch', diff --git a/recipes-devtools/python/python3-patch_1.16.bb b/recipes-devtools/python/python3-patch_1.16.bb index 6627a2b..6e7ff15 100755 --- a/recipes-devtools/python/python3-patch_1.16.bb +++ b/recipes-devtools/python/python3-patch_1.16.bb @@ -12,7 +12,9 @@ SRC_URI[sha256sum] = "c62073f356cff054c8ac24496f1a3d7cfa137835c31e9af39a9f5292fd inherit pypi -SRC_URI = "${PYPI_SRC_URI};subdir=${PYPI_PACKAGE}-${PV}" +SRC_URI = "${PYPI_SRC_URI};subdir=${PYPI_PACKAGE}-${PV} \ + file://0001-PATCH-setup.py-switch-to-setuptools.patch \ + " inherit setuptools3 |