From patchwork Fri Mar 22 21:07:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Yann E. MORIN" X-Patchwork-Id: 1061671 Return-Path: X-Original-To: incoming-buildroot@patchwork.ozlabs.org Delivered-To: patchwork-incoming-buildroot@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=busybox.net (client-ip=140.211.166.136; helo=silver.osuosl.org; envelope-from=buildroot-bounces@busybox.net; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=free.fr Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="EiRTxkKY"; dkim-atps=neutral Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44Qx7K5grbz9sNm for ; Sat, 23 Mar 2019 08:07:25 +1100 (AEDT) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 655A02291C; Fri, 22 Mar 2019 21:07:23 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PlxdFCGri5HC; Fri, 22 Mar 2019 21:07:16 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 7DD3123B81; Fri, 22 Mar 2019 21:07:15 +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 881D41BF366 for ; Fri, 22 Mar 2019 21:07:13 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 85E3F87A3A for ; Fri, 22 Mar 2019 21:07:13 +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 aQ2L7zYu9Oxx for ; Fri, 22 Mar 2019 21:07:13 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) by hemlock.osuosl.org (Postfix) with ESMTPS id A8948879FF for ; Fri, 22 Mar 2019 21:07:12 +0000 (UTC) Received: by mail-wm1-f48.google.com with SMTP id a188so3435313wmf.3 for ; Fri, 22 Mar 2019 14:07:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=sYqW4h6oHVYIqOVbjwHGmA9sGikiFQ1Cx0ZpecRIWWw=; b=EiRTxkKYRLU0hVgIsRJwCrxmwsVw96JBVXqVT1lOiawP2X4x1RdAvYeCFt+6zMvd8A Gc84cMNAAaKwPgY0rladHaSeII9MvS3nJKYBDbybqOxjn++j1WIPXRSC3hct6YBw24wo 6p9REPy5uky//5cR80UzXZDgI9rUD9/sVPuSeoelBSJbcdJmgUxIqClY5ZRps7Bn3alj pHQfjpuGWlH6s9Udlr/2xSBvvf2f5Oa6PPpvQxe3IN6hsHWhIIFL/XVuFSNwxmej1/4W Kej7EE2rCvrimL6G/Dl3Km6p774zXTRdedM8DWO36L//S12Elh3tP+lGyH3gjbUD8+6x 1iUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=sYqW4h6oHVYIqOVbjwHGmA9sGikiFQ1Cx0ZpecRIWWw=; b=uaWFlvRuxU93LMo5csuYOaZ1uQPmaCl66lGtrbh6CzL1xGJM8gf6NKIwWZaheRsxtk gyz8NfWHU8fnLWx2RdYnEiKXqQU1wFXqRixwsDAEPrPk60+yrtv7nGm5zLV/RNWOE8xc R0+Z4sYRBxYImYmbuVitEQvPy1aZpSDNL1twQx5jekY9ju8erGrGpHuYXuwc62XtB2i7 2GgSY3A9kXjYAFvxXsCz8M9mfx9/o2IsacjxU3whDxSIhYYrsg8+jAtwIgAwq2pFIMWf p0jfXUgY80kdWWlH8qqH5ZmXDoag+PtL9G7zfnusFZiyukSN4b1TraPUGFqlMcFEAiIG sueA== X-Gm-Message-State: APjAAAXsbw9YxIj/5c1L4Md9CV7aBIcUmj5jLMGKCCL08SeA+6tM2tzJ /2virghbrh1C/Q3RQW5ptUxdiU/u X-Google-Smtp-Source: APXvYqy4V4tYwRWlC7dHMmjtJvdSRZTwgKZjrhhe73VQ7Bl+BFkA1bwxMXdSyqoQXQW/isdzWStV3A== X-Received: by 2002:a1c:1aca:: with SMTP id a193mr4432229wma.40.1553288830918; Fri, 22 Mar 2019 14:07:10 -0700 (PDT) Received: from scaer.home ([2a01:cb19:829a:2800:68e8:7a61:9bb9:12a]) by smtp.gmail.com with ESMTPSA id x11sm7989892wmh.2.2019.03.22.14.07.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 22 Mar 2019 14:07:10 -0700 (PDT) From: "Yann E. MORIN" To: buildroot@buildroot.org Date: Fri, 22 Mar 2019 22:07:06 +0100 Message-Id: X-Mailer: git-send-email 2.14.1 In-Reply-To: References: Subject: [Buildroot] [PATCH 2/3 v3] support/graph-depends: don't eliminate mandatory deps for reverse graphs X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.29 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: "Yann E. MORIN" , Thomas Petazzoni MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: "buildroot" We we simplify the dependency graph, we try to remove so-called mandatory dependencies from each package, and for each mandatory that was thus removed, reattach it to the root-package of the graph. This was made so that mandatory dependencies (which are dependencies of all packages, or at least of a lot of packages) do not clutter the dependency graph, but that they are still shown in the graph, as dependencies of the root package. However, these mandatory dependencies are only _direct_ dependencies. As such, it does not make sense to reattach a mandatory dependency when doing a reverse graph. Worse, it can actually be incorrect. For example, 'skeleton' is a mandatory dependency, and as such is removed from all packages. But when doing a reverse graph, skeleton is now in the dependency chain of, e.g. skeleton-init-none; it should then not be removed. In short: the notion of mandatory dependencies does not make sense in the case of a reverse graph. Consequently, skip over the mandatory dependency removal when doing a reverse graph. Signed-off-by: "Yann E. MORIN" Cc: Thomas Petazzoni --- support/scripts/graph-depends | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/support/scripts/graph-depends b/support/scripts/graph-depends index 29134c8237..7ed28440bb 100755 --- a/support/scripts/graph-depends +++ b/support/scripts/graph-depends @@ -216,13 +216,17 @@ def check_circular_deps(deps): # This functions trims down the dependency list of all packages. # It applies in sequence all the dependency-elimination methods. -def remove_extra_deps(deps, rootpkg, transitive): - for pkg in list(deps.keys()): - if not pkg == rootpkg: - for d in get_mandatory_deps(pkg, deps): - if d not in deps[rootpkg]: - deps[rootpkg].append(d) - deps[pkg] = remove_mandatory_deps(pkg, deps) +def remove_extra_deps(deps, rootpkg, transitive, arrow_dir): + # For the direct dependencies, find and eliminate mandatory + # deps, and add them to the root package. Don't do it for a + # reverse graph, because mandatory deps are only direct deps. + if arrow_dir == "forward": + for pkg in list(deps.keys()): + if not pkg == rootpkg: + for d in get_mandatory_deps(pkg, deps): + if d not in deps[rootpkg]: + deps[rootpkg].append(d) + deps[pkg] = remove_mandatory_deps(pkg, deps) for pkg in list(deps.keys()): if not transitive or pkg == rootpkg: deps[pkg] = remove_transitive_deps(pkg, deps) @@ -420,7 +424,7 @@ def main(): if check_only: sys.exit(0) - dict_deps = remove_extra_deps(dict_deps, rootpkg, args.transitive) + dict_deps = remove_extra_deps(dict_deps, rootpkg, args.transitive, arrow_dir) dict_version = brpkgutil.get_version([pkg for pkg in allpkgs if pkg != "all" and not pkg.startswith("root")])