Open grahamc opened 7 years ago
It seems I needed to patch a hard-coded path to xmlstarlet:
substituteInPlace "$f" \
--replace "/usr/bin/xsltproc" "${libxslt.bin}/bin/xsltproc" \
--replace /etc/xml/catalog ${catalog} \
--replace /usr/bin/make $(which make) \
--replace /usr/bin/xmlstarlet ${xmlstarlet}/bin/xmlstarlet
but still investigating
That seemed to fix that particular issue. If you don't mind, I'd like to abuse this thread for a different one though:
Could not resolve URN "urn:x-daps:xslt:profiling:docbook45-profile.xsl" with xmlcatalog via catalog file "/nix/store/lm07z2q883152qwl5zzbhzsmxqxpfb09-catalog.xml"
however this catalog contains:
<nextCatalog catalog="/nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/catalog.xml"/>
and that catalog contains:
<?xml version="1.0"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<system systemId="urn:x-daps:xslt:profiling:docbook41-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/docbook41-profile.xsl"/>
<system systemId="urn:x-daps:xslt:profiling:docbook42-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/docbook42-profile.xsl"/>
<system systemId="urn:x-daps:xslt:profiling:docbook43-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/docbook43-profile.xsl"/>
<system systemId="urn:x-daps:xslt:profiling:docbook44-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/docbook44-profile.xsl"/>
<system systemId="urn:x-daps:xslt:profiling:docbook45-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/docbook45-profile.xsl"/>
<system systemId="urn:x-daps:xslt:profiling:docbook50-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/docbook50-profile.xsl"/>
<system systemId="urn:x-daps:xslt:profiling:docbook51-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/docbook51-profile.xsl"/>
<system systemId="urn:x-daps:xslt:profiling:novdoc-profile.xsl" uri="file:///nix/store/0fb0w45ya1krvhqldb58gmw73gk73irk-daps-catalog/share/xml/daps-xslt/profiling/novdoc-profile.xsl"/>
</catalog>
any tips on debugging this one?
Hi,
regarding the issue you reported first:
Seems we need to do a better job using the stuff configure
gives us - I will look into it. This is supposed to work without using hardcoded paths.
Regarding the catalog issue:
Try using xmlcatalog -v <MASTER_CATALOG> <URN>
. It gives you a list of catalogs it parses and should enable you to find out where it fails. On openSUSE it looks like this (shortened by a lot of "Free catalaog entry" lines that are of no importance here):
~> xmlcatalog -v /etc/xml/catalog urn:x-daps:xslt:profiling:docbook45-profile.xsl
Resolve sysID urn:x-daps:xslt:profiling:docbook45-profile.xsl
-1365461248 Parsing catalog /etc/xml/catalog
/etc/xml/catalog added to file hash
/etc/xml/catalog-d.xml not found in file hash
-1365461248 Parsing catalog /etc/xml/catalog-d.xml
/etc/xml/catalog-d.xml added to file hash
/etc/xml/suse-catalog.xml not found in file hash
-1365461248 Parsing catalog /etc/xml/suse-catalog.xml
/etc/xml/suse-catalog.xml added to file hash
Found system match urn:x-daps:xslt:profiling:docbook45-profile.xsl, using file:///usr/share/daps/daps-xslt/profiling/docbook45-profile.xsl
file:///usr/share/daps/daps-xslt/profiling/docbook45-profile.xsl
By the time I'm done, (if I finish) I'll have a good list of hardcoded paths :) none of them will work for NixOS (except for /bin/sh and /usr/bin/env)
re xmlcatalog: Interesting! Here is what I get:
Found system match urn:x-daps:xslt:profiling:docbook45-profile.xsl, using /nix/store/3fvq45fiw35flgzc00wrnybk0apkijfv-daps-catalog/share/xml/daps-xslt/profiling/docbook45-profile.xsl
I suspect I found a case of a hard-coded catalog path, I'll keep spelunking...!
It turned out to be a hard-coded ref to /usr/bin/xmlcatalog. I managed to get it to install! Time to give it some exercise, and try the tool on for size :) Thank you for the hints.
BTW for those who may find this and kick me for not posting the nix expression:
{ p ? import <nixpkgs> {} }:
let
pkgs = import (p.fetchFromGitHub {
owner = "nixos";
repo = "nixpkgs";
rev = "c19136c4c9fa1d448038023fdfedd22108a33981";
sha256 = "1vhb0s9zv3769bv0paj2dsnqgv45g9ijj07na9qphyx3c680i4wf";
}) {};
inherit (pkgs) stdenv fetchurl fetchFromGitHub runCommand libxml2
libxslt w3m remake fop jing trang imagemagick python3 dia exiftool
ghostscript inkscape optipng xfig poppler_utils docbook_xml_dtd_45
docbook_xml_dtd_44 docbook_xml_dtd_43 docbook_xml_dtd_42
docbook_xml_dtd_412 docbook5 docbook5_xsl getopt docbook_xsl_ns
which xmlstarlet bash autoreconfHook
;
daps-src = fetchFromGitHub {
owner = "openSUSE";
repo = "daps";
rev = "b624f6dcf309cebee409f0d3c2fe89a9f03f7559";
sha256 = "086bz7xfnzn7ziq0piz9wyghk81n8y4x19xp1i1nhcd00q7y6wcq";
};
daps-catalog = runCommand "daps-catalog" {}
''
mkdir -p $out/share/xml/
cp ${daps-src}/etc/catalog.generic $out/share/xml/catalog.xml
cp -r ${daps-src}/daps-xslt $out/share/xml/
substituteInPlace $out/share/xml/catalog.xml \
--replace "../daps-xslt/" "$out/share/xml/daps-xslt/"
'';
svg = fetchurl {
url = "https://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd";
sha256 = "0kvf5bfr55flg4p5yrn5vrbph77ikl6bdrblmpysbj2d5zkrhmbl";
};
catalog = runCommand "catalog.xml"
{
buildInputs = [ libxml2 ];
catalogs = [
docbook5 docbook5_xsl
docbook_xml_dtd_45 docbook_xml_dtd_44 docbook_xml_dtd_43
docbook_xml_dtd_42 docbook_xml_dtd_412 docbook_xsl_ns
daps-catalog
];
}
''
xmlcat() {
xmlcatalog --noout "$@" "$out"
}
(
echo '<?xml version="1.0"?>';
echo '<!DOCTYPE catalog PUBLIC "-//OASIS//DTD Entity Resolution XML Catalog V1.0//EN" "http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">';
echo '<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">';
for p in $catalogs; do
for d in $p/share/xml $p/xml/dtd $p/xml/xsl; do
if [ -d "$d" ]; then
for i in $(find $d -name catalog.xml); do
echo '<nextCatalog catalog="'$i'" />';
done
fi
done
done
echo '</catalog>'
) > $out
xmlcat --add rewriteURI \
"http://docbook.sourceforge.net/release/xsl/current/" \
"file://${docbook5_xsl}/share/xml/docbook-xsl-ns/"
xmlcat --add rewriteSystem \
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" \
"file://${svg}"
xmlcatalog -v $out "urn:x-daps:xslt:profiling:docbook45-profile.xsl"
#sleep 5
'';
in
stdenv.mkDerivation {
name = "daps-20171116";
src = daps-src;
buildInputs = [
autoreconfHook
libxml2 libxslt w3m remake fop jing trang imagemagick python3 dia
exiftool ghostscript inkscape optipng xfig poppler_utils getopt
which xmlstarlet
];
configureFlags = [
"--enable-edit-rootcatalog=no"
];
postPatch = ''
patchShebangs .
for f in $(find . -type f); do
substituteInPlace "$f" \
--replace "/usr/bin/xsltproc" "${libxslt.bin}/bin/xsltproc" \
--replace /etc/xml/catalog ${catalog} \
--replace /usr/bin/make $(which make) \
--replace /usr/bin/xmlstarlet ${xmlstarlet}/bin/xmlstarlet \
--replace /usr/bin/xmlcatalog ${libxml2}/bin/xmlcatalog
done
for f in "./lib/daps_functions" "./make/common_variables.mk" "./bin/daps-auto.pl"; do
substituteInPlace "$f" \
--replace "/bin/bash" "${bash}/bin/bash"
done
echo "post sub"
grep -r "catalog" . || true
echo "xml/catalog"
'';
}
Sorry for not coming back to you earlier...I was pretty busy.
I have a few questions questions:
Can I safely assume that NixOS recognises not only /bin/sh but other shebang lines like
#!/bin/bash
#!/usr/bin/python3
##!/usr/bin/perl
....
??
Is there a common default $bindir in NixOS (like /usr/bin on other distributions) and is it recognized by configure if not explicitly set on the command line?
Being not familiar with NixOS at all: can I assume that the paths ./configure gives me, are stable? If so, it will be easy to set paths via make using the results configure gives me.
Because it makes testing DAPS very easy our approach is to develop DAPS in a way that the github checkout works like a full DAPS installation (the only thing you have to do is to set $DAPSROOT). This is, of course, a bit more complicated if I cannot used fixed paths anymore (and I am reluctant to rely on $PATH). Any tips for me, how I can achieve this on NixOS?
sh
is the only thing in /bin
. You can also expect env
to be installed in /usr/bin
, allowing you to use the programs on PATH
in shebangs, but nothing else will be there.PATH
).PATH
is the right approach on NixOS. What are the reasons you would not want to do that? Alternately, you could use something like the following Meson code (I am not very familiar with autotools but there is probably something similar) find_program('/usr/bin/xmlcatalog', 'xmlcatalog')
, preferring the absolute path but falling back to PATH
lookup.
Edit: looks like you actually rely on PATH
, at least for xmlstarlet lookup in daps-init./configure
will provide stable paths, and it would be preferable in this case to use those paths directly instead of depending upon them being in the PATH.
Problem description
When building Daps on NixOS, the
make
phase ends with:I'm in the process of packaging daps for NixOS and would love any help you can provide. I'm also available to get on any IRC network if that would be easier.
Full Log (click to expand!)
``` [100] grahamc@Morbo> nix-build ./daps.nix -K ~/projects these derivations will be built: /nix/store/l31a5v9ckr93pg4f3x2q3qh7071igvw8-daps-20171116.drv building path(s) ‘/nix/store/c6yhpb4rqcc3bcrg9p0zf9qxagdzzmp0-daps-20171116’ unpacking sources unpacking source archive /nix/store/157y7i4hifbj8w629h9hk0qdryyl9f6y-daps-b624f6dcf309cebee409f0d3c2fe89a9f03f7559-src source root is daps-b624f6dcf309cebee409f0d3c2fe89a9f03f7559-src patching sources patching script interpreter paths in . ./autobuild/daps-autobuild.in: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./autogen.sh: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./contrib/preflight/daps-preflight: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./contrib/daps-xslt/daps-xslt: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./contrib/translation/extract_translators.sh: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./contrib/docbook-xsl-test/mypytest.py: interpreter directive changed from "/usr/bin/python" to "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/bin/python" ./contrib/docbook-xsl-test/tests/xhtml/article-title/test_root_element.py: interpreter directive changed from "/usr/bin/python" to "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/bin/python" ./contrib/bin/getdcfile: interpreter directive changed from "/usr/bin/env python3" to "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/bin/python3" ./contrib/bin/dtdparsing.py: interpreter directive changed from "/usr/bin/python" to "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/bin/python" ./contrib/bin/login2sf: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./contrib/bin/pdfdiff: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./contrib/suse-xsl-tests/suse-pytest.py: interpreter directive changed from "/usr/bin/python3" to "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/bin/python3" ./test/lib/009_builddir: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/036_package-html: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/000_source-validation: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/035_online-docs: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/005_profiling: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/030_package-src: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/007_images: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/033_locdrop: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/020_pdf: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/025_epub: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/common_functions: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/001_script: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/023_text: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/022_html: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/037_package-pdf: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/lib/010_filelists: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/run_tests.sh: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./test/xspec/xspec.sh: interpreter directive changed from "/bin/sh" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/sh" ./configure: interpreter directive changed from " /bin/sh" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/sh" ./missing: interpreter directive changed from " /bin/sh" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/sh" ./.travis-debug: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./bin/ccecho: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./bin/daps-init: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./bin/daps.in: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./bin/daps-check-deps: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./bin/daps-xmlformat.in: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/daps-migrate: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/xml_cat_resolver: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/entities-exchange.sh: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/daps-xslt: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/daps-xep: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/webhelpindexer: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/getentityname.py: interpreter directive changed from "/usr/bin/python3" to "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/bin/python3" ./libexec/daps-jing.debian: interpreter directive changed from "/bin/sh" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/sh" ./libexec/daps-jing.generic: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./libexec/daps-fop: interpreter directive changed from "/bin/bash" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/bash" ./debian/rules: interpreter directive changed from "/usr/bin/make -f" to "/nix/store/614rxvzn5c58s4vqllvkixiyc5zz01dg-gnumake-4.2.1/bin/make -f" ./install-sh: interpreter directive changed from "/bin/sh" to "/nix/store/vxx626vd8vwbckqpm4xicdckwjc9gh8h-bash-4.4-p12/bin/sh" ./packaging/builddaps4osc.py: interpreter directive changed from "/usr/bin/python" to "/nix/store/k0c5spdm7g4lb9gkm3l20v81dbl93s0h-python3-3.6.3/bin/python" ./packaging/debian/rules: interpreter directive changed from "/usr/bin/make -f" to "/nix/store/614rxvzn5c58s4vqllvkixiyc5zz01dg-gnumake-4.2.1/bin/make -f" ./configure.ac:dnl bash in this configure script (/bin/sh being a symlink to /bin/bash). Even ./debian/patches/remove-shebang.patch:-#!/bin/bash ./doc/xml/MAIN.DAPS.xml:Nix Expression (click to expand!)
```nix { p ? importExpected behavior
I expected the installation to continue and complete.
Steps to reproduce the behavior
nix-build ./daps.nix
"x86_64-linux"
Linux 4.9.61, NixOS, 17.09.2055.c19136c4c9 (Hummingbird)
yes
yes
nix-env (Nix) 1.11.15
"nixos-17.09.2055.c19136c4c9"
"fizzbuzz-17.03.1775.56da88a298"
/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs