Skip to content

Fix dependencies.sh: blank line, apt warning clarity, LLDB comment, xmake PATH guard#42

Merged
transicle merged 2 commits intomainfrom
copilot/update-dependencies-shell-script
Mar 27, 2026
Merged

Fix dependencies.sh: blank line, apt warning clarity, LLDB comment, xmake PATH guard#42
transicle merged 2 commits intomainfrom
copilot/update-dependencies-shell-script

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 27, 2026

Four minor but meaningful fixes to utils/dependencies.sh addressing readability, correctness, and user experience.

Changes

  • Blank line removed — drop empty line between install_packages() declaration and case statement, consistent with rest of script
  • Expanded apt-get update warning — failure message now tells the user installation will continue from cache and what to do if it ultimately fails:
    print_warn "Failed to update package list; continuing with installation using the existing package cache. If installation fails, please check your network connection or run 'sudo apt-get update' manually and re-run this script."
  • LLDB comment on darwin — documents why the LLDB check only warns instead of setting NEED_INSTALL=true (managed by Xcode/CLT, not the package manager)
  • Guard GITHUB_PATH update behind XMAKE_WAS_MISSING — previously the xmake PATH update ran whenever GITHUB_PATH was set, even if xmake was already present; now gated on a new XMAKE_WAS_MISSING flag set only when xmake is detected as missing at dependency-check time:
    check_dependency "xmake" "XMake" || { NEED_INSTALL=true; XMAKE_WAS_MISSING=true; }
    # ...
    if [ "$XMAKE_WAS_MISSING" = true ] && [ -n "$GITHUB_PATH" ]; then
Original prompt
Please apply the following diffs and create a pull request.
Once the PR is ready, give it a title based on the messages of the fixes being applied.

