diff mbox series

classes/create-spdx-2.2: Add missing import oe.packagedata

Message ID 20230920153049.13833-1-reatmon@ti.com
State New
Headers show
Series classes/create-spdx-2.2: Add missing import oe.packagedata | expand

Commit Message

Ryan Eatmon Sept. 20, 2023, 3:30 p.m. UTC
Add missing import statement to fix build failures:

File: '/scratch/jenkins_builds/arago-master-wip/build/sources/oe-core/meta/classes/create-spdx-2.2.bbclass', lineno: 722, function: collect_package_providers
     0718:    deps.append((d.getVar("PN"), d.getVar("BB_HASHFILENAME")))
     0719:
     0720:    for dep_pn, dep_hashfn in deps:
     0721:        localdata = d
 *** 0722:        recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
     0723:        if not recipe_data:
     0724:            localdata = bb.data.createCopy(d)
     0725:            localdata.setVar("PKGDATA_DIR", "${PKGDATA_DIR_SDK}")
     0726:            recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
Exception: AttributeError: module 'oe' has no attribute 'packagedata'

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
---
 meta/classes/create-spdx-2.2.bbclass | 1 +
 1 file changed, 1 insertion(+)

Comments

Richard Purdie Sept. 22, 2023, 6:47 a.m. UTC | #1
On Wed, 2023-09-20 at 10:30 -0500, Ryan Eatmon via
lists.openembedded.org wrote:
> Add missing import statement to fix build failures:
> 
> File: '/scratch/jenkins_builds/arago-master-wip/build/sources/oe-core/meta/classes/create-spdx-2.2.bbclass', lineno: 722, function: collect_package_providers
>      0718:    deps.append((d.getVar("PN"), d.getVar("BB_HASHFILENAME")))
>      0719:
>      0720:    for dep_pn, dep_hashfn in deps:
>      0721:        localdata = d
>  *** 0722:        recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
>      0723:        if not recipe_data:
>      0724:            localdata = bb.data.createCopy(d)
>      0725:            localdata.setVar("PKGDATA_DIR", "${PKGDATA_DIR_SDK}")
>      0726:            recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
> Exception: AttributeError: module 'oe' has no attribute 'packagedata'
> 
> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
> ---
>  meta/classes/create-spdx-2.2.bbclass | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass
> index 9b28d124c7..ff319207f7 100644
> --- a/meta/classes/create-spdx-2.2.bbclass
> +++ b/meta/classes/create-spdx-2.2.bbclass
> @@ -708,6 +708,7 @@ def collect_package_providers(d):
>      from pathlib import Path
>      import oe.sbom
>      import oe.spdx
> +    import oe.packagedata
>      import json
>  
>      deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))

We've realised that packagedata is missing in BBIMPORTS in
meta/lib/oe/__init__.py which should fix this but also add missing
dependency information so I'm likely to go with that change and this
one shouldn't be needed. Let me know if that isn't the case.

Cheers,

Richard
Ryan Eatmon Sept. 22, 2023, 8:37 p.m. UTC | #2
On 9/22/2023 1:47 AM, Richard Purdie wrote:
> On Wed, 2023-09-20 at 10:30 -0500, Ryan Eatmon via
> lists.openembedded.org wrote:
>> Add missing import statement to fix build failures:
>>
>> File: '/scratch/jenkins_builds/arago-master-wip/build/sources/oe-core/meta/classes/create-spdx-2.2.bbclass', lineno: 722, function: collect_package_providers
>>       0718:    deps.append((d.getVar("PN"), d.getVar("BB_HASHFILENAME")))
>>       0719:
>>       0720:    for dep_pn, dep_hashfn in deps:
>>       0721:        localdata = d
>>   *** 0722:        recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
>>       0723:        if not recipe_data:
>>       0724:            localdata = bb.data.createCopy(d)
>>       0725:            localdata.setVar("PKGDATA_DIR", "${PKGDATA_DIR_SDK}")
>>       0726:            recipe_data = oe.packagedata.read_pkgdata(dep_pn, localdata)
>> Exception: AttributeError: module 'oe' has no attribute 'packagedata'
>>
>> Signed-off-by: Ryan Eatmon <reatmon@ti.com>
>> ---
>>   meta/classes/create-spdx-2.2.bbclass | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass
>> index 9b28d124c7..ff319207f7 100644
>> --- a/meta/classes/create-spdx-2.2.bbclass
>> +++ b/meta/classes/create-spdx-2.2.bbclass
>> @@ -708,6 +708,7 @@ def collect_package_providers(d):
>>       from pathlib import Path
>>       import oe.sbom
>>       import oe.spdx
>> +    import oe.packagedata
>>       import json
>>   
>>       deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))
> 
> We've realised that packagedata is missing in BBIMPORTS in
> meta/lib/oe/__init__.py which should fix this but also add missing
> dependency information so I'm likely to go with that change and this
> one shouldn't be needed. Let me know if that isn't the case.

Your fix is better as it should cover all cases and not just this one.


> Cheers,
> 
> Richard
diff mbox series

Patch

diff --git a/meta/classes/create-spdx-2.2.bbclass b/meta/classes/create-spdx-2.2.bbclass
index 9b28d124c7..ff319207f7 100644
--- a/meta/classes/create-spdx-2.2.bbclass
+++ b/meta/classes/create-spdx-2.2.bbclass
@@ -708,6 +708,7 @@  def collect_package_providers(d):
     from pathlib import Path
     import oe.sbom
     import oe.spdx
+    import oe.packagedata
     import json
 
     deploy_dir_spdx = Path(d.getVar("DEPLOY_DIR_SPDX"))