From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 219681382C5 for ; Thu, 8 Mar 2018 17:06:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C3D2BE099F; Thu, 8 Mar 2018 17:05:55 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6E85EE096A for ; Thu, 8 Mar 2018 17:05:55 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 95EB7335C06; Thu, 8 Mar 2018 17:05:53 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH 0/8] linux-info.eclass: cleanup & better non-Linux support Date: Thu, 8 Mar 2018 18:05:40 +0100 Message-Id: <20180308170548.5782-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.16.2 Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 1c098084-7aaa-487b-8d7a-2f6ddc30cbaf X-Archives-Hash: 45a037359229504c7db3d8b0b0fcc099 Hi, everyone. Here's a patch set for linux-info.eclass. Besides some minor cleanup, it improves error handling and adds explicit handling for non-Linux systems. Currently, the eclass pretty much wrongly assumes that every system is Linux. This causes e.g. a lot of spurious warnings or completely random behavior on FreeBSD. While we could technically solve it by adding appropriate conditionals to ebuilds, it seems pointless to have to add it everywhere if the eclass can never be useful for non-Linux targets. For the purpose of these patches, I've split the public-ish API of the eclass into three groups: a. check_extra_config & pkg_setup are commonly used in 'assert'-style with non-fatal results. Those functions are made no-ops on non-Linux systems. b. Some functions are fatal assert-style, i.e. die if kernel doesn't support X. Those now die explicitly on non-Linux systems (as they would probably anyway). c. Functions that provide true/false results and get version can't work correctly on FreeBSD, and the failure can't be cleanly expressed in true/false (think of kernel_is). Those functions now also die on non-Linux systems and needs to be guarded in ebuilds. Please review. -- Best regards, Michał Górny Michał Górny (8): linux-info.eclass: get_localversion, do not call 'ls' linux-info.eclass: Replace unnecessary $? checks linux-info.eclass: linux-info_get_any_version, die on failure linux-info.eclass: Move get_version to require_configured_kernel linux-info.eclass: require_configured_kernel, improve error handling linux-info.eclass: Ignore check_extra_config on non-Linux linux-info.eclass: Die in most of public-ish APIs on non-Linux linux-info.eclass: Skip linux_config_*_exists on non-Linux eclass/linux-info.eclass | 72 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 58 insertions(+), 14 deletions(-) -- 2.16.2