gtk-doc symlink in .Docs extension is broken
Context
I have org.gnome.Sdk//3.30
and org.gnome.Sdk.Docs//3.30
installed, but Devhelp cannot see the docs from the latter, even though it looks in /usr/share/gtk-doc/html
. I think this is because the symlink from the SDK to the extension is broken:
$ ls -l /usr/share/gtk-doc/html
lrwxrwxrwx 11 0 0 25 Mar 4 09:38 /usr/share/gtk-doc/html -> runtime/docs/gtk-doc/html
$ ls -l /usr/share/gtk-doc/html/
ls: cannot access '/usr/share/gtk-doc/html/': No such file or directory
It should instead point to ../runtime/docs/gtk-doc/html
:
$ ls -l /usr/share/runtime/docs/gtk-doc/html
total 212K
drwxr-xr-x 2 0 0 12K Jan 1 1970 clutter
[...]
drwxr-xr-x 2 0 0 4.0K Jan 1 1970 vte-2.91
org.freedesktop.Sdk//18.08
has the same issue. This is due to the logic in split-docs.bst
:
move_doc() {
if [ -d "%{datadir}/${1}" ]; then
if [ -e "%{datadir}/runtime/docs/${2}" ]; then
echo "%{datadir}/runtime/docs/${2} already exists" 1>&2
exit 1
fi
mkdir -p "%{datadir}/runtime/docs/$(dirname "${2}")"
mv "%{datadir}/${1}" "%{datadir}/runtime/docs/${2}"
ln -s "$(realpath -m --relative-to="%{datadir}" "%{datadir}/runtime/docs/${2}")" "%{datadir}/${1}"
fi
}
move_doc man man
move_doc doc doc
move_doc examples examples
move_doc info info
move_doc help help
move_doc gtk-doc/html gtk-doc/html
If we expand the various macros, the ln -s $(realpath ...) ...
incantation becomes:
$ realpath -m --relative-to=/usr/share /usr/share/runtime/docs/gtk-doc/html
runtime/docs/gtk-doc/html
$ ln -s runtime/docs/gtk-doc/html /usr/share/runtime/docs/gtk-doc/html
The cmake links have the same problem:
[📦 org.freedesktop.Sdk ~]$ ls -l /usr/share/cmake-3.13/Help
lrwxrwxrwx 5 0 0 23 Mar 13 09:29 /usr/share/cmake-3.13/Help -> runtime/docs/cmake-3.13
[📦 org.freedesktop.Sdk ~]$ ls -l /usr/share/cmake-3.13/Help/
ls: cannot access '/usr/share/cmake-3.13/Help/': No such file or directory
[📦 org.freedesktop.Sdk ~]$ ls /usr/share/runtime/docs/cmake-3.13/
command cpack_gen envvar generator include index.rst manual module policy prop_cache prop_dir prop_gbl prop_inst prop_sf prop_test prop_tgt release variable
Description
There's no problem that can't be solved by another layer of indirection. The key point here is that the symlinks should not relative to %{datadir}
, but relative to $(basename "%{datadir}/${1}")
, which is the same in the case where ${1}
has only one component, but is different in the offending case. So:
- Make the above incantation calculate the relative path for the symlink correctly.
Acceptance Criteria
- Install
org.freedesktop.Sdk
andorg.freedesktop.Sdk.Docs
flatpak run org.freedesktop.Sdk//$BRANCH
-
ls -l /usr/share/cmake-3.13/Help/
shows some files, not "No such file or directory" -
ls -l /usr/share/gtk-doc/html/
shows some directories, not "No such file or directory" -
man bash
still works, indicating that the single-component symlinks have not been broken