From patchwork Fri Jan 1 00:01:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 561998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 6E764140B0E for ; Fri, 1 Jan 2016 11:01:35 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=kr4eOIhj; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 2EBF994CA9; Fri, 1 Jan 2016 00:01:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VOSjTAXcmOej; Fri, 1 Jan 2016 00:01:32 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id 1850494B62; Fri, 1 Jan 2016 00:01:32 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 72EAF1C0AC6 for ; Fri, 1 Jan 2016 00:01:31 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 6E76B94B62 for ; Fri, 1 Jan 2016 00:01:31 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ka6oLhRD+Ef3 for ; Fri, 1 Jan 2016 00:01:30 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm0-f53.google.com (mail-wm0-f53.google.com [74.125.82.53]) by hemlock.osuosl.org (Postfix) with ESMTPS id EE505938BB for ; Fri, 1 Jan 2016 00:01:29 +0000 (UTC) Received: by mail-wm0-f53.google.com with SMTP id u188so77140807wmu.1 for ; Thu, 31 Dec 2015 16:01:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id; bh=5OdJ9+KQr19qodKrwmmuHONc3xo66Ct0AagHqKYFEgw=; b=kr4eOIhjfW7kKbJoiuvZ6WRlAgwp96cQqZSfcjGimkTNI/xhTrvVNYd7+HZPBzW/3z 3GV/OD2b/AJG3AILLkd6wnKR1SvQsJ/4rlwNviIjoTxllpQzMi+OGwykDXYD8B5oJU0r wr38uU/I4NYFegbjPkbUwcCLK1IY8mbN1x4yVk9wfY3E209CkV5ydG+hGARrCNU2T4jc B5L8r89+14FRdhoThm7Mr1YPWNYbz36E85SNvzrqPdDYe3v1dJmEFSZCLrjh2P4KedJQ gYu0GtqMkGDj00pWPnLfHDV7C7nsueezlpIwFOVQ0Px/HgMeomkhQJTZvZz79O4vVle+ /ycA== X-Received: by 10.28.216.211 with SMTP id p202mr34898997wmg.84.1451606488378; Thu, 31 Dec 2015 16:01:28 -0800 (PST) Received: from gourin.bzh.lan (ns304657.ip-46-105-103.eu. [46.105.103.66]) by smtp.gmail.com with ESMTPSA id a126sm13108350wmh.0.2015.12.31.16.01.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 31 Dec 2015 16:01:27 -0800 (PST) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Fri, 1 Jan 2016 01:01:23 +0100 Message-Id: <1451606483-29096-1-git-send-email-yann.morin.1998@free.fr> X-Mailer: git-send-email 1.9.1 Cc: Thomas Petazzoni , "Yann E. MORIN" Subject: [Buildroot] [PATCH] pkg-generic: improve incorrectly used package detection X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" From: Thomas Petazzoni Currently, the check that packages we build are indeed enabled is done at the time a package is configured. This can come quite late in the build process, and does not provide direct knowledge of the real culprit for the incorrect dependency. However, we can improve these two issues quite easily, albeit at the expense of a very slightly more complicated make code. First, the check can not be done at the time we define the package, i.e. in the inner-generic-pacakge, because all its dependencies might have not been parsed yet, so we can't yet know whether it is enabled or not (because we can't match the package name of the dependency to its Kconfig variable yet). But then, we know we have all packages definitions after we scanned the the bundled packages, kernel, bootloaders and toolchains, as well as the br2-external tree (if any). So, at this location, we iterate through the list of enabled packages, and check that the packages they each depend on are indeed enabled. This allows us to: 1- do the check very early, before any build action, 2- report on the exact offending package very easily. Signed-off-by: "Yann E. MORIN" Cc: Thomas Petazzoni --- Changes v2 -> v3: (Yann) - completely drop the reverse dependency list - drop the pre-configure check - make it Makefile code - print the offending package - drop Thomas' SoB, as I rewrote it entirely and completely differently Changes v1 -> v2: (Yann) - recursively scan the reverse list of dependencies to find all the potential cuplrits, not only the first-level ones --- Makefile | 28 ++++++++++++++++++++++++++++ package/pkg-generic.mk | 14 -------------- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index 71ace68..9139e81 100644 --- a/Makefile +++ b/Makefile @@ -434,6 +434,34 @@ include fs/common.mk include $(BR2_EXTERNAL)/external.mk +# Now we are sure we have all the packages scanned and defined. We now +# check for each package in the list of enabled packages, that all its +# dependencies are indeed enabled. +# +# Only trigger the check for default builds. If the user forces building +# a package, even if not enabled in the configuration, we want to accept +# it. +# +ifeq ($(MAKECMDGOALS),) + +define CHECK_ONE_DEPENDENCY +ifeq ($$($(2)_TYPE),target) +ifeq ($$($(2)_IS_VIRTUAL),) +ifneq ($$($$($(2)_KCONFIG_VAR)),y) +$$(error $$($(2)_NAME) is in the dependency chain of $$($(1)_NAME) that \ +has added it to its _DEPENDENCIES variable without selecting it or \ +depending on it from Config.in) +endif +endif +endif +endef + +$(foreach pkg,$(call UPPERCASE,$(PACKAGES)),\ + $(foreach dep,$(call UPPERCASE,$($(pkg)_FINAL_ALL_DEPENDENCIES)),\ + $(eval $(call CHECK_ONE_DEPENDENCY,$(pkg),$(dep))$(sep)))) + +endif + dirs: $(BUILD_DIR) $(STAGING_DIR) $(TARGET_DIR) \ $(HOST_DIR) $(BINARIES_DIR) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index 9e88423..1e024d3 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -182,20 +182,6 @@ $(foreach dir,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)),\ # Configure $(BUILD_DIR)/%/.stamp_configured: -# Only trigger the check for default builds. If the user forces -# building a package, even if not enabled in the configuration, we -# want to accept it. -ifeq ($(MAKECMDGOALS),) - @if test "$($(PKG)_TYPE)" = "target" \ - -a "$($(PKG)_IS_VIRTUAL)" != "YES" \ - -a -z "$($($(PKG)_KCONFIG_VAR))" ; \ - then \ - echo "ERROR: $($(PKG)_NAME) is in the dependency chain of a package that has" ; \ - echo "added it to its _DEPENDENCIES variable (directly or indirectly)" ; \ - echo "without selecting it from Config.in." ; \ - exit 1 ; \ - fi -endif @$(call step_start,configure) @$(call MESSAGE,"Configuring") $(foreach hook,$($(PKG)_PRE_CONFIGURE_HOOKS),$(call $(hook))$(sep))