From unknown Mon Jun 16 23:53:15 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#51545 <51545@debbugs.gnu.org> To: bug#51545 <51545@debbugs.gnu.org> Subject: Status: [PATCH] import: egg: Allow imports of a specific version. Reply-To: bug#51545 <51545@debbugs.gnu.org> Date: Tue, 17 Jun 2025 06:53:15 +0000 retitle 51545 [PATCH] import: egg: Allow imports of a specific version. reassign 51545 guix-patches submitter 51545 Xinglu Chen severity 51545 normal tag 51545 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Nov 01 06:55:38 2021 Received: (at submit) by debbugs.gnu.org; 1 Nov 2021 10:55:38 +0000 Received: from localhost ([127.0.0.1]:33810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhUyX-00026b-TB for submit@debbugs.gnu.org; Mon, 01 Nov 2021 06:55:38 -0400 Received: from lists.gnu.org ([209.51.188.17]:55988) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mhUyV-00026T-Px for submit@debbugs.gnu.org; Mon, 01 Nov 2021 06:55:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41980) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhUyV-0007hm-IM for guix-patches@gnu.org; Mon, 01 Nov 2021 06:55:35 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:60976 helo=mail.yoctocell.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mhUyR-0007dy-RQ for guix-patches@gnu.org; Mon, 01 Nov 2021 06:55:35 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1635764127; bh=0oDjpkc19By7A3Uekc5v6hJRq3JGcqQBejqgDEoMT3o=; h=From:To:Subject:Date; b=DvAcnsAegqcRzU8/y9Gn1oxp2P74XQ/qOEUgHL4PA0i2IREaQGkeF9nD2GL80DLdp x25BXm+mNhRxLlAIILRKLglAYcyAam9nESZIMd7nCRp5PjzwOeiegaW4edveW7ArqM kvHiPAXoUg0krRZP7QW6Ora0VHda3plbzGnq2vdA= To: guix-patches@gnu.org Subject: [PATCH] import: egg: Allow imports of a specific version. Message-Id: Date: Mon, 01 Nov 2021 11:55:26 +0100 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=87.96.130.155; envelope-from=public@yoctocell.xyz; helo=mail.yoctocell.xyz X-Spam_score_int: 10 X-Spam_score: 1.0 X-Spam_bar: + X-Spam_report: (1.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FROM_SUSPICIOUS_NTLD=0.001, FROM_SUSPICIOUS_NTLD_FP=1.824, PDS_OTHER_BAD_TLD=0.001, PDS_RDNS_DYNAMIC_FP=0.001, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, TO_NO_BRKTS_DYNIP=0.248 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 1.7 (+) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: * guix/import/egg.scm (eggs-repository): Change URL. (egg-metadata): Accept optional #:version keyword argument. (egg->guix-package): Accept ‘version’ argument. (egg-recursive-import): Add ‘vers [...] Content analysis details: (1.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.0 RCVD_IN_MSPIKE_H2 RBL: Average reputation (+2) [209.51.188.17 listed in wl.mailspike.net] -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [209.51.188.17 listed in list.dnswl.org] 0.5 FROM_SUSPICIOUS_NTLD_FP From abused NTLD 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.2 (/) * guix/import/egg.scm (eggs-repository): Change URL. (egg-metadata): Accept optional #:version keyword argument. (egg->guix-package): Accept =E2=80=98version=E2=80=99 argument. (egg-recursive-import): Add =E2=80=98version=E2=80=99 argument and honor it. * guix/scripts/import/egg.scm (guix-import-egg): Parse a specification inst= ead of just a package name. * doc/guix.texi (Invoking guix import): Document it. --- doc/guix.texi | 8 +++++++- guix/import/egg.scm | 37 ++++++++++++++++++++----------------- guix/scripts/import/egg.scm | 34 +++++++++++++++++++--------------- 3 files changed, 46 insertions(+), 33 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index ea1973f02c..5432612009 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12166,7 +12166,7 @@ @cindex egg Import metadata for @uref{https://wiki.call-cc.org/eggs, CHICKEN eggs}. The information is taken from @file{PACKAGE.egg} files found in the -@uref{git://code.call-cc.org/eggs-5-latest, eggs-5-latest} Git +@uref{git://code.call-cc.org/eggs-5-all, eggs-5-all} Git repository. However, it does not provide all the information that we need, there is no ``description'' field, and the licenses used are not always precise (BSD is often used instead of BSD-N). @@ -12175,6 +12175,12 @@ guix import egg sourcehut @end example =20 +You can also ask for a specific version + +@example +guix import egg array@@1.0 +@end example + Additional options include: @table @code @item --recursive diff --git a/guix/import/egg.scm b/guix/import/egg.scm index 89e7a9160d..ff9f5a0247 100644 --- a/guix/import/egg.scm +++ b/guix/import/egg.scm @@ -51,10 +51,10 @@ (define-module (guix import egg) ;;; ;;; The following happens under the hood: ;;; -;;; * is a Git repository that cont= ains -;;; the latest version of all CHICKEN eggs. We look clone this reposito= ry -;;; and retrieve the latest version number, and the PACKAGE.egg file, wh= ich -;;; contains a list of lists containing metadata about the egg. +;;; * is a Git repository that contains +;;; all versions of all CHICKEN eggs. We look clone this repository and= , by +;;; default, retrieve the latest version number, and the PACKAGE.egg fil= e, +;;; which contains a list of lists containing metadata about the egg. ;;; ;;; * All the eggs are stored as tarballs at ;;; , so we grab the tarball for @@ -96,7 +96,7 @@ (define (egg-name->guix-name name) (define (eggs-repository) "Update or fetch the latest version of the eggs repository and return th= e path to the repository." - (let* ((url "git://code.call-cc.org/eggs-5-latest") + (let* ((url "git://code.call-cc.org/eggs-5-all") (directory commit _ (update-cached-checkout url))) directory)) =20 @@ -112,12 +112,13 @@ (define (find-latest-version name) (last directory) #f))) =20 -(define* (egg-metadata name #:optional file) - "Return the package metadata file for the egg NAME, or if FILE is specif= ied, -return the package metadata in FILE." +(define* (egg-metadata name #:key (version #f) (file #f)) + "Return the package metadata file for the egg NAME at version VERSION, o= r if +FILE is specified, return the package metadata in FILE." (call-with-input-file (or file (string-append (egg-directory name) "/" - (find-latest-version name) + (or version + (find-latest-version name)) "/" name ".egg")) read)) =20 @@ -173,10 +174,11 @@ (define string->license ;;; Egg importer. ;;; =20 -(define* (egg->guix-package name #:key (file #f) (source #f)) - "Import a CHICKEN egg called NAME from either the given .egg FILE, or fr= om -the latest NAME metadata downloaded from the official repository if FILE i= s #f. -Return a record or #f on failure. +(define* (egg->guix-package name version #:key (file #f) (source #f)) + "Import a CHICKEN egg called NAME from either the given .egg FILE, or fr= om the +latest NAME metadata downloaded from the official repository if FILE is #f. +Return a record or #f on failure. If VERSION is specified, impo= rt +the particular version from the egg repository. =20 SOURCE is a ``file-like'' object containing the source code corresponding = to the egg. If SOURCE is not specified, the latest tarball for egg NAME will= be @@ -186,8 +188,8 @@ (define* (egg->guix-package name #:key (file #f) (sourc= e #f)) locally. Note that if FILE and SOURCE are specified, recursive import will not work." (define egg-content (if file - (egg-metadata name file) - (egg-metadata name))) + (egg-metadata name #:file file) + (egg-metadata name #:version version))) (if (not egg-content) (values #f '()) ; egg doesn't exist (let* ((version* (or (assoc-ref egg-content 'version) @@ -326,10 +328,11 @@ (define (maybe-inputs input-type inputs) (define egg->guix-package/m ;memoized variant (memoize egg->guix-package)) =20 -(define (egg-recursive-import package-name) +(define* (egg-recursive-import package-name #:optional version) (recursive-import package-name + #:version version #:repo->guix-package (lambda* (name #:key version repo) - (egg->guix-package/m name)) + (egg->guix-package/m name versi= on)) #:guix-name egg-name->guix-name)) =20 diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm index 829cdc2ca0..6a9657d12c 100644 --- a/guix/scripts/import/egg.scm +++ b/guix/scripts/import/egg.scm @@ -26,6 +26,7 @@ (define-module (guix scripts import egg) #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (srfi srfi-37) + #:use-module (srfi srfi-71) #:use-module (ice-9 match) #:use-module (ice-9 format) #:export (guix-import-egg)) @@ -83,21 +84,24 @@ (define (parse-options) (_ #f)) (reverse opts)))) (match args - ((package-name) - (if (assoc-ref opts 'recursive) - ;; Recursive import - (map (match-lambda - ((and ('package ('name name) . rest) pkg) - `(define-public ,(string->symbol name) - ,pkg)) - (_ #f)) - (egg-recursive-import package-name)) - ;; Single import - (let ((sexp (egg->guix-package package-name))) - (unless sexp - (leave (G_ "failed to download meta-data for package '~a'~%= ") - package-name)) - sexp))) + ((spec) + (let ((name version (package-name->name+version spec))) + (if (assoc-ref opts 'recursive) + ;; Recursive import + (map (match-lambda + ((and ('package ('name name) . rest) pkg) + `(define-public ,(string->symbol name) + ,pkg)) + (_ #f)) + (egg-recursive-import name version)) + ;; Single import + (let ((sexp (egg->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 ...) base-commit: e1370ea8fa41417bedb437b2fc3a066b19f82c52 --=20 2.33.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Nov 07 16:02:03 2021 Received: (at 51545-done) by debbugs.gnu.org; 7 Nov 2021 21:02:03 +0000 Received: from localhost ([127.0.0.1]:55034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjpIh-0007g9-CR for submit@debbugs.gnu.org; Sun, 07 Nov 2021 16:02:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:42184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mjpIf-0007fS-CM for 51545-done@debbugs.gnu.org; Sun, 07 Nov 2021 16:02:02 -0500 Received: from [2001:470:142:3::e] (port=55992 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjpIZ-0001WE-Qp; Sun, 07 Nov 2021 16:01:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=wDsyZS5YQAGM6hos0cCo7b3iCCWJ+joQhHnueHIoYBQ=; b=LzM5DBMAzc5GAaGJrEy+ g+s0d8X1GlKhUK+f96mht1DDDLjNZvjYDLM3ZBfnGMSjH9o56t0W4fp0ba5OaBteSt8vgh+KuU5VB voZW4u07AC1rujhtJo+kv9qhTbdug854jmQG0LNijZ720xirqexUvNf8yElCgups9QjXqJaQZ+296 oX4/RHACVloXaWKLaR1KAl4i7Qo6+QcG9P/y6bQOFgmBCOMxNPkIrMF4hWzcQhWbYyr0mkCL+NoPg YEft/1yI9Do+sK5jRqAKLrCN0Xe9Gq+fhc1tuJisUoGaGxCvgB7aR8vh6Pi2HYM2dyxtSLZWhCvq5 d3skup1nnyzFag==; Received: from 91-160-117-201.subs.proxad.net ([91.160.117.201]:55546 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mjpIZ-00082i-HE; Sun, 07 Nov 2021 16:01:55 -0500 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Xinglu Chen Subject: Re: bug#51545: [PATCH] import: egg: Allow imports of a specific version. References: Date: Sun, 07 Nov 2021 22:01:54 +0100 In-Reply-To: (Xinglu Chen's message of "Mon, 01 Nov 2021 11:55:26 +0100") Message-ID: <87tugnk7ct.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: 51545-done Cc: 51545-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.3 (-) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi, Xinglu Chen skribis: > * guix/import/egg.scm (eggs-repository): Change URL. > (egg-metadata): Accept optional #:version keyword argument. > (egg->guix-package): Accept =E2=80=98version=E2=80=99 argument. > (egg-recursive-import): Add =E2=80=98version=E2=80=99 argument and honor = it. > * guix/scripts/import/egg.scm (guix-import-egg): Parse a specification in= stead > of just a package name. > * doc/guix.texi (Invoking guix import): Document it. Applied with the minor fix below, thanks! Ludo=E2=80=99. --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/doc/guix.texi b/doc/guix.texi index 978a454b83..3355a535ad 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -12175,10 +12175,10 @@ always precise (BSD is often used instead of BSD-N). guix import egg sourcehut @end example -You can also ask for a specific version +You can also ask for a specific version: @example -guix import egg array@@1.0 +guix import egg arrays@@1.0 @end example Additional options include: --=-=-=-- From unknown Mon Jun 16 23:53:15 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Mon, 06 Dec 2021 12:24:05 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator