Skip to content

Commit a21168f

Browse files
authored
fix (#283)
1 parent a418c95 commit a21168f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

_posts/2025-02-05-What-is-your-code-made-of-sboms.markdown

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ from conan.api.output import ConanOutput
5151
from conan.tools.sbom import cyclonedx_1_4
5252

5353
def post_package(conanfile, **kwargs):
54-
sbom_cyclonedx_1_4 = cyclonedx_1_4(conanfile.subgraph)
54+
sbom_cyclonedx_1_4 = cyclonedx_1_4(conanfile)
5555
metadata_folder = conanfile.package_metadata_folder
5656
file_name = "sbom.cdx.json"
5757
with open(os.path.join(metadata_folder, file_name), 'w') as f:
5858
json.dump(sbom_cyclonedx_1_4, f, indent=4)
5959
ConanOutput().success(f"CYCLONEDX CREATED - {conanfile.package_metadata_folder}")
6060
```
6161

62-
The hook calculates the subgraph using `conanfile.subgraph` and gives it to our new `cyclonedx_1_4` function, which returns
62+
The hook takes the `conanfile` and gives it to our new `cyclonedx_1_4` function, which returns
6363
the SBOM in JSON format. So, we just have to save this content in a new file. We will put it inside the package metadata folder,
6464
this is what you want if you want to upload it to your server for future analysis, by using the metadata feature of Conan (See our previous [metadata blogpost here](https://blog.conan.io/2023/10/24/Conan-launches-metadata-files.html) to learn how to use the feature).
6565
This hook launches on `post_package`, it is perfect for generating our SBOM after every `conan create`. Here you can see

0 commit comments

Comments
 (0)