* [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2)
@ 2023-01-02 23:19 Maciej Barć
2023-01-03 6:32 ` Michał Górny
2023-01-03 6:55 ` Florian Schmaus
0 siblings, 2 replies; 7+ messages in thread
From: Maciej Barć @ 2023-01-02 23:19 UTC (permalink / raw
To: gentoo-dev; +Cc: Maciej Barć
edune is a thin wrapper for dune, which will help to run special,
uncommon dune commands;
dune-compile is a function to selectively pick which packages will be
compiled "for-release" (as dune call it);
dune-compile without any arguments replaces the current dune_src_compile
Signed-off-by: Maciej Barć <xgqt@gentoo.org>
---
eclass/dune.eclass | 49 +++++++++++++++++++++++++++++++++++++++++-----
1 file changed, 44 insertions(+), 5 deletions(-)
diff --git a/eclass/dune.eclass b/eclass/dune.eclass
index 4bc73eda8..384908a40 100644
--- a/eclass/dune.eclass
+++ b/eclass/dune.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2022 Gentoo Authors
+# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: dune.eclass
@@ -29,7 +29,7 @@ _DUNE_ECLASS=1
# Set before inheriting the eclass.
: ${DUNE_PKG_NAME:=${PN}}
-inherit multiprocessing
+inherit edo multiprocessing
# Do not complain about CFLAGS etc since ml projects do not use them.
QA_FLAGS_IGNORED='.*'
@@ -44,15 +44,54 @@ BDEPEND="
dev-ml/dune
"
+# @FUNCTION: edune
+# @USAGE: <arg> ...
+# @DESCRIPTION:
+# A thin wrapper for the `dune` command.
+# Runs `dune` with given arguments and dies on failure.
+#
+# Example use:
+# @CODE
+# edune clean
+# @CODE
+edune() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ edo dune "${@}"
+}
+
+# @FUNCTION: dune-compile
+# @USAGE: [package] ...
+# @DESCRIPTION:
+# Compiles either all of packages sources in current directory or selected
+# packages. In case of all packages the package detection is done via dune
+# itself.
+#
+# Example use:
+# @CODE
+# dune-compile menhir menhirLib menhirSdk
+# @CODE
+dune-compile() {
+ local -a myduneopts=(
+ -j $(makeopts_jobs)
+ --profile release
+ )
+ if [[ -n "${1}" ]] ; then
+ myduneopts+=( --for-release-of-packages="$(IFS="," ; echo "${*}")" )
+ fi
+
+ edune build @install "${myduneopts[@]}"
+}
+
dune_src_compile() {
ebegin "Building"
- dune build @install -j $(makeopts_jobs) --profile release
+ dune-compile
eend $? || die
}
dune_src_test() {
ebegin "Testing"
- dune runtest -j $(makeopts_jobs) --profile release
+ edune runtest -j $(makeopts_jobs) --profile release
eend $? || die
}
@@ -80,7 +119,7 @@ dune-install() {
local pkg
for pkg in "${pkgs[@]}" ; do
ebegin "Installing ${pkg}"
- dune install ${myduneopts[@]} ${pkg}
+ edune install ${myduneopts[@]} ${pkg}
eend $? || die
# Move docs to the appropriate place.
--
2.38.2
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2)
2023-01-02 23:19 [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2) Maciej Barć
@ 2023-01-03 6:32 ` Michał Górny
2023-01-03 14:47 ` Maciej Barć
2023-01-03 6:55 ` Florian Schmaus
1 sibling, 1 reply; 7+ messages in thread
From: Michał Górny @ 2023-01-03 6:32 UTC (permalink / raw
To: gentoo-dev; +Cc: Maciej Barć
On Tue, 2023-01-03 at 00:19 +0100, Maciej Barć wrote:
> edune is a thin wrapper for dune, which will help to run special,
> uncommon dune commands;
> dune-compile is a function to selectively pick which packages will be
> compiled "for-release" (as dune call it);
> dune-compile without any arguments replaces the current dune_src_compile
>
> Signed-off-by: Maciej Barć <xgqt@gentoo.org>
> ---
> eclass/dune.eclass | 49 +++++++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 44 insertions(+), 5 deletions(-)
>
> diff --git a/eclass/dune.eclass b/eclass/dune.eclass
> index 4bc73eda8..384908a40 100644
> --- a/eclass/dune.eclass
> +++ b/eclass/dune.eclass
> @@ -1,4 +1,4 @@
> -# Copyright 1999-2022 Gentoo Authors
> +# Copyright 1999-2023 Gentoo Authors
> # Distributed under the terms of the GNU General Public License v2
>
> # @ECLASS: dune.eclass
> @@ -29,7 +29,7 @@ _DUNE_ECLASS=1
> # Set before inheriting the eclass.
> : ${DUNE_PKG_NAME:=${PN}}
>
> -inherit multiprocessing
> +inherit edo multiprocessing
>
> # Do not complain about CFLAGS etc since ml projects do not use them.
> QA_FLAGS_IGNORED='.*'
> @@ -44,15 +44,54 @@ BDEPEND="
> dev-ml/dune
> "
>
> +# @FUNCTION: edune
> +# @USAGE: <arg> ...
> +# @DESCRIPTION:
> +# A thin wrapper for the `dune` command.
> +# Runs `dune` with given arguments and dies on failure.
> +#
> +# Example use:
> +# @CODE
> +# edune clean
> +# @CODE
> +edune() {
> + debug-print-function ${FUNCNAME} "${@}"
> +
> + edo dune "${@}"
How do you pronounce it? ;-)
> +}
> +
> +# @FUNCTION: dune-compile
> +# @USAGE: [package] ...
> +# @DESCRIPTION:
> +# Compiles either all of packages sources in current directory or selected
> +# packages. In case of all packages the package detection is done via dune
> +# itself.
> +#
> +# Example use:
> +# @CODE
> +# dune-compile menhir menhirLib menhirSdk
> +# @CODE
> +dune-compile() {
> + local -a myduneopts=(
> + -j $(makeopts_jobs)
> + --profile release
> + )
> + if [[ -n "${1}" ]] ; then
> + myduneopts+=( --for-release-of-packages="$(IFS="," ; echo "${*}")" )
> + fi
> +
> + edune build @install "${myduneopts[@]}"
> +}
> +
> dune_src_compile() {
> ebegin "Building"
> - dune build @install -j $(makeopts_jobs) --profile release
> + dune-compile
> eend $? || die
> }
>
> dune_src_test() {
> ebegin "Testing"
> - dune runtest -j $(makeopts_jobs) --profile release
> + edune runtest -j $(makeopts_jobs) --profile release
> eend $? || die
> }
>
> @@ -80,7 +119,7 @@ dune-install() {
> local pkg
> for pkg in "${pkgs[@]}" ; do
> ebegin "Installing ${pkg}"
> - dune install ${myduneopts[@]} ${pkg}
> + edune install ${myduneopts[@]} ${pkg}
> eend $? || die
>
> # Move docs to the appropriate place.
--
Best regards,
Michał Górny
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2)
2023-01-02 23:19 [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2) Maciej Barć
2023-01-03 6:32 ` Michał Górny
@ 2023-01-03 6:55 ` Florian Schmaus
2023-01-03 14:51 ` Maciej Barć
1 sibling, 1 reply; 7+ messages in thread
From: Florian Schmaus @ 2023-01-03 6:55 UTC (permalink / raw
To: gentoo-dev
On 03/01/2023 00.19, Maciej Barć wrote:
> edune is a thin wrapper for dune, which will help to run special,
> uncommon dune commands;
> dune-compile is a function to selectively pick which packages will be
> compiled "for-release" (as dune call it);
> dune-compile without any arguments replaces the current dune_src_compile
>
> Signed-off-by: Maciej Barć <xgqt@gentoo.org>
> ---
> eclass/dune.eclass | 49 +++++++++++++++++++++++++++++++++++++++++-----
> 1 file changed, 44 insertions(+), 5 deletions(-)
>
> diff --git a/eclass/dune.eclass b/eclass/dune.eclass
> index 4bc73eda8..384908a40 100644
> --- a/eclass/dune.eclass
> +++ b/eclass/dune.eclass
> @@ -1,4 +1,4 @@
> -# Copyright 1999-2022 Gentoo Authors
> +# Copyright 1999-2023 Gentoo Authors
> # Distributed under the terms of the GNU General Public License v2
>
> # @ECLASS: dune.eclass
> @@ -29,7 +29,7 @@ _DUNE_ECLASS=1
> # Set before inheriting the eclass.
> : ${DUNE_PKG_NAME:=${PN}}
>
> -inherit multiprocessing
> +inherit edo multiprocessing
>
> # Do not complain about CFLAGS etc since ml projects do not use them.
> QA_FLAGS_IGNORED='.*'
> @@ -44,15 +44,54 @@ BDEPEND="
> dev-ml/dune
> "
>
> +# @FUNCTION: edune
> +# @USAGE: <arg> ...
> +# @DESCRIPTION:
> +# A thin wrapper for the `dune` command.
> +# Runs `dune` with given arguments and dies on failure.
> +#
> +# Example use:
> +# @CODE
> +# edune clean
> +# @CODE
> +edune() {
> + debug-print-function ${FUNCNAME} "${@}"
> +
> + edo dune "${@}"
> +}
> +
> +# @FUNCTION: dune-compile
> +# @USAGE: [package] ...
> +# @DESCRIPTION:
> +# Compiles either all of packages sources in current directory or selected
> +# packages. In case of all packages the package detection is done via dune
> +# itself.
> +#
> +# Example use:
> +# @CODE
> +# dune-compile menhir menhirLib menhirSdk
> +# @CODE
> +dune-compile() {
> + local -a myduneopts=(
> + -j $(makeopts_jobs)
> + --profile release
> + )
> + if [[ -n "${1}" ]] ; then
> + myduneopts+=( --for-release-of-packages="$(IFS="," ; echo "${*}")" )
> + fi
> +
> + edune build @install "${myduneopts[@]}"
> +}
> +
> dune_src_compile() {
> ebegin "Building"
> - dune build @install -j $(makeopts_jobs) --profile release
> + dune-compile
> eend $? || die
> }
>
> dune_src_test() {
> ebegin "Testing"
> - dune runtest -j $(makeopts_jobs) --profile release
> + edune runtest -j $(makeopts_jobs) --profile release
> eend $? || die
> }
>
> @@ -80,7 +119,7 @@ dune-install() {
> local pkg
> for pkg in "${pkgs[@]}" ; do
> ebegin "Installing ${pkg}"
> - dune install ${myduneopts[@]} ${pkg}
> + edune install ${myduneopts[@]} ${pkg}
> eend $? || die
>
> # Move docs to the appropriate place.
It appears there is additional output between the ebegin / eend. You may
want to consider dropping ebegin and eend. In general, the pattern
ebegin, edo, eend should probably be avoided.
- Flow
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2)
2023-01-03 6:32 ` Michał Górny
@ 2023-01-03 14:47 ` Maciej Barć
2023-01-03 15:23 ` Michał Górny
0 siblings, 1 reply; 7+ messages in thread
From: Maciej Barć @ 2023-01-03 14:47 UTC (permalink / raw
To: gentoo-dev, Michał Górny
[-- Attachment #1.1.1: Type: text/plain, Size: 3237 bytes --]
> How do you pronounce it? ;-)
Michał, I am not a phonetic expert but I guess it would be "e-dune",
like "e" in "e-mail" or "i-djun" in broken Polish. :-D
On 1/3/23 07:32, Michał Górny wrote:
> On Tue, 2023-01-03 at 00:19 +0100, Maciej Barć wrote:
>> edune is a thin wrapper for dune, which will help to run special,
>> uncommon dune commands;
>> dune-compile is a function to selectively pick which packages will be
>> compiled "for-release" (as dune call it);
>> dune-compile without any arguments replaces the current dune_src_compile
>>
>> Signed-off-by: Maciej Barć <xgqt@gentoo.org>
>> ---
>> eclass/dune.eclass | 49 +++++++++++++++++++++++++++++++++++++++++-----
>> 1 file changed, 44 insertions(+), 5 deletions(-)
>>
>> diff --git a/eclass/dune.eclass b/eclass/dune.eclass
>> index 4bc73eda8..384908a40 100644
>> --- a/eclass/dune.eclass
>> +++ b/eclass/dune.eclass
>> @@ -1,4 +1,4 @@
>> -# Copyright 1999-2022 Gentoo Authors
>> +# Copyright 1999-2023 Gentoo Authors
>> # Distributed under the terms of the GNU General Public License v2
>>
>> # @ECLASS: dune.eclass
>> @@ -29,7 +29,7 @@ _DUNE_ECLASS=1
>> # Set before inheriting the eclass.
>> : ${DUNE_PKG_NAME:=${PN}}
>>
>> -inherit multiprocessing
>> +inherit edo multiprocessing
>>
>> # Do not complain about CFLAGS etc since ml projects do not use them.
>> QA_FLAGS_IGNORED='.*'
>> @@ -44,15 +44,54 @@ BDEPEND="
>> dev-ml/dune
>> "
>>
>> +# @FUNCTION: edune
>> +# @USAGE: <arg> ...
>> +# @DESCRIPTION:
>> +# A thin wrapper for the `dune` command.
>> +# Runs `dune` with given arguments and dies on failure.
>> +#
>> +# Example use:
>> +# @CODE
>> +# edune clean
>> +# @CODE
>> +edune() {
>> + debug-print-function ${FUNCNAME} "${@}"
>> +
>> + edo dune "${@}"
>
> How do you pronounce it? ;-)
>
>> +}
>> +
>> +# @FUNCTION: dune-compile
>> +# @USAGE: [package] ...
>> +# @DESCRIPTION:
>> +# Compiles either all of packages sources in current directory or selected
>> +# packages. In case of all packages the package detection is done via dune
>> +# itself.
>> +#
>> +# Example use:
>> +# @CODE
>> +# dune-compile menhir menhirLib menhirSdk
>> +# @CODE
>> +dune-compile() {
>> + local -a myduneopts=(
>> + -j $(makeopts_jobs)
>> + --profile release
>> + )
>> + if [[ -n "${1}" ]] ; then
>> + myduneopts+=( --for-release-of-packages="$(IFS="," ; echo "${*}")" )
>> + fi
>> +
>> + edune build @install "${myduneopts[@]}"
>> +}
>> +
>> dune_src_compile() {
>> ebegin "Building"
>> - dune build @install -j $(makeopts_jobs) --profile release
>> + dune-compile
>> eend $? || die
>> }
>>
>> dune_src_test() {
>> ebegin "Testing"
>> - dune runtest -j $(makeopts_jobs) --profile release
>> + edune runtest -j $(makeopts_jobs) --profile release
>> eend $? || die
>> }
>>
>> @@ -80,7 +119,7 @@ dune-install() {
>> local pkg
>> for pkg in "${pkgs[@]}" ; do
>> ebegin "Installing ${pkg}"
>> - dune install ${myduneopts[@]} ${pkg}
>> + edune install ${myduneopts[@]} ${pkg}
>> eend $? || die
>>
>> # Move docs to the appropriate place.
>
--
Have a great day!
~ Maciej XGQT Barć
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 10875 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2)
2023-01-03 6:55 ` Florian Schmaus
@ 2023-01-03 14:51 ` Maciej Barć
2023-01-03 15:09 ` Florian Schmaus
0 siblings, 1 reply; 7+ messages in thread
From: Maciej Barć @ 2023-01-03 14:51 UTC (permalink / raw
To: gentoo-dev, Florian Schmaus; +Cc: Alfredo Tupone, Sam James
[-- Attachment #1.1.1: Type: text/plain, Size: 3873 bytes --]
> It appears there is additional output between the ebegin / eend. You may
> want to consider dropping ebegin and eend. In general, the pattern
> ebegin, edo, eend should probably be avoided.
I would like to keep the "Building ... [ OK ]" (made by ebegin) output
as it was before the change.
I think other ML team members could state their opinions, so please do
say how we want to log the build/test/install.
On 1/3/23 07:55, Florian Schmaus wrote:
> On 03/01/2023 00.19, Maciej Barć wrote:
>> edune is a thin wrapper for dune, which will help to run special,
>> uncommon dune commands;
>> dune-compile is a function to selectively pick which packages will be
>> compiled "for-release" (as dune call it);
>> dune-compile without any arguments replaces the current dune_src_compile
>>
>> Signed-off-by: Maciej Barć <xgqt@gentoo.org>
>> ---
>> eclass/dune.eclass | 49 +++++++++++++++++++++++++++++++++++++++++-----
>> 1 file changed, 44 insertions(+), 5 deletions(-)
>>
>> diff --git a/eclass/dune.eclass b/eclass/dune.eclass
>> index 4bc73eda8..384908a40 100644
>> --- a/eclass/dune.eclass
>> +++ b/eclass/dune.eclass
>> @@ -1,4 +1,4 @@
>> -# Copyright 1999-2022 Gentoo Authors
>> +# Copyright 1999-2023 Gentoo Authors
>> # Distributed under the terms of the GNU General Public License v2
>> # @ECLASS: dune.eclass
>> @@ -29,7 +29,7 @@ _DUNE_ECLASS=1
>> # Set before inheriting the eclass.
>> : ${DUNE_PKG_NAME:=${PN}}
>> -inherit multiprocessing
>> +inherit edo multiprocessing
>> # Do not complain about CFLAGS etc since ml projects do not use them.
>> QA_FLAGS_IGNORED='.*'
>> @@ -44,15 +44,54 @@ BDEPEND="
>> dev-ml/dune
>> "
>> +# @FUNCTION: edune
>> +# @USAGE: <arg> ...
>> +# @DESCRIPTION:
>> +# A thin wrapper for the `dune` command.
>> +# Runs `dune` with given arguments and dies on failure.
>> +#
>> +# Example use:
>> +# @CODE
>> +# edune clean
>> +# @CODE
>> +edune() {
>> + debug-print-function ${FUNCNAME} "${@}"
>> +
>> + edo dune "${@}"
>> +}
>> +
>> +# @FUNCTION: dune-compile
>> +# @USAGE: [package] ...
>> +# @DESCRIPTION:
>> +# Compiles either all of packages sources in current directory or
>> selected
>> +# packages. In case of all packages the package detection is done via
>> dune
>> +# itself.
>> +#
>> +# Example use:
>> +# @CODE
>> +# dune-compile menhir menhirLib menhirSdk
>> +# @CODE
>> +dune-compile() {
>> + local -a myduneopts=(
>> + -j $(makeopts_jobs)
>> + --profile release
>> + )
>> + if [[ -n "${1}" ]] ; then
>> + myduneopts+=( --for-release-of-packages="$(IFS="," ; echo
>> "${*}")" )
>> + fi
>> +
>> + edune build @install "${myduneopts[@]}"
>> +}
>> +
>> dune_src_compile() {
>> ebegin "Building"
>> - dune build @install -j $(makeopts_jobs) --profile release
>> + dune-compile
>> eend $? || die
>> }
>> dune_src_test() {
>> ebegin "Testing"
>> - dune runtest -j $(makeopts_jobs) --profile release
>> + edune runtest -j $(makeopts_jobs) --profile release
>> eend $? || die
>> }
>> @@ -80,7 +119,7 @@ dune-install() {
>> local pkg
>> for pkg in "${pkgs[@]}" ; do
>> ebegin "Installing ${pkg}"
>> - dune install ${myduneopts[@]} ${pkg}
>> + edune install ${myduneopts[@]} ${pkg}
>> eend $? || die
>> # Move docs to the appropriate place.
>
> It appears there is additional output between the ebegin / eend. You may
> want to consider dropping ebegin and eend. In general, the pattern
> ebegin, edo, eend should probably be avoided.
>
> - Flow
>
--
Have a great day!
~ Maciej XGQT Barć
[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 10875 bytes --]
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2)
2023-01-03 14:51 ` Maciej Barć
@ 2023-01-03 15:09 ` Florian Schmaus
0 siblings, 0 replies; 7+ messages in thread
From: Florian Schmaus @ 2023-01-03 15:09 UTC (permalink / raw
To: Maciej Barć, gentoo-dev; +Cc: Alfredo Tupone, Sam James
On 03/01/2023 15.51, Maciej Barć wrote:
>> It appears there is additional output between the ebegin / eend. You
>> may want to consider dropping ebegin and eend. In general, the pattern
>> ebegin, edo, eend should probably be avoided.
>
> I would like to keep the "Building ... [ OK ]" (made by ebegin) output
> as it was before the change.
The reason the ebegin/edo/eend pattern should be avoided is that the
output will not be
Building ... [ OK ]
instead it will be
Building ... dune foo bar
[ OK ]
so the expectation that [ OK ] is on the right hand side is not fulfilled.
Note that edo.eclass also provides edob(), which can be used if it is
known that the command does not produce output.
For example
edob dune foo bar
should result in
Running dune foo bar [ OK ]
- Flow
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2)
2023-01-03 14:47 ` Maciej Barć
@ 2023-01-03 15:23 ` Michał Górny
0 siblings, 0 replies; 7+ messages in thread
From: Michał Górny @ 2023-01-03 15:23 UTC (permalink / raw
To: gentoo-dev
On Tue, 2023-01-03 at 15:47 +0100, Maciej Barć wrote:
> > How do you pronounce it? ;-)
>
> Michał, I am not a phonetic expert but I guess it would be "e-dune",
> like "e" in "e-mail" or "i-djun" in broken Polish. :-D
I meant the "e-do-dune" part xP.
--
Best regards,
Michał Górny
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-01-03 15:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-02 23:19 [gentoo-dev] [PATCH] eclass/dune.eclass: introduce edune and dune-compile (v2) Maciej Barć
2023-01-03 6:32 ` Michał Górny
2023-01-03 14:47 ` Maciej Barć
2023-01-03 15:23 ` Michał Górny
2023-01-03 6:55 ` Florian Schmaus
2023-01-03 14:51 ` Maciej Barć
2023-01-03 15:09 ` Florian Schmaus
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox