Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package zvm for openSUSE:Factory checked in at 2025-04-07 17:37:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/zvm (Old) and /work/SRC/openSUSE:Factory/.zvm.new.1907 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "zvm" Mon Apr 7 17:37:19 2025 rev:2 rq:1267334 version:0.8.6 Changes: -------- --- /work/SRC/openSUSE:Factory/zvm/zvm.changes 2025-02-17 20:53:58.123080023 +0100 +++ /work/SRC/openSUSE:Factory/.zvm.new.1907/zvm.changes 2025-04-07 17:37:34.775239300 +0200 @@ -1,0 +2,9 @@ +Sat Apr 5 13:25:17 UTC 2025 - Andrea Manzini <andrea.manz...@suse.com> + +- Update to 0.8.6: + * skip flag parsing with zvm run by @vrischmann in #123 + * Add check for 32-bit arch as there is no release for it. by @geouno in #128 + +- fixed changelog version + +------------------------------------------------------------------- @@ -4 +13 @@ -- Update to 0.8.3: +- Update to 0.8.5: Old: ---- v0.8.5.tar.gz New: ---- v0.8.6.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ zvm.spec ++++++ --- /var/tmp/diff_new_pack.xFOfuo/_old 2025-04-07 17:37:35.275260218 +0200 +++ /var/tmp/diff_new_pack.xFOfuo/_new 2025-04-07 17:37:35.279260385 +0200 @@ -1,7 +1,7 @@ # # spec file for package zvm # -# Copyright (c) 2024 SUSE LLC +# Copyright (c) 2025 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,7 +17,7 @@ Name: zvm -Version: 0.8.5 +Version: 0.8.6 Release: 0 Summary: Easily install/upgrade between different versions of Zig License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.xFOfuo/_old 2025-04-07 17:37:35.307261557 +0200 +++ /var/tmp/diff_new_pack.xFOfuo/_new 2025-04-07 17:37:35.311261724 +0200 @@ -1,6 +1,7 @@ <services> <service name="go_modules" mode="disabled"> <param name="compression">xz</param> + <param name="archive">v0.8.6.tar.gz</param> </service> </services> ++++++ v0.8.5.tar.gz -> v0.8.6.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/.github/workflows/install-script.yml new/zvm-0.8.6/.github/workflows/install-script.yml --- old/zvm-0.8.5/.github/workflows/install-script.yml 1970-01-01 01:00:00.000000000 +0100 +++ new/zvm-0.8.6/.github/workflows/install-script.yml 2025-03-18 04:24:14.000000000 +0100 @@ -0,0 +1,74 @@ +name: Test ZVM Install Script + +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: +jobs: + test-install: + runs-on: ubuntu-latest + strategy: + matrix: + shell: [bash, zsh, fish] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + + - name: Install additional shell (if needed) + run: | + sudo apt-get update + if [ "${{ matrix.shell }}" = "zsh" ]; then + sudo apt-get install -y zsh + elif [ "${{ matrix.shell }}" = "fish" ]; then + sudo apt-get install -y fish + fi + + - name: Test install script in ${{ matrix.shell }} + shell: bash + run: | + set -euxo pipefail + + # Create a temporary home directory for testing. + TEST_HOME=$(mktemp -d) + echo "Using temporary home directory: $TEST_HOME" + export HOME="$TEST_HOME" + + # Create the appropriate shell configuration file and set $SHELL accordingly. + if [ "${{ matrix.shell }}" = "bash" ]; then + touch "$HOME/.bashrc" + echo "Using Bash startup file: $HOME/.bashrc" + export SHELL="/bin/bash" + elif [ "${{ matrix.shell }}" = "zsh" ]; then + touch "$HOME/.zshrc" + echo "Using Zsh startup file: $HOME/.zshrc" + export SHELL="/bin/zsh" + elif [ "${{ matrix.shell }}" = "fish" ]; then + mkdir -p "$HOME/.config/fish" + touch "$HOME/.config/fish/config.fish" + echo "Using Fish startup file: $HOME/.config/fish/config.fish" + export SHELL="/usr/bin/fish" + fi + + # Stub out the download part of the install script to avoid network calls. + # This replaces the install_latest function definition with a stub. + sed -i 's/install_latest() {/install_latest() {\n echo "Skipping download in test";\n return 0;/' install.sh + + # Run the install script. + bash install.sh + + # Determine which configuration file should have been updated and verify the expected content. + if [ "${{ matrix.shell }}" = "fish" ]; then + CONFIG_FILE="$HOME/.config/fish/config.fish" + grep -q 'set -gx ZVM_INSTALL "$HOME/.zvm/self"' "$CONFIG_FILE" + echo "Fish configuration updated successfully." + elif [ "${{ matrix.shell }}" = "zsh" ]; then + CONFIG_FILE="$HOME/.zshrc" + grep -q 'export ZVM_INSTALL="$HOME/.zvm/self"' "$CONFIG_FILE" + echo "Zsh configuration updated successfully." + else + CONFIG_FILE="$HOME/.bashrc" + grep -q 'export ZVM_INSTALL="$HOME/.zvm/self"' "$CONFIG_FILE" + echo "Bash configuration updated successfully." + fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/CONTRIBUTING.MD new/zvm-0.8.6/CONTRIBUTING.MD --- old/zvm-0.8.5/CONTRIBUTING.MD 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/CONTRIBUTING.MD 2025-03-18 04:24:14.000000000 +0100 @@ -17,8 +17,8 @@ important to me that you know that this is a very actively developed repository and all P.R.s will be reviewed within a month of submission. Probably sooner. If you would like to talk to me about your P.R. feel free to - [email](mailto:tristan.is...@hey.com) me or reach out on Discor or Twitter. I - check all regularly. + [email](mailto:tristan.is...@hey.com) me or reach out on Discord or Twitter. + I check all regularly. I hope you feel comfortable contributing to ZVM and know that I greatly appreaciate every contribution. I'm just one person so seeing community members diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/config.go new/zvm-0.8.6/cli/config.go --- old/zvm-0.8.5/cli/config.go 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/cli/config.go 2025-03-18 04:24:14.000000000 +0100 @@ -102,15 +102,7 @@ return version == "default" || version == "mach" } -func (z ZVM) zigPath() (string, error) { - zig := filepath.Join(z.baseDir, "bin", "zig") - log.Debug("zigPath", "zig", zig) - if _, err := os.Stat(zig); err != nil { - return "", err - } - return zig, nil -} func (z ZVM) getVersion(version string) error { if _, err := os.Stat(filepath.Join(z.baseDir, version)); err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/install.go new/zvm-0.8.6/cli/install.go --- old/zvm-0.8.5/cli/install.go 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/cli/install.go 2025-03-18 04:24:14.000000000 +0100 @@ -552,17 +552,27 @@ } func (z *ZVM) createSymlink(version string) { - if _, err := os.Lstat(filepath.Join(z.baseDir, "bin")); err == nil { - fmt.Println("Removing old symlink") - if err := os.RemoveAll(filepath.Join(z.baseDir, "bin")); err != nil { - log.Fatal("could not remove bin", err) - } + // .zvm/master + versionPath := filepath.Join(z.baseDir, version) + binDir := filepath.Join(z.baseDir, "bin") + + stat, err := os.Lstat(binDir) + + // See zvm.Use() for an explanation. + if stat != nil { + if err == nil { + fmt.Println("Removing old inode link") + if err := os.RemoveAll(binDir); err != nil { + log.Fatal("could not remove bin", "err", err, "dir", binDir) + } + } } - if err := meta.Symlink(filepath.Join(z.baseDir, version), filepath.Join(z.baseDir, "bin")); err != nil { - log.Fatal(err) + if err := meta.Link(versionPath, binDir); err != nil { + log.Fatal("meta.Link error", err) } + } func getTarPath(version string, data *map[string]map[string]any) (string, error) { @@ -676,6 +686,7 @@ if err != nil { return err } + defer reader.Close() // 2. Get the absolute destination path @@ -684,58 +695,63 @@ return err } - // 3. Iterate over zip files inside the archive and unzip each of them - for _, f := range reader.File { + os.MkdirAll(destination, 0755) - err := unzipFile(f, destination) + extractAndWriteFile := func(f *zip.File) error { + rc, err := f.Open() if err != nil { - meta.CtaFatal(err) + return err } - } - - return nil -} + defer func() { + if err := rc.Close(); err != nil { + panic(err) + } + }() + + path := filepath.Join(destination, f.Name) + if !strings.HasPrefix(path, filepath.Clean(destination)+string(os.PathSeparator)) { + return fmt.Errorf("illegal file path: %s", path) + } -func unzipFile(f *zip.File, destination string) error { - // 4. Check if file paths are not vulnerable to Zip Slip - filePath := filepath.Join(destination, f.Name) - if !strings.HasPrefix(filePath, filepath.Clean(destination)+string(os.PathSeparator)) { - return fmt.Errorf("invalid file path: %s", filePath) - } + if f.FileInfo().IsDir() { + os.MkdirAll(path, f.Mode()) + } else { + os.MkdirAll(filepath.Dir(path), f.Mode()) + f, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) + if err != nil { + return err + } - // 5. Create directory tree - if f.FileInfo().IsDir() { - if err := os.MkdirAll(filePath, os.ModePerm); err != nil { - return err + defer func() { + if err := f.Close(); err != nil { + panic(err) + } + }() + + _, err = io.Copy(f, rc) + if err != nil { + return err + } } - return nil - } - if err := os.MkdirAll(filepath.Dir(filePath), os.ModePerm); err != nil { - return err + return nil } + - // 6. Create a destination file for unzipped content - destinationFile, err := os.OpenFile(filePath, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, f.Mode()) - if err != nil { - return err - } - defer destinationFile.Close() + // 3. Iterate over zip files inside the archive and unzip each of them + for _, f := range reader.File { + err := extractAndWriteFile(f) + if err != nil { + return err + } - // 7. Unzip the content of a file and copy it to the destination file - zippedFile, err := f.Open() - if err != nil { - return err } - defer zippedFile.Close() - if _, err := io.Copy(destinationFile, zippedFile); err != nil { - return err - } return nil } + type installRequest struct { Site, Package, Version string } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/meta/errors.go new/zvm-0.8.6/cli/meta/errors.go --- old/zvm-0.8.5/cli/meta/errors.go 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/cli/meta/errors.go 2025-03-18 04:24:14.000000000 +0100 @@ -8,4 +8,5 @@ var ( ErrWinEscToAdmin = errors.New("unable to rerun as Windows Administrator") ErrEscalatedSymlink = errors.New("unable to symlink as Administrator") + ErrEscalatedHardlink = errors.New("unable to hardlink as Administrator") ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/meta/link_unix.go new/zvm-0.8.6/cli/meta/link_unix.go --- old/zvm-0.8.5/cli/meta/link_unix.go 1970-01-01 01:00:00.000000000 +0100 +++ new/zvm-0.8.6/cli/meta/link_unix.go 2025-03-18 04:24:14.000000000 +0100 @@ -0,0 +1,15 @@ +//go:build !windows + +// Copyright 2025 Tristan Isham. All rights reserved. +// Use of this source code is governed by the MIT +// license that can be found in the LICENSE file. +package meta + +import "os" + +// Link is a wrapper around Go's os.Symlink and os.Link functions, +// On Windows, if Link is unable to create a symlink it will attempt to create a +// hardlink before trying its automatic privilege escalation. +func Link(oldname, newname string) error { + return os.Symlink(oldname, newname) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/meta/link_win.go new/zvm-0.8.6/cli/meta/link_win.go --- old/zvm-0.8.5/cli/meta/link_win.go 1970-01-01 01:00:00.000000000 +0100 +++ new/zvm-0.8.6/cli/meta/link_win.go 2025-03-18 04:24:14.000000000 +0100 @@ -0,0 +1,85 @@ +//go:build windows + +// Copyright 2025 Tristan Isham. All rights reserved. +// Use of this source code is governed by the MIT +// license that can be found in the LICENSE file. +package meta + +import ( + // "bytes" + "errors" + "os" + + // "os/exec" + "strings" + "syscall" + + // "github.com/charmbracelet/log" + "github.com/charmbracelet/log" + "golang.org/x/sys/windows" +) + +func becomeAdmin() error { + verb := "runas" + exe, _ := os.Executable() + cwd, _ := os.Getwd() + args := strings.Join(os.Args[1:], " ") + + verbPtr, _ := syscall.UTF16PtrFromString(verb) + exePtr, _ := syscall.UTF16PtrFromString(exe) + cwdPtr, _ := syscall.UTF16PtrFromString(cwd) + argPtr, _ := syscall.UTF16PtrFromString(args) + + var showCmd int32 = 1 // SW_NORMAL + + err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd) + if err != nil { + return err + } + + return nil +} + +func isAdmin() bool { + _, err := os.Open("\\\\.\\PHYSICALDRIVE0") + + return err == nil +} + +// Link is a wrapper around Go's os.Symlink and os.Link functions, +// On Windows, if Link is unable to create a symlink it will attempt to create a +// hardlink before trying its automatic privilege escalation. +func Link(oldname, newname string) error { + // Attempt to do a regular symlink if allowed by user's permissions + if err := os.Symlink(oldname, newname); err != nil { + // If that fails, try to create an old hardlink. + if err := os.Link(oldname, newname); err == nil { + return nil + } + // If creating a hardlink fails, check to see if the user is an admin. + // If they're not an admin, try to become an admin and retry making a symlink. + if !isAdmin() { + log.Error("Symlink & Hardlink failed", "admin", false) + + // If not already admin, try to become admin + if adminErr := becomeAdmin(); adminErr != nil { + return errors.Join(ErrWinEscToAdmin, adminErr, err) + } + + if err := os.Symlink(oldname, newname); err != nil { + if err := os.Link(oldname, newname); err == nil { + return nil + } + + return errors.Join(ErrEscalatedSymlink, ErrEscalatedHardlink, err) + } + + return nil + } + + return errors.Join(ErrEscalatedSymlink, ErrEscalatedHardlink, err) + + } + + return nil +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/meta/symlink_unix.go new/zvm-0.8.6/cli/meta/symlink_unix.go --- old/zvm-0.8.5/cli/meta/symlink_unix.go 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/cli/meta/symlink_unix.go 1970-01-01 01:00:00.000000000 +0100 @@ -1,15 +0,0 @@ -//go:build !windows - -// Copyright 2025 Tristan Isham. All rights reserved. -// Use of this source code is governed by the MIT -// license that can be found in the LICENSE file. -package meta - -import "os" - -// Symlink is a wrapper around Go's os.Symlink, -// but with automatic privilege escalation on windows -// for systems that do not support non-admin symlinks. -func Symlink(oldname, newname string) error { - return os.Symlink(oldname, newname) -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/meta/symlink_win.go new/zvm-0.8.6/cli/meta/symlink_win.go --- old/zvm-0.8.5/cli/meta/symlink_win.go 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/cli/meta/symlink_win.go 1970-01-01 01:00:00.000000000 +0100 @@ -1,71 +0,0 @@ -//go:build windows - -// Copyright 2025 Tristan Isham. All rights reserved. -// Use of this source code is governed by the MIT -// license that can be found in the LICENSE file. -package meta - -import ( - // "bytes" - "errors" - "os" - - // "os/exec" - "strings" - "syscall" - - // "github.com/charmbracelet/log" - "golang.org/x/sys/windows" -) - -func becomeAdmin() error { - verb := "runas" - exe, _ := os.Executable() - cwd, _ := os.Getwd() - args := strings.Join(os.Args[1:], " ") - - verbPtr, _ := syscall.UTF16PtrFromString(verb) - exePtr, _ := syscall.UTF16PtrFromString(exe) - cwdPtr, _ := syscall.UTF16PtrFromString(cwd) - argPtr, _ := syscall.UTF16PtrFromString(args) - - var showCmd int32 = 1 // SW_NORMAL - - err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd) - if err != nil { - return err - } - - return nil -} - -func isAdmin() bool { - _, err := os.Open("\\\\.\\PHYSICALDRIVE0") - - return err == nil -} - -// Symlink is a wrapper around Go's os.Symlink, -// but with automatic privilege escalation on windows -// for systems that do not support non-admin symlinks. -func Symlink(oldname, newname string) error { - // Attempt to do a regular symlink if allowed by user's permissions - if err := os.Symlink(oldname, newname); err != nil { - // Check if already admin first - if isAdmin() { - if err := os.Symlink(oldname, newname); err != nil { - return errors.Join(ErrEscalatedSymlink, err) - } - return nil - } else { - // If not already admin, try to become admin - if err := becomeAdmin(); err != nil { - if err := os.Symlink(oldname, newname); err != nil { - return errors.Join(ErrEscalatedSymlink, err) - } - } - } - } - - return nil -} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/cli/use.go new/zvm-0.8.6/cli/use.go --- old/zvm-0.8.5/cli/use.go 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/cli/use.go 2025-03-18 04:24:14.000000000 +0100 @@ -10,6 +10,7 @@ "fmt" "os" "path/filepath" + "strings" "github.com/charmbracelet/log" @@ -37,12 +38,12 @@ func (z *ZVM) setBin(ver string) error { // .zvm/master version_path := filepath.Join(z.baseDir, ver) - bin_dir := filepath.Join(z.baseDir, "bin") + binDir := filepath.Join(z.baseDir, "bin") // Came across https://pkg.go.dev/os#Lstat // which is specifically to check symbolic links. // Seemed like the more appropriate solution here - stat, err := os.Lstat(bin_dir) + stat, err := os.Lstat(binDir) // Actually we need to check if the symbolic link to ~/.zvm/bin // exists yet, otherwise we get err: @@ -53,8 +54,8 @@ // therefore the the initial symbolic link is never created. if stat != nil { if err == nil { - log.Debugf("Removing old %s", bin_dir) - if err := os.Remove(bin_dir); err != nil { + log.Debugf("Removing old %s", binDir) + if err := os.Remove(binDir); err != nil { return err } } else { @@ -62,7 +63,7 @@ } } - if err := meta.Symlink(version_path, bin_dir); err != nil { + if err := meta.Link(version_path, binDir); err != nil { return err } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/go.mod new/zvm-0.8.6/go.mod --- old/zvm-0.8.5/go.mod 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/go.mod 2025-03-18 04:24:14.000000000 +0100 @@ -1,17 +1,25 @@ module github.com/tristanisham/zvm -go 1.23 +go 1.23.0 + +toolchain go1.24.1 require ( - github.com/charmbracelet/lipgloss v1.0.0 - github.com/charmbracelet/log v0.4.0 + github.com/charmbracelet/lipgloss v1.1.0 + github.com/charmbracelet/log v0.4.1 github.com/schollz/progressbar/v3 v3.18.0 github.com/tristanisham/clr v0.0.0-20221004001624-00ee60046d85 - golang.org/x/mod v0.22.0 - golang.org/x/sys v0.29.0 + golang.org/x/mod v0.24.0 + golang.org/x/sys v0.31.0 ) -require github.com/charmbracelet/x/ansi v0.7.0 // indirect +require ( + github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect + github.com/charmbracelet/x/ansi v0.8.0 // indirect + github.com/charmbracelet/x/cellbuf v0.0.13 // indirect + github.com/charmbracelet/x/term v0.2.1 // indirect + github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect +) require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect @@ -20,9 +28,9 @@ github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect - github.com/muesli/termenv v0.15.2 // indirect + github.com/muesli/termenv v0.16.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/urfave/cli/v3 v3.0.0-beta1 - golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 // indirect - golang.org/x/term v0.28.0 // indirect + golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect + golang.org/x/term v0.30.0 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/go.sum new/zvm-0.8.6/go.sum --- old/zvm-0.8.5/go.sum 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/go.sum 2025-03-18 04:24:14.000000000 +0100 @@ -1,11 +1,23 @@ github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= +github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= +github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo= +github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY= +github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30= github.com/charmbracelet/log v0.4.0 h1:G9bQAcx8rWA2T3pWvx7YtPTPwgqpk7D68BX21IRW8ZM= github.com/charmbracelet/log v0.4.0/go.mod h1:63bXt/djrizTec0l11H20t8FDSvA4CRZJ1KH22MdptM= +github.com/charmbracelet/log v0.4.1 h1:6AYnoHKADkghm/vt4neaNEXkxcXLSV2g1rdyFDOpTyk= +github.com/charmbracelet/log v0.4.1/go.mod h1:pXgyTsqsVu4N9hGdHmQ0xEA4RsXof402LX9ZgiITn2I= github.com/charmbracelet/x/ansi v0.7.0 h1:/QfFmiXOGGwN6fRbzvQaYp7fu1pkxpZ3qFBZWBsP404= github.com/charmbracelet/x/ansi v0.7.0/go.mod h1:KBUFw1la39nl0dLl10l5ORDAqGXaeurTQmwyyVKse/Q= +github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= +github.com/charmbracelet/x/ansi v0.8.0/go.mod h1:wdYl/ONOLHLIVmQaxbIYEC/cRKOQyjTkowiI4blgS9Q= +github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k= +github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= +github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= +github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/chengxilo/virtualterm v1.0.4 h1:Z6IpERbRVlfB8WkOmtbHiDbBANU7cimRIof7mk9/PwM= github.com/chengxilo/virtualterm v1.0.4/go.mod h1:DyxxBZz/x1iqJjFxTFcr6/x+jSpqN0iwWCOK1q10rlY= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -22,6 +34,8 @@ github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db/go.mod h1:l0dey0ia/Uv7NcFFVbCLtqEBQbrT4OCwCSKTEv6enCw= github.com/muesli/termenv v0.15.2 h1:GohcuySI0QmI3wN8Ok9PtKGkgkFIk7y6Vpb5PvrY+Wo= github.com/muesli/termenv v0.15.2/go.mod h1:Epx+iuz8sNs7mNKhxzH4fWXGNpZwUaJKRS1noLXviQ8= +github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc= +github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= @@ -31,18 +45,29 @@ github.com/schollz/progressbar/v3 v3.18.0/go.mod h1:IsO3lpbaGuzh8zIMzgY3+J8l4C8GjO0Y9S69eFvNsec= github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/tristanisham/clr v0.0.0-20221004001624-00ee60046d85 h1:zD4b2hs7jZ2sJtgtNdpMZyo4D4/Ifct8SMxvPNNkHzs= github.com/tristanisham/clr v0.0.0-20221004001624-00ee60046d85/go.mod h1:cKn2HV8Beq81OHjb2gja2ZiU4HAEQ6LSuxyaIT5Mg7o= github.com/urfave/cli/v3 v3.0.0-beta1 h1:6DTaaUarcM0wX7qj5Hcvs+5Dm3dyUTBbEwIWAjcw9Zg= github.com/urfave/cli/v3 v3.0.0-beta1/go.mod h1:FnIeEMYu+ko8zP1F9Ypr3xkZMIDqW3DR92yUtY39q1Y= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= +github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8 h1:yqrTHse8TCMW1M1ZCP+VAR/l0kKxwaAIqN/il7x4voA= golang.org/x/exp v0.0.0-20250106191152-7588d65b2ba8/go.mod h1:tujkw807nyEEAamNbDrEGzRav+ilXA7PCRAd6xsmwiU= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 h1:nDVHiLt8aIbd/VzvPWN6kSOPE7+F/fNFDSXLVYkE/Iw= +golang.org/x/exp v0.0.0-20250305212735-054e65f0b394/go.mod h1:sIifuuw/Yco/y6yb6+bDNfyeQ/MdPUy/hKEMYQV17cM= golang.org/x/mod v0.22.0 h1:D4nJWe9zXqHOmWqj4VMOJhvzj7bEZg4wEYa759z1pH4= golang.org/x/mod v0.22.0/go.mod h1:6SkKJ3Xj0I0BrPOZoBy3bdMptDDU9oJrpohJ3eWZ1fY= +golang.org/x/mod v0.24.0 h1:ZfthKaKaT4NrhGVZHO1/WDTwGES4De8KtWO0SIbNJMU= +golang.org/x/mod v0.24.0/go.mod h1:IXM97Txy2VM4PJ3gI61r1YEk/gAj6zAHN3AdZt6S9Ww= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.31.0 h1:ioabZlmFYtWhL+TRYpcnNlLwhyxaM9kWTDEmfnprqik= +golang.org/x/sys v0.31.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k= golang.org/x/term v0.28.0 h1:/Ts8HFuMR2E6IP/jlo7QVLZHggjKQbhu/7H0LJFr3Gg= golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= +golang.org/x/term v0.30.0 h1:PQ39fJZ+mfadBm0y5WlL4vlM7Sx1Hgf13sMIY2+QS9Y= +golang.org/x/term v0.30.0/go.mod h1:NYYFdzHoI5wRh/h5tDMdMqCqPJZEuNqVR5xJLd/n67g= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/install.ps1 new/zvm-0.8.6/install.ps1 --- old/zvm-0.8.5/install.ps1 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/install.ps1 2025-03-18 04:24:14.000000000 +0100 @@ -96,4 +96,11 @@ $PROCESSOR_ARCH = $env:PROCESSOR_ARCHITECTURE.ToLower() -Install-ZVM "zvm-windows-$PROCESSOR_ARCH.zip" \ No newline at end of file + +if ($PROCESSOR_ARCH -eq "x86") { + Write-Output "Install Failed - ZVM requires a 64-bit environment." + Write-Output "Please ensure that you are running the 64-bit version of PowerShell or that your system is 64-bit.`n" + exit 1 +} + +Install-ZVM "zvm-windows-$PROCESSOR_ARCH.zip" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/install.sh new/zvm-0.8.6/install.sh --- old/zvm-0.8.5/install.sh 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/install.sh 2025-03-18 04:24:14.000000000 +0100 @@ -1,17 +1,14 @@ #!/usr/bin/env bash -# ZVM install script - v0.2.0 - ZVM: https://github.com/tristanisham/zvm - - +# ZVM install script - v2.0.0 - ZVM: https://github.com/tristanisham/zvm ARCH=$(uname -m) OS=$(uname -s) - -if [ $ARCH = "aarch64" ]; then +if [ "$ARCH" = "aarch64" ]; then ARCH="arm64" fi -if [ $ARCH = "x86_64" ]; then +if [ "$ARCH" = "x86_64" ]; then ARCH="amd64" fi @@ -20,8 +17,7 @@ install_latest() { echo -e "Downloading $1 in $(pwd)" if [ "$(uname)" = "Darwin" ]; then - # Do something under MacOS platform - + # Do something under MacOS platform if command -v wget >/dev/null 2>&1; then echo "wget is installed. Using wget..." wget -q --show-progress --max-redirect 5 -O zvm.tar "https://github.com/tristanisham/zvm/releases/latest/download/$1" @@ -29,92 +25,127 @@ echo "wget is not installed. Using curl..." curl -L --max-redirs 5 "https://github.com/tristanisham/zvm/releases/latest/download/$1" -o zvm.tar fi - - mkdir -p $HOME/.zvm/self - tar -xf zvm.tar -C $HOME/.zvm/self + + mkdir -p "$HOME/.zvm/self" + tar -xf zvm.tar -C "$HOME/.zvm/self" rm "zvm.tar" - - elif [ $OS = "Linux" ]; then - # Do something under GNU/Linux platform + + elif [ "$OS" = "Linux" ]; then + # Do something under GNU/Linux platform if command -v wget2 >/dev/null 2>&1; then echo "wget2 is installed. Using wget2..." wget2 -q --force-progress --max-redirect 5 -O zvm.tar "https://github.com/tristanisham/zvm/releases/latest/download/$1" elif command -v wget >/dev/null 2>&1; then - echo "wget is installed. Using wget..." wget -q --show-progress --max-redirect 5 -O zvm.tar "https://github.com/tristanisham/zvm/releases/latest/download/$1" else echo "wget is not installed. Using curl..." curl -L --max-redirs 5 "https://github.com/tristanisham/zvm/releases/latest/download/$1" -o zvm.tar fi - - mkdir -p $HOME/.zvm/self - tar -xf zvm.tar -C $HOME/.zvm/self + + mkdir -p "$HOME/.zvm/self" + tar -xf zvm.tar -C "$HOME/.zvm/self" rm "zvm.tar" - elif [ $OS = "MINGW32_NT" ] || [ $OS == "MINGW64_NT" ]; then + elif [ "$OS" = "MINGW32_NT" ] || [ "$OS" = "MINGW64_NT" ]; then curl -L --max-redirs 5 "https://github.com/tristanisham/zvm/releases/latest/download/$1" -o zvm.zip # Additional extraction steps for Windows can be added here fi } - - if [ "$(uname)" = "Darwin" ]; then - # Do something under Mac OS X platform install_latest "zvm-darwin-$ARCH.tar" -elif [ $OS = "Linux" ]; then - # Do something under GNU/Linux platform +elif [ "$OS" = "Linux" ]; then install_latest "zvm-linux-$ARCH.tar" -elif [ $OS = "MINGW32_NT" ] || [ $OS == "MINGW64_NT" ]; then +elif [ "$OS" = "MINGW32_NT" ] || [ "$OS" = "MINGW64_NT" ]; then install_latest "zvm-windows-$ARCH.zip" fi -# Determine the target file -if [ -f "$HOME/.profile" ]; then - TARGET_FILE="$HOME/.profile" -elif [ -f "$HOME/.bashrc" ]; then - TARGET_FILE="$HOME/.bashrc" +############################### +# Determine the target file to update based on the user's shell. +# For Fish, we update ~/.config/fish/config.fish. +# For Zsh, we prefer .zshenv, .zprofile or .zshrc. +# Otherwise, we fallback to bash files (or any shell using .profile). + +TARGET_FILE="" + +if [[ "$SHELL" == */fish ]]; then + TARGET_FILE="$HOME/.config/fish/config.fish" +elif [[ "$SHELL" == */zsh ]]; then + if [ -f "$HOME/.zshenv" ]; then + TARGET_FILE="$HOME/.zshenv" + elif [ -f "$HOME/.zprofile" ]; then + TARGET_FILE="$HOME/.zprofile" + else + TARGET_FILE="$HOME/.zshrc" + fi else - TARGET_FILE="" + if [ -f "$HOME/.bashrc" ]; then + TARGET_FILE="$HOME/.bashrc" + elif [ -f "$HOME/.profile" ]; then + TARGET_FILE="$HOME/.profile" + else + TARGET_FILE="" + fi fi +############################### +# Append the ZVM environment variables if they are not already present. if [ -n "$TARGET_FILE" ]; then - # Check if variables are already present if grep -q 'ZVM_INSTALL' "$TARGET_FILE"; then echo "ZVM environment variables are already present in $TARGET_FILE" exit 0 fi - # Append the export statements to the TARGET_FILE echo "Adding ZVM environment variables to $TARGET_FILE" - { - echo - echo "# ZVM" - echo 'export ZVM_INSTALL="$HOME/.zvm/self"' - echo 'export PATH="$PATH:$HOME/.zvm/bin"' - echo 'export PATH="$PATH:$ZVM_INSTALL/"' - } >> "$TARGET_FILE" - echo "Run 'source $TARGET_FILE' to start using ZVM in this shell!" + + if [[ "$SHELL" == */fish ]]; then + { + echo + echo "# ZVM" + echo 'set -gx ZVM_INSTALL "$HOME/.zvm/self"' + echo 'set -gx PATH $PATH "$HOME/.zvm/bin"' + echo 'set -gx PATH $PATH "$ZVM_INSTALL/"' + } >>"$TARGET_FILE" + echo "Restart fish or run 'source $TARGET_FILE' to start using ZVM in this shell!" + else + { + echo + echo "# ZVM" + echo 'export ZVM_INSTALL="$HOME/.zvm/self"' + echo 'export PATH="$PATH:$HOME/.zvm/bin"' + echo 'export PATH="$PATH:$ZVM_INSTALL/"' + } >>"$TARGET_FILE" + echo "Run 'source $TARGET_FILE' to start using ZVM in this shell!" + fi echo "Run 'zvm i master' to install Zig" else echo - echo "No ~/.profile or ~/.bashrc file found." - echo "Run the following commands to set up ZVM environment variables in this session or append them to your shell's startup script:" - echo + echo "No suitable shell startup file found." + echo "Please add the following lines to your shell's startup script (or execute them in your current session):" if [[ "$TERM" == "xterm"* || "$TERM" == "screen"* || "$TERM" == "tmux"* ]]; then - # Colors - RED='\033[0;31m' # For strings - GREEN='\033[0;32m' # For commands - BLUE='\033[0;34m' # For variables - NC='\033[0m' # No Color - - echo -e "${GREEN}export${NC} ${BLUE}ZVM_INSTALL${NC}${GREEN}=${NC}${RED}\"\$HOME/.zvm/self\"${NC}" - echo -e "${GREEN}export${NC} ${BLUE}PATH${NC}${GREEN}=${NC}${RED}\"\$PATH:\$HOME/.zvm/bin\"${NC}" - echo -e "${GREEN}export${NC} ${BLUE}PATH${NC}${GREEN}=${NC}${RED}\"\$PATH:\$ZVM_INSTALL/\"${NC}" - echo -e "Run 'zvm i master' to install Zig" + # Colors for pretty-printing + RED='\033[0;31m' + GREEN='\033[0;32m' + BLUE='\033[0;34m' + NC='\033[0m' + if [[ "$SHELL" == */fish ]]; then + echo -e "${GREEN}set -gx${NC} ${BLUE}ZVM_INSTALL${NC}${GREEN} ${NC}${RED}\"\$HOME/.zvm/self\"${NC}" + echo -e "${GREEN}set -gx${NC} ${BLUE}PATH${NC}${GREEN} ${NC}${RED}\"\$PATH:\$HOME/.zvm/bin\"${NC}" + echo -e "${GREEN}set -gx${NC} ${BLUE}PATH${NC}${GREEN} ${NC}${RED}\"\$PATH:\$ZVM_INSTALL/\"${NC}" + else + echo -e "${GREEN}export${NC} ${BLUE}ZVM_INSTALL${NC}${GREEN}=${NC}${RED}\"\$HOME/.zvm/self\"${NC}" + echo -e "${GREEN}export${NC} ${BLUE}PATH${NC}${GREEN}=${NC}${RED}\"\$PATH:\$HOME/.zvm/bin\"${NC}" + echo -e "${GREEN}export${NC} ${BLUE}PATH${NC}${GREEN}=${NC}${RED}\"\$PATH:\$ZVM_INSTALL/\"${NC}" + fi else - echo 'export ZVM_INSTALL="$HOME/.zvm/self"' - echo 'export PATH="$PATH:$HOME/.zvm/bin"' - echo 'export PATH="$PATH:$ZVM_INSTALL/"' - echo "Run 'zvm i master' to install Zig" + if [[ "$SHELL" == */fish ]]; then + echo 'set -gx ZVM_INSTALL "$HOME/.zvm/self"' + echo 'set -gx PATH $PATH "$HOME/.zvm/bin"' + echo 'set -gx PATH $PATH "$ZVM_INSTALL/"' + else + echo 'export ZVM_INSTALL="$HOME/.zvm/self"' + echo 'export PATH="$PATH:$HOME/.zvm/bin"' + echo 'export PATH="$PATH:$ZVM_INSTALL/"' + fi fi + echo "Run 'zvm i master' to install Zig" fi diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/zvm-0.8.5/main.go new/zvm-0.8.6/main.go --- old/zvm-0.8.5/main.go 2025-01-22 21:31:56.000000000 +0100 +++ new/zvm-0.8.6/main.go 2025-03-18 04:24:14.000000000 +0100 @@ -145,6 +145,7 @@ Name: "run", Usage: "run a command with the given Zig version", // Args: true, + SkipFlagParsing: true, Action: func(ctx context.Context, cmd *opts.Command) error { versionArg := strings.TrimPrefix(cmd.Args().First(), "v") cmds := cmd.Args().Tail() ++++++ vendor.tar.xz ++++++ ++++ 15225 lines of diff (skipped)