> IIUC, the space separated list of arguments is assigned to pkgs, with
> a fallback to ${DUNE_PKG_NAME}. The 'for pkg in "${pkgs}"' loop isn't
> actually a loop because ${pkgs} is inside double quotes, so it will be
> executed only once with pkg being equal to pkgs.

Yes, you are right, I was wrong to test it with (modified) dev-ml/menhir lib which I believe does not need to call dune-install with multiple subpkgs now.

> Do you even need the fallback in dune_install() if you have it here too?

Yes, to keep old compatibility.


On 12/9/21 08:38, Ulrich Mueller wrote:
On Thu, 09 Dec 2021, Maciej Barć wrote:

  dune-install() {
+       local pkgs
+       if [[ -n "${@}" ]] ; then
+               pkgs="${@}"
+       else
+               pkgs=${DUNE_PKG_NAME}
+       fi
+
+       local myduneopts=(
+               --prefix="${ED%/}/usr"
+               --libdir="${D%/}$(ocamlc -where)"
+               --mandir="${ED%/}/usr/share/man"
+       )
        local pkg
-       for pkg ; do
-               dune install \
-                       --prefix="${ED%/}/usr" \
-                       --libdir="${D%/}$(ocamlc -where)" \
-                       --mandir="${ED%/}/usr/share/man" \
-                       "${pkg}" || die
+       for pkg in "${pkgs}" ; do
+               dune install ${myduneopts[@]} ${pkg} || die
        done
  }

Have you tested this?

IIUC, the space separated list of arguments is assigned to pkgs, with
a fallback to ${DUNE_PKG_NAME}. The 'for pkg in "${pkgs}"' loop isn't
actually a loop because ${pkgs} is inside double quotes, so it will be
executed only once with pkg being equal to pkgs.

The previous logic (simple 'for pkg' which will loop over $@) was
correct but of course without the fallback.

+dune_src_install() {
+       dune-install ${1:-${DUNE_PKG_NAME}}
+}

Do you even need the fallback in dune_install() if you have it here too?

Ulrich


--
Have a great day!

~ Maciej XGQT Barć

Attachment: OpenPGP_0x14D74A1F43A6AC3C.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature
Description: OpenPGP digital signature

Reply via email to