Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ users)
## Opamfile

## External dependencies
* Add missing references to Haiku package manager

## Format upgrade

Expand Down
14 changes: 13 additions & 1 deletion src/state/opamSysInteract.ml
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ type families =
| Dummy of test_setup
| Freebsd
| Gentoo
| Haiku
| Homebrew
| Macports
| Msys2
Expand Down Expand Up @@ -191,6 +192,7 @@ let family ~env () =
end
| "debian" | "ubuntu" -> Debian
| "gentoo" -> Gentoo
| "haiku" -> Haiku
| "homebrew" -> Homebrew
| "macports" -> Macports
| "nixos" -> Nix
Expand Down Expand Up @@ -863,6 +865,13 @@ let packages_status ?(env=OpamVariable.Map.empty) config packages =
|> package_set_of_pkgpath
in
compute_sets sys_installed
| Haiku ->
let sys_installed =
run_query_command "pkgman" ["search"; "%n\n%o"]
|> List.map OpamSysPkg.of_string
|> OpamSysPkg.Set.of_list
Comment on lines +870 to +872
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work at all. I've looked into it and the best we can do seems to be -a/--all but we need to extract a list from that (extract the second column after the ----- line). We could even extract the list of installed packages this way by looking at the first column (if it contains s, S, h or H then it is installed). Or we could wait for #6489 and split the two into pkgman search -a and pkgman search -i -a

Suggested change
run_query_command "pkgman" ["search"; "%n\n%o"]
|> List.map OpamSysPkg.of_string
|> OpamSysPkg.Set.of_list
run_query_command "pkgman" ["search"; "-a"]
|> some_post_processing

in
compute_sets sys_installed
| Homebrew ->
(* accept 'pkgname' and 'pkgname@version'
exampe output
Expand Down Expand Up @@ -1006,7 +1015,7 @@ let stateless_install ?(env=OpamVariable.Map.empty) () =
| exception Failure _ -> true (* no depexts *)
| Nix -> true
| Alpine | Altlinux | Arch | Centos | Cygwin | Debian | Dummy _
| Freebsd | Gentoo | Homebrew | Macports | Msys2 | Netbsd
| Freebsd | Gentoo | Haiku | Homebrew | Macports | Msys2 | Netbsd
| Openbsd | Suse -> false

(* Install *)
Expand All @@ -1026,6 +1035,7 @@ let package_manager_name_t ?(env=OpamVariable.Map.empty) config =
`AsUser "false"
| Freebsd -> `AsAdmin "pkg"
| Gentoo -> `AsAdmin "emerge"
| Haiku -> `AsAdmin "pkgman"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| Haiku -> `AsAdmin "pkgman"
| Haiku -> `AsUser "pkgman"

Copy link
Member

Choose a reason for hiding this comment

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

Haiku doesn't seem to have sudo/doas or any sort of distinction between admin and users as far as the package manager is concerned. It has su though so maybe? Do you know where this is documented? I couldn't find if haiku has a notion of superuser/privileged user

| Homebrew -> `AsUser "brew"
| Macports -> `AsAdmin "port"
| Msys2 -> `AsUser (Commands.msys2 config)
Expand Down Expand Up @@ -1112,6 +1122,7 @@ let install_packages_commands_t ?(env=OpamVariable.Map.empty) ~to_show st
[pm, []], None
| Freebsd -> [pm, "install"::yes ["-y"] packages], None
| Gentoo -> [pm, yes ~no:["-a"] [] packages], None
| Haiku -> [pm, "install"::yes ["-y"] packages], None
| Homebrew ->
[pm, "install"::packages], (* NOTE: Does not have any interactive mode *)
Some (["HOMEBREW_NO_AUTO_UPDATE","yes"])
Expand Down Expand Up @@ -1261,6 +1272,7 @@ let update ?(env=OpamVariable.Map.empty) config =
if test.install then None else Some (`AsUser "false", [])
| Freebsd -> None
| Gentoo -> Some (`AsAdmin "emerge", ["--sync"])
| Haiku -> Some (`AsAdmin "pkgman", ["update"])
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
| Haiku -> Some (`AsAdmin "pkgman", ["update"])
| Haiku -> Some (`AsUser "pkgman", ["full-sync"])

| Homebrew -> Some (`AsUser "brew", ["update"])
| Macports -> Some (`AsAdmin "port", ["sync"])
| Msys2 -> Some (`AsUser (Commands.msys2 config), ["-Sy"])
Expand Down