cschwan / sage-on-gentoo

(Unofficial) Gentoo Overlay for Sage- and Sage-related ebuilds
84 stars 26 forks source link

sci-mathematics/sage-8.0 - QA Notice: Symbolic link ... [in Prefix with USE=doc-html-bin] #491

Closed strogdon closed 7 years ago

strogdon commented 7 years ago

This is similar to https://github.com/cschwan/sage-on-gentoo/issues/490 but with a different twist since it's in Prefix. The QA Notices:

 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/installation/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/prep/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/thematic_tutorials/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/constructions/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/a_tour_of_sage/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/faq/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/tutorial/_static points to /usr/share/doc/sage/html/_static which does not exist.
 * QA Notice: Symbolic link /storage/strogdon/gentoo-rap/usr/share/doc/sage/html/en/reference/tensor/_static points to /usr/share/doc/sage/html/_static which does not exist.

Looking at sage-8.0-doc-html.tar.xz one can see the difficulty. There are symlinks like

lrwxrwxrwx fbissey/fbissey      0 2017-07-21 23:13 html/en/_static -> /usr/share/doc/sage/html/_static

which I believe are the source of the problem since $EPREFIX is missing in the symlink. This should work on Gentoo, but fixing this for Prefix may be daunting. It is probably a corner case, but the documentation doesn't play nicely. The build was with

sci-mathematics/sage-8.0::sage-on-gentoo was built with the following:
USE="doc-html-bin (prefix) sagenb -X -bliss -debug -doc-html -doc-pdf -doc-pdf-bin -latex -libbraiding -libhomfly -modular_decomposition -testsuite" L10N="en -ca -de -es -fr -hu -it -ja -pt -ru -tr" PYTHON_TARGETS="python2_7 -python3_6"
kiwifb commented 7 years ago

Yes that would be a variant on the same theme. I guess I shouldn't include the symlinks in the tarball and get the ebuild to create them at install time. Not sure I'll be able to fix this today.

strogdon commented 7 years ago

I was only trying to replicate that other issue and found this. I usually always build the docs. Generating the symlinks on the fly is what I thought to be a solution too. But this will require a lot of work.

strogdon commented 7 years ago

I believe something like

diff --git a/sci-mathematics/sage/sage-8.0.ebuild b/sci-mathematics/sage/sage-8.0.ebuild
index 1e44c3c2..c1c62001 100644
--- a/sci-mathematics/sage/sage-8.0.ebuild
+++ b/sci-mathematics/sage/sage-8.0.ebuild
@@ -492,6 +492,16 @@ python_install() {
                fi

                if use doc-html-bin ; then
+                       cp -r "${WORKDIR}"/html/_static build_doc/html/ || die "failed to copy _static folder"
+                       # Create correct symlink to _static folder in prefix
+                       if use prefix ; then
+                               for sdir in `find build_doc/html -name _static` ; do
+                                       if [ $sdir != "build_doc/html/_static" ] ; then
+                                               rm -f $sdir || die "failed to remove $sdir symlink"
+                                               ln -s "${EPREFIX}"/usr/share/doc/sage/html/_static $sdir
+                                       fi
+                               done
+                       fi
                        insinto /usr/share/doc/sage/html
                        doins -r build_doc/html/*
                fi

will fix this issue as well as https://github.com/cschwan/sage-on-gentoo/issues/490 since it appears the _static folder is missing there. I only tested with L10N="en".

kiwifb commented 7 years ago

Another better solution will be to follow more recent guidelines for ebuilds and use relative links. The logic for that will be harder to implement. It will certainly help with prefix but I am not sure about #490

kiwifb commented 7 years ago

Actually GNU ln provides the right tools for this, I am going to experiment but the html doc tarball will have to be regenerated.

kiwifb commented 7 years ago

Re-open if that doesn't fix it :)