Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,38 @@ All notable changes to this project will be documented in this file.

### Changed

- Add custom `HelpFormatter` to render boolean flags in a compact `--[no-]flag` format instead of the default `--flag, --no-flag`.
- The following filtering category arguments have been renamed and converted to
boolean options, all defaulting to `True`:
- `--show-packages` to `--[no-]packages`(default: --packages)
- `--show-config` to `--[no-]kernel-config`(default: --kernel-config)
- `--show-packageconfig` to `--[no-]packageconfig`(default: --packageconfig)
- `--ignore-proprietary` to `--[no-]packages-proprietary`(default: --packages-proprietary)

- Console output handling has been updated:
- **Structured JSON** output is emitted on **stdout** by default to facilitate seamless
integration of the tool into automated pipelines and scripting workflows.
- **Human-readable** output is now provided by using --human-readable argument which replace
the **Structured JSON** output

- The JSON output file has been updated:
- The JSON output file is no longer generated by default.
- The `--output <PATH>` option have been renamed to `--json-output <PATH>`
- The `--json-output <PATH>` option must now be explicitly specified to enable JSON file generation.

### Fixed

### Removed

- Refocused the tool on producing complete and reliable spdx diff:
- Removing output filtering options:
- `--show-added`
- `--show-changed`
- `--show-removed`
- The default behaviour is to show the full spdx diff, following arguments are removed:
- `--full`
- `--summary`

## [1.0.1] - 2026-02-12

### Added
Expand Down
10 changes: 5 additions & 5 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ After installation:
# Show help
spdx-diff --help

# Compare two SPDX files
# Compare two SPDX files, JSON output on stdout by default
spdx-diff reference.json new.json

# Show summary only
spdx-diff reference.json new.json --summary
# Compare two SPDX files, human readable output on stdout
spdx-diff reference.json new.json --human-readable

# JSON output for automation
spdx-diff reference.json new.json --format json --output results.json
# With JSON file output generated
spdx-diff reference.json new.json --json-output results.json
```

See `README.md` for full documentation.
Expand Down
89 changes: 24 additions & 65 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ This tool compares two SPDX3 JSON documents and reports differences in:
- Kernel configuration parameters (CONFIG_*)
- PACKAGECONFIG entries per package

It produces both human-readable output (console) and a structured JSON diff file.
The application separates human-readable and machine-readable outputs to improve automation and pipeline integration.

- By default, the tool emits structured **JSON output**, making it suitable for consumption by scripts and CI/CD pipelines.
- The default output format can be changed into a human-readable (text) using --human-readable optional argument.
- When a JSON filename parameter is provided, the JSON result is also written to the specified file.

Usage
-----
Expand All @@ -21,26 +25,14 @@ Required arguments:
- `new`: Path to the newer SPDX3 JSON file.

Optional arguments:
- `--full`: For console output, always show section names (added, removed,
changed) even if there is no difference.
- `--output <file>`: Save diff results to the given JSON file.
Default: `spdx_diff_<timestamp>.json`
- `--ignore-proprietary`: Ignore packages with LicenseRef-Proprietary.
- `--summary`: Show only summary statistics without detailed differences.
- `--format {text,json,both}`: Control output format:
- `text`: Console output only (no JSON file)
- `json`: JSON file only (silent mode for automation)
- `both`: Both console and JSON output (**default**)

Output filtering - change type:
- `--show-added`: Show only added items.
- `--show-removed`: Show only removed items.
- `--show-changed`: Show only changed items.

Output filtering - category:
- `--show-packages`: Show only package differences.
- `--show-config`: Show only kernel config differences.
- `--show-packageconfig`: Show only PACKAGECONFIG differences.
- `--json-output <file>`: Save diff results to the given JSON file.
- `--human-readable`: Output results in a human-readable text format.

Text output filtering - category :
- `--[no-]packages`: show|hide package differences.
- `--[no-]kernel-config`: show|hide kernel config differences.
- `--[no-]packageconfig`: show|hide PACKAGECONFIG differences.
- `--[no-]packages-proprietary`: show|hide packages with LicenseRef-Proprietary.

Output
------
Expand All @@ -67,27 +59,6 @@ Symbols:
- removed
~ changed

Summary Mode
------------
When using --summary, the tool displays aggregate statistics:

```
SPDX-Diff Summary:

Packages:
Added: 5
Removed: 2
Changed: 3

Kernel Config:
Added: 10
Removed: 3
Changed: 7

PACKAGECONFIG:
Features Added: 12
Features Removed: 4
Features Changed: 6
```

JSON Diff File
Expand Down Expand Up @@ -157,37 +128,25 @@ The script uses Python's logging module:
Examples
--------

### Basic comparison with both console and JSON output:
### Basic comparison with default JSON output on stdout:
./spdx-diff reference.json new.json

### Full details with proprietary packages excluded:
./spdx-diff reference.json new.json --ignore-proprietary --full

### Quick summary check:
./spdx-diff reference.json new.json --summary
./spdx-diff reference.json new.json --no-packages-proprietary

### Silent mode for CI/CD (JSON output only):
./spdx-diff reference.json new.json --format json --output results.json

### Console output only (no JSON file):
./spdx-diff reference.json new.json --format text --full

### Show only changed packages:
./spdx-diff reference.json new.json --show-packages --show-changed

### Show only added packages:
./spdx-diff reference.json new.json --show-packages --show-added
### Console output for CI/CD:
./spdx-diff reference.json new.json

### Show only kernel config changes:
./spdx-diff reference.json new.json --show-config --show-changed
### Console output human-readable:
./spdx-diff reference.json new.json --human-readable

### Show added and changed items across all categories:
./spdx-diff reference.json new.json --show-added --show-changed
### Console and JSON output with JSON file generated:
./spdx-diff reference.json new.json --json-output result.json

### Show only PACKAGECONFIG differences:
./spdx-diff reference.json new.json --show-packageconfig
### Exclude on console PACKAGECONFIG differences:
./spdx-diff reference.json new.json --no-packageconfig

Console output example:
Human readable console output example:
```
Packages - Added:
+ libfoo: 2.0
Expand Down
Loading
Loading