From patchwork Mon Nov 16 19:07:26 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hartmut Goebel X-Patchwork-Id: 25162 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 F3C5B27BBF6; Mon, 16 Nov 2020 19:30:41 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id AE8CE27BBF5 for ; Mon, 16 Nov 2020 19:30:40 +0000 (GMT) Received: from localhost ([::1]:49566 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kekD1-0005P9-QW for patchwork@mira.cbaines.net; Mon, 16 Nov 2020 14:30:39 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:46292) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kejrD-0001xb-HQ for guix-patches@gnu.org; Mon, 16 Nov 2020 14:08:07 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:45726) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kejrB-0001FN-6X for guix-patches@gnu.org; Mon, 16 Nov 2020 14:08:05 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kejrB-0002t9-18 for guix-patches@gnu.org; Mon, 16 Nov 2020 14:08:05 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#38408] [PATCH v17 6/8] import: utils: Trim patch version from names. Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 16 Nov 2020 19:08: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 Received: via spool by 38408-submit@debbugs.gnu.org id=B38408.160555367611013 (code B ref 38408); Mon, 16 Nov 2020 19:08:04 +0000 Received: (at 38408) by debbugs.gnu.org; 16 Nov 2020 19:07:56 +0000 Received: from localhost ([127.0.0.1]:57258 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kejr2-0002rY-5d for submit@debbugs.gnu.org; Mon, 16 Nov 2020 14:07:56 -0500 Received: from mail-out.m-online.net ([212.18.0.9]:35167) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kejr0-0002rR-Vy for 38408@debbugs.gnu.org; Mon, 16 Nov 2020 14:07:55 -0500 Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4CZdrB3z4dz1qs3l for <38408@debbugs.gnu.org>; Mon, 16 Nov 2020 20:07:54 +0100 (CET) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4CZdrB3tcZz1rYDf for <38408@debbugs.gnu.org>; Mon, 16 Nov 2020 20:07:54 +0100 (CET) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id A4y7C3GtLgX4 for <38408@debbugs.gnu.org>; Mon, 16 Nov 2020 20:07:53 +0100 (CET) Received: from hermia.goebel-consult.de (ppp-188-174-59-253.dynamic.mnet-online.de [188.174.59.253]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS for <38408@debbugs.gnu.org>; Mon, 16 Nov 2020 20:07:53 +0100 (CET) Received: from thisbe.fritz.box (thisbe.fritz.box [192.168.110.24]) by hermia.goebel-consult.de (Postfix) with ESMTP id B044C604D4; Mon, 16 Nov 2020 20:08:28 +0100 (CET) From: Hartmut Goebel Date: Mon, 16 Nov 2020 20:07:26 +0100 Message-Id: <80ceca7e7d470e9f1e59edc219c80bbfd9b9a4d0.1605552418.git.h.goebel@crazy-compilers.com> X-Mailer: git-send-email 2.21.3 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list 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 This remove the patch version from generated package names. For example 'rust-my-crate-1.1.2' now becomes 'rust-my-crate-1.1'. * guix/import/utils.scm (package->definition): Trim patch version from generated package names. * tests/crate.scm: (cargo>guix-package, cargo-recursive-import): Likewise. --- guix/import/crate.scm | 3 ++- guix/import/utils.scm | 7 ++++--- tests/crate.scm | 30 +++++++++++++++--------------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index 9704b3087b..20efa131d5 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -159,7 +159,8 @@ and LICENSE." (map (match-lambda ((name version) - (list (crate-name->package-name name) version))) + (list (crate-name->package-name name) + (version-major+minor version)))) inputs)) (let* ((port (http-fetch (crate-uri name version))) diff --git a/guix/import/utils.scm b/guix/import/utils.scm index 10eb030188..b74393e617 100644 --- a/guix/import/utils.scm +++ b/guix/import/utils.scm @@ -269,9 +269,10 @@ package definition." ('package ('name name) ('version version) . rest) ('let _ ('package ('name name) ('version version) . rest))) - `(define-public ,(string->symbol (if append-version? - (string-append name "-" version) - version)) + `(define-public ,(string->symbol + (if append-version? + (string-append name "-" (version-major+minor version)) + version)) ,guix-package)))) (define (build-system-modules) diff --git a/tests/crate.scm b/tests/crate.scm index b6cd577552..3fbf6762c5 100644 --- a/tests/crate.scm +++ b/tests/crate.scm @@ -352,7 +352,7 @@ (_ (error "Unexpected URL: " url))))) (match (crate->guix-package "foo") - ((define-public 'rust-foo-1.0.3 + ((define-public 'rust-foo-1.0 (package (name "rust-foo") (version "1.0.3") (source @@ -369,7 +369,7 @@ (#:skip-build? #t #:cargo-inputs (("rust-leaf-alice" - ('unquote 'rust-leaf-alice-0.7.5)))))) + ('unquote 'rust-leaf-alice-0.7)))))) (home-page "http://example.com") (synopsis "summary") (description "summary") @@ -433,7 +433,7 @@ (match (crate-recursive-import "root") ;; rust-intermediate-b has no dependency on the rust-leaf-alice ;; package, so this is a valid ordering - (((define-public 'rust-leaf-alice-0.7.5 + (((define-public 'rust-leaf-alice-0.7 (package (name "rust-leaf-alice") (version "0.7.5") @@ -452,7 +452,7 @@ (synopsis "summary") (description "summary") (license (list license:expat license:asl2.0)))) - (define-public 'rust-leaf-bob-3.0.1 + (define-public 'rust-leaf-bob-3.0 (package (name "rust-leaf-bob") (version "3.0.1") @@ -471,7 +471,7 @@ (synopsis "summary") (description "summary") (license (list license:expat license:asl2.0)))) - (define-public 'rust-intermediate-b-1.2.3 + (define-public 'rust-intermediate-b-1.2 (package (name "rust-intermediate-b") (version "1.2.3") @@ -489,12 +489,12 @@ ('quasiquote (#:skip-build? #t #:cargo-inputs (("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3.0.1)))))) + ('unquote 'rust-leaf-bob-3.0)))))) (home-page "http://example.com") (synopsis "summary") (description "summary") (license (list license:expat license:asl2.0)))) - (define-public 'rust-intermediate-a-1.0.42 + (define-public 'rust-intermediate-a-1.0 (package (name "rust-intermediate-a") (version "1.0.42") @@ -512,16 +512,16 @@ ('quasiquote (#:skip-build? #t #:cargo-inputs (("rust-intermediate-b" - ('unquote 'rust-intermediate-b-1.2.3)) + ('unquote 'rust-intermediate-b-1.2)) ("rust-leaf-alice" - ('unquote 'rust-leaf-alice-0.7.5)) + ('unquote 'rust-leaf-alice-0.7)) ("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3.0.1)))))) + ('unquote 'rust-leaf-bob-3.0)))))) (home-page "http://example.com") (synopsis "summary") (description "summary") (license (list license:expat license:asl2.0)))) - (define-public 'rust-root-1.0.4 + (define-public 'rust-root-1.0 (package (name "rust-root") (version "1.0.4") @@ -538,13 +538,13 @@ (arguments ('quasiquote (#:cargo-inputs (("rust-intermediate-a" - ('unquote 'rust-intermediate-a-1.0.42)) + ('unquote 'rust-intermediate-a-1.0)) ("rust-intermediate-b" - ('unquote 'rust-intermediate-b-1.2.3)) + ('unquote 'rust-intermediate-b-1.2)) ("rust-leaf-alice" - ('unquote 'rust-leaf-alice-0.7.5)) + ('unquote 'rust-leaf-alice-0.7)) ("rust-leaf-bob" - ('unquote 'rust-leaf-bob-3.0.1)))))) + ('unquote 'rust-leaf-bob-3.0)))))) (home-page "http://example.com") (synopsis "summary") (description "summary")