Re: [meta-spdxscanner][PATCH] fossology-rest.bbclass: Moved check if spdx already exists out of the task


leimaohui
 

Hi Marco

I'm sorry, but your patch seems not base on the latest source code.
https://git.yoctoproject.org/cgit/cgit.cgi/meta-spdxscanner/tree/classes/fossology-rest.bbclass

Best regards
Lei

-----Original Message-----
From: yocto@... <yocto@...> On Behalf
Of Marco Cavallini
Sent: Thursday, July 22, 2021 9:06 PM
To: yocto@...
Cc: Marco Cavallini <m.cavallini@...>; Marco Cavallini
<koansoftware@...>
Subject: [yocto] [meta-spdxscanner][PATCH] fossology-rest.bbclass: Moved
check if spdx already exists out of the task

From: Marco Cavallini <m.cavallini@...>

With the previous code was impossible to run the do_get_report task
whenever a correspondent .spdx file was already present in
tmp/deploy/spdx.
Now the check if spdx already exists is at a higher level therefore is possible
to run : bitbake -c get_report

Signed-off-by: Marco Cavallini <koansoftware@...>
---
classes/fossology-rest.bbclass | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/classes/fossology-rest.bbclass b/classes/fossology-rest.bbclass index
3694440..e55e859 100644
--- a/classes/fossology-rest.bbclass
+++ b/classes/fossology-rest.bbclass
@@ -84,6 +84,15 @@ python () {
create_manifest(info,sstatefile)
return

+ # if spdx already exists
+ if os.path.exists(info['outfile']):
+ bb.note(info['pn'] + "spdx file has been exist, do nothing")
+ return
+ if os.path.exists( sstatefile ):
+ bb.note(info['pn'] + "spdx file has been exist, do nothing")
+ create_manifest(info,sstatefile)
+ return
+
d.appendVarFlag('do_spdx', 'depends', ' %s:do_get_report' % pn)
bb.build.addtask('do_get_report', 'do_configure', 'do_patch' , d)
bb.build.addtask('do_spdx', 'do_configure', 'do_get_report', d) @@
-157,15 +166,6 @@ python do_get_report () {
info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] +
".spdx" )
sstatefile = os.path.join(spdx_outdir, info['pn'] + "-" + info['pv'] + ".spdx" )

- # if spdx has been exist
- if os.path.exists(info['outfile']):
- bb.note(info['pn'] + "spdx file has been exist, do nothing")
- return
- if os.path.exists( sstatefile ):
- bb.note(info['pn'] + "spdx file has been exist, do nothing")
- create_manifest(info,sstatefile)
- return
-
spdx_get_src(d)

bb.note('SPDX: Archiving the patched source...')
--
2.17.1

Join yocto@lists.yoctoproject.org to automatically receive all group messages.