# gc and the backend: gc deletes the stale images and the unused tool # images, whichever backend a tool image's record names or none, and never # a current image or a VM. No flag chooses a backend. env SHARE=$XDG_DATA_HOME/devvm/tools # base and foo on Lima, foo made stale. mkdir $XDG_CONFIG_HOME/devvm/layers cp foo.sh $XDG_CONFIG_HOME/devvm/layers/foo.sh exec devvm build foo exec sh -c 'echo "# edited" >> "$XDG_CONFIG_HOME/devvm/layers/foo.sh"' # Unused tool images: one recorded as Lima's, one nobody can tell; # claude's build, for a VM that's gone since, makes the lock, so they're # unused. project ag exec devvm --tools none --agents claude --network open --no-git-protect exec devvm rm --force --no-export exec sh -c 'cd "$SHARE" && for v in 1.2.0 1.3.0; do echo x > go-$v-0123456789ab.erofs; done' json_set $SHARE/go-1.2.0-0123456789ab.erofs.json sha256=x libc=gnu backend=lima built=2020-01-01T00:00:00Z # --backend is no flag of gc's, and refusing it deletes nothing. stub_reset ! exec devvm gc --backend lima --force stderr '^devvm: flag_unknown command=devvm gc flag=--backend$' ! stub_calls exists $SHARE/go-1.2.0-0123456789ab.erofs # gc: the stale image and both unused tool images; base stays. exec devvm gc --force stdout '^gc_image image=foo key=[0-9a-f]{12}$' stdout '^gc_tools count=2 ' ! stdout 'image=base' ! exists $SHARE/go-1.2.0-0123456789ab.erofs ! exists $SHARE/go-1.3.0-0123456789ab.erofs exec devvm images stdout '^base .* current ' -- foo.sh -- #!/bin/bash echo foo