@@ -80,16 +80,9 @@ fix_spdx_compatibility() {
8080
8181 log_info " Fixing SPDX compatibility issues for CycloneDX conversion"
8282
83- # Show what we're fixing
84- log_info " Original referenceCategory values:"
85- jq -r ' .packages[]?.externalRefs[]?.referenceCategory // empty' " $input_file " | sort | uniq | while read -r category; do
86- log_info " - $category "
87- done
88-
8983 # Fix referenceCategory values that CycloneDX doesn't recognize
9084 # Based on SPDX 2.2 spec, valid values are: SECURITY, PACKAGE_MANAGER, PERSISTENT_ID, OTHER
9185 if jq '
92- # Walk through the JSON and fix referenceCategory values
9386 walk(
9487 if type == "object" and has("referenceCategory") then
9588 .referenceCategory = (
@@ -105,25 +98,6 @@ fix_spdx_compatibility() {
10598 )
10699 ' " $input_file " > " $output_file " ; then
107100 log_success " SPDX compatibility fixes applied"
108-
109- # Show what we fixed
110- log_info " Fixed referenceCategory values:"
111- jq -r ' .packages[]?.externalRefs[]?.referenceCategory // empty' " $output_file " | sort | uniq | while read -r category; do
112- log_info " - $category "
113- done
114-
115- # Test if the fixed file can be parsed by trying a simple jq query
116- if ! jq ' .packages[0].externalRefs[0].referenceCategory // "none"' " $output_file " > /dev/null 2>&1 ; then
117- log_warning " Fixed file still seems problematic, trying fallback approach"
118-
119- # Fallback: Remove externalRefs entirely
120- if jq ' walk(if type == "object" and has("externalRefs") then del(.externalRefs) else . end)' " $input_file " > " $output_file " ; then
121- log_warning " Removed externalRefs as fallback"
122- else
123- log_error " Fallback approach also failed"
124- exit 1
125- fi
126- fi
127101 else
128102 log_error " Failed to apply SPDX compatibility fixes"
129103 exit 1
0 commit comments