From patchwork Fri Dec 6 18:21:37 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Becze X-Patchwork-Id: 16402 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 A37D81785C; Fri, 6 Dec 2019 18:29:46 +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 6EECE17833 for ; Fri, 6 Dec 2019 18:29:46 +0000 (GMT) Received: from localhost ([::1]:43484 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idIML-000517-Uh for patchwork@mira.cbaines.net; Fri, 06 Dec 2019 13:29:45 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:50109) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1idIEv-0004OC-Ru for guix-patches@gnu.org; Fri, 06 Dec 2019 13:22:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1idIEu-0003rb-IT for guix-patches@gnu.org; Fri, 06 Dec 2019 13:22:05 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:41068) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1idIEu-0003rJ-C7 for guix-patches@gnu.org; Fri, 06 Dec 2019 13:22:04 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1idIEu-000554-9O for guix-patches@gnu.org; Fri, 06 Dec 2019 13:22:04 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38408] [PATCH v3 5/5] guix: crate: Depublicated dependencies Resent-From: Martin Becze Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 06 Dec 2019 18:22: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.157565651319475 (code B ref 38408); Fri, 06 Dec 2019 18:22:04 +0000 Received: (at 38408) by debbugs.gnu.org; 6 Dec 2019 18:21:53 +0000 Received: from localhost ([127.0.0.1]:47036 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1idIEi-00053x-Vt for submit@debbugs.gnu.org; Fri, 06 Dec 2019 13:21:53 -0500 Received: from mx1.riseup.net ([198.252.153.129]:41896) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1idIEf-00053I-7e for 38408@debbugs.gnu.org; Fri, 06 Dec 2019 13:21:49 -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 47V1Bh69HXzDt64 for <38408@debbugs.gnu.org>; Fri, 6 Dec 2019 10:21:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1575656508; bh=s7kVPwUcU8b/+mRMpysYnE5JwybAezSwWf79j/xYYaU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AJkOo2HDM7xQMLOxnW1bWgB5d7Sb0gFoAWnTNTHmJYfglxb97YahbM8n7v7jBneeV NmiU5m7B2NtAVyG4R481v5bLSYbYMyG306nD71hsADs90hf4B70F3Uk5Qd3TwTnlQx fIDcRVFA+/ulPT71aZnfRIEkrR+aCXVs1V99vb+c= X-Riseup-User-ID: 435AD2D2182CCCFD11D5C5BC508140666D027EB730C5BA66DF2CC9D4C9AFEE1F Received: from [127.0.0.1] (localhost [127.0.0.1]) by capuchin.riseup.net (Postfix) with ESMTPSA id 47V1Bh2KPlz8syM; Fri, 6 Dec 2019 10:21:48 -0800 (PST) From: Martin Becze Date: Fri, 6 Dec 2019 13:21:37 -0500 Message-Id: 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))) ;;;