topgrade-rs / topgrade

Upgrade all the things
GNU General Public License v3.0
1.99k stars 135 forks source link

missing separators for some steps #167

Closed arctic-penguin closed 1 year ago

arctic-penguin commented 1 year ago

For example:

When these steps are executed, there isn't necessarily an indication something gets executed. In my case the previous step was pip, which ran successfully, then topgrade asked me if I wanted to try again, and the desktop notification indicated that the step pnpm had failed.

Additional Details

9999years commented 1 year ago

Hmm, the npm and pnpm steps call NPM::upgrade, which does print a separator:

https://github.com/topgrade-rs/topgrade/blob/1b49b70833acf4f9d3d6e80d921eb90e6d2d1ae1/src/steps/node.rs#L99

Example output on my machine (on the dev branch), showing the separators ```ShellSession $ cargo run -- --only node Compiling topgrade v10.1.2 (/Users/wiggles/topgrade) Finished dev [unoptimized + debuginfo] target(s) in 3.31s Running `target/debug/topgrade --only node` ―― 10:18:39 - Node Package Manager ――――――――――――――――――――――――――――――――――――――――――――― removed 13 packages, changed 75 packages, and audited 224 packages in 2s 14 packages are looking for funding run `npm fund` for details found 0 vulnerabilities ―― 10:18:41 - Yarn Package Manager ――――――――――――――――――――――――――――――――――――――――――――― yarn global v1.22.19 [1/4] 🔍 Resolving packages... warning create-react-app > tar-pack > tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 🔨 Rebuilding all packages... success Saved lockfile. success Saved 54 new dependencies. info Direct dependencies └─ create-react-app@5.0.1 info All dependencies ├─ ansi-styles@4.3.0 ... └─ yallist@4.0.0 ✨ Done in 1.34s. ―― 10:18:43 - PNPM ――――――――――――――――――――――――――――――――――――――――――――――――――――――――――――― Already up to date Done in 134ms ―― 10:18:43 - Summary ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――― npm: OK yarn: OK pnpm: OK ```

Do you have log output or anything? Definitely curious about this.

arctic-penguin commented 1 year ago

I had an issue with pnpm and npm on my machine which I have now ironed out. Cannot reproduce anymore. Thanks for the quick reply!

arctic-penguin commented 1 year ago

Disregard, I can still reproduce it. Branch dev.

$ cargo r -- --only node
   Compiling topgrade v10.1.2 (/home/xxxxxxxx/tmp/topgrade)
    Finished dev [unoptimized + debuginfo] target(s) in 5.36s
     Running `target/debug/topgrade --only node`

―― 17:36:04 - dotfiles ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――
Already up to date.

Retry? (y)es/(N)o/(s)hell/(q)uit

With a notifaction that pnpm is was the culprit.

With the verbose flag this reads like this.

$ cargo r -- --only node --verbose
    Finished dev [unoptimized + debuginfo] target(s) in 0.08s
     Running `target/debug/topgrade --only node --verbose`
 2022-11-10T16:38:29.077Z DEBUG topgrade::config > Configuration at /home/xxxxxxxx/.config/topgrade.toml
 2022-11-10T16:38:29.078Z DEBUG topgrade::config > Path ~/.config/cheat/cheatsheets/personal expanded to /home/xxxxxxxx/.config/cheat/cheatsheets/personal
 2022-11-10T16:38:29.078Z DEBUG topgrade::config > Loaded configuration: ConfigFile { pre_commands: Some({"dotfiles": "cd ~/dotfiles && git pull && ./setup.py"}), post_commands: None, commands: Some({}), git_repos: None, predefined_git_repos: None, disable: Some([Vim]), ignore_failures: None, remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, git_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: None, yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, no_retry: None, run_in_tmux: None, cleanup: None, notify_each_step: None, accept_all_windows_updates: None, skip_notify: None, bashit_branch: None, only: None, composer: Some(Composer { self_update: None }), brew: Some(Brew { greedy_cask: None, autoremove: None }), linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: Some(false), trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, apt_arguments: None, enable_tlmgr: Some(true), redhat_distro_sync: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None }), git: Some(Git { max_concurrency: Some(1), arguments: None, repos: Some(["/home/xxxxxxxx/.config/cheat/cheatsheets/personal"]), pull_predefined: Some(false) }), windows: Some(Windows { accept_all_updates: None, self_rename: None, open_remotes_in_new_terminal: None, enable_winget: None }), npm: Some(NPM { use_sudo: None }), yarn: None, vim: None, firmware: Some(Firmware { upgrade: None }), vagrant: None, flatpak: Some(Flatpak { use_sudo: None }), distrobox: None }
 2022-11-10T16:38:29.078Z DEBUG topgrade::utils  > Detected "/usr/bin/notify-send" as "notify-send"
 2022-11-10T16:38:29.078Z DEBUG topgrade         > Version: 10.1.2
 2022-11-10T16:38:29.078Z DEBUG topgrade         > OS: x86_64-unknown-linux-gnu
 2022-11-10T16:38:29.078Z DEBUG topgrade         > Args { inner: ["target/debug/topgrade", "--only", "node", "--verbose"] }
 2022-11-10T16:38:29.078Z DEBUG topgrade         > Binary path: Ok("/home/xxxxxxxx/tmp/topgrade/target/debug/topgrade")
 2022-11-10T16:38:29.078Z DEBUG topgrade         > Self Update: false
 2022-11-10T16:38:29.078Z DEBUG topgrade::utils  > Detected "/usr/bin/git" as "git"
 2022-11-10T16:38:29.078Z DEBUG topgrade::utils  > Cannot find "doas"
 2022-11-10T16:38:29.078Z DEBUG topgrade::utils  > Detected "/usr/bin/sudo" as "sudo"

