Skip to content

Add xbps support to doctor command.#5238

Open
nerdyslacker wants to merge 1 commit intowailsapp:masterfrom
nerdyslacker:xbps
Open

Add xbps support to doctor command.#5238
nerdyslacker wants to merge 1 commit intowailsapp:masterfrom
nerdyslacker:xbps

Conversation

@nerdyslacker
Copy link
Copy Markdown

@nerdyslacker nerdyslacker commented Apr 24, 2026

I added support for xbps package manager since I created a request to add wails to Void Linux official repositories. Currently I maintain and use wails in my own unofficial repository for void.

Now wails doctor works on Void Linux:

nerdyslacker@topstation:~ $ wails doctor
                                                                                                                                                                            
# Wails
Version         | v2.12.0     
Package Manager | xbps-install


# System
┌──────────────────────────────────────────────────────────────────────────────────────────────┐
| OS           | Void Linux                                                                    |
| Version      | Unknown                                                                       |
| ID           | void                                                                          |
| Branding     |                                                                               |
| Go Version   | go1.26.1                                                                      |
| Platform     | linux                                                                         |
| Architecture | amd64                                                                         |
| CPU          | Intel(R) Core(TM) i5-4200U CPU @ 1.60GHz                                      |
| GPU          | Haswell-ULT Integrated Graphics Controller (Intel Corporation) - Driver: i915 |
| Memory       | 16GB                                                                          |
└──────────────────────────────────────────────────────────────────────────────────────────────┘

# Dependencies
┌────────────────────────────────────────────────────────────────────┐
| Dependency | Package Name          | Status    | Version           |
| *docker    | docker                | Installed | 29.4.0_1          |
| gcc        | gcc                   | Installed | 14.2.1+20250405_4 |
| libgtk-3   | gtk+3-devel           | Installed | 3.24.52_1         |
| libwebkit  | libwebkit2gtk41-devel | Installed | 2.50.4_1          |
| npm        | nodejs                | Installed | 24.14.1_1         |
| pkg-config | pkg-config            | Installed | 0.29.2_3          |
| *upx       | upx                   | Available | 5.1.1_1           |
|                                                                    |
└───────────────────── * - Optional Dependency ──────────────────────┘

# Diagnosis
Optional package(s) installation details: 
  - upx: sudo xbps-install -S upx

 SUCCESS  Your system is ready for Wails development!

Summary by CodeRabbit

  • New Features
    • Added support for the xbps package manager on Linux systems. Developers using xbps-based distributions (such as Void Linux) can now use Wails with automatic handling of required compilation dependencies.
  • Documentation
    • Updated documentation guides to reflect xbps as a supported package manager option for Wails development.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 24, 2026

📝 Walkthrough

Walkthrough

The changes introduce support for the XBPS package manager (used by Void Linux) to the Wails build system. This includes updating the package manager factory to recognize "xbps-install", implementing a new Xbps backend with package discovery and installation capabilities, and adding documentation for this new supported package manager.

Changes

Cohort / File(s) Summary
Package Manager Factory
v2/internal/system/packagemanager/packagemanager.go
Added "xbps-install" to the package manager discovery list and updated the factory function to instantiate NewXbps(osid) when xbps-install is detected.
XBPS Implementation
v2/internal/system/packagemanager/xbps.go
New Linux-only package manager backend implementing package detection (via xbps-query), availability checking (via xbps-query -Rs), version extraction from repository and installed package queries, and installation command generation with support for both system and custom package sources.
Documentation
website/docs/guides/linux-distro-support.mdx
Updated supported package managers list to include xbps.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Suggested reviewers

  • leaanthony

Poem

🐰 A void in the package manager, we fill,
With xbps queries that bend to our will,
Void Linux now builds without a hitch,
Dependencies parsed—each package and switch! 📦✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ❓ Inconclusive The description explains the motivation and includes test output demonstrating functionality, but several required checklist items from the template are incomplete or unmarked. Complete the PR description checklist by marking tested platforms, confirming changelog updates, and verifying documentation changes are included.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding xbps package manager support to the doctor command for Void Linux compatibility.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 golangci-lint (2.11.4)

level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies"


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
v2/internal/system/packagemanager/packagemanager.go (1)

53-54: Nit: trailing whitespace on Line 54.

There's trailing whitespace after return NewXbps(osid) that will likely be flagged by gofmt / CI formatters. Run gofmt -w on the file.

Proposed fix
 	case "xbps-install":
