Skip to content

"swiftly uninstall all" command to remove all installed toolchains #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 25, 2023
Merged

Conversation

markdols
Copy link
Contributor

Hello, I maintain the swiftly-bin AUR package, and I appreciate all of the work that has gone into this utility, as it has been very useful to use (and definitely more flexible than just using the swift-bin AUR package!)

The .install script I wrote for said package runs swiftly uninstall latest in a loop until the ~/.local/share/swiftly/toolchains folder is empty. This is prone to an infinite loop if a non-toolchain file or folder is placed in that directory.

To alleviate this, I propose some small changes to Uninstall.swift that allow for a one-command uninstallation of all installed toolchains with swiftly uninstall all.

I am new to contributing, so please let me know if there are any issues with this proposal.

Thank you!

markdols and others added 3 commits December 24, 2023 16:30
Hello, I maintain the [swiftly-bin AUR package](https://aur.archlinux.org/packages/swiftly-bin), and I appreciate all of the work that has gone into this utility, as it has been very useful to use (and definitely more flexible than just using the swift-bin AUR package!)

The [.install script](https://aur.archlinux.org/cgit/aur.git/tree/swiftly-bin.install?h=swiftly-bin) I wrote for said package runs `swiftly uninstall latest` in a loop until the `~/.local/share/swiftly/toolchains` folder is empty. This is prone to an infinite loop if a non-toolchain file or folder is placed in that directory.

To alleviate this, I propose some small changes to Uninstall.swift that allow for a one-command uninstallation of all installed toolchains with `swiftly uninstall all.`

I am new to contributing, so please let me know if there are any issues with this proposal.

Thank you!
@patrickfreed
Copy link
Contributor

Hey, thanks for the PR, and also thanks for maintaining that package for swiftly!

I've gone ahead and made two slight changes to the PR:

  • Ensured the in-use toolchain is uninstalled last to avoid swiftly spamming the output with "x toolchain is now in use" each time the in-use toolchain is uninstalled during an "uninstall all" command
  • Added a unit test

Related question: is this functionality used for uninstalling swiftly? Or is it for cleaning up any prior swiftly installation before performing a fresh install? If it's the latter, note that this is already handled by the swiftly-install.sh script, if it's possible to use that as part of this installation process. If it's the former, then #84 will be useful for you in the future.

@patrickfreed
Copy link
Contributor

@swift-server-bot add to allowlist

@markdols
Copy link
Contributor Author

@patrickfreed This would be used for uninstalling swiftly. The package manager would be responsible for removing the binary; the .install script uninstalls all toolchains before the binary is uninstalled, which is where a swiftly uninstall all command would be useful.

@patrickfreed patrickfreed merged commit 43f8193 into swiftlang:main Dec 25, 2023
@patrickfreed
Copy link
Contributor

Makes sense, just merged it in now. Thanks for the contribution!

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