[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#993858: ocaml-dune: dune-install doesn't correctly place "doc" section in Debian systems



Hello,

Le 07/09/2021 à 12:27, Emilio Jesús Gallego Arias a écrit :
> dune-install will by default install files in the "doc" section to
> $prefix/doc, this is incorrect in Debian as it should be $share/doc.

I guess we are talking about people doing "sudo dune install", right? As
opposed to "dune install" being called during Debian package builds.

Installing arbitrary software this way (with root privileges) should not
be done IMHO, but if done, it must happen in /usr/local (or outside
/usr). I remember having trouble configuring dune correctly to do that
(I couldn't tell it to "dune install" into /usr/local, but still look
for libraries in /usr/lib/ocaml in "dune build".

It would be nice if dune had a notion of "profile": a default "local"
one that would use /usr/local directories, and a "debian" one, used only
for Debian package builds, that would use $destdir/usr and $destdir/etc.
While searching for libraries in all profiles ("local" first, then
"debian").

The "correct" path for the "doc" section in the "local" profile would be
/usr/local/share/doc.

> This creates problems for both users and developers.

What kind of problems?

> Dune >= 2.9 allows configuring the doc install path. For previous
> versions, this patch must be added:
> 
> diff --git a/src/dune_rules/install.ml b/src/dune_rules/install.ml
> index afa2acdad..9fd7e6779 100644
> --- a/src/dune_rules/install.ml
> +++ b/src/dune_rules/install.ml
> @@ -209,7 +209,7 @@ module Section = struct
>        let libexec_root = libdir in
>        let share_root = Path.relative destdir "share" in
>        let etc_root = Path.relative destdir "etc" in
> -      let doc_root = Path.relative destdir "doc" in
> +      let doc_root = Path.relative share_root "doc" in
>        { lib_root
>        ; libexec_root
>        ; share_root

Patching things this way could (would, I think) break Debian package
builds. One has to check that all packages using dune (and there are a
lot of them now) still build with this patch. Maybe this could be done
during as part of an OCaml transition... To be continued.

> Note that a similar problem may exist for files in the "etc" section.

I am not really sure on how to handle the "etc" section. I would use
/etc directly, even for third-party software but /usr/local/etc exists
on the Internet, so maybe it would be better to use it in the "local"
profile.


Cheers,

-- 
Stéphane


Reply to: