Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package conan for openSUSE:Factory checked in at 2025-02-17 20:57:44 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/conan (Old) and /work/SRC/openSUSE:Factory/.conan.new.8181 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "conan" Mon Feb 17 20:57:44 2025 rev:12 rq:1246429 version:2.12.2 Changes: -------- --- /work/SRC/openSUSE:Factory/conan/conan.changes 2025-02-09 20:34:12.671268873 +0100 +++ /work/SRC/openSUSE:Factory/.conan.new.8181/conan.changes 2025-02-17 20:58:11.665649271 +0100 @@ -1,0 +2,10 @@ +Sat Feb 15 12:01:54 UTC 2025 - Atri Bhattacharya <[email protected]> + +- Update to version 2.12.2: + * Fix default name and let cycloneDX define a custom name + (gh#conan-io/conan#17760). + * Add cycloneDX add_tests and add_build parameters + (gh#conan-io/conan#17760). + * Fix cycloneDX tool parameters (gh#conan-io/conan#17760). + +------------------------------------------------------------------- Old: ---- conan-2.12.1.tar.gz New: ---- conan-2.12.2.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ conan.spec ++++++ --- /var/tmp/diff_new_pack.Fwkn8C/_old 2025-02-17 20:58:12.789696145 +0100 +++ /var/tmp/diff_new_pack.Fwkn8C/_new 2025-02-17 20:58:12.793696311 +0100 @@ -18,7 +18,7 @@ # Note: We only want to build for the default python3 Name: conan -Version: 2.12.1 +Version: 2.12.2 Release: 0 Summary: A C/C++ package manager License: MIT ++++++ conan-2.12.1.tar.gz -> conan-2.12.2.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conan-2.12.1/PKG-INFO new/conan-2.12.2/PKG-INFO --- old/conan-2.12.1/PKG-INFO 2025-01-28 12:42:11.867645000 +0100 +++ new/conan-2.12.2/PKG-INFO 2025-02-12 16:04:40.938154500 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: conan -Version: 2.12.1 +Version: 2.12.2 Summary: Conan C/C++ package manager Home-page: https://conan.io Author: JFrog LTD diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conan-2.12.1/conan/__init__.py new/conan-2.12.2/conan/__init__.py --- old/conan-2.12.1/conan/__init__.py 2025-01-28 12:42:02.000000000 +0100 +++ new/conan-2.12.2/conan/__init__.py 2025-02-12 16:04:32.000000000 +0100 @@ -1,5 +1,5 @@ from conan.internal.model.conan_file import ConanFile from conan.internal.model.version import Version -__version__ = '2.12.1' +__version__ = '2.12.2' conan_version = Version(__version__) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conan-2.12.1/conan/tools/sbom/__init__.py new/conan-2.12.2/conan/tools/sbom/__init__.py --- old/conan-2.12.1/conan/tools/sbom/__init__.py 2025-01-28 12:42:02.000000000 +0100 +++ new/conan-2.12.2/conan/tools/sbom/__init__.py 2025-02-12 16:04:32.000000000 +0100 @@ -0,0 +1 @@ +from conan.tools.sbom.cyclonedx import cyclonedx_1_4 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conan-2.12.1/conan/tools/sbom/cyclonedx.py new/conan-2.12.2/conan/tools/sbom/cyclonedx.py --- old/conan-2.12.1/conan/tools/sbom/cyclonedx.py 2025-01-28 12:42:02.000000000 +0100 +++ new/conan-2.12.2/conan/tools/sbom/cyclonedx.py 2025-02-12 16:04:32.000000000 +0100 @@ -1,16 +1,39 @@ -def cyclonedx_1_4(graph, **kwargs): + +def cyclonedx_1_4(conanfile, name=None, add_build=False, add_tests=False, **kwargs): """ - (Experimental) Generate cyclone 1.4 sbom with json format + (Experimental) Generate cyclone 1.4 SBOM with JSON format + + Creates a CycloneDX 1.4 Software Bill of Materials (SBOM) from a given dependency graph. + + + + Parameters: + conanfile: The conanfile instance. + name (str, optional): Custom name for the metadata field. + add_build (bool, optional, default=False): Include build dependencies. + add_tests (bool, optional, default=False): Include test dependencies. + + Returns: + The generated CycloneDX 1.4 document as a string. + + Example usage: + ``` + cyclonedx(conanfile, name="custom_name", add_build=True, add_test=True, **kwargs) + ``` + """ import uuid import time from datetime import datetime, timezone + graph = conanfile.subgraph has_special_root_node = not (getattr(graph.root.ref, "name", False) and getattr(graph.root.ref, "version", False) and getattr(graph.root.ref, "revision", False)) special_id = str(uuid.uuid4()) - components = [node for node in graph.nodes] + name_default = getattr(graph.root.ref, "name", False) or "conan-sbom" + name_default += f"/{graph.root.ref.version}" if bool(getattr(graph.root.ref, "version", False)) else "" + components = [node for node in graph.nodes if (node.context == "host" or add_build) and (not node.test or add_tests)] if has_special_root_node: components = components[1:] @@ -22,7 +45,9 @@ dependencies.append(deps) for c in components: deps = {"ref": f"pkg:conan/{c.name}@{c.ref.version}?rref={c.ref.revision}"} - depends_on = [f"pkg:conan/{d.dst.name}@{d.dst.ref.version}?rref={d.dst.ref.revision}" for d in c.dependencies] + dep = [d for d in c.dependencies if (d.dst.context == "host" or add_build) and (not d.dst.test or add_tests)] + + depends_on = [f"pkg:conan/{d.dst.name}@{d.dst.ref.version}?rref={d.dst.ref.revision}" for d in dep] if depends_on: deps["dependsOn"] = depends_on dependencies.append(deps) @@ -56,7 +81,7 @@ "component": { "author": "Conan", "bom-ref": special_id if has_special_root_node else f"pkg:conan/{c.name}@{c.ref.version}?rref={c.ref.revision}", - "name": graph.root.conanfile.display_name, + "name": name if name else name_default, "type": "library" }, "timestamp": f"{datetime.fromtimestamp(time.time(), tz=timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')}", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conan-2.12.1/conan.egg-info/PKG-INFO new/conan-2.12.2/conan.egg-info/PKG-INFO --- old/conan-2.12.1/conan.egg-info/PKG-INFO 2025-01-28 12:42:11.000000000 +0100 +++ new/conan-2.12.2/conan.egg-info/PKG-INFO 2025-02-12 16:04:40.000000000 +0100 @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: conan -Version: 2.12.1 +Version: 2.12.2 Summary: Conan C/C++ package manager Home-page: https://conan.io Author: JFrog LTD
