Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 619178 - meson.eclass - several eclass improvements
Summary: meson.eclass - several eclass improvements
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: William Hubbs
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2017-05-21 12:06 UTC by Coacher
Modified: 2017-05-21 22:39 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
meson.patch (meson.patch,2.47 KB, patch)
2017-05-21 12:06 UTC, Coacher
Details | Diff
meson.patch (meson.patch,2.32 KB, patch)
2017-05-21 12:24 UTC, Coacher
Details | Diff
meson.patch (meson.patch,2.60 KB, patch)
2017-05-21 13:13 UTC, Coacher
Details | Diff
meson.patch (meson.patch,2.58 KB, patch)
2017-05-21 13:44 UTC, Coacher
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Coacher 2017-05-21 12:06:43 UTC
Created attachment 473662 [details, diff]
meson.patch

Hello.

While reading meson.eclass and porting existing ebuilds to it, I found several problems with meson.eclass. Nothing serious, but some of them are rather annoying.

1. Unneeded dep on dev-util/ninja. meson.eclass calls only eninja (not ninja directly) and shouldn't bother how ninja-utils.eclass provides this function.

2. Unneeded '-v' option passed to eninja calls. ninja-utils.eclass already provides verbose builds as required per devmanual. No need to pass '-v' again.

3. meson_src_install doesn't call einstalldocs. Thus meson_src_install isn't consistent with default_src_install and all meson ebuilds must call einstalldocs manually to provide a complete set of files.

4. @DEFAULT_UNSET attribute is incorrectly applied to BUILD_DIR and EMESON_SOURCE. These variables have default values, they are not unset.

5. Minor inconsistencies in naming and quoting.
Comment 1 Mart Raudsepp gentoo-dev 2017-05-21 12:10:36 UTC
(In reply to Coacher from comment #0)
> 1. Unneeded dep on dev-util/ninja. meson.eclass calls only eninja (not ninja
> directly) and shouldn't bother how ninja-utils.eclass provides this function.

The ninja dep is very much needed, or all meson.eclass users will have to manually add it. ninja-utils.eclass doesn't depend on ninja due to it only providing a function that is called; the callers need to provide the dep. This is some cmake-utils.eclass necessity or something (it only optionally uses ninja over make, but eninja function has to be always inherited)
Comment 2 Coacher 2017-05-21 12:24:26 UTC
Created attachment 473664 [details, diff]
meson.patch

(In reply to Mart Raudsepp from comment #1)
> (In reply to Coacher from comment #0)
> ninja-utils.eclass doesn't depend on ninja due to it only
> providing a function that is called; the callers need to provide the dep.
> This is some cmake-utils.eclass necessity or something (it only optionally
> uses ninja over make, but eninja function has to be always inherited)

Ok, I've updated the patch accordingly.
Though I must say it is unexpected that consumers must provide the dep.
Comment 3 Coacher 2017-05-21 12:50:37 UTC
There is also this QA notice:
 * QA Notice: EXPORT_FUNCTIONS is called before inherit in meson.eclass. For
 * compatibility with <=portage-2.1.6.7, only call EXPORT_FUNCTIONS after
 * inherit(s).

I'm not sure if it's too serious since the mentioned portage versions are long gone now. But EXPORT_FUNCTIONS along with EAPI check should probably be moved under `if [[ -z ${_MESON_ECLASS} ]];` condition.
Comment 4 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-05-21 12:57:51 UTC
(In reply to Coacher from comment #0)
> 4. @DEFAULT_UNSET attribute is incorrectly applied to BUILD_DIR and
> EMESON_SOURCE. These variables have default values, they are not unset.

BUILD_DIR does not have a default value in the global scope. It gets assigned later on, optionally.

EMESON_SOURCE does not have a default value and is not assigned by the eclass. It merely has a fallback in the code.

(In reply to Coacher from comment #3)
> There is also this QA notice:
>  * QA Notice: EXPORT_FUNCTIONS is called before inherit in meson.eclass. For
>  * compatibility with <=portage-2.1.6.7, only call EXPORT_FUNCTIONS after
>  * inherit(s).
> 
> I'm not sure if it's too serious since the mentioned portage versions are
> long gone now. But EXPORT_FUNCTIONS along with EAPI check should probably be
> moved under `if [[ -z ${_MESON_ECLASS} ]];` condition.

Fix it anyway. EXPORT_FUNCTIONS should stay outside to avoid multiple-inheritance-disorder mess.
Comment 5 Coacher 2017-05-21 13:13:39 UTC
Created attachment 473666 [details, diff]
meson.patch

(In reply to Michał Górny from comment #4)
> BUILD_DIR does not have a default value in the global scope. It gets
> assigned later on, optionally.
> 
> EMESON_SOURCE does not have a default value and is not assigned by the
> eclass. It merely has a fallback in the code.

I see. My understanding was incorrect.

> Fix it anyway. EXPORT_FUNCTIONS should stay outside to avoid
> multiple-inheritance-disorder mess.

Done. Patch updated.
Comment 6 Coacher 2017-05-21 13:44:16 UTC
Created attachment 473670 [details, diff]
meson.patch

Another update after mgorny's suggestions on IRC re the previous version.
Comment 7 Michał Górny archtester Gentoo Infrastructure gentoo-dev Security 2017-05-21 13:59:17 UTC
LGTM.
Comment 8 Mike Gilbert gentoo-dev 2017-05-21 17:29:33 UTC
Looks good to me as well.
Comment 9 Coacher 2017-05-21 22:39:14 UTC
Fixed in commit 5fe09d0d25b28455f712ceab14fba82c82915531
Author:     Coacher <itumaykin+gentoo@gmail.com>
AuthorDate: Sun May 21 14:36:29 2017 -0500
Commit:     William Hubbs <williamh@gentoo.org>
CommitDate: Sun May 21 14:50:49 2017 -0500

    meson.eclass: misc improvements for #619178

Thanks everyone.