Skip to contentSkip to conversation

fossology-rest.bbclass: Moved check if spdx already exists out of the task

PATCH In review Marco Cavallini 2 participants 6 messages Jul 22, 2021 – Jul 27, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fossology-rest.bbclass: Moved check if spdx already exists out of the task

From: Marco Cavallini <[email protected]>

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

---
 classes/fossology-rest.bbclass | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
classes/fossology-rest.bbclass +9 -9
index 3694440..e55e859 100644
@@ -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...')
Signature · 1 line
2.17.1
#1 lore raw

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

Quoted 62 lines

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

From: Marco Cavallini <[email protected]>

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

---
 classes/fossology-rest.bbclass | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
classes/fossology-rest.bbclass index renamed from classes/fossology-rest.bbclass +0 -0

3694440..e55e859 100644

classes/fossology-rest.bbclass +9 -1
@@ -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" )
classes/fossology-rest.bbclass +0 -10
-    # 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

#2 lore raw

Hi Lei,
my patches are based on branch MASTER therefore they are based on the latest source code.

Would you mind to apply this one so will be possible to call "bitbake -c get_report" ?

Thank you

--
Marco

Quoted 72 lines · On 27/07/21 03:11, [email protected] wrote:

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

Quoted 62 lines

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

From: Marco Cavallini <[email protected]>

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

---
  classes/fossology-rest.bbclass | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
classes/fossology-rest.bbclass index renamed from classes/fossology-rest.bbclass +0 -0

3694440..e55e859 100644

classes/fossology-rest.bbclass +9 -1
@@ -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" )
classes/fossology-rest.bbclass +0 -10
-    # 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

#3 lore raw

Hi, Marco

I got what you mean, but I think your patch should be modified as the following, just make do_get_report not check spdx file again, is it ?

$ git diff classes/fossology-rest.bbclass
classes/fossology-rest.bbclass +0 -9
index 3694440..c29e57f 100644
@@ -157,15 +157,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...')

There is no necessary to add check in line 87, because line 79~85 has checked whether the spdx files exist.

