summary refs log tree commit diff
path: root/pkgs/development/libraries/dbus
diff options
context:
space:
mode:
authoraszlig <aszlig@redmoonstudios.org>2017-02-20 00:54:19 +0100
committeraszlig <aszlig@redmoonstudios.org>2017-02-20 03:24:26 +0100
commitedce2b759cc31d6ee5ad1682819240f59b1b03a8 (patch)
tree972c4020f38e9c8482f833d9cb96d8a61d6fb6ad /pkgs/development/libraries/dbus
parent68f01b3b8c596146d6f27590ad4d2189261a661f (diff)
downloadnixpkgs-edce2b759cc31d6ee5ad1682819240f59b1b03a8.tar
nixpkgs-edce2b759cc31d6ee5ad1682819240f59b1b03a8.tar.gz
nixpkgs-edce2b759cc31d6ee5ad1682819240f59b1b03a8.tar.bz2
nixpkgs-edce2b759cc31d6ee5ad1682819240f59b1b03a8.tar.lz
nixpkgs-edce2b759cc31d6ee5ad1682819240f59b1b03a8.tar.xz
nixpkgs-edce2b759cc31d6ee5ad1682819240f59b1b03a8.tar.zst
nixpkgs-edce2b759cc31d6ee5ad1682819240f59b1b03a8.zip
make-dbus-conf: Don't try to access network
This is the output of the builder:

building path(s) `/nix/store/khkcfb8433i9mabb6wnb8ik6p9skg644-dbus-1'
error : connection refused
error : connection refused

However, even when using --nonet we'd still get this:

I/O error : Attempt to load network entity
http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd

So in order to avoid this, we now provide an XML catalog file, mapping
the public URLs to the local DTD paths inside the store instead of using
--path (which doesn't seem to work with xsltproc).

Tested this by comparing the SHA256 (nix-hash --type sha256) of the
output path generated by:

nix-build -E '(import ./. {}).makeDBusConf {
  suidHelper = "SUIDHELPER";
  serviceDirectories = [ "SERVICEDIR1" "SERVICEDIR1" ];
}'

... with the SHA256 of the generated output path prior to this commit
and they have the same hash:

6f3f9594b12fddbff9407b85252b6f649da11f56b7fd514f761966c11399a7ab

Signed-off-by: aszlig <aszlig@redmoonstudios.org>
Cc: @abbradar
Diffstat (limited to 'pkgs/development/libraries/dbus')
-rw-r--r--pkgs/development/libraries/dbus/make-dbus-conf.nix23
1 files changed, 18 insertions, 5 deletions
diff --git a/pkgs/development/libraries/dbus/make-dbus-conf.nix b/pkgs/development/libraries/dbus/make-dbus-conf.nix
index 7e35a9162c8..46cf1046d6a 100644
--- a/pkgs/development/libraries/dbus/make-dbus-conf.nix
+++ b/pkgs/development/libraries/dbus/make-dbus-conf.nix
@@ -1,4 +1,7 @@
-{ runCommand, libxslt, dbus, serviceDirectories ? [], suidHelper ? "/var/setuid-wrappers/dbus-daemon-launch-helper" }:
+{ runCommand, writeText, libxslt, dbus
+, serviceDirectories ? []
+, suidHelper ? "/var/setuid-wrappers/dbus-daemon-launch-helper"
+}:
 
 /* DBus has two configuration parsers -- normal and "trivial", which is used
  * for suid helper. Unfortunately the latter doesn't support <include>
@@ -9,19 +12,29 @@ runCommand "dbus-1"
   {
     buildInputs = [ libxslt ];
     inherit serviceDirectories suidHelper;
+    XML_CATALOG_FILES = writeText "dbus-catalog.xml" ''
+      <?xml version="1.0"?>
+      <!DOCTYPE catalog PUBLIC
+        "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN"
+        "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
+
+      <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
+        <rewriteSystem
+          systemIdStartString="http://www.freedesktop.org/standards/dbus/1.0/"
+          rewritePrefix="file://${dbus.doc}/share/xml/dbus/"/>
+      </catalog>
+    '';
   }
   ''
     mkdir -p $out
 
-    xsltproc \
+    xsltproc --nonet \
       --stringparam serviceDirectories "$serviceDirectories" \
       --stringparam suidHelper "$suidHelper" \
-      --path ${dbus.doc}/share/xml/dbus \
       ${./make-system-conf.xsl} ${dbus}/share/dbus-1/system.conf \
       > $out/system.conf
-    xsltproc \
+    xsltproc --nonet \
       --stringparam serviceDirectories "$serviceDirectories" \
-      --path ${dbus.doc}/share/xml/dbus \
       ${./make-session-conf.xsl} ${dbus}/share/dbus-1/session.conf \
       > $out/session.conf
   ''