[{"message":"The empty line after the function declaration reduces readability. Remove the blank line between the function declaration and the case statement for consistency with shell scripting conventions.","fixFiles":[{"filePath":"utils/dependencies.sh","diff":"diff --git a/utils/dependencies.sh b/utils/dependencies.sh\n--- a/utils/dependencies.sh\n+++ b/utils/dependencies.sh\n@@ -72,7 +72,6 @@\n }\n \n install_packages() {\n-\n     case $PKG_MGR in\n     apt)\n         print_info \"Updating package list...\"\n"}]},{"message":"The warning message 'Failed to update package list' doesn't inform the user about next steps or whether the installation will continue. Consider expanding the message to clarify whether this is a recoverable error and what action the user should take.","fixFiles":[{"filePath":"utils/dependencies.sh","diff":"diff --git a/utils/dependencies.sh b/utils/dependencies.sh\n--- a/utils/dependencies.sh\n+++ b/utils/dependencies.sh\n@@ -76,7 +76,7 @@\n     case $PKG_MGR in\n     apt)\n         print_info \"Updating package list...\"\n-        $SUDO apt-get update -qq || print_warn \"Failed to update package list\"\n+        $SUDO apt-get update -qq || print_warn \"Failed to update package list; continuing with installation using the existing package cache. If installation fails, please check your network connection or run 'sudo apt-get update' manually and re-run this script.\"\n         print_info \"Installing packages: $*\"\n         $SUDO apt-get install -y \"$@\"\n         ;;\n"}]},{"message":"The check for LLDB on darwin doesn't set NEED_INSTALL=true when it fails, unlike other dependency checks. This creates inconsistent behavior where LLDB is checked but not automatically installed. Either add NEED_INSTALL=true to make it consistent with other checks, or add a comment explaining why LLDB is handled differently.","fixFiles":[{"filePath":"utils/dependencies.sh","diff":"diff --git a/utils/dependencies.sh b/utils/dependencies.sh\n--- a/utils/dependencies.sh\n+++ b/utils/dependencies.sh\n@@ -199,6 +199,8 @@\n         check_dependency \"clang\" \"Clang compiler\" || NEED_INSTALL=true\n         check_dependency \"clang-format\" \"clang-format\" || NEED_INSTALL=true\n         check_dependency \"xmake\" \"XMake\" || NEED_INSTALL=true\n+        # LLDB is typically installed via Xcode / Command Line Tools on macOS,\n+        # not via the package manager, so we only warn here instead of setting NEED_INSTALL=true.\n         check_dependency \"lldb\" \"LLDB debugger\" || print_warn \"LLDB is not installed — run: xcode-select --install\"\n     else\n         check_dependency \"gcc\" \"GCC compiler\" || NEED_INSTALL=true\n"}]},{"message":"The logic for updating GITHUB_PATH with xmake directory is only executed after successful package installation, but it doesn't verify that xmake was actually part of the installed packages. If xmake was already installed before running this script, the PATH update logic still executes unnecessarily. Consider checking if xmake was newly installed or refactoring this logic to be more explicit about when PATH updates are needed.","fixFiles":[{"filePath":"utils/dependencies.sh","diff":"diff --git a/utils/dependencies.sh b/utils/dependencies.sh\n--- a/utils/dependencies.sh\n+++ b/utils/dependencies.sh\n@@ -195,15 +195,16 @@\n     echo\n \n     NEED_INSTALL=false\n+    XMAKE_WAS_MISSING=false\n     if [ \"$DISTRO\" = \"darwin\" ]; then\n         check_dependency \"clang\" \"Clang compiler\" || NEED_INSTALL=true\n         check_dependency \"clang-format\" \"clang-format\" || NEED_INSTALL=true\n-        check_dependency \"xmake\" \"XMake\" || NEED_INSTALL=true\n+        check_dependency \"xmake\" \"XMake\" || { NEED_INSTALL=true; XMAKE_WAS_MISSING=true; }\n         check_dependency \"lldb\" \"LLDB debugger\" || print_warn \"LLDB is not installed — run: xcode-select --install\"\n     else\n         check_dependency \"gcc\" \"GCC compiler\" || NEED_INSTALL=true\n         check_dependency \"clang-format\" \"clang-format\" || NEED_INSTALL=true\n-        check_dependency \"xmake\" \"XMake\" || NEED_INSTALL=true\n+        check_dependency \"xmake\" \"XMake\" || { NEED_INSTALL=true; XMAKE_WAS_MISSING=true; }\n         check_dependency \"gdb\" \"GDB debugger\" || NEED_INSTALL=true\n     fi\n \n@@ -219,7 +213,7 @@\n     echo\n \n     if install_packages \"${PACKAGES[@]}\"; then\n-        if [ -n \"$GITHUB_PATH\" ]; then\n+        if [ \"$XMAKE_WAS_MISSING\" = true ] && [ -n \"$GITHUB_PATH\" ]; then\n             # Detect actual xmake installation path before updating GITHUB_PATH\n             XMAKE_PATH=\"$(command -v xmake || true)\"\n             if [ -n \"$XMAKE_PATH\" ]; then\n"}]}]

📍 Connect Copilot coding agent with Jira, Azure Boards or Linear to delegate work to Copilot in one click without leaving your project management tool.

…e PATH guard

Agent-Logs-Url: https://github.com/Cappucina/ADAN/sessions/e8dc27ec-ba7c-43cd-98fe-91c686db4521

Co-authored-by: transicle <173532449+transicle@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix readability and improve warning message in dependencies script Fix dependencies.sh: blank line, apt warning clarity, LLDB comment, xmake PATH guard Mar 27, 2026
@transicle transicle marked this pull request as ready for review March 27, 2026 20:17
Copilot AI requested a review from transicle March 27, 2026 20:17
@transicle transicle merged commit 6c2db5e into main Mar 27, 2026
3 of 4 checks passed
@transicle transicle deleted the copilot/update-dependencies-shell-script branch March 27, 2026 20:18
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.

2 participants