Skip to content
Open
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
26 changes: 26 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,39 @@ All notable changes to this project will be documented in this file.
## [Unreleased]

### Added
- Added quiet argument for decreasing verbosity to ERROR only.

### Changed
- The following filtering category arguments have been renamed and converted to
boolean options, all defaulting to `True`:
- `--show-packages` to `--packages`(default) and `--no-packages`
- `--show-config` to `--kernel-config`(default) and `--no-kernel-config`
- `--show-packageconfig` to `--packageconfig`(default) and `--no-packageconfig`
- `--ignore-proprietary` to `--packages-proprietary`(default) and `--no-packages-proprietary`

- Console output handling has been updated:
- **Human-readable** output is now redirected to **stderr**
- **Structured JSON** output is emitted on **stdout** to facilitate seamless
integration of the tool into automated pipelines and scripting workflows.

- 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

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

## [1.0.1] - 2026-02-12

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

# Compare two SPDX files
# Compare two SPDX files, human-readable output on stderr and JSON output on stdout
spdx-diff reference.json new.json

# Show summary only
spdx-diff reference.json new.json --summary

# 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
87 changes: 21 additions & 66 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.

- **stderr** is used for human-readable (text) output intended for debugging.
- **stdout** always emits structured **JSON output**, making it suitable for consumption by scripts and CI/CD pipelines.
- When a JSON filename parameter is provided, the JSON result is also written to the specified file.

Usage
-----
Expand All @@ -21,26 +25,13 @@ 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.

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 +58,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 +127,22 @@ The script uses Python's logging module:
Examples
--------

### Basic comparison with both console and JSON output:
### Basic comparison with both console(stderr) and JSON(stdout) output:
./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 for CI/CD:
./spdx-diff reference.json new.json --quiet

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

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

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

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

### Show added and changed items across all categories:
./spdx-diff reference.json new.json --show-added --show-changed

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

Console output example:
Console output(stderr) example:
```
Packages - Added:
+ libfoo: 2.0
Expand Down
Loading
Loading