Fix issue #1055 and clean up the nix and packaging environments - #1057
Open
simoninns wants to merge 2 commits into
Open
Fix issue #1055 and clean up the nix and packaging environments#1057simoninns wants to merge 2 commits into
simoninns wants to merge 2 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix issue #1055 and clean up the nix and packaging environments
This started as a fix for #1055 —
ld-cutwas not usable from an installedcopy of ld-decode — and ended up as a cleanup of everything around it: the
last two shell-outs to tools that are not part of this repo are gone, the
flake installs a self-contained set of commands, and all three release
packages are built and smoke tested the same way.
Issue #1055: ld-cut
ld-cutwas a loose script at the repo root. It was not listed inpyproject.toml, sopip installand the flake never put it on PATH, andwriting
.ldsoutput shelled out told-lds-converter— a C++ tool from theseparate ld-decode-tools repo — so it failed even when
ld-cutitself wasreachable.
lddecode/cut.pybehind amain(), andld-cutis now aconsole entry point in
pyproject.toml. The rootld-cutstays as a thinshim for running from a source checkout.
.ldsoutput is packed in process bylddecode.lds, so it no longerdepends on anything being on PATH.
ld-lds-converter ported to Python
lddecode/lds.pyis an in-tree port of the C++ld-lds-converter, installedas
ld-lds-converter-py.tests/test_lds.pychecks the packing and unpackingagainst the original tool's format, so output stays byte-identical to the
legacy
ld-lds-converter.exe.ld-compress rewritten in Python
scripts/ld-compress(a bash script) becamelddecode/compress.py, installedas
ld-compress, withtests/test_compress.pycovering it and a rootld-compressshim for source checkouts. Along the way:when stderr is a terminal, so redirecting to a log file keeps the log clean;
-nturns it off at a terminal,-pforces it on when it is not one.on its own, so the extra code path and its external dependency bought
nothing. Compression levels are now flac's 1–8, default 8.
ld-compress runs; it needs 1.5.0 or later for
-j. Uncompress (-u) andverify (
-v) need nothing external at all — they decode through PyAV, thesame FFmpeg binding ld-decode already uses, and pack with
lddecode.lds.and macOS, and it finds the
flac.exeshipped beside it with no PATH setup.pv,xxd,awk,openssland the hand-rolled ffmpeg pipelines the oldscript relied on are all gone.
Nix flake
ld-cut,ld-compressandld-lds-converter-pyare installed and exposedas
nix run .#<tool>apps alongsideld-decodeandld-ldf-reader-py.flacandffmpeg, plus the package's ownbin, prefixed onto PATH — prefixed rather than replaced, so the user's owntools stay reachable. Nothing has to be installed separately any more.
mainProgramset,flacadded to the dev shell.Release packages
All three now ship the same five commands plus flac 1.5.0, and all three
prove it before publishing:
--versionon the tools, then a fullld-lds-converter-py→ld-compress→ld-compress -uround trip comparedbyte for byte against the original.
of a Nix closure. Nix binaries have absolute
/nix/storepaths baked in, sothe previous AppImage could not start on a machine without that exact store
path. The tools are self-locating shell wrappers, pip's build-time console
scripts are stripped, and the build fails if anything in the bundle still
refers to the build directory. flac is compiled statically so it does not
raise the bundle's glibc requirement. The relocation test runs from a copy
at a different path with
env -i.--windowedis usedonly for the ones that are never a stdio filter, since
ld-compressandld-lds-converter-pyread and write pipes. flac is built statically fromsource rather than taken from Homebrew, so there are no dylibs to relocate.
Nested executables are signed individually before the bundle is sealed,
which Apple silicon requires.
.batwrappers for all five tools inbin\, alongsideXiph's official
flac.exe1.5.0 andlibFLAC.dlland their licences.ld-compress.batruns a real script file rather thanpython -c, soargv[0]points atbin\and the flac lookup works.Tests
tests/test_lds.py—.ldspacking/unpacking, including formatcompatibility with the C++ converter.
tests/test_compress.py— compression, uncompression, verification, CLIbehaviour.
python-unit-tests,cut-ntsc-lds(ld-cut writing.lds),decode-ntsc-lds(that the result decodes) andcompress-lds-round-trip(
cmake_modules/LdsRoundTrip.cmake, skipped when flac is absent).Docs
INSTALL.md,BUILD.md, the threedocs/installation/pages anddocs/user-guide/scripts.mdupdated for the new command set, the bundledflac, the removed GPU path and the new
ld-compressoptions. The Windowsdrag-and-drop
.batrecipe now just callsld-compress. Also correctednix profile installtonix profile add.