This patch allows the Haskell daemons to locate Python libraries
installed to a non-standard pythondir. It is necessary because Guix
does not use versionedsharedir (see related patch that disables it).
diff --git a/Makefile.am b/Makefile.am
--- a/Makefile.am
+++ b/Makefile.am
@@ -83,6 +83,7 @@ myexeclibdir = $(pkglibdir)
bindir = $(versiondir)/$(BINDIR)
sbindir = $(versiondir)$(SBINDIR)
mandir = $(versionedsharedir)/root$(MANDIR)
+pythondir = $(versionedsharedir)
pkgpythondir = $(versionedsharedir)/ganeti
pkgpython_rpc_stubdir = $(versionedsharedir)/ganeti/rpc/stub
gntpythondir = $(versionedsharedir)
@@ -2386,6 +2387,7 @@ src/AutoConf.hs: Makefile src/AutoConf.hs.in $(PRINT_PY_CONSTANTS) \
-DPKGLIBDIR="$(libdir)/ganeti" \
-DSHAREDIR="$(prefix)/share/ganeti" \
-DVERSIONEDSHAREDIR="$(versionedsharedir)" \
+ -DPYTHONDIR="$(pythondir)" \
-DDRBD_BARRIERS="$(DRBD_BARRIERS)" \
-DDRBD_NO_META_FLUSH="$(DRBD_NO_META_FLUSH)" \
-DSYSLOG_USAGE="$(SYSLOG_USAGE)" \
diff --git a/src/AutoConf.hs.in b/src/AutoConf.hs.in
--- a/src/AutoConf.hs.in
+++ b/src/AutoConf.hs.in
@@ -157,6 +157,9 @@ sharedir = "SHAREDIR"
versionedsharedir :: String
versionedsharedir = "VERSIONEDSHAREDIR"
+pythondir :: String
+pythondir = "PYTHONDIR"
+
drbdBarriers :: String
drbdBarriers = "DRBD_BARRIERS"
diff --git a/src/Ganeti/Path.hs b/src/Ganeti/Path.hs
--- a/src/Ganeti/Path.hs
+++ b/src/Ganeti/Path.hs
@@ -188,5 +188,5 @@ getInstReasonFilename instName = instanceReasonDir `pjoin` instName
-- | The path to the Python executable for starting jobs.
jqueueExecutorPy :: IO FilePath
-jqueueExecutorPy = return $ versionedsharedir
- > "ganeti" > "jqueue" > "exec.py"
+jqueueExecutorPy = return $ pythondir
+ > "ganeti" > "jqueue" > "exec.py"
diff --git a/src/Ganeti/Query/Exec.hs b/src/Ganeti/Query/Exec.hs
--- a/src/Ganeti/Query/Exec.hs
+++ b/src/Ganeti/Query/Exec.hs
@@ -99,12 +99,12 @@ spawnJobProcess jid = withErrorLogAt CRITICAL (show jid) $
do
use_debug <- isDebugMode
env_ <- (M.toList . M.insert "GNT_DEBUG" (if use_debug then "1" else "0")
- . M.insert "PYTHONPATH" AC.versionedsharedir
+ . M.insert "PYTHONPATH" AC.pythondir
. M.fromList)
`liftM` getEnvironment
execPy <- P.jqueueExecutorPy
logDebug $ "Executing " ++ AC.pythonPath ++ " " ++ execPy
- ++ " with PYTHONPATH=" ++ AC.versionedsharedir
+ ++ " with PYTHONPATH=" ++ AC.pythondir
(master, child) <- pipeClient connectConfig
let (rh, wh) = clientToHandle child
pand)
Author |
2022-06-10 | services: jami: Modernize to adjust to Shepherd 0.9+ changes....This partially fixes <https://issues.guix.gnu.org/54786>, allowing the 'jami'
and 'jami-provisioning' system tests to pass again.
In version 0.9.0, Shepherd constructors are now run concurrently, via
cooperative scheduling (Guile Fibers). The Jami service previously relied on
blocking sleeps while polling for D-Bus services to become ready after forking
a process; this wouldn't work anymore since while blocking the service process
wouldn't be given the chance to finish starting. The new reliance on Fibers
in Shepherd's fork+exec-command in the helper 'send-dbus' procedure also meant
that it wouldn't work outside of Shepherd anymore. Finally, the
'start-service' Shepherd procedure used in the test suite would cause the Jami
daemon to be spawned multiple times (a bug introduced in Shepherd 0.9.0).
To fix/simplify these problems, this change does the following:
1. Use the Guile AC/D-Bus library for D-Bus communication, which simplify
things, such as avoiding the need to fork 'dbus-send' processes.
2. The non-blocking 'sleep' version of Fiber is used for the 'with-retries'
waiting syntax.
3. A 'dbus' package variant is used to adjust the session bus configuration,
tailoring it for the use case at hand.
4. Avoid start-service in the tests, preferring 'jami-service-available?' for
now.
* gnu/build/jami-service.scm (parse-dbus-reply, strip-quotes)
(deserialize-item, serialize-boolean, dbus-dict->alist)
(dbus-array->list, parse-account-ids, parse-account-details)
(parse-contacts): Delete procedures.
(%send-dbus-binary, %send-dbus-bus, %send-dbus-user, %send-dbus-group)
(%send-dbus-debug): Delete parameters.
(jami-service-running?): New procedure.
(send-dbus/configuration-manager): Rename to...
(call-configuration-manager-method): ... this. Turn METHOD into a positional
argument. Turn ARGUMENTS into an optional argument. Invoke
`call-dbus-method' instead of `send-dbus', adjusting callers accordingly.
(get-account-ids, id->account-details, id->account-details)
(id->volatile-account-details, username->id, add-account remove-account)
(username->contacts, remove-contact, add-contact, set-account-details)
(set-all-moderators, username->all-moderators?, username->moderators)
(set-moderator): Adjust accordingly.
(with-retries, send-dbus, dbus-available-services)
(dbus-service-available?): Move to ...
* gnu/build/dbus-service.scm: ... this new module.
(send-dbus): Rewrite to use the Guile AC/D-Bus library.
(%dbus-query-timeout, sleep*): New variables.
(%current-dbus-connection): New parameter.
(initialize-dbus-connection!, argument->signature-type)
(call-dbus-method): New procedures.
(dbus-available-services): Adjust accordingly.
* gnu/local.mk (GNU_SYSTEM_MODULES): Register new module.
* gnu/packages/glib.scm (dbus-for-jami): New variable.
* gnu/services/telephony.scm: (jami-configuration)[dbus]: Default to
dbus-for-jami.
(jami-dbus-session-activation): Write a D-Bus daemon configuration file at
'/var/run/jami/session-local.conf'.
(jami-shepherd-services): Add the closure of guile-ac-d-bus and guile-fibers
as extensions. Adjust imported modules. Remove no longer used parameters.
<jami-dbus-session>: Use a PID file, avoiding the need for the manual
synchronization.
<jami>: Set DBUS_SESSION_BUS_ADDRESS environment variable. Poll using
'jami-service-available?' instead of 'dbus-service-available?'.
* gnu/tests/telephony.scm (run-jami-test): Add needed Guile extensions. Set
DBUS_SESSION_BUS_ADDRESS environment variable. Adjust all tests to use
'jami-service-available?' to determine if the service is started rather than
the now problematic Shepherd's 'start-service'.
| Maxim Cournoyer |