-		return NewXbps(osid)		
+		return NewXbps(osid)
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/internal/system/packagemanager/packagemanager.go` around lines 53 - 54,
Remove the trailing whitespace after the line "return NewXbps(osid)" in the
switch case for "xbps-install" in packagemanager.go; ensure the line ends
without extra spaces and then run gofmt -w on the file to apply formatting
changes (this touches the switch case returning NewXbps and the surrounding
function in packagemanager.go).
v2/internal/system/packagemanager/xbps.go (1)

86-104: Simplify parsing and fix error handling in xbps-query output.

The current parsing using strings.LastIndex(pkgfield, "-") works for the current package names, but is fragile. Since getPackageVersion (line 120) already uses strings.HasPrefix(pkgfield, pkg.Name+"-"), the same approach should be used here for consistency and clarity.

Additionally, xbps-query -Rs returns a non-zero exit when there are no matches. Currently, this error is propagated directly from PackageAvailable, but other package managers like pacman.go explicitly check for exec.ExitError and return (false, nil) to treat command failure as "package not available". The xbps implementation should follow the same pattern to avoid surfacing expected errors to callers.

Suggested change
 	stdout, _, err := shell.RunCommand(".", "xbps-query", "-Rs", pkg.Name)
 	available := false
 	for _, line := range strings.Split(stdout, "\n") {
 		// Each line is like: "[-] pkgname-version ..."  or  "[*] pkgname-version ..."
 		fields := strings.Fields(line)
 		if len(fields) < 2 {
 			continue
 		}
-		// fields[1] is "pkgname-version", strip the version to compare
-		pkgfield := fields[1]
-		dashIdx := strings.LastIndex(pkgfield, "-")
-		if dashIdx > 0 && strings.EqualFold(pkgfield[:dashIdx], pkg.Name) {
+		// fields[1] is "<pkgname>-<version>"
+		pkgfield := fields[1]
+		if strings.HasPrefix(pkgfield, pkg.Name+"-") {
 			available = true
 			x.getPackageVersion(pkg, pkgfield)
 			break
 		}
 	}
-	return available, err
+	if available {
+		return true, nil
+	}
+	// Treat command not found as "not available" rather than error
+	if err != nil {
+		_, ok := err.(*exec.ExitError)
+		if ok {
+			return false, nil
+		}
+	}
+	return false, err
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@v2/internal/system/packagemanager/xbps.go` around lines 86 - 104, In
PackageAvailable, simplify the package match by replacing the fragile LastIndex
logic with the same prefix check used by getPackageVersion (i.e., use
strings.HasPrefix(pkgfield, pkg.Name+"-") to detect the package and then call
x.getPackageVersion(pkg, pkgfield)); also improve error handling from
shell.RunCommand by treating an exec.ExitError (command returned non-zero
because no matches) as a non-fatal "not available" case and return (false, nil)
instead of propagating the error, while still returning other unexpected errors.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@v2/internal/system/packagemanager/packagemanager.go`:
- Around line 53-54: Remove the trailing whitespace after the line "return
NewXbps(osid)" in the switch case for "xbps-install" in packagemanager.go;
ensure the line ends without extra spaces and then run gofmt -w on the file to
apply formatting changes (this touches the switch case returning NewXbps and the
surrounding function in packagemanager.go).

In `@v2/internal/system/packagemanager/xbps.go`:
- Around line 86-104: In PackageAvailable, simplify the package match by
replacing the fragile LastIndex logic with the same prefix check used by
getPackageVersion (i.e., use strings.HasPrefix(pkgfield, pkg.Name+"-") to detect
the package and then call x.getPackageVersion(pkg, pkgfield)); also improve
error handling from shell.RunCommand by treating an exec.ExitError (command
returned non-zero because no matches) as a non-fatal "not available" case and
return (false, nil) instead of propagating the error, while still returning
other unexpected errors.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f3360174-2ca0-428d-93df-7726f84b444d

📥 Commits

Reviewing files that changed from the base of the PR and between b618f81 and c5674ea.

�� Files selected for processing (3)
  • v2/internal/system/packagemanager/packagemanager.go
  • v2/internal/system/packagemanager/xbps.go
  • website/docs/guides/linux-distro-support.mdx
@leaanthony
Copy link
Copy Markdown
Member

Triaged ✓ — labeled Ready For Testing.
Dispatching cross-platform tests:
• Mac: WAI-30
• Linux: WAI-31
• Windows: WAI-32
Each engineer will checkout headRefOid c5674ea330, build, run unit tests, and visually verify the example apps. Verdicts will land here as separate comments.

— Wails PR Reviewer (autopilot triage). Last reviewed commit: c5674ea330. Mention @triage-bot to ping a human.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants