hst/dbus: move dbus config struct
Some checks failed
Test / Create distribution (push) Failing after 26s
Test / Sandbox (race detector) (push) Failing after 42s
Test / Sandbox (push) Failing after 42s
Test / Hakurei (race detector) (push) Failing after 49s
Test / Hakurei (push) Failing after 49s
Test / Hpkg (push) Failing after 46s
Test / Flake checks (push) Has been skipped

This allows holding a xdg-dbus-proxy configuration without importing system/dbus.

It also makes more sense in the project structure since the config struct is part of the hst API however the rest of the implementation is not.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-10-07 19:01:18 +09:00
parent 3ce63e95d7
commit be194272d9
9 changed files with 143 additions and 223 deletions

View File

@@ -21,7 +21,7 @@ var (
)
// MustProxyDBus calls ProxyDBus and panics if an error is returned.
func (sys *I) MustProxyDBus(sessionPath *container.Absolute, session *dbus.Config, systemPath *container.Absolute, system *dbus.Config) *I {
func (sys *I) MustProxyDBus(sessionPath *container.Absolute, session *hst.BusConfig, systemPath *container.Absolute, system *hst.BusConfig) *I {
if err := sys.ProxyDBus(session, system, sessionPath, systemPath); err != nil {
panic(err.Error())
} else {
@@ -31,7 +31,7 @@ func (sys *I) MustProxyDBus(sessionPath *container.Absolute, session *dbus.Confi
// ProxyDBus finalises configuration ahead of time and starts xdg-dbus-proxy via [dbus] and terminates it on revert.
// This [Op] is always [Process] scoped.
func (sys *I) ProxyDBus(session, system *dbus.Config, sessionPath, systemPath *container.Absolute) error {
func (sys *I) ProxyDBus(session, system *hst.BusConfig, sessionPath, systemPath *container.Absolute) error {
d := new(dbusProxyOp)
// session bus is required as otherwise this is effectively a very expensive noop
@@ -56,9 +56,9 @@ func (sys *I) ProxyDBus(session, system *dbus.Config, sessionPath, systemPath *c
fmt.Sprintf("cannot finalise message bus proxy: %v", err), false)
} else {
if sys.msg.IsVerbose() {
sys.msg.Verbose("session bus proxy:", session.Args(sessionBus))
sys.msg.Verbose("session bus proxy:", dbus.Args(session, sessionBus))
if system != nil {
sys.msg.Verbose("system bus proxy:", system.Args(systemBus))
sys.msg.Verbose("system bus proxy:", dbus.Args(system, systemBus))
}
// this calls the argsWt String method