Skip to content

generate_html_notices_from_json.py uses componentLicenses keys are missed from the report on latest releases #280

Open

Description

@senthilkumarasr

Hi Team,
While creating report using the script "examples/generate_html_notices_report_from_json/generate_html_notices_from_json.py", returning only below keys on the json on latest hub releases 2024.7.x+,

{
"reportContent": [
{
"fileName": "TestProject-ProjectVersion_2024-11-25_141727/version-license_2024-11-25_141727.json",
"fileContent": {
"projectVersion": [
{
"projectName": "TestProject",
"versionName": "ProjectVersion",
"versionPhase": "PLANNING",
"versionDistribution": "EXTERNAL"
}
],
"reportContents": [
{
"label": "Origin Copyright Text",
"description": "Copyright texts discovered by component origins. Only available if components with origins are present in the project.",
"category": "COPYRIGHT_TEXT",
"dependsOn": []
}
],
"componentCopyrightTexts": [
{
"componentVersionSummary": {
"projectName": "Apache Tomcat",
"versionName": "10.1.28",
"homeUrl": "http://tomcat.apache.org/"
},
"originFullName": "maven:org.apache.tomcat.embed:tomcat-embed-websocket:10.1.28",
"copyrightTexts": [
"Copyright 1999-2024 The Apache Software Foundation This product includes software developed at"
],
"originId": "a21266f9-f8eb-4039-a393-3e4773f94f20",
"componentProjectName": "Apache Tomcat"
}
]
},
"fileNamePrefix": "version-license_2024-11-25_141727"
}
]
}

but the script uses
fh.write(template.render(componentLicenses=fileContent['componentLicenses'],
licenseTexts=fileContent['licenseTexts'],
componentCopyrightTexts=fileContent['componentCopyrightTexts'],
projectVersion=fileContent['projectVersion']))

those fields are missed in the latest releases, so please update the script with latest hub releases

Activity

  1. Lythenas commented on Dec 3, 2024

    @Lythenas

    I ran into the same issue. Root cause seems to be this: https://documentation.blackduck.com/bundle/bd-hub/page/ReleaseNotes/2024.7.x/apiEnhancements_2024_7_1.html (LICENSE_DATA and LICENSE_TEXT are no longer the default).

    I fixed it running the following instead of calling create_version_notices_report:

        # copied and adapted version of
        # response = hub.create_version_notices_report(version, 'JSON', include_copyright_info=True)
        # with the new api changes that exclude the LICENSE_DATA and LICENSE_TEXT by default
        post_data = {
            'versionId': blackduck.Utils.object_id(version),
            'reportType': 'VERSION',
            'reportFormat': 'JSON',
            'categories': [
                'LICENSE_DATA', 'LICENSE_TEXT', 'COPYRIGHT_TEXT',
            ]
        }
    
        notices_report_url = hub.get_link(version, 'licenseReports')
        logger.error(notices_report_url)
        response = hub.execute_post(notices_report_url, post_data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions