Skip to content
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

fix: use env BUN_INSTALL to locate package.json #734

Merged
merged 1 commit into from
Mar 7, 2024

Conversation

SteveLauC
Copy link
Member

Standards checklist:

  • The PR title is descriptive.
  • I have read CONTRIBUTING.md
  • The code compiles (cargo build)
  • The code passes rustfmt (cargo fmt)
  • The code passes clippy (cargo clippy)
  • The code passes tests (cargo test)
  • Optional: I have tested the code myself

For new steps

  • Optional: Topgrade skips this step where needed
  • Optional: The --dry-run option works with this step
  • Optional: The --yes option works with this step if it is supported by
    the underlying command

If you developed a feature or a bug fix for someone else and you do not have the
means to test it, please tag this person here.

Closes #733

Copy link

codecov bot commented Mar 7, 2024

Codecov Report

Attention: Patch coverage is 0% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 5.48%. Comparing base (fbc84e8) to head (09358d7).

Files Patch % Lines
src/steps/os/unix.rs 0.00% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #734      +/-   ##
========================================
- Coverage   5.48%   5.48%   -0.01%     
========================================
  Files         37      37              
  Lines      11860   11862       +2     
========================================
  Hits         651     651              
- Misses     11209   11211       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@SteveLauC
Copy link
Member Author

cc @jtrv, here is build with this patch included, welcome to give it a test: https://github.com/SteveLauC/topgrade/releases/tag/PR734

@jtrv
Copy link

jtrv commented Mar 7, 2024

@SteveLauC sorry I just saw this. This PR does not solve the issue for me. However I just wrote my own PR which works correctly in my testing: #735

@SteveLauC
Copy link
Member Author

Would you like to run this binary: #734 (comment) with:

$ ./topgrade --only bun_packages --verbose

and give me the output?

@jtrv
Copy link

jtrv commented Mar 7, 2024

