Add ghcup step (#89)

This commit is contained in:
Rebecca Turner
2022-10-30 12:34:14 -04:00
committed by GitHub
parent 5a6f0d2e15
commit 18cec5c9fa
3 changed files with 16 additions and 0 deletions

View File

@@ -93,6 +93,7 @@ pub enum Step {
Fossil, Fossil,
Gcloud, Gcloud,
Gem, Gem,
Ghcup,
GithubCliExtensions, GithubCliExtensions,
GitRepos, GitRepos,
Go, Go,

View File

@@ -323,6 +323,7 @@ fn run() -> Result<()> {
runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?; runner.execute(Step::Pipx, "pipx", || generic::run_pipx_update(run_type))?;
runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?; runner.execute(Step::Conda, "conda", || generic::run_conda_update(&ctx))?;
runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?; runner.execute(Step::Pip3, "pip3", || generic::run_pip3_update(run_type))?;
runner.execute(Step::Ghcup, "ghcup", || generic::run_ghcup_update(run_type))?;
runner.execute(Step::Stack, "stack", || generic::run_stack_update(run_type))?; runner.execute(Step::Stack, "stack", || generic::run_stack_update(run_type))?;
runner.execute(Step::Tlmgr, "tlmgr", || generic::run_tlmgr_update(&ctx))?; runner.execute(Step::Tlmgr, "tlmgr", || generic::run_tlmgr_update(&ctx))?;
runner.execute(Step::Myrepos, "myrepos", || { runner.execute(Step::Myrepos, "myrepos", || {

View File

@@ -289,12 +289,26 @@ pub fn run_pip3_update(run_type: RunType) -> Result<()> {
} }
pub fn run_stack_update(run_type: RunType) -> Result<()> { pub fn run_stack_update(run_type: RunType) -> Result<()> {
if let Ok(_) = utils::require("ghcup") {
// `ghcup` is present and probably(?) being used to install `stack`.
// Don't upgrade `stack`, let `ghcup` handle it. Per `ghcup install stack`:
// !!! Additionally, you should upgrade stack only through ghcup and not use 'stack upgrade' !!!
return Ok(());
}
let stack = utils::require("stack")?; let stack = utils::require("stack")?;
print_separator("stack"); print_separator("stack");
run_type.execute(&stack).arg("upgrade").check_run() run_type.execute(&stack).arg("upgrade").check_run()
} }
pub fn run_ghcup_update(run_type: RunType) -> Result<()> {
let ghcup = utils::require("ghcup")?;
print_separator("ghcup");
run_type.execute(&ghcup).arg("upgrade").check_run()
}
pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> { pub fn run_tlmgr_update(ctx: &ExecutionContext) -> Result<()> {
cfg_if::cfg_if! { cfg_if::cfg_if! {
if #[cfg(any(target_os = "linux", target_os = "android"))] { if #[cfg(any(target_os = "linux", target_os = "android"))] {