Review python () { · line 95

Quoted 13 lines
(quoted diff) +9 -0
@@ -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
+

Best regards
Lei

Quoted 100 lines
(quoted diff) +0 -1
-----Original Message-----

From: Marco <[email protected]>
Sent: Tuesday, July 27, 2021 2:51 PM
To: Lei, Maohui <[email protected]>; [email protected]
Cc: Marco Cavallini <[email protected]>
Subject: Re: [yocto] [meta-spdxscanner][PATCH] fossology-rest.bbclass: Moved check if spdx already exists out of the task

Hi Lei,
my patches are based on branch MASTER therefore they are based on the latest source code.

Would you mind to apply this one so will be possible to call "bitbake -c get_report" ?

Thank you

--
Marco

Quoted 76 lines · On 27/07/21 03:11, [email protected] wrote:

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/class
es/fossology-rest.bbclass

Best regards
Lei

Quoted 65 lines

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

From: Marco Cavallini <[email protected]>

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

---
  classes/fossology-rest.bbclass | 18 +++++++++---------
  1 file changed, 9 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/classes/fossology-rest.bbclass index
3694440..e55e859 100644

classes/fossology-rest.bbclass +9 -0
@@ -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" )

classes/fossology-rest.bbclass +0 -10
-    # 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

#4 lore raw

Hi Lei,
you are right.
Ignore this one and please see my other patch I set a few minutes ago.

Thank you
--
Marco

Quoted 145 lines · On 27/07/21 09:27, [email protected] wrote:

Hi, Marco

I got what you mean, but I think your patch should be modified as the following, just make do_get_report not check spdx file again, is it ?

$ git diff classes/fossology-rest.bbclass
classes/fossology-rest.bbclass +0 -9
index 3694440..c29e57f 100644
@@ -157,15 +157,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...')

There is no necessary to add check in line 87, because line 79~85 has checked whether the spdx files exist.

Review python () { · line 95

Quoted 13 lines
(quoted diff) +9 -0
@@ -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
+

Best regards
Lei

Quoted 100 lines
(quoted diff) +0 -1
-----Original Message-----

From: Marco <[email protected]>
Sent: Tuesday, July 27, 2021 2:51 PM
To: Lei, Maohui <[email protected]>; [email protected]
Cc: Marco Cavallini <[email protected]>
Subject: Re: [yocto] [meta-spdxscanner][PATCH] fossology-rest.bbclass: Moved check if spdx already exists out of the task

Hi Lei,
my patches are based on branch MASTER therefore they are based on the latest source code.

Would you mind to apply this one so will be possible to call "bitbake -c get_report" ?

Thank you

--
Marco

Quoted 76 lines · On 27/07/21 03:11, [email protected] wrote:

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/class
es/fossology-rest.bbclass

Best regards
Lei

Quoted 65 lines

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

From: Marco Cavallini <[email protected]>

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

---
   classes/fossology-rest.bbclass | 18 +++++++++---------
   1 file changed, 9 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/classes/fossology-rest.bbclass index
3694440..e55e859 100644

classes/fossology-rest.bbclass +9 -0
@@ -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" )

classes/fossology-rest.bbclass +0 -10
-    # 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

#5 lore raw

merged

Quoted 170 lines

-----Original Message-----
From: Marco <[email protected]>
Sent: Tuesday, July 27, 2021 3:34 PM
To: Lei, Maohui <[email protected]>; [email protected]
Cc: Marco Cavallini <[email protected]>
Subject: Re: [yocto] [meta-spdxscanner][PATCH] fossology-rest.bbclass: Moved check if spdx already exists out of the task

Hi Lei,
you are right.
Ignore this one and please see my other patch I set a few minutes ago.

Thank you
--
Marco

Quoted 3 lines · On 27/07/21 09:27, [email protected] wrote:

Hi, Marco

I got what you mean, but I think your patch should be modified as the

following, just make do_get_report not check spdx file again, is it ?

classes/fossology-rest.bbclass python do_get_report () { · line 157

Quoted 8 lines
$ git diff classes/fossology-rest.bbclass diff --git
a/classes/fossology-rest.bbclass b/classes/fossology-rest.bbclass
index 3694440..c29e57f 100644
classes/fossology-rest.bbclass +0 -0
@@ -157,15 +157,6 @@ python do_get_report () {
      info['outfile'] = os.path.join(manifest_dir, info['pn'] + "-" + info['pv'] +

".spdx" )

Quoted 16 lines
classes/fossology-rest.bbclass +0 -9
      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...')

Quoted 1 line

There is no necessary to add check in line 87, because line 79~85 has checked

whether the spdx files exist.

Quoted 84 lines

Review python () { · line 95

Quoted 13 lines
(quoted diff) +9 -0
@@ -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
+

Best regards
Lei

Quoted 67 lines
(quoted diff) +0 -1
-----Original Message-----

From: Marco <[email protected]>
Sent: Tuesday, July 27, 2021 2:51 PM
To: Lei, Maohui <[email protected]>; [email protected]
Cc: Marco Cavallini <[email protected]>
Subject: Re: [yocto] [meta-spdxscanner][PATCH] fossology-rest.bbclass: Moved check if spdx already exists out of the task

Hi Lei,
my patches are based on branch MASTER therefore they are based on the latest source code.

Would you mind to apply this one so will be possible to call "bitbake -c get_report" ?

Thank you

--
Marco

Quoted 43 lines · On 27/07/21 03:11, [email protected] wrote:

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/cla
ss
es/fossology-rest.bbclass

Best regards
Lei

Quoted 32 lines

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

From: Marco Cavallini <[email protected]>

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

---
   classes/fossology-rest.bbclass | 18 +++++++++---------
   1 file changed, 9 insertions(+), 9 deletions(-)
(quoted diff) +0 -0

b/classes/fossology-rest.bbclass index
3694440..e55e859 100644

classes/fossology-rest.bbclass +0 -0
@@ -84,6 +84,15 @@ python () {
           create_manifest(info,sstatefile)
           return
 
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines

classes/fossology-rest.bbclass python () { · line 96

Quoted 10 lines
classes/fossology-rest.bbclass +9 -0
+    # 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)

Quoted 25 lines
Quoted 24 lines
Quoted 24 lines
Quoted 23 lines
classes/fossology-rest.bbclass +0 -0
       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" )

classes/fossology-rest.bbclass +0 -10
-    # 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