―― 17:38:29 - dotfiles ―――――――――――――――――――――――――――――――――――――――――――――――――――――――――
 2022-11-10T16:38:29.078Z DEBUG topgrade::command > Executing command `/usr/bin/zsh -c 'cd ~/dotfiles && git pull && ./setup.py'`
Already up to date.
 2022-11-10T16:38:43.412Z DEBUG topgrade::utils   > Cannot find "pwsh"
 2022-11-10T16:38:43.412Z DEBUG topgrade::utils   > Cannot find "powershell"
 2022-11-10T16:38:43.413Z DEBUG topgrade::utils   > Path "/home/xxxxxxxx/.config/emacs" doesn't exist
 2022-11-10T16:38:43.413Z DEBUG topgrade::utils   > Path "/home/xxxxxxxx/.emacs.d" doesn't exist
 2022-11-10T16:38:43.413Z DEBUG topgrade::runner  > Step "npm"
 2022-11-10T16:38:43.413Z DEBUG topgrade::runner  > Step "yarn"
 2022-11-10T16:38:43.413Z DEBUG topgrade::utils   > Detected "/usr/bin/yarn" as "yarn"
 2022-11-10T16:38:43.413Z DEBUG topgrade::utils   > Detected "/usr/bin/yarn" as "yarn"
 2022-11-10T16:38:43.413Z DEBUG topgrade::command > Executing command `/usr/bin/yarn --version`
 2022-11-10T16:38:43.614Z DEBUG topgrade::command > Executing command `/usr/bin/yarn global dir`
 2022-11-10T16:38:43.823Z DEBUG topgrade::runner  > Step "pnpm"
 2022-11-10T16:38:43.823Z DEBUG topgrade::utils   > Detected "/usr/bin/pnpm" as "pnpm"
 2022-11-10T16:38:43.823Z DEBUG topgrade::command > Executing command `/usr/bin/pnpm --version`
 2022-11-10T16:38:43.825Z DEBUG topgrade::command > Executing command `/usr/bin/pnpm root -g`
 2022-11-10T16:38:43.826Z DEBUG topgrade::runner  > Step "pnpm" failed: Failed to execute `/usr/bin/pnpm root -g`

Caused by:
    Exec format error (os error 8)
 2022-11-10T16:38:43.826Z DEBUG topgrade::terminal > Desktop notification: pnpm failed
 2022-11-10T16:38:43.826Z DEBUG topgrade::command  > Executing command `/usr/bin/notify-send -a Topgrade Topgrade 'pnpm failed'`

Retry? (y)es/(N)o/(s)hell/(q)uit
9999years commented 1 year ago

I have two fixes for this! One, in #170, moves the separators to the correct place, so that the banner will be printed before the command that failed. The second, in #171, prints detailed error messages when commands fail; this would have made it clear exactly what program failed and what it had to say, even before running in debug-mode.

9999years commented 1 year ago

I think we can close this now that #170 and #171 are merged.