Skip to content

Commit

Permalink
daemon: Remove support for session bus
Browse files Browse the repository at this point in the history
We haven't actually tested this in a long time, it's just
cruft now.  Bigger picture we need to make it as ergonomic and
fast as possible to test in VMs.

(I think it likely would be worthwhile at some point having rpm-ostree run in a "stock
podman container" w/o systemd but that's a whole lot of work.)

Prep for some work on socket activation.
  • Loading branch information
cgwalters committed May 23, 2021
1 parent da84ab8 commit 0a53e35
Show file tree
Hide file tree
Showing 9 changed files with 6 additions and 579 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
/config.status.lineno
/configure
/configure.lineno
/dbus-run-session
/gtk-doc.make
/insttree/
/libglnx.la
Expand Down
13 changes: 0 additions & 13 deletions Makefile-tests.am
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,8 @@ uninstalled_test_scripts = \
$(NULL)

uninstalled_test_extra_programs = \
dbus-run-session \
$(NULL)

dbus_run_session_SOURCES = tests/utils/dbus-run-session.c

check-local:
@echo " *** NOTE ***"
@echo " \"make check\" only runs unit tests, which have limited coverage currently."
Expand All @@ -52,13 +49,3 @@ vmoverlay:
# development so that e.g. we automatically overlay.
vmcheck: vmoverlay
@tests/vmcheck.sh

testenv:
@echo "===== ENTERING TESTENV ====="
test_tmpdir=$$(mktemp -d test.XXXXXX) && \
cd $$test_tmpdir && \
env $(BASE_TESTS_ENVIRONMENT) PATH=$(abs_builddir):$$PATH TESTENV=1 \
sh ../tests/utils/setup-session.sh bash && \
cd .. && \
rm -rf $$test_tmpdir
@echo "===== LEAVING TESTENV ====="
2 changes: 1 addition & 1 deletion buildutil/glib-tap.mk
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ installed_test_meta_DATA = $(installed_testcases:=.test)
%.test: %$(EXEEXT) Makefile
$(AM_V_GEN) (echo '[Test]' > $@.tmp; \
echo 'Type=session' >> $@.tmp; \
echo 'Exec=$(installed_testdir)/setup-session.sh $(installed_testdir)/$(notdir $<)' >> $@.tmp; \
echo 'Exec=$(installed_testdir)/$(notdir $<)' >> $@.tmp; \
mv $@.tmp $@)

CLEANFILES += $(installed_test_meta_DATA)
Expand Down
10 changes: 5 additions & 5 deletions src/app/rpmostree-builtin-start-daemon.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ start_daemon (GDBusConnection *connection,
"connection", connection,
"sysroot-path", opt_sysroot ?: "/",
NULL);
return rpm_ostree_daemon != NULL;
if (rpm_ostree_daemon == NULL)
return FALSE;
(void) g_bus_own_name_on_connection (connection, DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE,
NULL, NULL, NULL, NULL);
return TRUE;
}

static void
Expand Down Expand Up @@ -315,8 +319,6 @@ rpmostree_builtin_start_daemon (int argc,
* the system bus. */
if (g_getenv ("DBUS_STARTER_BUS_TYPE") != NULL)
bus_type = G_BUS_TYPE_STARTER;
else if (g_getenv ("RPMOSTREE_USE_SESSION_BUS") != NULL)
bus_type = G_BUS_TYPE_SESSION;
else
bus_type = G_BUS_TYPE_SYSTEM;

Expand All @@ -326,8 +328,6 @@ rpmostree_builtin_start_daemon (int argc,
return FALSE;
if (!start_daemon (bus, error))
return FALSE;
(void) g_bus_own_name_on_connection (bus, DBUS_NAME, G_BUS_NAME_OWNER_FLAGS_NONE,
NULL, NULL, NULL, NULL);
}
else if (!connect_to_peer (service_dbus_fd, error))
return FALSE;
Expand Down
19 changes: 0 additions & 19 deletions src/app/rpmostree-clientlib.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,6 @@ get_connection_for_path (const char *sysroot,
GCancellable *cancellable,
GError **error)
{
/* This is only intended for use by installed tests.
* Note that it disregards the 'sysroot' and 'force_peer' options
* and assumes the service activation command has been configured
* to use the desired system root path. */
if (g_getenv ("RPMOSTREE_USE_SESSION_BUS") != NULL)
{
if (sysroot != NULL)
g_warning ("RPMOSTREE_USE_SESSION_BUS set, ignoring --sysroot=%s", sysroot);

/* NB: as opposed to other early returns, this is _also_ a happy path */
GDBusConnection *ret = g_bus_get_sync (G_BUS_TYPE_SESSION, cancellable, error);
if (!ret)
return (GDBusConnection*)(glnx_prefix_error_null (error, "Connecting to session bus"));

*out_bus_type = G_BUS_TYPE_SESSION;
return ret;
}

if (sysroot == NULL)
sysroot = "/";

Expand All @@ -89,7 +71,6 @@ get_connection_for_path (const char *sysroot,
GDBusConnection *ret = g_bus_get_sync (G_BUS_TYPE_SYSTEM, cancellable, error);
if (!ret)
return (GDBusConnection*)(glnx_prefix_error_null (error, "Connecting to system bus"));

*out_bus_type = G_BUS_TYPE_SYSTEM;
return ret;
}
Expand Down
3 changes: 0 additions & 3 deletions src/daemon/rpmostreed-sysroot.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -542,9 +542,6 @@ rpmostreed_sysroot_init (RpmostreedSysroot *self)

self->monitor = NULL;

if (g_getenv ("RPMOSTREE_USE_SESSION_BUS") != NULL)
self->on_session_bus = TRUE;

/* Only use polkit when running as root on system bus; self-tests don't need it */
if (!self->on_session_bus)
{
Expand Down
7 changes: 0 additions & 7 deletions tests/common/libtest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,6 @@ check_root_test ()
fi
}

ensure_dbus ()
{
if test -z "$RPMOSTREE_USE_SESSION_BUS"; then
exec "$topsrcdir/tests/utils/setup-session.sh" "$self"
fi
}

# https://github.com/ostreedev/ostree/commit/47b4dd1b38e422254afa67756873957c25aeab6d
# Unfortunately, introspection uses dlopen(), which doesn't quite
# work when the DSO is compiled with ASAN but the outer executable
Expand Down
Loading

0 comments on commit 0a53e35

Please sign in to comment.