From patchwork Thu Sep 26 18:31:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Becze X-Patchwork-Id: 15488 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 5C80917442; Thu, 26 Sep 2019 19:34:30 +0100 (BST) 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 2443E17440 for ; Thu, 26 Sep 2019 19:34:30 +0100 (BST) Received: from localhost ([::1]:42444 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDYaz-0007U8-MW for patchwork@mira.cbaines.net; Thu, 26 Sep 2019 14:34:29 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40030) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDYYf-0006Hi-Or for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDYYd-0003Qi-OL for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36329) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDYYc-0003QG-L3 for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iDYYc-0000bE-EH for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37525] [PATCH 1/3] added recusive import functionality to the crate importer References: <20190926182812.10566-1-mjbecze@riseup.net> In-Reply-To: <20190926182812.10566-1-mjbecze@riseup.net> Resent-From: Martin Becze Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2019 18:32:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37525 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37525@debbugs.gnu.org Received: via spool by 37525-submit@debbugs.gnu.org id=B37525.156952268432692 (code B ref 37525); Thu, 26 Sep 2019 18:32:02 +0000 Received: (at 37525) by debbugs.gnu.org; 26 Sep 2019 18:31:24 +0000 Received: from localhost ([127.0.0.1]:45139 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYY0-0008Uv-6I for submit@debbugs.gnu.org; Thu, 26 Sep 2019 14:31:24 -0400 Received: from mx1.riseup.net ([198.252.153.129]:44160) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYXy-0008T7-Ae for 37525@debbugs.gnu.org; Thu, 26 Sep 2019 14:31:22 -0400 Received: from bell.riseup.net (bell-pn.riseup.net [10.0.1.178]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id 46fNmT4bKhzFbcn for <37525@debbugs.gnu.org>; Thu, 26 Sep 2019 11:31:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1569522681; bh=a4OZGMhL4X2Z2LYW2tcXrT1ZL8n/GNkAU9LOb+wMDus=; h=From:To:Cc:Subject:Date:From; b=Mteea/V4q82D0f5Voy+kV3KeNThF6lUOvZHW6sr7+q0A/C4uufgwCVPaVUCeVavU9 pLpvxghWshXC+CoVaCwuBGQbqK1sg8u4B0BWtjWCQn4qyaQyeqh2SbLdEvjBXMyszh vHD4TkkCKsjwm0IDPykhRZ5dqtCz5ggOtjZCDBGU= X-Riseup-User-ID: 065AAACFF59AC0523127A6ED5C9A1D21D9E3260C92EE3EEDA55A7B04E01C7C26 Received: from [127.0.0.1] (localhost [127.0.0.1]) by bell.riseup.net (Postfix) with ESMTPSA id 46fNmS5kkrzJxhV; Thu, 26 Sep 2019 11:31:20 -0700 (PDT) From: Martin Becze Date: Thu, 26 Sep 2019 14:31:01 -0400 Message-Id: <20190926183103.10646-1-mjbecze@riseup.net> 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: , Cc: Martin Becze Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- guix/import/crate.scm | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/guix/import/crate.scm b/guix/import/crate.scm index fd1974eae8..8dc014d232 100644 --- a/guix/import/crate.scm +++ b/guix/import/crate.scm @@ -40,6 +40,7 @@ #:use-module (srfi srfi-26) #:export (crate->guix-package guix-package->crate-name + crate-recursive-import %crate-updater)) @@ -218,16 +219,24 @@ latest version of CRATE-NAME." (cargo-development-inputs (sort (map crate-dependency-id dev-dep-crates) string-ci (crate-version-license version*) - string->license))))) + (values + (make-crate-sexp #:name crate-name + #:version (crate-version-number version*) + #:cargo-inputs cargo-inputs + #:cargo-development-inputs cargo-development-inputs + #:home-page (or (crate-home-page crate) + (crate-repository crate)) + #:synopsis (crate-description crate) + #:description (crate-description crate) + #:license (and=> (crate-version-license version*) + string->license)) + (append cargo-inputs cargo-development-inputs))))) + +(define (crate-recursive-import crate-name) + (recursive-import crate-name #f + #:repo->guix-package (lambda (name repo) + (crate->guix-package name)) + #:guix-name crate-name->package-name)) (define (guix-package->crate-name package) "Return the crate name of PACKAGE." From patchwork Thu Sep 26 18:31:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Becze X-Patchwork-Id: 15486 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 9C35B17442; Thu, 26 Sep 2019 19:32:33 +0100 (BST) 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, URIBL_BLOCKED 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 59F3717440 for ; Thu, 26 Sep 2019 19:32:33 +0100 (BST) Received: from localhost ([::1]:42430 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDYZ6-0006Q1-EM for patchwork@mira.cbaines.net; Thu, 26 Sep 2019 14:32:32 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40031) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDYYf-0006Hk-P0 for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDYYd-0003Qo-Oo for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36330) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDYYd-0003QU-Bj for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iDYYd-0000bf-6J for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37525] [PATCH 2/3] updated the crate import script to accept recursive option Resent-From: Martin Becze Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2019 18:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37525 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37525@debbugs.gnu.org Received: via spool by 37525-submit@debbugs.gnu.org id=B37525.1569522692713 (code B ref 37525); Thu, 26 Sep 2019 18:32:03 +0000 Received: (at 37525) by debbugs.gnu.org; 26 Sep 2019 18:31:32 +0000 Received: from localhost ([127.0.0.1]:45142 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYY7-0000B2-JG for submit@debbugs.gnu.org; Thu, 26 Sep 2019 14:31:32 -0400 Received: from mx1.riseup.net ([198.252.153.129]:44324) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYY4-00008Q-UQ for 37525@debbugs.gnu.org; Thu, 26 Sep 2019 14:31:30 -0400 Received: from bell.riseup.net (bell-pn.riseup.net [10.0.1.178]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id 46fNmc3wklzDrl7 for <37525@debbugs.gnu.org>; Thu, 26 Sep 2019 11:31:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1569522688; bh=W7/TiRp0IgndAInXcaqD0GYBeEmuPwxSpMlTxjMW92s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=aVPyecJq9QOuUs/wu6a24g94mrMjdFEkby2be+PtLEFlbDK7POQLPS0yU3WIA1kYS UIHq4aBVPkrKsOSOYbNnDXA1uma5mi/fVCmPNqkt9Qfd8Zc88SA7NQ5eDrJ+0l8E2i vLv/7iCinHhiVSywkVwqiuct+l3ufpFX/ImGqu98= X-Riseup-User-ID: D0F103132DC8D5E712C4C74C477A1164A1B229D89A92032D35E35930D34C14E8 Received: from [127.0.0.1] (localhost [127.0.0.1]) by bell.riseup.net (Postfix) with ESMTPSA id 46fNmb5hmZzJxhV; Thu, 26 Sep 2019 11:31:27 -0700 (PDT) From: Martin Becze Date: Thu, 26 Sep 2019 14:31:02 -0400 Message-Id: <20190926183103.10646-2-mjbecze@riseup.net> In-Reply-To: <20190926183103.10646-1-mjbecze@riseup.net> References: <20190926183103.10646-1-mjbecze@riseup.net> 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: , Cc: Martin Becze Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- guix/scripts/import/crate.scm | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/guix/scripts/import/crate.scm b/guix/scripts/import/crate.scm index 7ae8638911..19c8277d14 100644 --- a/guix/scripts/import/crate.scm +++ b/guix/scripts/import/crate.scm @@ -28,6 +28,7 @@ #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-37) + #:use-module (srfi srfi-41) #:use-module (ice-9 match) #:use-module (ice-9 format) #:export (guix-import-crate)) @@ -46,6 +47,8 @@ Import and convert the crate.io package for PACKAGE-NAME.\n")) (display (G_ " -h, --help display this help and exit")) (display (G_ " + -r, --recursive import packages recursively")) + (display (G_ " -V, --version display version information and exit")) (newline) (show-bug-report-information)) @@ -59,6 +62,9 @@ Import and convert the crate.io package for PACKAGE-NAME.\n")) (option '(#\V "version") #f #f (lambda args (show-version-and-exit "guix import crate"))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive #t result))) %standard-import-options)) @@ -79,22 +85,31 @@ Import and convert the crate.io package for PACKAGE-NAME.\n")) (let* ((opts (parse-options)) (args (filter-map (match-lambda - (('argument . value) - value) - (_ #f)) + (('argument . value) + value) + (_ #f)) (reverse opts)))) (match args ((spec) (define-values (name version) (package-name->name+version spec)) - (let ((sexp (crate->guix-package name version))) - (unless sexp - (leave (G_ "failed to download meta-data for package '~a'~%") - (if version - (string-append name "@" version) - name))) - sexp)) + (if (assoc-ref opts 'recursive) + (map (match-lambda + ((and ('package ('name name) . rest) pkg) + `(define-public ,(string->symbol name) + ,pkg)) + (_ #f)) + (reverse + (stream->list + (crate-recursive-import name)))) + (let ((sexp (crate->guix-package name version))) + (unless sexp + (leave (G_ "failed to download meta-data for package '~a'~%") + (if version + (string-append name "@" version) + name))) + sexp))) (() (leave (G_ "too few arguments~%"))) ((many ...) From patchwork Thu Sep 26 18:31:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Becze X-Patchwork-Id: 15487 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 22ABF17442; Thu, 26 Sep 2019 19:32:34 +0100 (BST) 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, URIBL_BLOCKED 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 DDE7F17440 for ; Thu, 26 Sep 2019 19:32:33 +0100 (BST) Received: from localhost ([::1]:42432 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDYZ7-0006Re-7I for patchwork@mira.cbaines.net; Thu, 26 Sep 2019 14:32:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40053) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iDYYh-0006KD-M7 for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iDYYf-0003RX-Mm for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:07 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:36331) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iDYYe-0003Qw-6F for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iDYYe-0000cF-1e for guix-patches@gnu.org; Thu, 26 Sep 2019 14:32:04 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#37525] [PATCH 3/3] updated docs for import crate Resent-From: Martin Becze Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 26 Sep 2019 18:32:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37525 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 37525@debbugs.gnu.org Received: via spool by 37525-submit@debbugs.gnu.org id=B37525.1569522695901 (code B ref 37525); Thu, 26 Sep 2019 18:32:03 +0000 Received: (at 37525) by debbugs.gnu.org; 26 Sep 2019 18:31:35 +0000 Received: from localhost ([127.0.0.1]:45145 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYYB-0000E7-4m for submit@debbugs.gnu.org; Thu, 26 Sep 2019 14:31:35 -0400 Received: from mx1.riseup.net ([198.252.153.129]:44364) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iDYY7-0000At-K9 for 37525@debbugs.gnu.org; Thu, 26 Sep 2019 14:31:33 -0400 Received: from bell.riseup.net (bell-pn.riseup.net [10.0.1.178]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "*.riseup.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.riseup.net (Postfix) with ESMTPS id 46fNmg1hdWzDqjr for <37525@debbugs.gnu.org>; Thu, 26 Sep 2019 11:31:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1569522691; bh=qEIIIhwNaoab6kAU8fjVO0wD3Fv0spAVm9H+KOHQYXE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QOSrtSw/V4t8c9851Rx46h+lk6zhgdQCVU96AVBBBuFL4kpxMZ6RmSswyrGuYw8Hm 6GAQi8k5LMtatmzDrbiskLixwpoKdxSpyHVFcaoSc/kBnV2JgibarIiyQtyTz0FqSE qiu46Dk7XZ1+xU7pg6ZCz5pXhrIxSsnOCiTmQ6oU= X-Riseup-User-ID: 9A93518D18404139D476B22D471D206B8234E5D74CA17FFC8F493B2EF7B77C84 Received: from [127.0.0.1] (localhost [127.0.0.1]) by bell.riseup.net (Postfix) with ESMTPSA id 46fNmf37ZyzJxhV; Thu, 26 Sep 2019 11:31:30 -0700 (PDT) From: Martin Becze Date: Thu, 26 Sep 2019 14:31:03 -0400 Message-Id: <20190926183103.10646-3-mjbecze@riseup.net> In-Reply-To: <20190926183103.10646-1-mjbecze@riseup.net> References: <20190926183103.10646-1-mjbecze@riseup.net> 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: , Cc: Martin Becze Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches --- doc/guix.texi | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/doc/guix.texi b/doc/guix.texi index 14c4514b31..3b3645b854 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -9054,6 +9054,13 @@ in Guix. Import metadata from the crates.io Rust package repository @uref{https://crates.io, crates.io}, as in this example: +@item --recursive +@itemx -r +Traverse the dependency graph of the given upstream package recursively +and generate package expressions for all those packages that are not yet +in Guix. +@end table + @example guix import crate blake2-rfc @end example