Fix #4609: Handle file-type license references in NuGet packages#4701
Fix #4609: Handle file-type license references in NuGet packages#4701Jayant-kernel wants to merge 1 commit intoaboutcode-org:developfrom
Conversation
e213a40 to
24c47b2
Compare
|
Hi @pombredanne and @AyanSinhaMahapatra! This fixes #4609 following the feedback from #4689. I've corrected the issues: What changed from #4689:
Implementation:
All tests passing. Let me know If any changes required |
Lots of test failures in Please make sure you either explain the failures or regenerate the test expectations (related to your PR) |
89e3ed6 to
b48a7e3
Compare
|
Yes, all tests pass locally: pytest tests/packagedcode/test_nuget.py -vvs I see CI failures but they appear to be in test suites unrelated to NuGet (cluecode_license_base, misc_and_scancode). My changes only touch NuGet-specific files. thanks for the review |
- Add license_file_references field to PackageData model - Implement get_license_details() helper in nuget.py - Update NugetNuspecHandler to capture file references - Add test case for file-based license - Update existing expectations with minimal surgical changes Fixes aboutcode-org#4609 Signed-off-by: Jayant <[email protected]>
b48a7e3 to
2b24056
Compare
|
@AyanSinhaMahapatra @chinyeungli |
Fix #4609: Handle file-type license references in NuGet packages
Detect
<license type='file'>in .nuspec files and extract file path tolicense_file_referencesfield. Keepextracted_license_statementas raw path value to integrate with existing license resolution inprocess_codebasefunction.This follows the two-phase architecture pattern:
process_codebaseresolves file referencesMinimal changes (37 lines) following maintainer feedback from PR #4689.
Fixes #4609
Changes Made
Problem
NuGet packages with
<license type="file">path/LICENSE.txt</license>were returningLicenseRef-scancode-unknownbecause the file-type license references were not being extracted.Solution
license_file_referencesfield toNugetNuspecHandler@type="file"in nuspec XMLextracted_license_statementandlicense_file_referencesFiles Changed
src/packagedcode/nuget.py- Core implementation (21 lines added)tests/packagedcode/test_nuget.py- New test case (8 lines added)tests/packagedcode/data/nuget/license_file.nuspec- Test fixture (new file).expectedtest files - Updated withlicense_file_referencesfield (1 line each)Testing
✅ All existing tests pass (11 passed in 7.91s)
✅ New test
test_nuget_parse_license_file_referencevalidates license file extractionTasks
fix-4609-nuget-license-file-v4) and has no merge conflicts 📁Implementation Details
Code Changes in
src/packagedcode/nuget.py:Why This Works
process_codebasefunction will handle file resolution using the stored pathsSigned-off-by: Jayant [email protected]