From patchwork Fri Oct 9 09:15:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 528139 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ozlabs.org (Postfix) with ESMTP id 630D61402B8 for ; Fri, 9 Oct 2015 20:17:41 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id AD005A377A; Fri, 9 Oct 2015 09:17:40 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IyDnO6xpIeka; Fri, 9 Oct 2015 09:17:40 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by fraxinus.osuosl.org (Postfix) with ESMTP id 2A900A37B2; Fri, 9 Oct 2015 09:17:40 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id D48081C284D for ; Fri, 9 Oct 2015 09:17:38 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id CEA7B91018 for ; Fri, 9 Oct 2015 09:17:38 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B1m1znYyKxVG for ; Fri, 9 Oct 2015 09:17:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail.free-electrons.com (down.free-electrons.com [37.187.137.238]) by whitealder.osuosl.org (Postfix) with ESMTP id 301E990853 for ; Fri, 9 Oct 2015 09:17:38 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 9D3DD445D; Fri, 9 Oct 2015 11:17:37 +0200 (CEST) Received: from localhost (AToulouse-657-1-26-161.w83-193.abo.wanadoo.fr [83.193.1.161]) by mail.free-electrons.com (Postfix) with ESMTPSA id D35194853; Fri, 9 Oct 2015 11:15:09 +0200 (CEST) From: Thomas Petazzoni To: buildroot@uclibc.org Date: Fri, 9 Oct 2015 11:15:06 +0200 Message-Id: <1444382106-16019-3-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1444382106-16019-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1444382106-16019-1-git-send-email-thomas.petazzoni@free-electrons.com> Cc: Thomas Petazzoni Subject: [Buildroot] [PATCHv5 2/2] 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" The package infrastructure now detects when a target package is being built even if its corresponding Config.in option is not enabled, and aborts with an error. However, it does not indicate *which* package is improperly depending on the current package without selecting it at the kconfig level. So, in this commit, in addition to displaying an error, we try to help the user by saying which packages could be the culprit. To achieve this, we register the reverse dependencies of each package in a variable called _DEPENDENT_OF, and display this variable for the problematic package when the error is detected. Many thanks to Yann E. Morin for the idea and implementation! Signed-off-by: Thomas Petazzoni --- package/pkg-generic.mk | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk index a831199..1266a47 100644 --- a/package/pkg-generic.mk +++ b/package/pkg-generic.mk @@ -150,6 +150,8 @@ ifeq ($(MAKECMDGOALS),) @if test "$($(PKG)_TYPE)" = "target" -a -z "$($($(PKG)_KCONFIG_VAR))" ; then \ echo "ERROR: A package must have added $($(PKG)_NAME) to its _DEPENDENCIES line but" ; \ echo "forgot to add the corresponding select / depends on $($(PKG)_KCONFIG_VAR)." ; \ + echo "Potential culprits:" ; \ + for p in $($(PKG)_DEPENDENT_OF) ; do echo " - $$p" ; done ; \ exit 1 ; \ fi endif @@ -777,6 +779,12 @@ endif # ifneq ($$(call qstrip,$$($(2)_SOURCE)),) # configuration ifeq ($$($$($(2)_KCONFIG_VAR)),y) +# Store reverse build-dependency information: we add the name of the +# current package to the _DEPENDENT_OF variable of all packages +# the current package depends on. +$$(eval $$(foreach d,$$($(2)_FINAL_ALL_DEPENDENCIES),\ + $$(call UPPERCASE,$$(d))_DEPENDENT_OF += $(1)$$(sep))) + # Ensure the calling package is the declared provider for all the virtual # packages it claims to be an implementation of. ifneq ($$($(2)_PROVIDES),)