Skip to content

Commit 1f55c07

Browse files
committed
build: automatically include bus/own-* abstraction when required.
1 parent 9ab321d commit 1f55c07

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

pkg/prebuild/directive/dbus.go

+3
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ func (d Dbus) own(rules map[string]string) aa.Rules {
110110
interfaces := getInterfaces(rules)
111111

112112
res := aa.Rules{
113+
&aa.Include{
114+
IsMagic: true, Path: "abstractions/bus/own-" + rules["bus"],
115+
},
113116
&aa.Dbus{
114117
Access: []string{"bind"}, Bus: rules["bus"], Name: rules["name"],
115118
},

pkg/prebuild/directive/dbus_test.go

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ import (
88
"testing"
99
)
1010

11-
const dbusOwnSystemd1 = ` dbus bind bus=system name=org.freedesktop.systemd1{,.*},
11+
const dbusOwnSystemd1 = ` include <abstractions/bus/own-system>
12+
13+
dbus bind bus=system name=org.freedesktop.systemd1{,.*},
1214
dbus receive bus=system path=/org/freedesktop/systemd1{,/**}
1315
interface=org.freedesktop.systemd1{,.*}
1416
peer=(name="@{busname}"),
@@ -71,7 +73,9 @@ func TestDbus_Apply(t *testing.T) {
7173
Raw: " #aa:dbus own bus=session name=com.rastersoft.ding interface+=org.gtk.Actions",
7274
},
7375
profile: " #aa:dbus own bus=session name=com.rastersoft.ding interface+=org.gtk.Actions",
74-
want: ` dbus bind bus=session name=com.rastersoft.ding{,.*},
76+
want: ` include <abstractions/bus/own-session>
77+
78+
dbus bind bus=session name=com.rastersoft.ding{,.*},
7579
dbus receive bus=session path=/com/rastersoft/ding{,/**}
7680
interface=com.rastersoft.ding{,.*}
7781
peer=(name="@{busname}"),

0 commit comments

Comments
 (0)