# Tools

This directory contains helper utilities used for compatibility checks and release support for the sysinfo client. Run them from the client directory (the parent of `tools/`).

## Script Inventory

- compare_reports: compares a v3.7.1 reference report with a new report, enforcing old-key compatibility rules and allowed differences
- make_release: builds the release tarball and its checksum from one svn tag, or from `^/testing` or `^/stable` (or the uncommitted working copy); also builds the Windows client zip and its checksum from `windows/`

## compare_reports

`tools/compare_reports OLD.yaml NEW.yaml` skips the `#sysinfo:` header line and lists (a) old key paths missing in NEW, (b) type changes, and (c) value differences outside the allowed list in `Documentation/Spec.md` §1.2. It exits 0 only when (a) and (b) are empty.

Compare an old and new report file directly:

```bash
tools/compare_reports t/fixtures/linux-md-lvm/v3.7.1-report.yaml /tmp/sysinfo.testing.yaml
```

Loop over fixture references and validate each generated report:

```bash
for f in t/fixtures/*/v3.7.1-report.yaml; do tools/compare_reports "$f" /tmp/sysinfo.testing.yaml || exit 1; done
```

Call the tool after each report build and alert on non-zero exit status.

## make_release

`tools/make_release <version|testing|stable>` does an `svn export` of `tags/<version>`, or of `^/testing` or `^/stable` when given that word, builds the Unix tarball from `unix/` and the Windows zip from `windows/` (nothing else in the repository ships: `t/`, `tools/`, `server/`, `Documentation/`, `WorkingNotes/` and `reference/` stay out; test scratch files and `reports/` are dropped), and writes four files in a work directory (default `/tmp/sysinfo_release_work`, which is emptied first; `--workdir PATH` changes it; the repository is `--repo-root URL`, default the camp_sysinfo_client_3 repository):

- `sysinfo-client.tgz`: the tarball, with a single top directory `sysinfo_client/`.
- `sysinfo-client.tgz.sha256`: its checksum.
- `sysinfo-client-windows.zip`: the Windows client (the contents of `windows/`), with a single top directory `sysinfo_client_windows/`, built with `python3 -m zipfile` (no `zip` binary is needed).
- `sysinfo-client-windows.zip.sha256`: its checksum.

The files, with the install seeds `sysinfo-client.seed.yaml` (Unix) and `sysinfo-client.seed.json` (Windows, a JSON seed of the same site-wide settings), are uploaded to the release location (see `installer/README.md`). The file names carry no version; the version is read from the unpacked tree with `sysinfo_client --version`.

```bash
tools/make_release v3.8.1
tools/make_release testing
tools/make_release --working-copy
```

`--working-copy` (no tag) packages this working copy as it is, with uncommitted changes and new unversioned files, leaving out `.svn`, `.vscode`, `.bugzilla*` and editor backups (`*~`), so changes can be tried on beta machines before a commit. It prints a warning. Such a tarball cannot be rebuilt later, so do not publish it as a release.
