From patchwork Thu Dec 5 20:05:35 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Becze X-Patchwork-Id: 16390 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 9A3D217851; Thu, 5 Dec 2019 20:07:56 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 67A811784F for ; Thu, 5 Dec 2019 20:07:56 +0000 (GMT) Received: from localhost ([::1]:60476 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icxPn-0003j2-Uz for patchwork@mira.cbaines.net; Thu, 05 Dec 2019 15:07:55 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:55666) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1icxP1-00039m-HJ for guix-patches@gnu.org; Thu, 05 Dec 2019 15:07:08 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1icxP0-0007IO-7n for guix-patches@gnu.org; Thu, 05 Dec 2019 15:07:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:39298) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1icxOz-0007Fk-3j for guix-patches@gnu.org; Thu, 05 Dec 2019 15:07:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1icxOy-0002ny-Ti for guix-patches@gnu.org; Thu, 05 Dec 2019 15:07:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38408] [PATCH v2 5/5] guix: crate: Depublicated build and normal dependencies Resent-From: Martin Becze Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 05 Dec 2019 20:07:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 38408 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 38408@debbugs.gnu.org Cc: Martin Becze Received: via spool by 38408-submit@debbugs.gnu.org id=B38408.157557639110690 (code B ref 38408); Thu, 05 Dec 2019 20:07:04 +0000 Received: (at 38408) by debbugs.gnu.org; 5 Dec 2019 20:06:31 +0000 Received: from localhost ([127.0.0.1]:45263 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1icxOR-0002mL-BF for submit@debbugs.gnu.org; Thu, 05 Dec 2019 15:06:31 -0500 Received: from mx1.riseup.net ([198.252.153.129]:46022) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1icxON-0002lz-GD for 38408@debbugs.gnu.org; Thu, 05 Dec 2019 15:06:27 -0500 Received: from capuchin.riseup.net (capuchin-pn.riseup.net [10.0.1.176]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "Sectigo RSA Domain Validation Secure Server CA" (not verified)) by mx1.riseup.net (Postfix) with ESMTPS id 47TRYh63KyzFcpZ for <38408@debbugs.gnu.org>; Thu, 5 Dec 2019 12:06:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1575576384; bh=s7kVPwUcU8b/+mRMpysYnE5JwybAezSwWf79j/xYYaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CrTu3LGhDxqlbs/QkGSP68/azryhmSzfv+EJSoxyD1ZutU9H0+1xGSsJ8/g5aMg5I 6Ktij6GJZcvRoSFXp8VJZqZ87OJ/nLZyVzS//g/s1aV/R+hub6rhraJs3X9LE8L9U9 vjFU00s4e+d1JleOeFTeY8Y7n4u0BZZI6UwwboSk= X-Riseup-User-ID: A69F499F732212D2BBC4CA3A4C65E48982F42D1B8945E22C18F416E62F4F1C53 Received: from [127.0.0.1] (localhost [127.0.0.1]) by capuchin.riseup.net (Postfix) with ESMTPSA id 47TRYJ1Xhkz8thH; Thu, 5 Dec 2019 12:05:56 -0800 (PST) From: Martin Becze Date: Thu, 5 Dec 2019 15:05:35 -0500 Message-Id: <8ffe3fa2e5d612802069f2b214b03a66df05780b.1575575779.git.mjbecze@riseup.net> In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/import/crate.scm: (crate-version-dependencies): dedup deps --- guix/import/crate.scm | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 5683369b7a..f3c36ba516 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -109,14 +109,26 @@ record or #f if it was not found." "Return the list of records of VERSION, a ." (let* ((path (assoc-ref (crate-version-links version) "dependencies")) - (url (string-append (%crate-base-url) path))) - (match (assoc-ref (or (json-fetch url) '()) "dependencies") - ((? vector? vector) - (filter (lambda (dep) - (not (eq? (crate-dependency-kind dep) 'dev))) - (map json->crate-dependency (vector->list vector)))) - (_ - '())))) + (url (string-append (%crate-base-url) path)) + (deps-list (match (assoc-ref (or (json-fetch url) '()) "dependencies") + ((? vector? vector) (vector->list vector)) + (_ + '()))) + ;; turn the raw list into 's and remove dev depenedencies + (deps (filter-map (lambda (json) + (let ((dep (json->crate-dependency json))) + (if (eq? (crate-dependency-kind dep) 'dev) + #f + dep))) + deps-list)) + ;; split normal and build dependencies + (deps-normal deps-build (partition (lambda (dep) + (eq? (crate-dependency-kind dep) 'normal)) + deps))) + ;;remove duplicate normal and build dependencies + (lset-union (lambda (a b) + (string= (crate-dependency-id a) (crate-dependency-id a))) + deps-normal deps-build))) ;;;