DEBUG Configuration at /home/USER/.config/topgrade.toml
DEBUG Path ~/repos/* expanded to /home/USER/repos/*
DEBUG Loaded configuration: ConfigFile { include: None, misc: Some(Misc { pre_sudo: None, sudo_command: None, disable: Some([Containers, Protonup]), ignore_failures: Some([GitRepos]), remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: Some(true), no_retry: None, run_in_tmux: None, cleanup: Some(true), notify_each_step: Some(true), skip_notify: None, bashit_branch: None, only: None, no_self_update: None, log_filters: None }), pre_commands: Some({}), post_commands: None, commands: Some({"bun globals": "bun update -g", "proton": "protonup-rs -q"}), python: None, composer: Some(Composer { self_update: Some(true) }), brew: None, linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, nix_env_arguments: None, apt_arguments: None, enable_tlmgr: Some(true), redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: Some(10), arguments: None, repos: Some(["/home/USER/repos/*"]), pull_predefined: None }), containers: None, windows: None, npm: None, yarn: None, vim: None, firmware: None, vagrant: None, flatpak: None, distrobox: None }
DEBUG Version: 14.0.1
DEBUG OS: x86_64-unknown-linux-gnu
DEBUG Args { inner: ["./topgrade", "--only", "bun_packages", "--verbose"] }
DEBUG Binary path: Ok("/home/USER/tmp/topgrade/target/release/topgrade")
DEBUG self-update Feature Enabled: false
DEBUG Configuration: Config { opt: CommandLineArgs { edit_config: false, show_config_reference: false, run_in_tmux: false, cleanup: false, dry_run: false, no_retry: false, disable: [], only: [BunPackages], custom_commands: [], env: [], verbose: true, keep_at_end: false, skip_notify: false, yes: None, disable_predefined_git_repos: false, config: None, remote_host_limit: None, show_skipped: false, log_filter: "warn", gen_completion: None, gen_manpage: false, no_self_update: false }, config_file: ConfigFile { include: None, misc: Some(Misc { pre_sudo: None, sudo_command: None, disable: Some([Containers, Protonup]), ignore_failures: Some([GitRepos]), remote_topgrades: None, remote_topgrade_path: None, ssh_arguments: None, tmux_arguments: None, set_title: None, display_time: None, assume_yes: Some(true), no_retry: None, run_in_tmux: None, cleanup: Some(true), notify_each_step: Some(true), skip_notify: None, bashit_branch: None, only: None, no_self_update: None, log_filters: None }), pre_commands: Some({}), post_commands: None, commands: Some({"bun globals": "bun update -g", "proton": "protonup-rs -q"}), python: None, composer: Some(Composer { self_update: Some(true) }), brew: None, linux: Some(Linux { yay_arguments: None, aura_aur_arguments: None, aura_pacman_arguments: None, arch_package_manager: None, show_arch_news: None, garuda_update_arguments: None, trizen_arguments: None, pikaur_arguments: None, pamac_arguments: None, dnf_arguments: None, nix_arguments: None, nix_env_arguments: None, apt_arguments: None, enable_tlmgr: Some(true), redhat_distro_sync: None, suse_dup: None, rpm_ostree: None, emerge_sync_flags: None, emerge_update_flags: None, home_manager_arguments: None }), git: Some(Git { max_concurrency: Some(10), arguments: None, repos: Some(["/home/USER/repos/*"]), pull_predefined: None }), containers: None, windows: None, npm: None, yarn: None, vim: None, firmware: None, vagrant: None, flatpak: None, distrobox: None }, allowed_steps: [BunPackages] }
DEBUG Detected "/usr/bin/git" as "git"
DEBUG Cannot find "pwsh"
DEBUG Cannot find "powershell"
DEBUG Path "/home/USER/.config/emacs" doesn't exist
DEBUG Path "/home/USER/.emacs.d" doesn't exist
DEBUG Detected "/usr/bin/doas" as "doas"
DEBUG Step "bun-packages"
DEBUG Detected "/home/USER/.local/share/bun/bin/bun" as "bun"
DEBUG Desktop notification: Bun Packages
 INFO perform: new
 INFO perform:write_command{command=Auth(Some(External), Some([49, 48, 48, 48]))}: new
 INFO perform:write_command{command=Auth(Some(External), Some([49, 48, 48, 48]))}: close
 INFO perform:read_command: new
 INFO perform:read_command: close
 INFO perform:write_command{command=NegotiateUnixFD}: new
 INFO perform:write_command{command=NegotiateUnixFD}: close
 INFO perform:read_command: new
 INFO perform:read_command: close
 INFO perform:write_command{command=Begin}: new
 INFO perform:write_command{command=Begin}: close
 INFO perform: close
 INFO socket reader: new
 INFO socket reader: close
―― 16:45:49 - Bun Packages ――
No global packages installed
DEBUG /home/USER/.ideavimrc does not exist
DEBUG /home/USER/.intellimacs does not exist
DEBUG /home/USER/.zshrc does not exist
DEBUG Checking if /home/USER/.config/fish is a git repository
DEBUG Executing command `/usr/bin/git rev-parse --show-toplevel`
DEBUG Command failed: Err(
   0: Command failed: `/usr/bin/git rev-parse --show-toplevel`

      Stderr:
      fatal: not a git repository (or any parent up to mount point /)
      Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
   1: `/usr/bin/git` failed: exit status: 128

Location:
   src/steps/git.rs:170)
DEBUG /home/USER/.config/openbox does not exist
DEBUG /home/USER/.config/bspwm does not exist
DEBUG /home/USER/.config/i3 does not exist
DEBUG /home/USER/.config/sway does not exist
DEBUG Desktop notification: Summary
 INFO perform: new
 INFO perform:write_command{command=Auth(Some(External), Some([49, 48, 48, 48]))}: new
 INFO perform:write_command{command=Auth(Some(External), Some([49, 48, 48, 48]))}: close
 INFO perform:read_command: new
 INFO perform:read_command: close
 INFO perform:write_command{command=NegotiateUnixFD}: new
 INFO perform:write_command{command=NegotiateUnixFD}: close
 INFO perform:read_command: new
 INFO perform:read_command: close
 INFO perform:write_command{command=Begin}: new
 INFO perform:write_command{command=Begin}: close
 INFO perform: close
 INFO socket reader: new
―― 16:45:49 - Summary ――
bun-packages INFO socket reader: close
: OK

Pacman backup configuration files found:
/etc/pacman.d/mirrorlist.pacnew
/etc/pacman.d/chaotic-mirrorlist.pacnew
/etc/systemd/logind.conf.pacnew
/etc/systemd/resolved.conf.pacnew
/etc/ssh/sshd_config.pacnew
/etc/bluetooth/main.conf.pacnew
/etc/texmf/web2c/fmtutil.cnf.pacsave
/etc/passwd.pacnew
/etc/profile.pacnew
/etc/shells.pacnew
/etc/locale.gen.pacnew
/etc/makepkg.conf.pacnew
/etc/pacman.conf.pacnew
/etc/mkinitcpio.conf.pacnew
DEBUG Desktop notification: Topgrade finished successfully
 INFO perform: new
 INFO perform:write_command{command=Auth(Some(External), Some([49, 48, 48, 48]))}: new
 INFO perform:write_command{command=Auth(Some(External), Some([49, 48, 48, 48]))}: close
 INFO perform:read_command: new
 INFO perform:read_command: close
 INFO perform:write_command{command=NegotiateUnixFD}: new
 INFO perform:write_command{command=NegotiateUnixFD}: close
 INFO perform:read_command: new
 INFO perform:read_command: close
 INFO perform:write_command{command=Begin}: new
 INFO perform:write_command{command=Begin}: close
 INFO perform: close
 INFO socket reader: new
 INFO socket reader: close

@SteveLauC
Copy link
Member Author

So, that log does not help too much, what is the path of your package.json? Is it /home/jtrv/.local/share/bun/install/global/package.json, if so, this patch should work.

And what is the value of your BUN_HOME

$ echo $BUN_HOME

@SteveLauC
Copy link
Member Author

In your PR, I see you are using shellexpand, does bun recognize shell signs like ~?

@jtrv
Copy link

jtrv commented Mar 7, 2024

My apologies @SteveLauC I realized I compiled on the wrong branch, this works and it looks better than my PR, I'll close mine 👍🏽

@SteveLauC SteveLauC merged commit 12116c3 into topgrade-rs:main Mar 7, 2024
17 of 19 checks passed
@SteveLauC SteveLauC deleted the fix/bun_package_json branch March 7, 2024 06:12
InnocentZero pushed a commit to InnocentZero/topgrade that referenced this pull request May 25, 2024
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.

Bun packages step should use $BUN_INSTALL/install/global/package.json
2 participants