File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -117,12 +117,27 @@ def to_file(self, filepath):
117117 Path (filepath ).write_text (self .to_yaml (), encoding = "utf-8" )
118118
119119
120+ def get_ort_project_type (project ):
121+ """
122+ Determine the ORT project type based on the project's input sources.
123+
124+ Currently, this function checks whether any of the project's
125+ input download URLs start with "docker://".
126+ If at least one Docker URL is found, it returns "docker".
127+ """
128+ inputs_url = project .inputsources .values_list ("download_url" , flat = True )
129+ if any (url .startswith ("docker://" ) for url in inputs_url ):
130+ return "docker"
131+
132+
120133def to_ort_package_list_yml (project ):
121134 """Convert a project object into a YAML string in the ORT package list format."""
135+ project_type = get_ort_project_type (project )
136+
122137 dependencies = []
123138 for package in project .discoveredpackages .all ():
124139 dependency = Dependency (
125- id = f"{ package .type } ::{ package .name } :{ package .version } " ,
140+ id = f"{ project_type or package .type } ::{ package .name } :{ package .version } " ,
126141 purl = package .purl ,
127142 sourceArtifact = SourceArtifact (url = package .download_url ),
128143 declaredLicenses = [package .get_declared_license_expression_spdx ()],
You can’t perform that action at this time.
0 commit comments