README.md
Artifact-contained source contract (schema 1)
The AppImage and Noble .deb contain:
usr/share/doc/splotch-blot/source-manifest.json: the authoritative, versioned record of application identity, payload mapping, components, exact source coordinates/hashes/sizes, notices, recipes and build/test identities.usr/share/doc/splotch-blot/THIRD-PARTY-SOURCES.txt: generated only from that record, including the full relevant notices and standalone source instructions.usr/share/doc/splotch-blot/source-tools/{contract,common}.py: the small, application-owned collector itself, inventoried in the payload. After normal artifact extraction, runpython3 usr/share/doc/splotch-blot/source-tools/contract.pywith the commands below. This avoids needing a checkout or a prior application source download just to obtain the source collector; no source tarball is embedded.
Installed records/tool sources are 0644, with 0755 documentation parents, so ordinary package users can read and use them. This is deliberately separate from private archive publication (0600 files / 0700 newly created directories).
Nothing in the installed paint program downloads sources. These are intentional
maintainer/recipient tools. They use Python 3.10+, Git, curl, dpkg-deb and
unsquashfs. They do not execute an AppImage to extract it. No public dependency
source mirror or embedded source tarballs are used. Upstreams are not promised
forever; the private archive is the fallback.
Freeze once, build that input
From a checkout with all intended new source/tests explicitly tracked:
| 1 | python3 packaging/source/export.py freeze --mode candidate \ |
| 2 | --output packaging/build/inputs/candidate-example |
| 3 | python3 packaging/source/export.py verify-input packaging/build/inputs/candidate-example/tree |
This writes source.tar.gz, source.json and tree/. The canonical archive has
one splotch-blot/ prefix, byte-sorted regular files, normalized mode/ownership/time
and gzip time zero. source.json records its exact SHA256, file hashes/modes,
GitCafe repository, actual checkout base commit, public reconstruction commit,
and a Git binary patch for the candidate. --retrieval-base permits an available
public ancestor when the local base has not been pushed; it must be an ancestor
of HEAD. Without the option it defaults to HEAD. Convenience builders accept
SPLOTCH_RETRIEVAL_BASE for the same purpose. Do not conflate the local base
with the publicly retrievable reconstruction commit. Candidate reconstruction
can use that ancestor plus the recorded patch without publishing local commits.
It never pretends dirty modifications are in a final release tag. The patch is
embedded reconstruction data, not an embedded source tarball. Given the
artifact alone, the collector fetches that commit from GitCafe, applies the
patch, checks every file and reconstructs/verifies the exact archive bytes.
The source archive itself contains only intended source. tree/SOURCE-INPUT.json
and tree/SOURCE-INPUT.tar.gz are external build provenance and the original
export, not recursively added to the archive. Builders verify bytes, modes and
absence of unlisted inputs before compiling. They need no .git. They use the
same export for their independent source-build check. Native module pins stay in
go.mod; Jammy/Noble pins stay in their separate module files.
Untracked files are excluded; explicitly review/stage intended new files first.
Tracked private/generated paths are errors, not silently exported. Source symlinks
are rejected. Private agent configuration, archive/dist, packaging/build/,
executables and Python caches cannot enter exports. archive.sh NEW.tar.gz [splotch-blot] remains a
small compatibility helper; use export.py freeze to retain provenance too.
Package helpers default automatic freezes to packaging/build/inputs/ and
artifact/staging outputs to packaging/build/<format>/<version>/.
SPLOTCH_DIST_ROOT retains compatibility as an output-root override; when
building from an exported tree, use an absolute checkout-local scratch path to
keep builds outside the input. packaging/release/source.sh TAG defaults to
packaging/build/release/<version>/source; the override also applies there,
and an explicit output argument takes precedence. Untracked scratch is ignored
when checking an input inventory, but tracked scratch is an export error.
All builds, freezes, fixture outputs and previews are disposable. Stop builds
and retain selected artifacts/evidence before packaging/clean-build.sh --apply
(dry-run by default). It only cleans local packaging/build/, never override
destinations, public dist/archive/, private dist/mirror/ or dist/.state/.
For final source use packaging/release/source.sh "$TAG" NEW_DIRECTORY
after the approved annotated tag exists, with TAG set to that tag. It reads
that commit, not the working tree; requires the committed version to match;
records the tag object and has no patch.
It never creates a tag. Candidate absence of a final tag is expected; missing
required dependency sources/notices is an error in both modes.
Package version boundaries
The source's literal appVersion must agree with its input record. Helpers then
check the package version against that exact MAJOR.MINOR.PATCH before
starting Podman/makepkg; artifact validation uses the same rule:
- AppImage: the exact application version, optionally
-LABEL. LABEL starts alphanumeric and then uses alphanumeric,.,+,~or-characters. .deb: the exact application version, optionally-REVISION. REVISION starts with a digit and then uses alphanumeric,.,+or~characters. Epochs and changes to the upstream version (including~rcbefore the revision) are not supported by this recipe. Put candidate/distro qualifiers in the revision.- The local Arch helper uses the exact application version plus
-and numeric PKGREL. This does not add Arch to the artifact collector's supported formats.
Thus 1.0.1-candidate-jammy1, 1.0.1-jammy1,
1.0.1-0candidate~noble1 and 1.0.1-1~noble1 are valid examples;
1.0.10-jammy1 never matches application/tag version 1.0.1. Candidate versus
release identity still comes from the source mode/tag record, not its filename.
Real artifact commands
After the frozen builds described in release/README.md:
| 1 | export PYTHONDONTWRITEBYTECODE=1 |
| 2 | A=/path/to/Selected.AppImage |
| 3 | python3 packaging/source/contract.py extract "$A" --mode candidate --output packaging/build/records/candidate-example |
| 4 | python3 packaging/source/contract.py verify "$A" --mode candidate --sidecar packaging/build/records/candidate-example/source-manifest.json |
| 5 | python3 packaging/source/contract.py fetch "$A" --mode candidate --label candidate-example --archive-root archive |
| 6 | AH=$(sha256sum "$A"); AH=${AH%% *} |
| 7 | AA=archive/candidate-example/$AH |
| 8 | # These operations are fully offline; keep the artifacts available locally. |
| 9 | python3 packaging/source/contract.py verify-archive "$A" --mode candidate --directory "$AA" |
| 10 | python3 packaging/source/contract.py bundle "$A" --mode candidate --directory "$AA" --output archive/candidate-example/sources-$AH.tar.gz |
Use the same commands for a .deb path. Select --mode release and a
release-... label for approved tagged artifacts; do not relabel candidates.
fetch starts with the actual artifact bytes, verifies the embedded payload
inventory, readable notices and (AppImage) runtime prefix, then retrieves each
source and checks its size and SHA256 before publication. The optional --sidecar
is an equality check against the embedded record, never a substitute for it.
collect has the same arguments plus required available bytes in --source-dir
and does no network. fetch --source-dir DIRECTORY can also reuse already
verified matching inputs. Filenames come from the embedded records. The app
export is named splotch-blot-source.tar.gz.
An archive is archive/<candidate-or-release-label>/<actual-artifact-sha256>/:
index.json, the exact embedded source-manifest.json, generated readable
notices, and sources/. index.json binds both artifact and manifest hashes.
This checkout directory is private, not the website's public archive/ URL;
never recursively copy it into website staging. The
deployment workflow uses private dist/mirror/
alongside this per-artifact collector format. Persistent public packages/catalog
live separately in dist/archive/; static pages live in dist/website/ and
dist/website.tar.gz + .sha256, with no archive/packages/private sources in
that transfer. Editable website state lives in dist/.state/{release,test}/,
and .state/current/ inventories public outputs. Snapshot combines only public
outputs for preview under packaging/build/website/current/site/; never serve
dist/. After cleaning scratch, website/manage.py preview regenerates it.
Back up dist/archive/, dist/mirror/ and dist/.state/ together; a public
archive backup restores release metadata/files through website import, not
private sources. Website migrate-layout moves old managed dist/deploy/ state
without changing source identity or discarding bytes; preserve/move unknown
legacy root outputs first. It does not automatically migrate legacy private
source collections.
Offline verification re-extracts the artifact, verifies the whole source set and
rejects extra files. The bundle contains only that verified set. Keep the binary
artifact separately; its hash is not a publisher signature. Copying to a NAS is
a maintainer operation, not something these tools perform.
All outputs must be new. Unsafe components, symlinked parents/index targets,
wrong/missing sources and candidate/release mismatches fail. Collection stages
in a private sibling directory and publishes only a verified complete set;
failures retain .pending-*/FAILURE.txt for diagnosis, never a success index.
No old archive is overwritten, merged or cleaned. This protects against unsafe
input paths; it is not a sandbox against a concurrent malicious process with the
same Unix account replacing directories while the tool runs.
What the records mean
components[].role distinguishes application, shipped library/data, compiled
Go/C/protocol inputs, embedded runtime/static inputs, build-only, host-build and
host-tested records. Every payload file/symlink has a byte hash or link target,
component references, origin and transformation. Generated schema/MIME/icon
caches, flattened/patchelf-adjusted libraries, all pixbuf loaders, fonts and
fontconfig rules are included. The manifest and its own readable rendering are
the two explicitly non-recursive payload entries.
Ubuntu sources record separate binary/source versions, exact .dsc and all
constituent archives with hashes/sizes and ordinary Ubuntu archive/security/old-
releases URLs. dpkg-source -x applies the recorded distribution patch series.
Go records come from the actual binary's go version -m dependencies, not every
module in the build cache; the exact proxy zip and toolchain/standard-library
source are recorded. Local recipes/options are in the application export.
Selected protocol XML records include exact file hashes and individual notice references. The Wayland-protocols inputs compiled by GTK are mapped to the GTK library, not to the Go executable; GTK also declares that compiled-input relationship. The pinned recipe verifies XML bytes/notice text before compiling.
Noble links APT GTK, not the source-built AppImage stack. Build and successful
clean-runtime installed binary/source identities are captured independently,
including the resolved dynamic library closure and SVG loader. Empty/header-only
records fail independently. The final .deb is installed/tested again after
record assembly and its runtime identities must still match. A later user's
updated host libraries are not claimed to be the tested ones.
Arch remains host-stack packaging; its installed source-input.json, compiled
module notices and build-info distinguish that from a bundled stack. The
artifact collector here targets AppImage/.deb, not a promise to reconstruct
all of a rolling Arch host from its native binary package.
Cheap gate
| 1 | ./packaging/source/test-contract.sh |
| 2 | # Or use an ALREADY PRESENT equipped image, no pull/build/network: |
| 3 | TMPDIR="$PWD/packaging/build/contract-fixtures" CONTRACT_IMAGE=localhost/splotch-blot-appimage:stack \ |
| 4 | ./packaging/source/test-contract.sh |
Create that private fixture directory first. The image route sets isolated XDG state/config/data inside it. Synthetic tiny packages and isolated repositories exercise source identity, retrieval records and unsafe-input rejection without networking or building the application. This checks tooling contracts, not native behavior or actual-package desktop compatibility.
Shared private mirror (separate from the installed collector)
mirror.py is maintainer-side, Python standard library, for deduplicating verified
legacy archives or exact ordinary source files. It does not change the
installed collector API or its archive/<label>/<artifact-hash>/ format. It
requires Python 3.10+. Package import, verify and bundle additionally need
dpkg-deb for .deb or unsquashfs for AppImage; browsing and source-file
extraction do not. --fetch also requires Git/curl and network access.
Run it in an equipped environment; do not install tools on a bootc host merely
for this task. It never executes the AppImage.
Find and restore retained sources
Human-readable listings avoid manually opening hash-named records:
| 1 | python3 packaging/source/mirror.py list |
| 2 | python3 packaging/source/mirror.py list --search jammy |
| 3 | python3 packaging/source/mirror.py sources --search gtk |
list shows built packages with format, version, mode and short package ID.
sources shows original source filenames, sizes, short source hashes and build
reference counts. Shared filename/hash pairs appear once. Supply a unique
package version, version substring or package hash prefix (at least eight
characters) to limit either listing to one build. For example:
| 1 | python3 packaging/source/mirror.py sources PACKAGE_ID --search gtk |
| 2 | python3 packaging/source/mirror.py extract PACKAGE_ID \ |
| 3 | --source ORIGINAL_SOURCE_FILENAME --output packaging/build/restored-source |
| 4 | python3 packaging/source/mirror.py extract PACKAGE_ID \ |
| 5 | --output packaging/build/restored-build-sources |
The first extraction restores one file under its original filename. The second
restores the build's complete sources/ directory plus source manifest, notices
and collector-compatible index. No binary package is added to that extraction.
Output must be a new directory outside the mirror; existing files are never
overwritten. Extracted copies are private and may be archived or inspected
without changing the deduplicated store.
To restore a source shared across builds, omit the package selector:
| 1 | python3 packaging/source/mirror.py extract --source ORIGINAL_SOURCE_FILENAME \ |
| 2 | --output packaging/build/restored-source |
If that filename has different retained versions, extraction refuses to guess.
Select a build or supply the unique source hash prefix printed by sources as
--source. Extraction restores the original archive/patch files; it does not
unpack their internal tar/zip members or execute anything.
Listing checks retained record correspondence, not every source object's bytes.
Extraction checks the records and every selected source object's size/SHA-256,
then verifies the copied bytes. Both are offline Python-only operations. Full
verify additionally re-extracts the retained package, checks its embedded
payload/provenance and verifies all corresponding sources; use it in an equipped
environment when that stronger package-level check is needed.
Import, verify and bundle
| 1 | python3 packaging/source/mirror.py import ACTUAL.AppImage --mode candidate \ |
| 2 | --archive archive/candidate-label/ACTUAL_ARTIFACT_SHA256 --mirror-root dist/mirror |
| 3 | python3 packaging/source/mirror.py import ACTUAL.deb --mode release \ |
| 4 | --source-dir EXISTING_SOURCES --mirror-root dist/mirror |
| 5 | python3 packaging/source/mirror.py verify ARTIFACT_SHA256 --mirror-root dist/mirror |
| 6 | python3 packaging/source/mirror.py bundle ARTIFACT_SHA256 --mirror-root dist/mirror \ |
| 7 | --output NEW-sources.tar.gz |
The import positional argument is the actual package path, not a sidecar.
--archive verifies the complete, unmodified legacy archive against the embedded
record and copies from it; the original archive is never moved or deleted.
Explicitly supplied archives are reverified even when the artifact was already
mirrored. --source-dir supplies exact filenames for missing objects; its path
and every present matching source file are checked even on repeat import. Missing
source-dir files are allowed only when verified mirror objects already suffice
(or explicit fetch can provide them). Without either input, existing verified
mirror objects suffice, but missing objects fail offline;
--fetch explicitly enables the collector's validated reconstruction/download
for missing files. --sidecar optionally checks equality against the embedded
manifest. Archive and source-dir paths must not contain symlink ancestors or
symlinked source files. An import returns the actual artifact SHA256 ID; callers
should retain it. verify and bundle take that ID, not the package path.
They operate offline on the retained package even after the input build is gone.
The private layout is objects/sha256/<sha256> (both original package and source
bytes) and artifacts/<artifact-sha256>/{index.json,source-manifest.json,THIRD-PARTY-SOURCES.txt}.
Index schema 1 includes mode, package hash/size, embedded manifest hash and a
filename-to-hash/size source map. It is not a public website metadata schema.
Object names depend on bytes, not filename; identical bytes across different
artifacts share one object, while distinct bytes with the same filename remain
separate. Existing objects are checked before reuse; corrupt/missing files cause
failure, never silent replacement. The per-artifact record is published only
after all objects are present and verified. Locking excludes mirror writers and
readers during import, offline verification and bundle creation; object and
record publication is exclusive, and objects are never automatically evicted.
Failed imports may leave harmless unreferenced, verified objects or .pending-
files, but cannot leave a complete record. The lock is advisory: all cooperating
mirror callers must use this CLI/API. Do not edit private files in place.
bundle requires a new output outside the mirror root (including via aliases),
so it cannot add files to immutable artifact records or objects. Symlinked
output parents are refused, even when they lead outside the mirror.
bundle writes a new portable gzip tar with ordinary sources/<filename>
entries plus the collector-format index, exact embedded manifest and readable
notices. It never exports the retained binary package; preserve that separately
for authoritative package verification. No public mirroring, deployment or
release approval follows from an import.
Python entry points for website tooling: import_artifact(root, path, mode, archive=None, source_dir=None, fetch=False, sidecar=None) -> artifact_sha256,
verify(root, artifact_sha256) -> index, bundle(root, artifact_sha256, output) -> output Path. The functions raise ValueError/OSError on failures. The
index is a private contract, not the website's public catalog.
Fixture gate: in an environment with package extraction tools, run
python3 -m unittest discover -s packaging/source -p 'test_*.py'; the mirror
tests use tiny real .deb packages and no network. Existing legacy archives
remain supported read-only inputs, not a mandatory bulk migration.