Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 0/8] linux-info.eclass: cleanup & better non-Linux support
Date: Thu, 08 Mar 2018 17:06:01
Message-Id: 20180308170548.5782-1-mgorny@gentoo.org
1 Hi, everyone.
2
3 Here's a patch set for linux-info.eclass. Besides some minor cleanup,
4 it improves error handling and adds explicit handling for non-Linux
5 systems.
6
7 Currently, the eclass pretty much wrongly assumes that every system
8 is Linux. This causes e.g. a lot of spurious warnings or completely
9 random behavior on FreeBSD. While we could technically solve it
10 by adding appropriate conditionals to ebuilds, it seems pointless
11 to have to add it everywhere if the eclass can never be useful
12 for non-Linux targets.
13
14 For the purpose of these patches, I've split the public-ish API
15 of the eclass into three groups:
16
17 a. check_extra_config & pkg_setup are commonly used in 'assert'-style
18 with non-fatal results. Those functions are made no-ops on non-Linux
19 systems.
20
21 b. Some functions are fatal assert-style, i.e. die if kernel doesn't
22 support X. Those now die explicitly on non-Linux systems (as they
23 would probably anyway).
24
25 c. Functions that provide true/false results and get version can't work
26 correctly on FreeBSD, and the failure can't be cleanly expressed
27 in true/false (think of kernel_is). Those functions now also die
28 on non-Linux systems and needs to be guarded in ebuilds.
29
30 Please review.
31
32 --
33 Best regards,
34 Michał Górny
35
36 Michał Górny (8):
37 linux-info.eclass: get_localversion, do not call 'ls'
38 linux-info.eclass: Replace unnecessary $? checks
39 linux-info.eclass: linux-info_get_any_version, die on failure
40 linux-info.eclass: Move get_version to require_configured_kernel
41 linux-info.eclass: require_configured_kernel, improve error handling
42 linux-info.eclass: Ignore check_extra_config on non-Linux
43 linux-info.eclass: Die in most of public-ish APIs on non-Linux
44 linux-info.eclass: Skip linux_config_*_exists on non-Linux
45
46 eclass/linux-info.eclass | 72 ++++++++++++++++++++++++++++++++++++++----------
47 1 file changed, 58 insertions(+), 14 deletions(-)
48
49 --
50 2.16.2

Replies