5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-08 03:51:15 +08:00
wails/v3/internal/doctor/packagemanager/pm.go
Atterpac 9173537ce5
[V3-Linux] Support for deb,rpm,arch linux packager packaging (#3909)
* Support for linux deb,rpm,arch linux packager packaging

* remove optional tasks from linux:package task

CHANGELOG.md

* Update Taskfile.linux.yml

* Integrated nfpm into CLI.
Fixed task update.

* package tool fixes and add bundle name field

empty name guard

* add linux depdencies

* Add some docs

* Fixed tests. Updated task to latest.

* Update v3/internal/commands/tool_package.go

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

* Remove doctor references to nfpm

---------

Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2024-11-30 13:31:56 +11:00

66 lines
1.6 KiB
Go

//go:build linux
package packagemanager
// Package contains information about a system package
type Package struct {
Name string
Version string
InstallCommand string
InstallCheck func() bool
SystemPackage bool
Library bool
Optional bool
}
type Packagemap = map[string][]*Package
// PackageManager is a common interface across all package managers
type PackageManager interface {
Name() string
Packages() Packagemap
PackageInstalled(*Package) (bool, error)
PackageAvailable(*Package) (bool, error)
InstallCommand(*Package) string
}
// Dependency represents a system package that we require
type Dependency struct {
Name string
PackageName string
Installed bool
InstallCommand string
Version string
Optional bool
External bool
}
// DependencyList is a list of Dependency instances
type DependencyList []*Dependency
// InstallAllRequiredCommand returns the command you need to use to install all required dependencies
func (d DependencyList) InstallAllRequiredCommand() string {
result := ""
for _, dependency := range d {
if !dependency.Installed && !dependency.Optional {
result += " - " + dependency.Name + ": " + dependency.InstallCommand + "\n"
}
}
return result
}
// InstallAllOptionalCommand returns the command you need to use to install all optional dependencies
func (d DependencyList) InstallAllOptionalCommand() string {
result := ""
for _, dependency := range d {
if !dependency.Installed && dependency.Optional {
result += " - " + dependency.Name + ": " + dependency.InstallCommand + "\n"
}
}
return result
}