Skip to content

Reselect assets only when --filter changes - #21

Merged
jsnjack merged 1 commit into
jsnjack:masterfrom
patrick-5546:unchanged-filter
Oct 30, 2026
Merged

jsnjack merged 1 commit into
jsnjack:masterfrom
patrick-5546:unchanged-filter

Conversation

@patrick-5546

Copy link
Copy Markdown
Contributor

Problem

The README says "Changing --filter starts asset selection again", but install uses cmd.Flags().Changed("filter"), which only reports that -f was passed. Running the same command twice, for example grm install --yes -f tar.gz bootandy/dust, reinstalls the package the second time even though it is already at the latest release.

Scripts and Ansible tasks repeat the same install command, so every run downloads and reinstalls every package that was given -f. The repeated filter also discards the remembered selection. For example, if only some binaries in an archive were selected, --yes installs all of them again, and without --yes grm asks again whenever there are several suitable assets or binaries. For a package installed before v2, reselect also disables the legacy migration that keeps the installed binary.

Change

install compares --filter with the saved filter. A different filter selects assets again as before. Passing the saved filter keeps the remembered selection, so the "already at" check applies, and an update reuses the saved asset and binaries. README and AGENTS.md describe this.

Tested

  • New TestInstallReselectsOnlyWhenFilterChanges runs installCmd for a tracked package with a saved filter and a saved selection of one of the archive's two binaries:

    • With the same filter at the installed version, nothing is downloaded.
    • With the same filter and a newer release, only the remembered binary is installed.
    • With a different filter, assets are selected again.

    The first two cases fail on master.

  • make fmt vet build lint passes. go test ./... passes in a fedora:44 container as root and as a regular user, and the new test passes with -race. On Ubuntu, three existing asset filter tests fail on master too, because they expect rpm to be installed and dpkg to be missing.

  • E2E in fedora:44: running grm install --yes -f tar.gz bootandy/dust twice prints bootandy/dust already at v1.2.6 the second time, where v2.0.8 reinstalls. A following grm install --yes -f musl bootandy/dust installs the musl asset on both.

This change is independent of #20.

cmd.Flags().Changed reports that --filter was passed, not that it
differs from the saved filter. Repeating the same install command
therefore selected assets again and reinstalled the package at the
installed version, replacing the remembered selection. Compare --filter
with the saved filter instead.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jsnjack

jsnjack commented Oct 30, 2026

Copy link
Copy Markdown
Owner

thanks!

@jsnjack
jsnjack merged commit baaa467 into jsnjack:master Oct 30, 2026
@patrick-5546
patrick-5546 deleted the unchanged-filter branch November 2, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants