From 4aaee3d230747b0b03405fa71a8e6c4030a5283d Mon Sep 17 00:00:00 2001 From: partisan Date: Sat, 18 Jan 2025 20:41:00 +0100 Subject: [PATCH] fixed deps check --- spitfire/checks.go | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/spitfire/checks.go b/spitfire/checks.go index 75cb9a5..15d79b4 100644 --- a/spitfire/checks.go +++ b/spitfire/checks.go @@ -13,22 +13,22 @@ import ( func CheckDependencies() error { // Common dependencies dependencies := map[string]string{ - "git": "https://git-scm.com/download/win", // Git - "python": "https://www.python.org/downloads/", // Python - "pip3": "https://pip.pypa.io/en/stable/installing/", // Pip3 - "mercurial": "https://www.mercurial-scm.org/", // Mercurial (hg) + "git": "https://git-scm.com/downloads", // Git + "python": "https://www.python.org/downloads/", // Python + "pip3": "https://pip.pypa.io/en/stable/installing/", // Pip3 + "hg": "https://www.mercurial-scm.org/", // Mercurial (hg) } // Add platform-specific dependencies - if runtime.GOOS == "windows" || !isMsys2() { + if runtime.GOOS == "windows" { mozBuildPath := os.Getenv("MOZILLABUILD") if mozBuildPath == "" { - mozBuildPath = "C:\\mozilla-build" // Default path for MozillaBuild + mozBuildPath = "C:\\mozilla-build" // Default path for MozillaBuild on Windows } if !dirExists(mozBuildPath) { dependencies["mozbuild"] = "https://ftp.mozilla.org/pub/mozilla/libraries/win32/MozillaBuildSetup-Latest.exe" } - } else if runtime.GOOS != "windows" || !isMsys2() { + } else { dependencies["rsync"] = "https://rsync.samba.org/download.html" // rsync for non-Windows platforms } @@ -40,10 +40,10 @@ func CheckDependencies() error { } } - // Special check for `mach` in the local source directory + // Check for `mach` script in the source directory machPath := filepath.Join("mozilla-release", "mach") if !fileExists(machPath) { - missingTools = append(missingTools, "mach (ensure you are in the mozilla-release directory)") + missingTools = append(missingTools, "mach (ensure you are in the mozilla-release directory and it is built)") } // Report missing tools if any @@ -61,8 +61,12 @@ func CheckDependencies() error { // isCommandAvailable checks if a command/tool is available on the system. func isCommandAvailable(command string) bool { - _, err := exec.LookPath(command) - return err == nil + path, err := exec.LookPath(command) + if err != nil { + return false + } + fmt.Printf("Command '%s' found at path '%s'\n", command, path) + return true } // fileExists checks if a file exists at the given path.