anthonyharrison / distro2SBOM

Generates SBOM files from system packaging information
Apache License 2.0
10 stars 7 forks source link

'RpmBuilder' object has no attribute 'license' #1

Closed danielperna84 closed 1 year ago

danielperna84 commented 1 year ago

Hi.

While playing around with version 0.2.0 I got the following exception:

Traceback (most recent call last):
  File "/opt/app-root/bin/distro2sbom", line 8, in <module>
    sys.exit(main())
  File "/opt/app-root/lib64/python3.8/site-packages/distro2sbom/cli.py", line 209, in main
    sbom_build.process_distro_package(args["package"])
  File "/opt/app-root/lib64/python3.8/site-packages/distro2sbom/distrobuilder/rpmbuilder.py", line 206, in process_distro_package
    if self.process_package(module_name):
  File "/opt/app-root/lib64/python3.8/site-packages/distro2sbom/distrobuilder/rpmbuilder.py", line 149, in process_package
    license = self.license.find_license(self.get("License"))
AttributeError: 'RpmBuilder' object has no attribute 'license'

The command used to generate this exception:

distro2sbom --distro rpm --name centos --release 7 --sbom cyclonedx -o sbom.json --format json -p bash

The enviroment is a Docker container (quay.io/centos7/python-38-centos7)

I don't get the exception if I instead use -i packages.txt. However in this case there is no license information in the resulting file (even when switching the SBOM format to spdx). Which I think might be another issue.

My assumption is, that distrobuilder.py contains changes (the license attribute, along with the associated methods to find licenses), which weren't included in the commits related to version 0.2.0.

anthonyharrison commented 1 year ago

@danielperna84 Thanks for reaching out.

I can see the error. I don't have a Centos system to hand at the moment but it worked on my Ubuntu system :-)

Will get an update done shortly and release a new version.

anthonyharrison commented 1 year ago

@danielperna84 Can you try version 0.2.1 (pip install distro2sbom --upgrade)?

danielperna84 commented 1 year ago

Yes, now it's working with -p bash. Thanks. 👍