From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 May 2021 12:49:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48697@debbugs.gnu.org Cc: raingloom X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162211973424967 (code B ref -1); Thu, 27 May 2021 12:49:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 May 2021 12:48:54 +0000 Received: from localhost ([127.0.0.1]:50864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmFRU-0006Uc-La for submit@debbugs.gnu.org; Thu, 27 May 2021 08:48:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:54362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmFRS-0006UT-40 for submit@debbugs.gnu.org; Thu, 27 May 2021 08:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmFRO-0006o8-Gq for guix-patches@gnu.org; Thu, 27 May 2021 08:48:47 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:45932 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 1lmFRG-0004Of-Oe for guix-patches@gnu.org; Thu, 27 May 2021 08:48:43 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622119711; bh=pMI0Zk6pmdgMLyji5MXuyKAisFM7LLEc/zjjXN31Zxw=; h=From:To:Cc:Subject:Date; b=bKmE7NUKlZgfwwiIZvY/6ptVcHKsoIduAbYkpGZXhA9OpIfTNRV+4+xX29Dx+16Tv H9MdUwByHxvghL9BVg5v1klDhV9I2exqF0Y6eYVFpDXDufnksk12QTCvBC6IYLyMIb Dh/rSVqUfWa2henK+eJXEXsDZRJ8HSWjZNk1z8MY= Message-Id: Date: Thu, 27 May 2021 14:48:30 +0200 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: 34 X-Spam_score: 3.4 X-Spam_bar: +++ X-Spam_report: (3.4 / 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.499, FROM_SUSPICIOUS_NTLD_FP=1.999, PDS_OTHER_BAD_TLD=1.999, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 3.2 (+++) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * guix/scripts/import.scm (importers): Add egg i [...] Content analysis details: (3.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [209.51.188.17 listed in wl.mailspike.net] 2.0 FROM_SUSPICIOUS_NTLD_FP From abused NTLD 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * guix/scripts/import.scm (importers): Add egg importer. * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document it. --- [ Cc=E2=80=99ing raingloom since you wrote the CHICKEN build system ] This patch adds recursive importer for CHICKEN eggs, the generated packages aren=E2=80=99t entirely complete, though. It gets information fro= m The PACKAGE.egg, which is just a Scheme file that contains a list of lists that specify the metadata for an egg. However, it doesn=E2=80=99t specify a description, so I have just set the =E2=80=98description=E2=80=99 field to = #f for now. The licensing policy for eggs is also a bit vague[1], there is no strict naming format for licenses, and a lot of eggs just specify =E2=80=98BSD=E2= =80=99 rather than =E2=80=98BSD-N-Clause=E2=80=99. The PACKAGE.egg file can also specify system dependencies, but there is no consistent format for this, sometimes strings are used, other times symbols are used, and sometimes the version of the package is also included. The user will have to double check the names and make sure they are correct. I am also unsure about whether the system dependencies should be =E2=80=98propagated-inputs=E2=80=99 or just =E2=80= =98inputs=E2=80=99. [1]: https://wiki.call-cc.org/eggs-licensing Try it out! --8<---------------cut here---------------start------------->8--- ~/src/guix $ ./pre-inst-env guix import egg -r medea Starting download of /tmp/guix-file.nFumLb >From https://code.call-cc.org/egg-tarballs/5/medea/medea-4.tar.gz... medea-4.tar.gz 7KiB 162KiB/s 00:00 [##################] 1= 00.0% Starting download of /tmp/guix-file.8QWL6a >From https://code.call-cc.org/egg-tarballs/5/comparse/comparse-3.tar.gz... =E2=80=A6-3.tar.gz 7KiB 203KiB/s 00:00 [#############= #####] 100.0% Starting download of /tmp/guix-file.hZPs19 >From https://code.call-cc.org/egg-tarballs/5/srfi-13/srfi-13-0.3.1.tar.gz... =E2=80=A63.1.tar.gz 28KiB 328KiB/s 00:00 [#############= #####] 100.0% Starting download of /tmp/guix-file.VMAPo7 >From https://code.call-cc.org/egg-tarballs/5/lazy-seq/lazy-seq-2.tar.gz... =E2=80=A6-2.tar.gz 3KiB 158KiB/s 00:00 [#############= #####] 100.0% Starting download of /tmp/guix-file.6LM9K7 >From https://code.call-cc.org/egg-tarballs/5/trie/trie-2.tar.gz... trie-2.tar.gz 1KiB 1.5MiB/s 00:00 [##################] 1= 00.0% Starting download of /tmp/guix-file.8Yn8L7 >From https://code.call-cc.org/egg-tarballs/5/matchable/matchable-1.1.tar.gz= ... =E2=80=A61.1.tar.gz 14KiB 370KiB/s 00:00 [#############= #####] 100.0% (define-public chicken-srfi-13 (package (name "chicken-srfi-13") (version "0.3.1") (source (origin (method url-fetch) (uri "https://code.call-cc.org/egg-tarballs/5/srfi-13/srfi-13-0.3.1= .tar.gz") (sha256 (base32 "1430grdp9d13rjp7asn5cs7cbcllbv89g49gx95zqlp07y9df6dm")))) (build-system chicken-build-system) (arguments `(#:egg-name "srfi-13")) (native-inputs `(("chicken-test" ,chicken-test))) (propagated-inputs `(("chicken-srfi-14" ,chicken-srfi-14))) (home-page "https://api.call-cc.org/5/doc/srfi-13") (synopsis "SRFI-13 string library") (description #f) (license license:bsd?))) [...] (define-public chicken-medea (package (name "chicken-medea") (version "4") (source (origin (method url-fetch) (uri "https://code.call-cc.org/egg-tarballs/5/medea/medea-4.tar.gz") (sha256 (base32 "1ad7x1sziynjjgxiv70ghbabc1mwa15mdx38wazfzn3nl7ma1hm6")))) (build-system chicken-build-system) (arguments `(#:egg-name "medea")) (native-inputs `(("chicken-test" ,chicken-test))) (propagated-inputs `(("chicken-comparse" ,chicken-comparse) ("chicken-srfi-1" ,chicken-srfi-1) ("chicken-srfi-13" ,chicken-srfi-13) ("chicken-srfi-14" ,chicken-srfi-14) ("chicken-srfi-69" ,chicken-srfi-69))) (home-page "https://api.call-cc.org/5/doc/medea") (synopsis "A JSON parser (and emitter) built with comparse") (description #f) (license license:bsd?))) --8<---------------cut here---------------end--------------->8--- Makefile.am | 3 + doc/guix.texi | 24 +++ guix/import/egg.scm | 363 ++++++++++++++++++++++++++++++++++++ guix/scripts/import.scm | 4 +- guix/scripts/import/egg.scm | 107 +++++++++++ tests/egg.scm | 90 +++++++++ 6 files changed, 589 insertions(+), 2 deletions(-) create mode 100644 guix/import/egg.scm create mode 100644 guix/scripts/import/egg.scm create mode 100644 tests/egg.scm diff --git a/Makefile.am b/Makefile.am index 8db7d6a320..3e72c3ebd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -248,6 +248,7 @@ MODULES =3D \ guix/import/cpan.scm \ guix/import/cran.scm \ guix/import/crate.scm \ + guix/import/egg.scm \ guix/import/elpa.scm \ guix/import/gem.scm \ guix/import/github.scm \ @@ -293,6 +294,7 @@ MODULES =3D \ guix/scripts/challenge.scm \ guix/scripts/import/crate.scm \ guix/scripts/import/cran.scm \ + guix/scripts/import/egg.scm \ guix/scripts/import/elpa.scm \ guix/scripts/import/gem.scm \ guix/scripts/import/gnu.scm \ @@ -449,6 +451,7 @@ SCM_TESTS =3D \ tests/debug-link.scm \ tests/derivations.scm \ tests/discovery.scm \ + tests/egg.scm \ tests/elpa.scm \ tests/file-systems.scm \ tests/gem.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index e8b0485f78..6a38ff707f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11594,6 +11594,28 @@ using this mode, the symbol of the package is made= by appending the version to its name, so that multiple versions of the same package can coexist. @end table + +@item egg +@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 +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). + +@example +guix import egg sourcehut +@end example + +Additional options include: +@table @code +@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 @end table =20 The structure of the @command{guix import} code is modular. It would be @@ -11748,6 +11770,8 @@ the updater for KDE packages; the updater for X.org packages; @item kernel.org the updater for packages hosted on kernel.org; +@item egg +the updater for @uref{https://wiki.call-cc.org/eggs/, Egg} packages; @item elpa the updater for @uref{https://elpa.gnu.org/, ELPA} packages; @item cran diff --git a/guix/import/egg.scm b/guix/import/egg.scm new file mode 100644 index 0000000000..eb342dac32 --- /dev/null +++ b/guix/import/egg.scm @@ -0,0 +1,363 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix import egg) + #:use-module (ice-9 ftw) + #:use-module (ice-9 match) + #:use-module (ice-9 string-fun) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (web uri) + #:use-module (sxml simple) + #:use-module ((sxml xpath) #:hide (filter)) + #:use-module (gcrypt hash) + #:use-module (guix git) + #:use-module (guix i18n) + #:use-module (guix http-client) + #:use-module (guix base32) + #:use-module (guix memoization) + #:use-module (guix packages) + #:use-module (guix upstream) + #:use-module (guix build-system) + #:use-module (guix store) + #:use-module ((guix download) #:select (download-to-store url-fetch)) + #:use-module (guix import utils) + #:use-module ((guix licenses) #:prefix license:) + #:export (egg->guix-package + egg-recursive-import + %egg-updater + + guix-package->egg-name)) + +;;; Commentary: +;;; +;;; (guix import egg) provides package importer for CHICKEN eggs. See the +;;; official specification format for eggs +;;; . +;;; +;;; 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. +;;; +;;; * All the eggs are stored as tarballs at +;;; , so we grab the tarball for +;;; the egg from there. +;;; +;;; * The rest of the package fields will be parsed from the PACKAGE.egg f= ile. +;;; +;;; Todos: +;;; +;;; * Support for CHICKEN 4? +;;; +;;; * Some packages will specify a specific version of a depencency in the +;;; PACKAGE.egg file, how should we handle this? +;;; +;;; Code: + + +;;; +;;; Egg metadata fetcher and helper functions. +;;; + +(define package-name-prefix "chicken-") + +(define %eggs-url + (make-parameter "https://code.call-cc.org/egg-tarballs/5")) + +(define %eggs-home-page + (make-parameter "https://api.call-cc.org/5/doc")) + +(define (egg-source-url name version) + "Return the URL to the source tarball for version VERSION of the CHICKEN= egg +NAME." + (string-append (%eggs-url) "/" name "/" name "-" version ".tar.gz")) + +(define (egg-name->guix-name name) + "Return the package name for CHICKEN egg NAME." + (string-append package-name-prefix name)) + +(define (get-eggs-repository) + "Update or fetch the latest version of the eggs repository and return th= e path +to the repository." + (let*-values (((url) "git://code.call-cc.org/eggs-5-latest") + ((directory commit _) + (update-cached-checkout url))) + directory)) + +(define (egg-directory name) + "Return the directory containing the source code for the egg NAME." + (let ((eggs-directory (get-eggs-repository))) + (string-append eggs-directory "/" name))) + +(define (find-latest-version name) + "Get the latest version of the egg NAME." + (let ((directory (scandir (egg-directory name)))) + (if directory + (last directory) + (begin + (format #t (G_ "Package not found in eggs repository: ~a~%") nam= e) + #f)))) + +(define (get-metadata port) + "Parse the egg metadata from PORT." + (let ((content (read port))) + (close-port port) + content)) + +(define (egg-metadata name) + "Return the package metadata file for the egg NAME." + (let ((version (find-latest-version name))) + (if version + (get-metadata (open-file + (string-append (egg-directory name) "/" + version "/" name ".egg") + "r")) + #f))) + +(define (guix-name->egg-name name) + "Return the CHICKEN egg name corresponding to the Guix package NAME." + (if (string-prefix? package-name-prefix name) + (substring name (string-length package-name-prefix)) + name)) + +(define (guix-package->egg-name package) + "Return the CHICKEN egg name of the Guix CHICKEN PACKAGE." + (let ((upstream-name (assoc-ref + (package-properties package) + 'upstream-name)) + (name (package-name package))) + (if upstream-name + upstream-name + (guix-name->egg-name name)))) + +(define (egg-package? package) + "Check if PACKAGE is an CHICKEN egg package." + (and (eq? (build-system-name (package-build-system package)) 'chicken) + (string-prefix? package-name-prefix (package-name package)))) + +(define string->license + ;; Doesn't seem to use a specific format. + ;; + (match-lambda + ("GPL-2" 'license:gpl2) + ("GPL-3" 'license:gpl3) + ("GPL" 'license:gpl?) + ("AGPL-3" 'license:agpl3) + ("AGPL" 'license:agpl?) + ("LGPL-2.1" 'license:lgpl2.1) + ("LGPL-3" 'license:lgpl3) + ("LGPL" 'license:lgpl?) + ("BSD-2" 'license:bsd-2) + ("BSD-3" 'license:bsd-3) + ("BSD" 'license:bsd?) + ("MIT" 'license:expat) + ("ISC" 'license:isc) + ("Artistic-2" 'license:artistic2.0) + ("Apache-2.0" 'license:asl2.0) + ("Public Domain" 'license:public-domain) + ((x) (string->license x)) + ((lst ...) `(list ,@(map string->license lst))) + (_ #f))) + + +;;; +;;; Egg importer. +;;; + +(define* (egg->guix-package name #:key (port #f) (source #f)) + "Import CHICKEN egg NAME from and return a @code{} record type = for +the egg, or @code{#f} on failure. PORT is the port for the NAME.egg to re= ad +from. SOURCE is the a ``file-like'' object containing the source code +corresonding to the egg. If SOURCE is not specified, the tarball for the = egg +will be downloaded. + +Specifying the SOURCE argument is mainly useful for developing a CHICKEN e= gg +locally. Note that if PORT and SOURCE are specified, +recursive import will not work." + (define egg-content (if port + (get-metadata port) + (egg-metadata name))) + (if (not egg-content) + (values #f '()) ; egg doesn't exist + (let* ((version* (or (assoc-ref egg-content 'version) + (find-latest-version name))) + (version (if (list? version*) (first version*) version*)) + (source-url (if source #f (egg-source-url name version))) + (tarball (if source + #f + (with-store store + (download-to-store store source-url))))) + + (define (safe-append lst1 lst2) + (match (list lst1 lst2) + ((#f #f) #f) + ((lst1 #f) lst1) + ((#f lst2) lst2) + (_ (append lst1 lst2)))) + + (define egg-home-page + (string-append (%eggs-home-page) "/" name)) + + (define egg-synopsis + (let ((synopsis (assoc-ref egg-content 'synopsis))) + (if (list? synopsis) + (first synopsis) + #f))) + + (define egg-license + (let ((license (assoc-ref egg-content 'license))) + (if (list? license) + ;; Multiple licenses are separated by `/'. + (string->license (string-split (first license) #\/)) + #f))) + + (define (prettify-system-dependency name) + (let ((name* (if (symbol? name) + (symbol->string name) + name))) + ;; System dependecies sometimes have spaces and/or upper case + ;; letters in them. + ;; + ;; There will probably still be some weird edge cases. + (string-replace-substring (string-downcase name*) " " ""))) + + (define (maybe-string->symbol str) + (if (string? str) (string->symbol string) str)) + + (define (maybe-symbol->string sym) + (if (symbol? sym) (symbol->string sym) sym)) + + (define* (egg-parse-dependency name #:key (system? #f)) + (let* ((name* (if (list? name) + (first name) ; (name version) + name)) + (name (if system? + (prettify-system-dependency name*) + (maybe-symbol->string name*)))) + ;; Dependencies are sometimes specified as symbols and sometim= es + ;; as strings + (list (string-append (if system? "" package-name-prefix) + name) + (list 'unquote + (string->symbol (string-append + (if system? "" package-name-prefi= x) + name)))))) + + (define egg-propagated-inputs + (let ((dependencies (assoc-ref egg-content 'dependencies))) + (if (list? dependencies) + (map egg-parse-dependency + dependencies) + '()))) + + ;; TODO: Or should these be propagated? + (define egg-inputs + (let ((dependencies (assoc-ref egg-content 'foreign-dependencies= ))) + (if (list? dependencies) + (map (lambda (name) + (egg-parse-dependency name #:system? #t)) + dependencies) + '()))) + + (define egg-native-inputs + (let* ((test-dependencies (assoc-ref egg-content + 'test-dependencies)) + (build-dependencies (assoc-ref egg-content + 'build-dependencies)) + (test+build-dependencies (safe-append + test-dependencies + build-dependencies))) + (if (list? test+build-dependencies) + (map egg-parse-dependency + test+build-dependencies) + '()))) + + ;; Copied from (guix import hackage). + (define (maybe-inputs input-type inputs) + (match inputs + (() + '()) + ((inputs ...) + (list (list input-type + (list 'quasiquote inputs)))))) + + (values + `(package + (name ,(egg-name->guix-name name)) + (version ,version) + (source + ,(if source + source + `(origin + (method url-fetch) + (uri ,source-url) + (sha256 + (base32 ,(if tarball + (bytevector->nix-base32-string + (file-sha256 tarball)) + "failed to download tar archive")))))) + (build-system chicken-build-system) + (arguments ,(list 'quasiquote (list #:egg-name name))) + ,@(maybe-inputs 'native-inputs egg-native-inputs) + ,@(maybe-inputs 'inputs egg-inputs) + ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs) + (home-page ,egg-home-page) + (synopsis ,egg-synopsis) + (description #f) + (license ,egg-license)) + (filter (lambda (name) + (not (member name '("srfi-4")))) + (map (compose guix-name->egg-name first) + (append egg-propagated-inputs + egg-native-inputs))))))) + +(define egg->guix-package/m ;memoized variant + (memoize egg->guix-package)) + +(define (egg-recursive-import package-name) + (recursive-import package-name + #:repo->guix-package (lambda* (name #:key version repo) + (egg->guix-package/m name)) + #:guix-name egg-name->guix-name)) + + +;;; +;;; Updater. +;;; + +(define (latest-release package) + "Return an @code{} for the latest release of PACKAGE." + (let* ((egg-name (guix-package->egg-name package)) + (version (find-latest-version egg-name)) + (source-url (egg-source-url egg-name version))) + (upstream-source + (package (package-name package)) + (version version) + (urls (list source-url))))) + +(define %egg-updater + (upstream-updater + (name 'egg) + (description "Updater for CHICKEN egg packages") + (pred egg-package?) + (latest latest-release))) + +;;; egg.scm ends here diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index bbd9a3b190..f53d1ac1f4 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -76,8 +76,8 @@ rather than \\n." ;;; Entry point. ;;; =20 -(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "elpa" "gem" - "go" "cran" "crate" "texlive" "json" "opam")) +(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa" + "gem" "go" "cran" "crate" "texlive" "json" "opam")) =20 (define (resolve-importer name) (let ((module (resolve-interface diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm new file mode 100644 index 0000000000..7dbd6fcd5a --- /dev/null +++ b/guix/scripts/import/egg.scm @@ -0,0 +1,107 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts import egg) + #:use-module (guix ui) + #:use-module (guix utils) + #:use-module (guix scripts) + #:use-module (guix import egg) + #:use-module (guix scripts import) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:use-module (ice-9 format) + #:export (guix-import-egg)) + + +;;; +;;; Command-line options. +;;; + +(define %default-options + '()) + +(define (show-help) + (display (G_ "Usage: guix import egg PACKAGE-NAME +Import and convert the egg 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)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix import egg"))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive #t result))) + %standard-import-options)) + + +;;; +;;; Entry point. +;;; + +(define (guix-import-egg . args) + (define (parse-options) + ;; Return the alist of option values. + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) + + (let* ((opts (parse-options)) + (repo (and=3D> (assoc-ref opts 'repo) string->symbol)) + (args (filter-map (match-lambda + (('argument . value) + value) + (_ #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))) + (() + (leave (G_ "too few arguments~%"))) + ((many ...) + (leave (G_ "too many arguments~%")))))) diff --git a/tests/egg.scm b/tests/egg.scm new file mode 100644 index 0000000000..b853f777c4 --- /dev/null +++ b/tests/egg.scm @@ -0,0 +1,90 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-eggs) + #:use-module (guix import egg) + #:use-module (guix gexp) + #:use-module (guix base32) + #:use-module (gcrypt hash) + #:use-module (guix tests) + #:use-module ((guix build syscalls) #:select (mkdtemp!)) + #:use-module ((guix build utils) #:select (delete-file-recursively mkdir= -p which)) + #:use-module ((guix utils) #:select (call-with-temporary-output-file)) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64) + #:use-module (web uri) + #:use-module (ice-9 match)) + +(define test-egg-1 + "((synopsis \"Example egg\") + (license \"GPL-3/MIT\") + (version \"1.0.0\") + (test-dependencies test srfi-1) + (foreign-dependencies libgit2) + (build-dependencies begin-syntax) + (dependencies datatype) + (author \"John Doe\"))") + +(test-begin "egg") + +(test-equal "guix-package->egg-name" + "bar" + (guix-package->egg-name + (dummy-package "dummy" + (name "chicken-bar")))) + +;; Copied from tests/hackage.scm +(define-syntax-rule (define-package-matcher name pattern) + (define* (name obj) + (match obj + (pattern #t) + (x (pk 'fail x #f))))) + +(define (eval-test-with-egg-file egg-test matcher) + (define port (open-input-string egg-test)) + (matcher (egg->guix-package "foo" + #:port port + #:source (plain-file "foo-egg" "content")))) + +(define-package-matcher match-chicken-foo + ('package + ('name "chicken-foo") + ('version "1.0.0") + ('source (? file-like? source)) + ('build-system 'chicken-build-system) + ('arguments ('quasiquote ('#:egg-name "foo"))) + ('native-inputs + ('quasiquote + (("chicken-test" ('unquote chicken-test)) + ("chicken-srfi-1" ('unquote chicken-srfi-1)) + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) + ('inputs + ('quasiquote + (("libgit2" ('unquote libgit2))))) + ('propagated-inputs + ('quasiquote + (("chicken-datatype" ('unquote chicken-datatype))))) + ('home-page "https://api.call-cc.org/5/doc/foo") + ('synopsis "Example egg") + ('description #f) + ('license (list 'license:gpl3 'license:expat)))) + +(test-assert "egg->guix-package local file" + (eval-test-with-egg-file test-egg-1 match-chicken-foo)) + +(test-end "egg") base-commit: 23ab7067f32495a8a02710c08b7cfe0e21be7f3f --=20 2.31.1 From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH] import: Add CHICKEN egg importer. Resent-From: raingloom Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 28 May 2021 03:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Xinglu Chen Cc: 48697@debbugs.gnu.org X-Debbugs-Original-Cc: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162217238511801 (code B ref -1); Fri, 28 May 2021 03:27:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 May 2021 03:26:25 +0000 Received: from localhost ([127.0.0.1]:53402 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmT8i-00034H-RH for submit@debbugs.gnu.org; Thu, 27 May 2021 23:26:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:55290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmT8g-000343-Gw for submit@debbugs.gnu.org; Thu, 27 May 2021 23:26:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51638) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmT8g-00081Y-AJ for guix-patches@gnu.org; Thu, 27 May 2021 23:26:22 -0400 Received: from mx1.riseup.net ([198.252.153.129]:42136) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmT8e-0007Q1-98 for guix-patches@gnu.org; Thu, 27 May 2021 23:26:21 -0400 Received: from fews1.riseup.net (fews1-pn.riseup.net [10.0.1.83]) (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 4Frqpd5ZpBzDq6S; Thu, 27 May 2021 20:26:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1622172377; bh=pMQoijzMRSHjLAuwGTgl27qbaHJ8BbWG9DVMeUehHLM=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=SPRTxDWbAgIC6jHIB++heVcNq+4j/DkSv1Aw7apkiA9UhaOjV+hmO0RgqJQTlfk1Q dcr7fcDoQI0laffDhtEIyhKcvgJYdgOp3iRjPJGdG3ss2u+ZMIFovoQIL9AJP0OvTS J5KF0LCMXmg/wa92hp6iN88wcmYG6cBPmNQgvb0s= X-Riseup-User-ID: 8A45ECE5F1E6D727655EBF5FC41F023C64631B2731D1DE49C683A4247B01921F Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews1.riseup.net (Postfix) with ESMTPSA id 4Frqpc5wpqz5vbM; Thu, 27 May 2021 20:26:16 -0700 (PDT) Date: Thu, 27 May 2021 21:21:54 +0200 From: raingloom Message-ID: <20210527212154.1f8d07bc@riseup.net> In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=198.252.153.129; envelope-from=raingloom@riseup.net; helo=mx1.riseup.net X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_06_12=1.543, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 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: On Thu, 27 May 2021 14:48:30 +0200 Xinglu Chen wrote: > * guix/import/egg.scm: New file. > * guix/scripts/import/egg.scm: New file. > * tests/egg.scm: New file. > * Makefile.am (MODULES, SCM_TESTS): Register them. > * guix/scripts/import.scm (importers): [...] Content analysis details: (1.7 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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.0 SPF_HELO_PASS SPF: HELO matches SPF record 0.9 SPF_FAIL SPF: sender does not match SPF record (fail) [SPF failed: Please see http://www.openspf.org/Why?s=mfrom; id=raingloom%40riseup.net; ip=209.51.188.17; r=debbugs.gnu.org] 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 1.1 DATE_IN_PAST_06_12 Date: is 6 to 12 hours before Received: date 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [209.51.188.17 listed in wl.mailspike.net] 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders 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.7 (/) On Thu, 27 May 2021 14:48:30 +0200 Xinglu Chen wrote: > * guix/import/egg.scm: New file. > * guix/scripts/import/egg.scm: New file. > * tests/egg.scm: New file. > * Makefile.am (MODULES, SCM_TESTS): Register them. > * guix/scripts/import.scm (importers): Add egg importer. > * doc/guix.texi (Invoking guix import, Invoking guix refresh): > Document it. --- > [ Cc=E2=80=99ing raingloom since you wrote the CHICKEN build system ] >=20 > This patch adds recursive importer for CHICKEN eggs, the generated > packages aren=E2=80=99t entirely complete, though. It gets information f= rom > The PACKAGE.egg, which is just a Scheme file that contains a list of > lists that specify the metadata for an egg. However, it doesn=E2=80=99t > specify a description, so I have just set the =E2=80=98description=E2=80= =99 field to > #f for now. The licensing policy for eggs is also a bit vague[1], > there is no strict naming format for licenses, and a lot of eggs just > specify =E2=80=98BSD=E2=80=99 rather than =E2=80=98BSD-N-Clause=E2=80=99. Aaaa, thank you so much for this! I was actually considering writing one, but now I don't have to. UwU But seriously, thanks! Gonna give it a spin soon. From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH] import: Add CHICKEN egg importer. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 29 May 2021 16:45:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Xinglu Chen Cc: 48697@debbugs.gnu.org, raingloom Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.16223066563477 (code B ref 48697); Sat, 29 May 2021 16:45:02 +0000 Received: (at 48697) by debbugs.gnu.org; 29 May 2021 16:44:16 +0000 Received: from localhost ([127.0.0.1]:57607 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln24N-0000u0-OA for submit@debbugs.gnu.org; Sat, 29 May 2021 12:44:16 -0400 Received: from eggs.gnu.org ([209.51.188.92]:51758) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln24L-0000tj-1J for 48697@debbugs.gnu.org; Sat, 29 May 2021 12:44:14 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47342) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ln24E-0002s8-Px; Sat, 29 May 2021 12:44:06 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=40312 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ln24E-0007ff-HT; Sat, 29 May 2021 12:44:06 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: Date: Sat, 29 May 2021 18:44:04 +0200 In-Reply-To: (Xinglu Chen's message of "Thu, 27 May 2021 14:48:30 +0200") Message-ID: <87zgwd7anf.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.3 (/) 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 (-) Hello! Xinglu Chen skribis: > * guix/import/egg.scm: New file. > * guix/scripts/import/egg.scm: New file. > * tests/egg.scm: New file. > * Makefile.am (MODULES, SCM_TESTS): Register them. > * guix/scripts/import.scm (importers): Add egg importer. > * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document i= t. Woohoo, very nice! > This patch adds recursive importer for CHICKEN eggs, the generated > packages aren=E2=80=99t entirely complete, though. It gets information f= rom The > PACKAGE.egg, which is just a Scheme file that contains a list of lists > that specify the metadata for an egg. However, it doesn=E2=80=99t specif= y a > description, so I have just set the =E2=80=98description=E2=80=99 field t= o #f for now. > The licensing policy for eggs is also a bit vague[1], there is no strict > naming format for licenses, and a lot of eggs just specify =E2=80=98BSD= =E2=80=99 rather > than =E2=80=98BSD-N-Clause=E2=80=99. On IRC, Mario Goulart of CHICKEN fame mentioned that they are working on it, linking to this discussion: https://lists.nongnu.org/archive/html/chicken-hackers/2020-10/msg00003.ht= ml So hopefully it=E2=80=99ll improve soon. In the meantime, what this patch = does (leaving a question mark when licensing is vague) LGTM. > The PACKAGE.egg file can also specify system dependencies, but there is > no consistent format for this, sometimes strings are used, other times > symbols are used, and sometimes the version of the package is also > included. The user will have to double check the names and make sure > they are correct. I am also unsure about whether the system > dependencies should be =E2=80=98propagated-inputs=E2=80=99 or just =E2=80= =98inputs=E2=80=99. Probably just =E2=80=98inputs=E2=80=99, no? Why would they need to be prop= agated? For Guile (and Python, etc.) they have to be propagated because you need .scm and .go files to be in the search path; but with CHICKEN, I believe you end up with .so files, so there=E2=80=99s probably no need for propagat= ion? Not sure actually. > + #:use-module (ice-9 string-fun) Uh, first time I see this one (!). Maybe add #:select to clarify why it=E2=80=99s used for. > +(define %eggs-home-page > + (make-parameter "https://api.call-cc.org/5/doc")) On IRC, Mario suggested that a better value may be "https://wiki.call-cc.org/egg/". > +(define (get-eggs-repository) > + "Update or fetch the latest version of the eggs repository and return = the path > +to the repository." > + (let*-values (((url) "git://code.call-cc.org/eggs-5-latest") > + ((directory commit _) > + (update-cached-checkout url))) > + directory)) I=E2=80=99d call it =E2=80=98eggs-repository=E2=80=99 (without =E2=80=98get= -=E2=80=99). Also, I recommend using srfi-71 instead of srfi-11 in new code. > +(define (find-latest-version name) > + "Get the latest version of the egg NAME." > + (let ((directory (scandir (egg-directory name)))) > + (if directory > + (last directory) > + (begin > + (format #t (G_ "Package not found in eggs repository: ~a~%") n= ame) > + #f)))) This should be rendered with =E2=80=98warning=E2=80=99 from (guix diagnosti= cs). Or maybe it should be raised as a =E2=80=98formatted-message=E2=80=99 excep= tion? > +(define (get-metadata port) > + "Parse the egg metadata from PORT." > + (let ((content (read port))) > + (close-port port) > + content)) > + > +(define (egg-metadata name) > + "Return the package metadata file for the egg NAME." > + (let ((version (find-latest-version name))) > + (if version > + (get-metadata (open-file > + (string-append (egg-directory name) "/" > + version "/" name ".egg") > + "r")) > + #f))) Rather: (call-with-input-file (string-append =E2=80=A6) read) =E2=80=A6 and you can remove =E2=80=98get-metadata=E2=80=99. > +(define (guix-name->egg-name name) > + "Return the CHICKEN egg name corresponding to the Guix package NAME." > + (if (string-prefix? package-name-prefix name) > + (substring name (string-length package-name-prefix)) > + name)) Use =E2=80=98string-drop=E2=80=99 instead of =E2=80=98substring=E2=80=99; I= find it slightly clearer. > +(define (guix-package->egg-name package) > + "Return the CHICKEN egg name of the Guix CHICKEN PACKAGE." > + (let ((upstream-name (assoc-ref > + (package-properties package) > + 'upstream-name)) > + (name (package-name package))) > + (if upstream-name > + upstream-name > + (guix-name->egg-name name)))) This can be simplified a bit: (define (guix-package->egg-name package) (or (assq-ref (package-properties package) 'upstream-name) (guix-name->egg-name (package-name package)))) > +(define (egg-package? package) > + "Check if PACKAGE is an CHICKEN egg package." > + (and (eq? (build-system-name (package-build-system package)) 'chicken) > + (string-prefix? package-name-prefix (package-name package)))) I suggest not relying on build system names; they=E2=80=99re just a debuggi= ng aid. Thus, replace the first =E2=80=98eq?=E2=80=99 with: (eq? (package-build-system package) chicken-build-system) > + (define (safe-append lst1 lst2) > + (match (list lst1 lst2) > + ((#f #f) #f) > + ((lst1 #f) lst1) > + ((#f lst2) lst2) > + (_ (append lst1 lst2)))) This looks like a weird interface. I=E2=80=99d simply ensure you always manipulate lists: empty lists or non-empty lists. > + (define egg-home-page > + (string-append (%eggs-home-page) "/" name)) > + > + (define egg-synopsis > + (let ((synopsis (assoc-ref egg-content 'synopsis))) > + (if (list? synopsis) > + (first synopsis) > + #f))) Rather: (match (assoc-ref egg-content 'synopsis) ((synopsis) synopsis) (_ #f)) > + (define egg-license > + (let ((license (assoc-ref egg-content 'license))) > + (if (list? license) > + ;; Multiple licenses are separated by `/'. > + (string->license (string-split (first license) #\/)) > + #f))) Just make it =E2=80=98egg-licenses=E2=80=99 (plural) since the =E2=80=98lic= ense=E2=80=99 field of can be a list, and then: (match (assoc-ref egg-content 'license) ((license) (map string->license (string-split license #\/))) (#f '())) > + (define (prettify-system-dependency name) > + (let ((name* (if (symbol? name) > + (symbol->string name) > + name))) > + ;; System dependecies sometimes have spaces and/or upper case Typo (=E2=80=9Cdependencies=E2=80=9D). > + ;; letters in them. > + ;; > + ;; There will probably still be some weird edge cases. > + (string-replace-substring (string-downcase name*) " " ""))) How about: (string-map (lambda (chr) (case chr ((#\space) #\-) (else chr))) (string-downcase name)) ? > + (define* (egg-parse-dependency name #:key (system? #f)) > + (let* ((name* (if (list? name) > + (first name) ; (name version) > + name)) > + (name (if system? > + (prettify-system-dependency name*) > + (maybe-symbol->string name*)))) Use =E2=80=98match=E2=80=99. > + (define egg-native-inputs > + (let* ((test-dependencies (assoc-ref egg-content > + 'test-dependencies)) > + (build-dependencies (assoc-ref egg-content > + 'build-dependencies)) > + (test+build-dependencies (safe-append > + test-dependencies > + build-dependencies))) > + (if (list? test+build-dependencies) > + (map egg-parse-dependency > + test+build-dependencies) > + '()))) Use =E2=80=98match=E2=80=99. Arrange so =E2=80=98test-dependencies=E2=80= =99 and =E2=80=98build-dependencies=E2=80=99 are always lists so you don=E2=80=99t need =E2=80=98safe-append=E2=80=99. Last, could you add files that contain translatable strings to =E2=80=98po/guix/POTFILES.in=E2=80=99? Otherwise LGTM. Could you send an updated patch? Thank you! Ludo=E2=80=99. From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 29 May 2021 19:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 48697@debbugs.gnu.org, raingloom Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.162231790030273 (code B ref 48697); Sat, 29 May 2021 19:52:02 +0000 Received: (at 48697) by debbugs.gnu.org; 29 May 2021 19:51:40 +0000 Received: from localhost ([127.0.0.1]:57751 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln4zj-0007sC-N0 for submit@debbugs.gnu.org; Sat, 29 May 2021 15:51:40 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:41308 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln4zg-0007rn-Da for 48697@debbugs.gnu.org; Sat, 29 May 2021 15:51:39 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622317888; bh=j9+MSZ/FRWOcnRmS75j6dTONqeAWj9740RYD5f1fkYU=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=kC0Xb9qbjtpfQm5OBy0935762sjV4/vnC7gUXgOms78oQTr9Gg8ne7BVW8Dy2JpAX fAA81df/h9+Nlfi6715BdRZITiO/68+3v/2c/qiBn8qP1U7vx4XwPJ1SlAoWOdwp1m C3ByS+M25IdAzQpPLcaGrVouFLph3NGfiSnLJQDk= In-Reply-To: <87zgwd7anf.fsf@gnu.org> References: <87zgwd7anf.fsf@gnu.org> Date: Sat, 29 May 2021 21:51:06 +0200 Message-ID: <87eedppbdh.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 2.9 (++) 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: On Sat, May 29 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Hello! > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_ [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 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: 2.9 (++) 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: On Sat, May 29 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Hello! > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_ [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 1.0 BULK_RE_SUSP_NTLD Precedence bulk and RE: from a suspicious TLD 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Sat, May 29 2021, Ludovic Court=C3=A8s wrote: > Hello! > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_TESTS): Register them. >> * guix/scripts/import.scm (importers): Add egg importer. >> * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document = it. > > Woohoo, very nice! > >> This patch adds recursive importer for CHICKEN eggs, the generated >> packages aren=E2=80=99t entirely complete, though. It gets information = from The >> PACKAGE.egg, which is just a Scheme file that contains a list of lists >> that specify the metadata for an egg. However, it doesn=E2=80=99t speci= fy a >> description, so I have just set the =E2=80=98description=E2=80=99 field = to #f for now. >> The licensing policy for eggs is also a bit vague[1], there is no strict >> naming format for licenses, and a lot of eggs just specify =E2=80=98BSD= =E2=80=99 rather >> than =E2=80=98BSD-N-Clause=E2=80=99. > > On IRC, Mario Goulart of CHICKEN fame mentioned that they are working on > it, linking to this discussion: > > https://lists.nongnu.org/archive/html/chicken-hackers/2020-10/msg00003.= html That=E2=80=99s great to see! >> The PACKAGE.egg file can also specify system dependencies, but there is >> no consistent format for this, sometimes strings are used, other times >> symbols are used, and sometimes the version of the package is also >> included. The user will have to double check the names and make sure >> they are correct. I am also unsure about whether the system >> dependencies should be =E2=80=98propagated-inputs=E2=80=99 or just =E2= =80=98inputs=E2=80=99. > > Probably just =E2=80=98inputs=E2=80=99, no? Why would they need to be pr= opagated? For > Guile (and Python, etc.) they have to be propagated because you need > .scm and .go files to be in the search path; but with CHICKEN, I believe > you end up with .so files, so there=E2=80=99s probably no need for propag= ation? > Not sure actually. Ah, that makes sense, I am actually not that familiar with CHICKEN. :) >> + #:use-module (ice-9 string-fun) > > Uh, first time I see this one (!). Maybe add #:select to clarify why > it=E2=80=99s used for. It=E2=80=99s needed for the =E2=80=98string-replace-substring=E2=80=99 proc= edure. Here is the relevant part of the Guile manual (in case you were curios) The following additional functions are available in the module =E2=80=98(ice-9 string-fun)=E2=80=99. They can be used with: =20=20 (use-modules (ice-9 string-fun)) =20=20 -- Scheme Procedure: string-replace-substring str substring replacement Return a new string where every instance of SUBSTRING in string STR has been replaced by REPLACEMENT. For example: =20=20 (string-replace-substring "a ring of strings" "ring" "rut") =E2=87=92 "a rut of struts" >> +(define %eggs-home-page >> + (make-parameter "https://api.call-cc.org/5/doc")) > > On IRC, Mario suggested that a better value may be > "https://wiki.call-cc.org/egg/". Indeed, that looks like a better page. >> +(define (get-eggs-repository) >> + "Update or fetch the latest version of the eggs repository and return= the path >> +to the repository." >> + (let*-values (((url) "git://code.call-cc.org/eggs-5-latest") >> + ((directory commit _) >> + (update-cached-checkout url))) >> + directory)) > > I=E2=80=99d call it =E2=80=98eggs-repository=E2=80=99 (without =E2=80=98g= et-=E2=80=99). > > Also, I recommend using srfi-71 instead of srfi-11 in new code. Oh, I didn=E2=80=99t know about that, definitely looks nicer. >> +(define (find-latest-version name) >> + "Get the latest version of the egg NAME." >> + (let ((directory (scandir (egg-directory name)))) >> + (if directory >> + (last directory) >> + (begin >> + (format #t (G_ "Package not found in eggs repository: ~a~%") = name) >> + #f)))) > > This should be rendered with =E2=80=98warning=E2=80=99 from (guix diagnos= tics). > > Or maybe it should be raised as a =E2=80=98formatted-message=E2=80=99 exc= eption? Not sure if it should be an exception or not, if you run =E2=80=98guix impo= rt egg=E2=80=99 on a package that doesn=E2=80=99t exist, it will already throw an error =2D-8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix import egg lasdkfj Package not found in eggs repository: lasdkfj guix import: error: failed to download meta-data for package 'lasdkfj' =2D-8<---------------cut here---------------end--------------->8--- >> +(define (get-metadata port) >> + "Parse the egg metadata from PORT." >> + (let ((content (read port))) >> + (close-port port) >> + content)) >> + >> +(define (egg-metadata name) >> + "Return the package metadata file for the egg NAME." >> + (let ((version (find-latest-version name))) >> + (if version >> + (get-metadata (open-file >> + (string-append (egg-directory name) "/" >> + version "/" name ".egg") >> + "r")) >> + #f))) > > Rather: > > (call-with-input-file (string-append =E2=80=A6) > read) > > =E2=80=A6 and you can remove =E2=80=98get-metadata=E2=80=99. Good idea. >> + ;; letters in them. >> + ;; >> + ;; There will probably still be some weird edge cases. >> + (string-replace-substring (string-downcase name*) " " ""))) > > How about: > > (string-map (lambda (chr) > (case chr > ((#\space) #\-) > (else chr))) > (string-downcase name)) > > ? That would also work, and then we don=E2=80=99t have to import (ice-9 string-fun). :) >> + (define egg-native-inputs >> + (let* ((test-dependencies (assoc-ref egg-content >> + 'test-dependencies)) >> + (build-dependencies (assoc-ref egg-content >> + 'build-dependencies)) >> + (test+build-dependencies (safe-append >> + test-dependencies >> + build-dependencies))) >> + (if (list? test+build-dependencies) >> + (map egg-parse-dependency >> + test+build-dependencies) >> + '()))) > > Use =E2=80=98match=E2=80=99. Arrange so =E2=80=98test-dependencies=E2=80= =99 and =E2=80=98build-dependencies=E2=80=99 > are always lists so you don=E2=80=99t need =E2=80=98safe-append=E2=80=99. > > Last, could you add files that contain translatable strings to > =E2=80=98po/guix/POTFILES.in=E2=80=99? Sure! > Otherwise LGTM. Could you send an updated patch? > > Thank you! > > Ludo=E2=80=99. Thanks for the review! v2 will be coming. :) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmCymyoVHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5AiIP/3ndFwzFHoWnmpYJrsOhml7/ctLu YDYwkGwNKr1xdEmipJWaDgFIgdnMZbri60C1q6eRC+LxXsUOXTKvZZOT7/2v57Ef neCZyLk4Q9GwAvHAH8LSNgqaeQuT/LahexeYjW1EG45xoP0f9UCleEnYhngOT8g2 CJQnaOIx36bAK9q80v6Jut1SkocaciYWGmfQ5g7rUITp7AVcTEVIZCRH13d2vi8M D55t25+vaRjs+dinEu13xWYz8gA1v7ddfkuElo/dJ867vlym68I6uDwynFPscVIh yazqBio+bOMs2dcBW/z/68rhAOQ/d9NFGw8bRrnFvFakPB6HCIq5/JFAdmWkGbET iPwXFr5HoJkANXqV9MjTkCHBOOMf/AdlHczApmbhqs/ujg329ipH9VV4CjoFVgD6 +6ASmtD8kGJFpyMIT/wfqrTCwW41sd22gioFVH2ae+r+QWz/BxIXgIuBqSJj2yjv aGRTuhZ4TaNAWFXDBB87tYwAhOH4wwxg+XGMjHn1nTY/v91npaZNJPc5HwhDVvvr i4QEUbOZG/EcaqWP9+gPNxPRho6G7PC87Y7nQW9K9ZMvdQVVyi2502DXEb9vqN07 vmvB5SJiOo3sU/dUzZ3dhwxdHMtZ1Q2N6ZqgNRgnsgoAQdDDNv6BIQ96KXm2tXpL urlKFwRDdDAHm6r1 =o9RB -----END PGP SIGNATURE----- --=-=-=-- From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 29 May 2021 21:42:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48697@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.162232448616326 (code B ref 48697); Sat, 29 May 2021 21:42:02 +0000 Received: (at 48697) by debbugs.gnu.org; 29 May 2021 21:41:26 +0000 Received: from localhost ([127.0.0.1]:57840 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln6hs-0004FA-WE for submit@debbugs.gnu.org; Sat, 29 May 2021 17:41:26 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:43872 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ln6hq-0004Ew-Ju for 48697@debbugs.gnu.org; Sat, 29 May 2021 17:41:20 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622324472; bh=sJgkhJgE7uhNOMTZs4kLryqQyGm+6CTNgwzVEzuJ6N0=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=NfpPI3fBbFa+7Ax74WN4Yg6ILGWS4CM96M36mEcG7Z7WUXga+SoipnavMgeszCl4x Qcxp3zDJIWd94wNSB6U5c0aHwHtRwmVY7hMuH2Rt2n2k34rS0x0AF8XzR0kkHimcpg vSnlx+sr406F6QgYvI0YlG6wAEOQbu3331fabZjE= In-Reply-To: References: Message-Id: <5cc0e9783a2dc35e0475ec5ac2875fa2a1801551.1622323865.git.public@yoctocell.xyz> Date: Sat, 29 May 2021 23:41:11 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 2.9 (++) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/ [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 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.9 (+) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/ [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager * guix/import/egg.scm: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/import.scm (importers): Add egg importer. * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document it. --- Changes since v1: * Addressed the comments made by Ludovic[1] * I Changed the #:port argument for =E2=80=98egg->guix-package=E2=80=99 to = #:file since =E2=80=98get-metadata=E2=80=99 was removed in favor of =E2=80=98egg-metad= ata=E2=80=99, which reads a file and not a port. * Some minor clean up of imports that were unnecessary. One problem is that one of the tests are failing, I am not sure why. Looking at the debug output, it seems identical to the expected output (with the quotes removed), or maybe I am just blind and need more sleep. --8<---------------cut here---------------start------------->8--- ;;; (fail (package (name "chicken-foo") (version "1.0.0") (source #< name: "foo-egg" content: "content" references: ()>) (build-system chi= cken-build-system) (arguments (quasiquote (#:egg-name "foo"))) (native-inpu= ts (quasiquote (("chicken-test" (unquote chicken-test)) ("chicken-srfi-1" (= unquote chicken-srfi-1)) ("chicken-begin-syntax" (unquote chicken-begin-syn= tax))))) (inputs (quasiquote (("libgit2" (unquote libgit2))))) (propagated-= inputs (quasiquote (("chicken-datatype" (unquote chicken-datatype))))) (hom= e-page "https://wiki.call-cc.org/egg/foo") (synopsis "Example egg") (descri= ption #f) (license (license:gpl3 license:expat))) #f) test-name: egg->guix-package local file location: /home/yoctocell/src/guix/tests/egg.scm:92 source: + (test-assert + "egg->guix-package local file" + (eval-test-with-egg-file + test-egg-1 + test-egg-1-file + match-chicken-foo)) actual-value: #f result: FAIL --8<---------------cut here---------------end--------------->8--- [1]: https://issues.guix.gnu.org/48697#2 Makefile.am | 3 + doc/guix.texi | 24 +++ guix/import/egg.scm | 343 ++++++++++++++++++++++++++++++++++++ guix/scripts/import.scm | 4 +- guix/scripts/import/egg.scm | 107 +++++++++++ po/guix/POTFILES.in | 2 + tests/egg.scm | 95 ++++++++++ 7 files changed, 576 insertions(+), 2 deletions(-) create mode 100644 guix/import/egg.scm create mode 100644 guix/scripts/import/egg.scm create mode 100644 tests/egg.scm diff --git a/Makefile.am b/Makefile.am index 8db7d6a320..3e72c3ebd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -248,6 +248,7 @@ MODULES =3D \ guix/import/cpan.scm \ guix/import/cran.scm \ guix/import/crate.scm \ + guix/import/egg.scm \ guix/import/elpa.scm \ guix/import/gem.scm \ guix/import/github.scm \ @@ -293,6 +294,7 @@ MODULES =3D \ guix/scripts/challenge.scm \ guix/scripts/import/crate.scm \ guix/scripts/import/cran.scm \ + guix/scripts/import/egg.scm \ guix/scripts/import/elpa.scm \ guix/scripts/import/gem.scm \ guix/scripts/import/gnu.scm \ @@ -449,6 +451,7 @@ SCM_TESTS =3D \ tests/debug-link.scm \ tests/derivations.scm \ tests/discovery.scm \ + tests/egg.scm \ tests/elpa.scm \ tests/file-systems.scm \ tests/gem.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 52c263f7a4..7aa98c8858 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11601,6 +11601,28 @@ using this mode, the symbol of the package is made= by appending the version to its name, so that multiple versions of the same package can coexist. @end table + +@item egg +@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 +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). + +@example +guix import egg sourcehut +@end example + +Additional options include: +@table @code +@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 @end table =20 The structure of the @command{guix import} code is modular. It would be @@ -11755,6 +11777,8 @@ the updater for KDE packages; the updater for X.org packages; @item kernel.org the updater for packages hosted on kernel.org; +@item egg +the updater for @uref{https://wiki.call-cc.org/eggs/, Egg} packages; @item elpa the updater for @uref{https://elpa.gnu.org/, ELPA} packages; @item cran diff --git a/guix/import/egg.scm b/guix/import/egg.scm new file mode 100644 index 0000000000..e550201d59 --- /dev/null +++ b/guix/import/egg.scm @@ -0,0 +1,343 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix import egg) + #:use-module (ice-9 ftw) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-71) + #:use-module (gcrypt hash) + #:use-module (guix git) + #:use-module (guix i18n) + #:use-module (guix base32) + #:use-module (guix diagnostics) + #:use-module (guix memoization) + #:use-module (guix packages) + #:use-module (guix upstream) + #:use-module (guix build-system) + #:use-module (guix build-system chicken) + #:use-module (guix store) + #:use-module ((guix download) #:select (download-to-store url-fetch)) + #:use-module (guix import utils) + #:use-module ((guix licenses) #:prefix license:) + #:export (egg->guix-package + egg-recursive-import + %egg-updater + + ;; For tests. + guix-package->egg-name)) + +;;; Commentary: +;;; +;;; (guix import egg) provides package importer for CHICKEN eggs. See the +;;; official specification format for eggs +;;; . +;;; +;;; 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. +;;; +;;; * All the eggs are stored as tarballs at +;;; , so we grab the tarball for +;;; the egg from there. +;;; +;;; * The rest of the package fields will be parsed from the PACKAGE.egg f= ile. +;;; +;;; Todos: +;;; +;;; * Support for CHICKEN 4? +;;; +;;; * Some packages will specify a specific version of a depencency in the +;;; PACKAGE.egg file, how should we handle this? +;;; +;;; Code: + + +;;; +;;; Egg metadata fetcher and helper functions. +;;; + +(define package-name-prefix "chicken-") + +(define %eggs-url + (make-parameter "https://code.call-cc.org/egg-tarballs/5")) + +(define %eggs-home-page + (make-parameter "https://wiki.call-cc.org/egg")) + +(define (egg-source-url name version) + "Return the URL to the source tarball for version VERSION of the CHICKEN= egg +NAME." + (string-append (%eggs-url) "/" name "/" name "-" version ".tar.gz")) + +(define (egg-name->guix-name name) + "Return the package name for CHICKEN egg NAME." + (string-append package-name-prefix 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") + (directory commit _ (update-cached-checkout url))) + directory)) + +(define (egg-directory name) + "Return the directory containing the source code for the egg NAME." + (let ((eggs-directory (eggs-repository))) + (string-append eggs-directory "/" name))) + +(define (find-latest-version name) + "Get the latest version of the egg NAME." + (let ((directory (scandir (egg-directory name)))) + (if directory + (last directory) + (begin + (warning #t (G_ "Package not found in eggs repository: ~a~%") na= me) + #f)))) + +(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." + (call-with-input-file (or file + (string-append (egg-directory name) "/" + (find-latest-version name) + "/" name ".egg")) + read)) + +(define (guix-name->egg-name name) + "Return the CHICKEN egg name corresponding to the Guix package NAME." + (if (string-prefix? package-name-prefix name) + (string-drop name (string-length package-name-prefix)) + name)) + +(define (guix-package->egg-name package) + "Return the CHICKEN egg name of the Guix CHICKEN PACKAGE." + (or (assq-ref (package-properties package) 'upstream-name) + (guix-name->egg-name (package-name package)))) + +(define (egg-package? package) + "Check if PACKAGE is an CHICKEN egg package." + (and (eq? (package-build-system package) chicken-build-system) + (string-prefix? package-name-prefix (package-name package)))) + +(define string->license + ;; Doesn't seem to use a specific format. + ;; + (match-lambda + ("GPL-2" 'license:gpl2) + ("GPL-3" 'license:gpl3) + ("GPL" 'license:gpl?) + ("AGPL-3" 'license:agpl3) + ("AGPL" 'license:agpl?) + ("LGPL-2.1" 'license:lgpl2.1) + ("LGPL-3" 'license:lgpl3) + ("LGPL" 'license:lgpl?) + ("BSD-2" 'license:bsd-2) + ("BSD-3" 'license:bsd-3) + ("BSD" 'license:bsd?) + ("MIT" 'license:expat) + ("ISC" 'license:isc) + ("Artistic-2" 'license:artistic2.0) + ("Apache-2.0" 'license:asl2.0) + ("Public Domain" 'license:public-domain) + ((x) (string->license x)) + ((lst ...) `(list ,@(map string->license lst))) + (_ #f))) + + +;;; +;;; Egg importer. +;;; + +(define* (egg->guix-package name #:key (file #f) (source #f)) + "Import CHICKEN egg NAME from and return a record type for the +egg, or #f on failure. FILE is the filepath to the NAME.egg file. SOURCE= is +the a ``file-like'' object containing the source code corresonding to the = egg. +If SOURCE is not specified, the tarball for the egg will be downloaded. + +Specifying the SOURCE argument is mainly useful for developing a CHICKEN e= gg +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))) + (if (not egg-content) + (values #f '()) ; egg doesn't exist + (let* ((version* (or (assoc-ref egg-content 'version) + (find-latest-version name))) + (version (if (list? version*) (first version*) version*)) + (source-url (if source #f (egg-source-url name version))) + (tarball (if source + #f + (with-store store + (download-to-store store source-url))))) + + (define egg-home-page + (string-append (%eggs-home-page) "/" name)) + + (define egg-synopsis + (match (assoc-ref egg-content 'synopsis) + ((synopsis) synopsis) + (_ #f))) + + (define egg-licenses + (match (assoc-ref egg-content 'license) + ((license) + (map string->license (string-split license #\/))) + (#f + '()))) + + (define (maybe-symbol->string sym) + (if (symbol? sym) (symbol->string sym) sym)) + + (define (prettify-system-dependency name) + ;; System dependencies sometimes have spaces and/or upper case + ;; letters in them. + ;; + ;; There will probably still be some weird edge cases. + (string-map (lambda (char) + (case char + ((#\space) #\-) + (else char))) + (maybe-symbol->string name))) + + (define* (egg-parse-dependency name #:key (system? #f)) + (define extract-name + (match-lambda + ((name version) name) + (name name))) + + (define (prettify-name name) + (if system? + (prettify-system-dependency name) + (maybe-symbol->string name))) +=20=20=20=20=20=20=20=20=20=20 + (let ((name (prettify-name (extract-name name)))) + ;; Dependencies are sometimes specified as symbols and sometim= es + ;; as strings + (list (string-append (if system? "" package-name-prefix) + name) + (list 'unquote + (string->symbol (string-append + (if system? "" package-name-prefi= x) + name)))))) + + (define egg-propagated-inputs + (let ((dependencies (assoc-ref egg-content 'dependencies))) + (if (list? dependencies) + (map egg-parse-dependency + dependencies) + '()))) + + ;; TODO: Or should these be propagated? + (define egg-inputs + (let ((dependencies (assoc-ref egg-content 'foreign-dependencies= ))) + (if (list? dependencies) + (map (lambda (name) + (egg-parse-dependency name #:system? #t)) + dependencies) + '()))) + + (define egg-native-inputs + (let* ((test-dependencies (or (assoc-ref egg-content + 'test-dependencies) + '())) + (build-dependencies (or (assoc-ref egg-content + 'build-dependencies) + '())) + (test+build-dependencies (append test-dependencies + build-dependencies))) + (match test+build-dependencies + ((_ _ ...) (map egg-parse-dependency + test+build-dependencies)) + (() '())))) + + ;; Copied from (guix import hackage). + (define (maybe-inputs input-type inputs) + (match inputs + (() + '()) + ((inputs ...) + (list (list input-type + (list 'quasiquote inputs)))))) + + (values + `(package + (name ,(egg-name->guix-name name)) + (version ,version) + (source + ,(if source + source + `(origin + (method url-fetch) + (uri ,source-url) + (sha256 + (base32 ,(if tarball + (bytevector->nix-base32-string + (file-sha256 tarball)) + "failed to download tar archive")))))) + (build-system chicken-build-system) + (arguments ,(list 'quasiquote (list #:egg-name name))) + ,@(maybe-inputs 'native-inputs egg-native-inputs) + ,@(maybe-inputs 'inputs egg-inputs) + ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs) + (home-page ,egg-home-page) + (synopsis ,egg-synopsis) + (description #f) + (license ,egg-licenses)) + (filter (lambda (name) + (not (member name '("srfi-4")))) + (map (compose guix-name->egg-name first) + (append egg-propagated-inputs + egg-native-inputs))))))) + +(define egg->guix-package/m ;memoized variant + (memoize egg->guix-package)) + +(define (egg-recursive-import package-name) + (recursive-import package-name + #:repo->guix-package (lambda* (name #:key version repo) + (egg->guix-package/m name)) + #:guix-name egg-name->guix-name)) + + +;;; +;;; Updater. +;;; + +(define (latest-release package) + "Return an @code{} for the latest release of PACKAGE." + (let* ((egg-name (guix-package->egg-name package)) + (version (find-latest-version egg-name)) + (source-url (egg-source-url egg-name version))) + (upstream-source + (package (package-name package)) + (version version) + (urls (list source-url))))) + +(define %egg-updater + (upstream-updater + (name 'egg) + (description "Updater for CHICKEN egg packages") + (pred egg-package?) + (latest latest-release))) + +;;; egg.scm ends here diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index bbd9a3b190..f53d1ac1f4 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -76,8 +76,8 @@ rather than \\n." ;;; Entry point. ;;; =20 -(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "elpa" "gem" - "go" "cran" "crate" "texlive" "json" "opam")) +(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa" + "gem" "go" "cran" "crate" "texlive" "json" "opam")) =20 (define (resolve-importer name) (let ((module (resolve-interface diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm new file mode 100644 index 0000000000..7dbd6fcd5a --- /dev/null +++ b/guix/scripts/import/egg.scm @@ -0,0 +1,107 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts import egg) + #:use-module (guix ui) + #:use-module (guix utils) + #:use-module (guix scripts) + #:use-module (guix import egg) + #:use-module (guix scripts import) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:use-module (ice-9 format) + #:export (guix-import-egg)) + + +;;; +;;; Command-line options. +;;; + +(define %default-options + '()) + +(define (show-help) + (display (G_ "Usage: guix import egg PACKAGE-NAME +Import and convert the egg 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)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix import egg"))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive #t result))) + %standard-import-options)) + + +;;; +;;; Entry point. +;;; + +(define (guix-import-egg . args) + (define (parse-options) + ;; Return the alist of option values. + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) + + (let* ((opts (parse-options)) + (repo (and=3D> (assoc-ref opts 'repo) string->symbol)) + (args (filter-map (match-lambda + (('argument . value) + value) + (_ #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))) + (() + (leave (G_ "too few arguments~%"))) + ((many ...) + (leave (G_ "too many arguments~%")))))) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 74cc5ebf9a..8fd944ff22 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -7,6 +7,7 @@ gnu/system.scm gnu/services/shepherd.scm gnu/system/mapped-devices.scm gnu/system/shadow.scm +guix/import/egg.scm guix/import/opam.scm gnu/installer.scm gnu/installer/connman.scm @@ -99,6 +100,7 @@ guix/scripts/environment.scm guix/scripts/time-machine.scm guix/scripts/import/cpan.scm guix/scripts/import/crate.scm +guix/scripts/import/egg.scm guix/scripts/import/gem.scm guix/scripts/import/gnu.scm guix/scripts/import/go.scm diff --git a/tests/egg.scm b/tests/egg.scm new file mode 100644 index 0000000000..88817a1a16 --- /dev/null +++ b/tests/egg.scm @@ -0,0 +1,95 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-eggs) + #:use-module (guix import egg) + #:use-module (guix gexp) + #:use-module (guix base32) + #:use-module (gcrypt hash) + #:use-module (guix tests) + #:use-module ((guix build syscalls) #:select (mkdtemp!)) + #:use-module ((guix build utils) #:select (delete-file-recursively mkdir= -p which)) + #:use-module ((guix utils) #:select (call-with-temporary-output-file)) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64) + #:use-module (web uri) + #:use-module (ice-9 match)) + +(define test-egg-1 + "\ +((synopsis \"Example egg\") +(license \"GPL-3/MIT\") +(version \"1.0.0\") +(test-dependencies test srfi-1) +(foreign-dependencies libgit2) +(build-dependencies begin-syntax) +(dependencies datatype) +(author \"John Doe\"))") + +(define test-egg-1-file "/tmp/guix-egg-1") + +(test-begin "egg") + +(test-equal "guix-package->egg-name" + "bar" + (guix-package->egg-name + (dummy-package "dummy" + (name "chicken-bar")))) + +;; Copied from tests/hackage.scm +(define-syntax-rule (define-package-matcher name pattern) + (define* (name obj) + (match obj + (pattern #t) + (x (pk 'fail x #f))))) + +(define (eval-test-with-egg-file egg-test egg-file matcher) + (call-with-output-file egg-file + (lambda (port) + (display egg-test port))) + (matcher (egg->guix-package "foo" + #:file egg-file + #:source (plain-file "foo-egg" "content")))) + +(define-package-matcher match-chicken-foo + ('package + ('name "chicken-foo") + ('version "1.0.0") + ('source (? file-like? source)) + ('build-system 'chicken-build-system) + ('arguments ('quasiquote ('#:egg-name "foo"))) + ('native-inputs + ('quasiquote + (("chicken-test" ('unquote chicken-test)) + ("chicken-srfi-1" ('unquote chicken-srfi-1)) + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) + ('inputs + ('quasiquote + (("libgit2" ('unquote libgit2))))) + ('propagated-inputs + ('quasiquote + (("chicken-datatype" ('unquote chicken-datatype))))) + ('home-page "https://wiki.call-cc.org/egg/foo") + ('synopsis "Example egg") + ('description #f) + ('license (list 'license:gpl3 'license:expat)))) + +(test-assert "egg->guix-package local file" + (eval-test-with-egg-file test-egg-1 test-egg-1-file match-chicken-foo)) + +(test-end "egg") base-commit: cefa260fb42693b87545b1baab8cef9723827f80 --=20 2.31.1 From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH] import: Add CHICKEN egg importer. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 31 May 2021 16:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Xinglu Chen Cc: 48697@debbugs.gnu.org, raingloom Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.162247774925877 (code B ref 48697); Mon, 31 May 2021 16:16:02 +0000 Received: (at 48697) by debbugs.gnu.org; 31 May 2021 16:15:49 +0000 Received: from localhost ([127.0.0.1]:34683 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnkZw-0006jI-Ui for submit@debbugs.gnu.org; Mon, 31 May 2021 12:15:49 -0400 Received: from eggs.gnu.org ([209.51.188.92]:50042) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnkZv-0006iz-8r for 48697@debbugs.gnu.org; Mon, 31 May 2021 12:15:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50210) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lnkZm-00074D-OF; Mon, 31 May 2021 12:15:40 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=48394 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lnkZm-0000El-Fz; Mon, 31 May 2021 12:15:38 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87zgwd7anf.fsf@gnu.org> <87eedppbdh.fsf@yoctocell.xyz> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 12 Prairial an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Mon, 31 May 2021 18:15:36 +0200 In-Reply-To: <87eedppbdh.fsf@yoctocell.xyz> (Xinglu Chen's message of "Sat, 29 May 2021 21:51:06 +0200") Message-ID: <87v96y3mmv.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.3 (/) 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 (-) Heya, Xinglu Chen skribis: > On Sat, May 29 2021, Ludovic Court=C3=A8s wrote: [...] >>> +(define (find-latest-version name) >>> + "Get the latest version of the egg NAME." >>> + (let ((directory (scandir (egg-directory name)))) >>> + (if directory >>> + (last directory) >>> + (begin >>> + (format #t (G_ "Package not found in eggs repository: ~a~%")= name) >>> + #f)))) >> >> This should be rendered with =E2=80=98warning=E2=80=99 from (guix diagno= stics). >> >> Or maybe it should be raised as a =E2=80=98formatted-message=E2=80=99 ex= ception? > > Not sure if it should be an exception or not, if you run =E2=80=98guix im= port egg=E2=80=99 > on a package that doesn=E2=80=99t exist, it will already throw an error > > $ ./pre-inst-env guix import egg lasdkfj > Package not found in eggs repository: lasdkfj > guix import: error: failed to download meta-data for package 'lasdkfj' True! So perhaps we can omit the extra message altogether since it doesn=E2=80=99t convey any more info. Thanks, Ludo=E2=80=99. From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 31 May 2021 18:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 48697@debbugs.gnu.org, raingloom Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.16224840623222 (code B ref 48697); Mon, 31 May 2021 18:02:01 +0000 Received: (at 48697) by debbugs.gnu.org; 31 May 2021 18:01:02 +0000 Received: from localhost ([127.0.0.1]:34767 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnmDl-0000pi-Hs for submit@debbugs.gnu.org; Mon, 31 May 2021 14:01:01 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:48544 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnmDj-0000pF-Fb for 48697@debbugs.gnu.org; Mon, 31 May 2021 14:01:00 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622484053; bh=cekBY7vexKf/+jkueIuu0Xa804bo1ZgqA6QoaGg/KxQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=WPDClUC7o1fSf0JvCkebDMJHBMi4IUz0kHXSgzOZdiJnd+CmxnpORdpej7rpzlAYc tU5WIB22rYB2TCYRtSCGXZTXh3M6yUbI+w89pcPOST8FrDjtX5S6z8J5gzjsv2kSGv C33kSFOupRx4mdsF/uSHYsr5RC6jl/UH0XoBx+6A= In-Reply-To: <87v96y3mmv.fsf@gnu.org> References: <87zgwd7anf.fsf@gnu.org> <87eedppbdh.fsf@yoctocell.xyz> <87v96y3mmv.fsf@gnu.org> Date: Mon, 31 May 2021 20:00:51 +0200 Message-ID: <87lf7u3hrg.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 2.9 (++) 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: On Mon, May 31 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Heya, > > Xinglu Chen skribis: > >> On Sat, May 29 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > > [...] > >>>> +(define (find-latest-version name) >>>> + "Get the latest version of the egg [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 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: 2.9 (++) 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: On Mon, May 31 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Heya, > > Xinglu Chen skribis: > >> On Sat, May 29 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > > [...] > >>>> +(define (find-latest-version name) >>>> + "Get the latest version of the egg [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 1.0 BULK_RE_SUSP_NTLD Precedence bulk and RE: from a suspicious TLD 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Mon, May 31 2021, Ludovic Court=C3=A8s wrote: > Heya, > > Xinglu Chen skribis: > >> On Sat, May 29 2021, Ludovic Court=C3=A8s wrote: > > [...] > >>>> +(define (find-latest-version name) >>>> + "Get the latest version of the egg NAME." >>>> + (let ((directory (scandir (egg-directory name)))) >>>> + (if directory >>>> + (last directory) >>>> + (begin >>>> + (format #t (G_ "Package not found in eggs repository: ~a~%"= ) name) >>>> + #f)))) >>> >>> This should be rendered with =E2=80=98warning=E2=80=99 from (guix diagn= ostics). >>> >>> Or maybe it should be raised as a =E2=80=98formatted-message=E2=80=99 e= xception? >> >> Not sure if it should be an exception or not, if you run =E2=80=98guix i= mport egg=E2=80=99 >> on a package that doesn=E2=80=99t exist, it will already throw an error >> >> $ ./pre-inst-env guix import egg lasdkfj >> Package not found in eggs repository: lasdkfj >> guix import: error: failed to download meta-data for package 'lasdkfj' > > True! So perhaps we can omit the extra message altogether since it > doesn=E2=80=99t convey any more info. That would work as well. :) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmC1JFMVHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5OKEP/21Ag57TzryIULOU6Kr2ftQPiQsv o0jQtFDlu2Ibt9bozcvD5eMb5z7SOAxSdUSXacZBGwHcTPeXs1RUuNwN4FfJ6Y6/ eNAtB87yFvBN/hyoYK40nsf72KxbnRFeG3rhUHB+pmUOQNP4sLNeY1JmHVN9bsRF ORs5k7aix7rvGfdkpsoGVWv+3itKvo/VmPtYmOhMwjP0iN/F34bAg6pkrSm5Llk4 qCP9OOGAoNza7kBOJeNMqyvKvI20JCb//Zhc3PU0KNnJQtTsUnEfG/wnP9XcmAMo No9Dsdd+6BQUd6JBs/UBBXVT2V4w2Pt9lMIyGbZrFah4gSdXkIea9J16gzLPDD2G WlpFsxlmbuu6hBW8epsNQW3YolWo8Oc9MGqu2rYWRcvaUhgAe19k/3RqMQhRp214 eidIvdFIICZwfLT/H9muSwtW1vM/cC/EQvBa+QhunVE2KUtjj/vwC/AQubpwTZwU tR0BqXXF5C1lvOwntPE/VligQe8ih+LhOm6rnnc9JkkP2SlK/KX+bu9Hhq9wPomk bMybtxdp813DLEf9l4MrWIDaPYrl9JrWEuXzSDCSZCTvZuH30ER5UmKIm39Ww6+s 3+82ZnmqxoQBdP6RbjO6PzH/zi0kRj9IJj2vhP20eWOsrglci17ctPjhmM1jI0oR wERo1DtZbOMjFCaa =xEbH -----END PGP SIGNATURE----- --=-=-=-- From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH v3] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 31 May 2021 18:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48697@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= , raingloom Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.16224857686204 (code B ref 48697); Mon, 31 May 2021 18:30:02 +0000 Received: (at 48697) by debbugs.gnu.org; 31 May 2021 18:29:28 +0000 Received: from localhost ([127.0.0.1]:34781 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnmfD-0001bt-BD for submit@debbugs.gnu.org; Mon, 31 May 2021 14:29:28 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:49172 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lnmf9-0001bb-L4 for 48697@debbugs.gnu.org; Mon, 31 May 2021 14:29:21 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622485753; bh=eX3fKKOKiWp+Z9yoFSZPw1n5XVGqe2xQJbTLSN6r3uI=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=jH4naBYL806uaENCBpVZ58gkSezltf4bUeQqy8LGSIa8uDzVRhNfNd22CYJsi8FHo WnJ3BZPWxIj7MlZSLl/3L47H4HIFcZF4fJ6kz59qT90cF4FI2TNk/ihZHPvxD4BWB1 R8zldCn9703oirFkkYtT70eQt0mDQCr6/JETp61c= In-Reply-To: References: Message-Id: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> Date: Mon, 31 May 2021 20:29:12 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 2.9 (++) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/ [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 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.9 (+) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/ [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager * guix/import/egg.scm: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/import.scm (importers): Add egg importer. * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document it. --- Changes since v2: * Remove message telling the user that the egg doesn=E2=80=99t exist, =E2= =80=98guix import=E2=80=99 will already throw an error if this happens. * Fixed the failing test, I just had to change (license (list 'a 'b)) to (license '(a b)), duh. =20=20 Makefile.am | 3 + doc/guix.texi | 24 +++ guix/import/egg.scm | 341 ++++++++++++++++++++++++++++++++++++ guix/scripts/import.scm | 4 +- guix/scripts/import/egg.scm | 107 +++++++++++ po/guix/POTFILES.in | 2 + tests/egg.scm | 94 ++++++++++ 7 files changed, 573 insertions(+), 2 deletions(-) create mode 100644 guix/import/egg.scm create mode 100644 guix/scripts/import/egg.scm create mode 100644 tests/egg.scm diff --git a/Makefile.am b/Makefile.am index 8db7d6a320..3e72c3ebd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -248,6 +248,7 @@ MODULES =3D \ guix/import/cpan.scm \ guix/import/cran.scm \ guix/import/crate.scm \ + guix/import/egg.scm \ guix/import/elpa.scm \ guix/import/gem.scm \ guix/import/github.scm \ @@ -293,6 +294,7 @@ MODULES =3D \ guix/scripts/challenge.scm \ guix/scripts/import/crate.scm \ guix/scripts/import/cran.scm \ + guix/scripts/import/egg.scm \ guix/scripts/import/elpa.scm \ guix/scripts/import/gem.scm \ guix/scripts/import/gnu.scm \ @@ -449,6 +451,7 @@ SCM_TESTS =3D \ tests/debug-link.scm \ tests/derivations.scm \ tests/discovery.scm \ + tests/egg.scm \ tests/elpa.scm \ tests/file-systems.scm \ tests/gem.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 0126099d68..0340fd4968 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11601,6 +11601,28 @@ using this mode, the symbol of the package is made= by appending the version to its name, so that multiple versions of the same package can coexist. @end table + +@item egg +@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 +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). + +@example +guix import egg sourcehut +@end example + +Additional options include: +@table @code +@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 @end table =20 The structure of the @command{guix import} code is modular. It would be @@ -11755,6 +11777,8 @@ the updater for KDE packages; the updater for X.org packages; @item kernel.org the updater for packages hosted on kernel.org; +@item egg +the updater for @uref{https://wiki.call-cc.org/eggs/, Egg} packages; @item elpa the updater for @uref{https://elpa.gnu.org/, ELPA} packages; @item cran diff --git a/guix/import/egg.scm b/guix/import/egg.scm new file mode 100644 index 0000000000..4505dfbc4d --- /dev/null +++ b/guix/import/egg.scm @@ -0,0 +1,341 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix import egg) + #:use-module (ice-9 ftw) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-71) + #:use-module (gcrypt hash) + #:use-module (guix git) + #:use-module (guix i18n) + #:use-module (guix base32) + #:use-module (guix diagnostics) + #:use-module (guix memoization) + #:use-module (guix packages) + #:use-module (guix upstream) + #:use-module (guix build-system) + #:use-module (guix build-system chicken) + #:use-module (guix store) + #:use-module ((guix download) #:select (download-to-store url-fetch)) + #:use-module (guix import utils) + #:use-module ((guix licenses) #:prefix license:) + #:export (egg->guix-package + egg-recursive-import + %egg-updater + + ;; For tests. + guix-package->egg-name)) + +;;; Commentary: +;;; +;;; (guix import egg) provides package importer for CHICKEN eggs. See the +;;; official specification format for eggs +;;; . +;;; +;;; 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. +;;; +;;; * All the eggs are stored as tarballs at +;;; , so we grab the tarball for +;;; the egg from there. +;;; +;;; * The rest of the package fields will be parsed from the PACKAGE.egg f= ile. +;;; +;;; Todos: +;;; +;;; * Support for CHICKEN 4? +;;; +;;; * Some packages will specify a specific version of a depencency in the +;;; PACKAGE.egg file, how should we handle this? +;;; +;;; Code: + + +;;; +;;; Egg metadata fetcher and helper functions. +;;; + +(define package-name-prefix "chicken-") + +(define %eggs-url + (make-parameter "https://code.call-cc.org/egg-tarballs/5")) + +(define %eggs-home-page + (make-parameter "https://wiki.call-cc.org/egg")) + +(define (egg-source-url name version) + "Return the URL to the source tarball for version VERSION of the CHICKEN= egg +NAME." + (string-append (%eggs-url) "/" name "/" name "-" version ".tar.gz")) + +(define (egg-name->guix-name name) + "Return the package name for CHICKEN egg NAME." + (string-append package-name-prefix 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") + (directory commit _ (update-cached-checkout url))) + directory)) + +(define (egg-directory name) + "Return the directory containing the source code for the egg NAME." + (let ((eggs-directory (eggs-repository))) + (string-append eggs-directory "/" name))) + +(define (find-latest-version name) + "Get the latest version of the egg NAME." + (let ((directory (scandir (egg-directory name)))) + (if directory + (last directory) + #f))) + +(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." + (call-with-input-file (or file + (string-append (egg-directory name) "/" + (find-latest-version name) + "/" name ".egg")) + read)) + +(define (guix-name->egg-name name) + "Return the CHICKEN egg name corresponding to the Guix package NAME." + (if (string-prefix? package-name-prefix name) + (string-drop name (string-length package-name-prefix)) + name)) + +(define (guix-package->egg-name package) + "Return the CHICKEN egg name of the Guix CHICKEN PACKAGE." + (or (assq-ref (package-properties package) 'upstream-name) + (guix-name->egg-name (package-name package)))) + +(define (egg-package? package) + "Check if PACKAGE is an CHICKEN egg package." + (and (eq? (package-build-system package) chicken-build-system) + (string-prefix? package-name-prefix (package-name package)))) + +(define string->license + ;; Doesn't seem to use a specific format. + ;; + (match-lambda + ("GPL-2" 'license:gpl2) + ("GPL-3" 'license:gpl3) + ("GPL" 'license:gpl?) + ("AGPL-3" 'license:agpl3) + ("AGPL" 'license:agpl?) + ("LGPL-2.1" 'license:lgpl2.1) + ("LGPL-3" 'license:lgpl3) + ("LGPL" 'license:lgpl?) + ("BSD-2" 'license:bsd-2) + ("BSD-3" 'license:bsd-3) + ("BSD" 'license:bsd?) + ("MIT" 'license:expat) + ("ISC" 'license:isc) + ("Artistic-2" 'license:artistic2.0) + ("Apache-2.0" 'license:asl2.0) + ("Public Domain" 'license:public-domain) + ((x) (string->license x)) + ((lst ...) `(list ,@(map string->license lst))) + (_ #f))) + + +;;; +;;; Egg importer. +;;; + +(define* (egg->guix-package name #:key (file #f) (source #f)) + "Import CHICKEN egg NAME from and return a record type for the +egg, or #f on failure. FILE is the filepath to the NAME.egg file. SOURCE= is +the a ``file-like'' object containing the source code corresonding to the = egg. +If SOURCE is not specified, the tarball for the egg will be downloaded. + +Specifying the SOURCE argument is mainly useful for developing a CHICKEN e= gg +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))) + (if (not egg-content) + (values #f '()) ; egg doesn't exist + (let* ((version* (or (assoc-ref egg-content 'version) + (find-latest-version name))) + (version (if (list? version*) (first version*) version*)) + (source-url (if source #f (egg-source-url name version))) + (tarball (if source + #f + (with-store store + (download-to-store store source-url))))) + + (define egg-home-page + (string-append (%eggs-home-page) "/" name)) + + (define egg-synopsis + (match (assoc-ref egg-content 'synopsis) + ((synopsis) synopsis) + (_ #f))) + + (define egg-licenses + (match (assoc-ref egg-content 'license) + ((license) + (map string->license (string-split license #\/))) + (#f + '()))) + + (define (maybe-symbol->string sym) + (if (symbol? sym) (symbol->string sym) sym)) + + (define (prettify-system-dependency name) + ;; System dependencies sometimes have spaces and/or upper case + ;; letters in them. + ;; + ;; There will probably still be some weird edge cases. + (string-map (lambda (char) + (case char + ((#\space) #\-) + (else char))) + (maybe-symbol->string name))) + + (define* (egg-parse-dependency name #:key (system? #f)) + (define extract-name + (match-lambda + ((name version) name) + (name name))) + + (define (prettify-name name) + (if system? + (prettify-system-dependency name) + (maybe-symbol->string name))) +=20=20=20=20=20=20=20=20=20=20 + (let ((name (prettify-name (extract-name name)))) + ;; Dependencies are sometimes specified as symbols and sometim= es + ;; as strings + (list (string-append (if system? "" package-name-prefix) + name) + (list 'unquote + (string->symbol (string-append + (if system? "" package-name-prefi= x) + name)))))) + + (define egg-propagated-inputs + (let ((dependencies (assoc-ref egg-content 'dependencies))) + (if (list? dependencies) + (map egg-parse-dependency + dependencies) + '()))) + + ;; TODO: Or should these be propagated? + (define egg-inputs + (let ((dependencies (assoc-ref egg-content 'foreign-dependencies= ))) + (if (list? dependencies) + (map (lambda (name) + (egg-parse-dependency name #:system? #t)) + dependencies) + '()))) + + (define egg-native-inputs + (let* ((test-dependencies (or (assoc-ref egg-content + 'test-dependencies) + '())) + (build-dependencies (or (assoc-ref egg-content + 'build-dependencies) + '())) + (test+build-dependencies (append test-dependencies + build-dependencies))) + (match test+build-dependencies + ((_ _ ...) (map egg-parse-dependency + test+build-dependencies)) + (() '())))) + + ;; Copied from (guix import hackage). + (define (maybe-inputs input-type inputs) + (match inputs + (() + '()) + ((inputs ...) + (list (list input-type + (list 'quasiquote inputs)))))) + + (values + `(package + (name ,(egg-name->guix-name name)) + (version ,version) + (source + ,(if source + source + `(origin + (method url-fetch) + (uri ,source-url) + (sha256 + (base32 ,(if tarball + (bytevector->nix-base32-string + (file-sha256 tarball)) + "failed to download tar archive")))))) + (build-system chicken-build-system) + (arguments ,(list 'quasiquote (list #:egg-name name))) + ,@(maybe-inputs 'native-inputs egg-native-inputs) + ,@(maybe-inputs 'inputs egg-inputs) + ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs) + (home-page ,egg-home-page) + (synopsis ,egg-synopsis) + (description #f) + (license ,egg-licenses)) + (filter (lambda (name) + (not (member name '("srfi-4")))) + (map (compose guix-name->egg-name first) + (append egg-propagated-inputs + egg-native-inputs))))))) + +(define egg->guix-package/m ;memoized variant + (memoize egg->guix-package)) + +(define (egg-recursive-import package-name) + (recursive-import package-name + #:repo->guix-package (lambda* (name #:key version repo) + (egg->guix-package/m name)) + #:guix-name egg-name->guix-name)) + + +;;; +;;; Updater. +;;; + +(define (latest-release package) + "Return an @code{} for the latest release of PACKAGE." + (let* ((egg-name (guix-package->egg-name package)) + (version (find-latest-version egg-name)) + (source-url (egg-source-url egg-name version))) + (upstream-source + (package (package-name package)) + (version version) + (urls (list source-url))))) + +(define %egg-updater + (upstream-updater + (name 'egg) + (description "Updater for CHICKEN egg packages") + (pred egg-package?) + (latest latest-release))) + +;;; egg.scm ends here diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index bbd9a3b190..f53d1ac1f4 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -76,8 +76,8 @@ rather than \\n." ;;; Entry point. ;;; =20 -(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "elpa" "gem" - "go" "cran" "crate" "texlive" "json" "opam")) +(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa" + "gem" "go" "cran" "crate" "texlive" "json" "opam")) =20 (define (resolve-importer name) (let ((module (resolve-interface diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm new file mode 100644 index 0000000000..7dbd6fcd5a --- /dev/null +++ b/guix/scripts/import/egg.scm @@ -0,0 +1,107 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts import egg) + #:use-module (guix ui) + #:use-module (guix utils) + #:use-module (guix scripts) + #:use-module (guix import egg) + #:use-module (guix scripts import) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:use-module (ice-9 format) + #:export (guix-import-egg)) + + +;;; +;;; Command-line options. +;;; + +(define %default-options + '()) + +(define (show-help) + (display (G_ "Usage: guix import egg PACKAGE-NAME +Import and convert the egg 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)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix import egg"))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive #t result))) + %standard-import-options)) + + +;;; +;;; Entry point. +;;; + +(define (guix-import-egg . args) + (define (parse-options) + ;; Return the alist of option values. + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) + + (let* ((opts (parse-options)) + (repo (and=3D> (assoc-ref opts 'repo) string->symbol)) + (args (filter-map (match-lambda + (('argument . value) + value) + (_ #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))) + (() + (leave (G_ "too few arguments~%"))) + ((many ...) + (leave (G_ "too many arguments~%")))))) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 74cc5ebf9a..8fd944ff22 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -7,6 +7,7 @@ gnu/system.scm gnu/services/shepherd.scm gnu/system/mapped-devices.scm gnu/system/shadow.scm +guix/import/egg.scm guix/import/opam.scm gnu/installer.scm gnu/installer/connman.scm @@ -99,6 +100,7 @@ guix/scripts/environment.scm guix/scripts/time-machine.scm guix/scripts/import/cpan.scm guix/scripts/import/crate.scm +guix/scripts/import/egg.scm guix/scripts/import/gem.scm guix/scripts/import/gnu.scm guix/scripts/import/go.scm diff --git a/tests/egg.scm b/tests/egg.scm new file mode 100644 index 0000000000..d89368da61 --- /dev/null +++ b/tests/egg.scm @@ -0,0 +1,94 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-eggs) + #:use-module (guix import egg) + #:use-module (guix gexp) + #:use-module (guix base32) + #:use-module (gcrypt hash) + #:use-module (guix tests) + #:use-module ((guix build syscalls) #:select (mkdtemp!)) + #:use-module ((guix build utils) #:select (delete-file-recursively mkdir= -p which)) + #:use-module ((guix utils) #:select (call-with-temporary-output-file)) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64) + #:use-module (web uri) + #:use-module (ice-9 match)) + +(define test-egg-1 + '((synopsis "Example egg") + (license "GPL-3/MIT") + (version "1.0.0") + (test-dependencies test srfi-1) + (foreign-dependencies libgit2) + (build-dependencies begin-syntax) + (dependencies datatype) + (author "John Doe"))) + +(define test-egg-1-file "/tmp/guix-egg-1") + +(test-begin "egg") + +(test-equal "guix-package->egg-name" + "bar" + (guix-package->egg-name + (dummy-package "dummy" + (name "chicken-bar")))) + +;; Copied from tests/hackage.scm +(define-syntax-rule (define-package-matcher name pattern) + (define* (name obj) + (match obj + (pattern #t) + (x (pk 'fail x #f))))) + +(define (eval-test-with-egg-file egg-test egg-file matcher) + (call-with-output-file egg-file + (lambda (port) + (write egg-test port))) + (matcher (egg->guix-package "foo" + #:file egg-file + #:source (plain-file "foo-egg" "content")))) + +(define-package-matcher match-chicken-foo + ('package + ('name "chicken-foo") + ('version "1.0.0") + ('source (? file-like? source)) + ('build-system 'chicken-build-system) + ('arguments ('quasiquote ('#:egg-name "foo"))) + ('native-inputs + ('quasiquote + (("chicken-test" ('unquote chicken-test)) + ("chicken-srfi-1" ('unquote chicken-srfi-1)) + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) + ('inputs + ('quasiquote + (("libgit2" ('unquote libgit2))))) + ('propagated-inputs + ('quasiquote + (("chicken-datatype" ('unquote chicken-datatype))))) + ('home-page "https://wiki.call-cc.org/egg/foo") + ('synopsis "Example egg") + ('description #f) + ('license '(license:gpl3 license:expat)))) + +(test-assert "egg->guix-package local file" + (eval-test-with-egg-file test-egg-1 test-egg-1-file match-chicken-foo)) + +(test-end "egg") base-commit: f463f376e91ccc1fe4ab68d5e822b5d71a1234f5 --=20 2.31.1 From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH v3] import: Add CHICKEN egg importer. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 01 Jun 2021 21:12:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Xinglu Chen Cc: 48697@debbugs.gnu.org, raingloom Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.16225818667767 (code B ref 48697); Tue, 01 Jun 2021 21:12:01 +0000 Received: (at 48697) by debbugs.gnu.org; 1 Jun 2021 21:11:06 +0000 Received: from localhost ([127.0.0.1]:38041 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loBfG-00021C-6P for submit@debbugs.gnu.org; Tue, 01 Jun 2021 17:11:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:32934) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loBfE-00020i-2h for 48697@debbugs.gnu.org; Tue, 01 Jun 2021 17:11:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47320) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1loBf7-0005mf-VI; Tue, 01 Jun 2021 17:10:57 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=57836 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1loBf6-0003ML-Mw; Tue, 01 Jun 2021 17:10:57 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 13 Prairial an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Tue, 01 Jun 2021 23:10:54 +0200 In-Reply-To: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> (Xinglu Chen's message of "Mon, 31 May 2021 20:29:12 +0200") Message-ID: <87mts9z3xd.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.3 (/) 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 (-) Hi! Xinglu Chen skribis: > * guix/import/egg.scm: New file. > * guix/scripts/import/egg.scm: New file. > * tests/egg.scm: New file. > * Makefile.am (MODULES, SCM_TESTS): Register them. > * po/guix/POTFILES.in: Likewise. > * guix/scripts/import.scm (importers): Add egg importer. > * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document i= t. > --- > Changes since v2: > * Remove message telling the user that the egg doesn=E2=80=99t exist, =E2= =80=98guix > import=E2=80=99 will already throw an error if this happens. > > * Fixed the failing test, I just had to change (license (list 'a 'b)) to > (license '(a b)), duh. This LGTM, except this last bit, as shown here: > +(define-package-matcher match-chicken-foo > + ('package > + ('name "chicken-foo") > + ('version "1.0.0") > + ('source (? file-like? source)) > + ('build-system 'chicken-build-system) > + ('arguments ('quasiquote ('#:egg-name "foo"))) > + ('native-inputs > + ('quasiquote > + (("chicken-test" ('unquote chicken-test)) > + ("chicken-srfi-1" ('unquote chicken-srfi-1)) > + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) > + ('inputs > + ('quasiquote > + (("libgit2" ('unquote libgit2))))) > + ('propagated-inputs > + ('quasiquote > + (("chicken-datatype" ('unquote chicken-datatype))))) > + ('home-page "https://wiki.call-cc.org/egg/foo") > + ('synopsis "Example egg") > + ('description #f) > + ('license '(license:gpl3 license:expat)))) The generated =E2=80=98license=E2=80=99 team is incorrect. For multiple li= censes, the generated code should look like: (package ;; =E2=80=A6 (license (list license:gpl3 license:expat))) For a single license: (package ;; =E2=80=A6 (license license:gpl3+)) Compare with: --8<---------------cut here---------------start------------->8--- $ ./pre-inst-env guix import egg sourcehut | tail -1 Starting download of /tmp/guix-file.N300R0 >From https://code.call-cc.org/egg-tarballs/5/sourcehut/sourcehut-0.3.3.tar.= gz... =E2=80=A6.3.3.tar.gz 20KiB 678KiB/s 00:00 [#############= #####] 100.0% (license (license:bsd?))) --8<---------------cut here---------------end--------------->8--- That=E2=80=99s the last remaining issue in my view. Could you send a v3? BTW, if you want, you can also send a snippet for =E2=80=98etc/news.scm=E2= =80=99 to announce =E2=80=98guix import egg=E2=80=99 to fellow users! You can take i= nspiration from the =E2=80=98guix import go=E2=80=99 news entry; I=E2=80=99ll fix up t= he commit ID when committing. Thanks! Ludo=E2=80=99. From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH v3] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 01 Jun 2021 22:06:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 48697@debbugs.gnu.org, raingloom Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.162258512512919 (code B ref 48697); Tue, 01 Jun 2021 22:06:02 +0000 Received: (at 48697) by debbugs.gnu.org; 1 Jun 2021 22:05:25 +0000 Received: from localhost ([127.0.0.1]:38109 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loCVp-0003MI-1O for submit@debbugs.gnu.org; Tue, 01 Jun 2021 18:05:25 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:57214 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loCVm-0003M1-B4 for 48697@debbugs.gnu.org; Tue, 01 Jun 2021 18:05:23 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622585116; bh=jf1ozOV3qVZ1AI/V/eRS4gT62E28ivZVpmJkzLDXllw=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=UoGPxCFGWqHFaaFoBFD51o5VKtl3eUNOFM3gmNCZaeraQ2yxX6nmjE9oSxTUKyRwS YYu8NxXfiD/4f/0cVNjZ4l1jBc5DdnOfYWnoiOfKZaaWb4zKxAqK8YcH9V0mQbcS+S mnThb7MiZ1MGJgj/GcaPHuWPCVBGu5RQTUhj5q/8= In-Reply-To: <87mts9z3xd.fsf@gnu.org> References: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> <87mts9z3xd.fsf@gnu.org> Date: Wed, 02 Jun 2021 00:05:15 +0200 Message-ID: <877djdxmuc.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 2.9 (++) 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: On Tue, Jun 01 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Hi! > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_TES [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 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: 2.9 (++) 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: On Tue, Jun 01 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Hi! > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_TES [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 1.0 BULK_RE_SUSP_NTLD Precedence bulk and RE: from a suspicious TLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Tue, Jun 01 2021, Ludovic Court=C3=A8s wrote: > Hi! > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_TESTS): Register them. >> * po/guix/POTFILES.in: Likewise. >> * guix/scripts/import.scm (importers): Add egg importer. >> * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document = it. >> --- >> Changes since v2: >> * Remove message telling the user that the egg doesn=E2=80=99t exist, = =E2=80=98guix >> import=E2=80=99 will already throw an error if this happens. >> >> * Fixed the failing test, I just had to change (license (list 'a 'b)) to >> (license '(a b)), duh. > > This LGTM, except this last bit, as shown here: > >> +(define-package-matcher match-chicken-foo >> + ('package >> + ('name "chicken-foo") >> + ('version "1.0.0") >> + ('source (? file-like? source)) >> + ('build-system 'chicken-build-system) >> + ('arguments ('quasiquote ('#:egg-name "foo"))) >> + ('native-inputs >> + ('quasiquote >> + (("chicken-test" ('unquote chicken-test)) >> + ("chicken-srfi-1" ('unquote chicken-srfi-1)) >> + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) >> + ('inputs >> + ('quasiquote >> + (("libgit2" ('unquote libgit2))))) >> + ('propagated-inputs >> + ('quasiquote >> + (("chicken-datatype" ('unquote chicken-datatype))))) >> + ('home-page "https://wiki.call-cc.org/egg/foo") >> + ('synopsis "Example egg") >> + ('description #f) >> + ('license '(license:gpl3 license:expat)))) > > The generated =E2=80=98license=E2=80=99 team is incorrect. For multiple = licenses, the > generated code should look like: > > (package > ;; =E2=80=A6 > (license (list license:gpl3 license:expat))) > > For a single license: > > (package > ;; =E2=80=A6 > (license license:gpl3+)) > > Compare with: > > --8<---------------cut here---------------start------------->8--- > $ ./pre-inst-env guix import egg sourcehut | tail -1 > > Starting download of /tmp/guix-file.N300R0 > From https://code.call-cc.org/egg-tarballs/5/sourcehut/sourcehut-0.3.3.ta= r.gz... > =E2=80=A6.3.3.tar.gz 20KiB 678KiB/s 00:00 [###########= #######] 100.0% > (license (license:bsd?))) > --8<---------------cut here---------------end--------------->8--- Ah, good catch! > That=E2=80=99s the last remaining issue in my view. Could you send a v3? > > BTW, if you want, you can also send a snippet for =E2=80=98etc/news.scm= =E2=80=99 to > announce =E2=80=98guix import egg=E2=80=99 to fellow users! You can take= inspiration > from the =E2=80=98guix import go=E2=80=99 news entry; I=E2=80=99ll fix up= the commit ID when > committing. Sure, sound good! --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmC2rxsVHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5tZoP/2PV/afNQrjhkata6goKT9J6naOn IKSBZHeRXC45jnmB3lip1w3PU9NQ+QWRJWVBrgYBzsbNYGhaOyUGPv0Zxevk5j9s Slz4yXs2SYFi3fur52IrzO2QV00BgjC4rbfN7loyE9K/BHx5Dmzr4ODJI39eJBos eqBO233TBD+sv0vqISn0ck6aWAc5Q2yITAL39+OT0zK5k8RErNp9z8G1sbTEt6EI DHAUf644QWHmPPf1AwwZQGU1dzKy+89JY3LiPuicX9SSzgVg0dakI+QGsZFX7PBk 0oqaVYtXKFZm+bSEVma/mcDCKR3V5kBGFQbocstYB2jMyP5/+wJY6dp5YI2ZDr7b 5Js3PTBIOLUiHrzdSjp6UvlFj3hMxJs5sX7d9b+rlWWa6EX4o24R809sJ1pTnQbz 5qcTJZwjYHIqlhwcpG1E0j63lFpi2Z+/h1yRqzVstbNU+cF9xhOxk8ykdxxfZgtE 8FdgvvlW0z/SnZ+GdakABTnWakuPqvsyYqjtBG8yMrDNPDjBIFziuOeHt8ePHWkM 5+3rr4M9l89Vkd2VvO4wA7vnJB/oEzr8NDr27LVbYr9i+DB7CaJ9koXnVu49sR7c wJU/kQbzNaRY5gHlbWbgkS89B/fselxQ9jR7h2fElyrE1zF8M+6Kx+O8h6C7zo2x 9K3vS38aDbjUXIeB =7p3o -----END PGP SIGNATURE----- --=-=-=-- From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH v4] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 02 Jun 2021 15:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48697@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 48697-submit@debbugs.gnu.org id=B48697.162264712125335 (code B ref 48697); Wed, 02 Jun 2021 15:19:02 +0000 Received: (at 48697) by debbugs.gnu.org; 2 Jun 2021 15:18:41 +0000 Received: from localhost ([127.0.0.1]:41154 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loSdg-0006aU-VH for submit@debbugs.gnu.org; Wed, 02 Jun 2021 11:18:41 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:50158 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1loSdZ-0006a7-Vr for 48697@debbugs.gnu.org; Wed, 02 Jun 2021 11:18:34 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622647103; bh=mqc1zjc/dj94q0RNvDonYtZiFLr/GIORXyP6i0Mx7qQ=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=cLGd2ZIocrIQMcEJdgkqGZ+H/y2qT2lII2mjBQnVILoMY4Hb19VkjGL4T/SP6M1oi HW/4IvIuoEFrvIIaEJkpWq6owZGki70qX/mDrL6DlntkEnOP7fzGlbI1eU03+uAzmk j2qxVZ81Oc3Ivtnt2TG6N6uCa/oXWSe1NLOiGZoY= In-Reply-To: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> References: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> Message-Id: <0a08cf8ad3ee4db5002e683d48e45f8b1084cd02.1622646776.git.public@yoctocell.xyz> Date: Wed, 02 Jun 2021 17:18:22 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 2.9 (++) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/ [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 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.9 (+) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/ [...] Content analysis details: (1.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager * guix/import/egg.scm: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * po/guix/POTFILES.in: Likewise. * guix/scripts/import.scm (importers): Add egg importer. * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document it. * etc/news.scm: Add entry. --- Changes since v3: * Fix generated license field, as pointed out by Ludovic. I also added a new test where the test egg only contains a single license, rather than multiple ones. * I took a look at the egg index[1] and added some more cases to the =E2=80=98string->license=E2=80=99 procedure. * Add news entry for the importer, both English and Chinese. My Chinese is not that good so the Chinese translation might not be the best, but still better than nothing I guess... Also, don=E2=80=99t forget to update the commit id in the news entry :) [1]: https://wiki.call-cc.org/chicken-projects/egg-index-5.html Makefile.am | 3 + doc/guix.texi | 24 +++ etc/news.scm | 24 +++ guix/import/egg.scm | 352 ++++++++++++++++++++++++++++++++++++ guix/scripts/import.scm | 4 +- guix/scripts/import/egg.scm | 107 +++++++++++ po/guix/POTFILES.in | 2 + tests/egg.scm | 132 ++++++++++++++ 8 files changed, 646 insertions(+), 2 deletions(-) create mode 100644 guix/import/egg.scm create mode 100644 guix/scripts/import/egg.scm create mode 100644 tests/egg.scm diff --git a/Makefile.am b/Makefile.am index 8db7d6a320..3e72c3ebd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -248,6 +248,7 @@ MODULES =3D \ guix/import/cpan.scm \ guix/import/cran.scm \ guix/import/crate.scm \ + guix/import/egg.scm \ guix/import/elpa.scm \ guix/import/gem.scm \ guix/import/github.scm \ @@ -293,6 +294,7 @@ MODULES =3D \ guix/scripts/challenge.scm \ guix/scripts/import/crate.scm \ guix/scripts/import/cran.scm \ + guix/scripts/import/egg.scm \ guix/scripts/import/elpa.scm \ guix/scripts/import/gem.scm \ guix/scripts/import/gnu.scm \ @@ -449,6 +451,7 @@ SCM_TESTS =3D \ tests/debug-link.scm \ tests/derivations.scm \ tests/discovery.scm \ + tests/egg.scm \ tests/elpa.scm \ tests/file-systems.scm \ tests/gem.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index 0126099d68..0340fd4968 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11601,6 +11601,28 @@ using this mode, the symbol of the package is made= by appending the version to its name, so that multiple versions of the same package can coexist. @end table + +@item egg +@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 +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). + +@example +guix import egg sourcehut +@end example + +Additional options include: +@table @code +@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 @end table =20 The structure of the @command{guix import} code is modular. It would be @@ -11755,6 +11777,8 @@ the updater for KDE packages; the updater for X.org packages; @item kernel.org the updater for packages hosted on kernel.org; +@item egg +the updater for @uref{https://wiki.call-cc.org/eggs/, Egg} packages; @item elpa the updater for @uref{https://elpa.gnu.org/, ELPA} packages; @item cran diff --git a/etc/news.scm b/etc/news.scm index 65d83061df..6eb483f7ff 100644 --- a/etc/news.scm +++ b/etc/news.scm @@ -14,6 +14,7 @@ ;; Copyright =C2=A9 2021 Zhu Zihao ;; Copyright =C2=A9 2021 Chris Marusich ;; Copyright =C2=A9 2021 Maxime Devos +;; Copyright =C2=A9 2021 Xinglu Chen ;; ;; Copying and distribution of this file, with or without modification, are ;; permitted in any medium without royalty provided the copyright notice a= nd @@ -22,6 +23,29 @@ (channel-news (version 0) =20 + (entry (commit "0000000000000000000000000000000000000000") + (title + (en "New @command{guix import egg} command") + (zh "=E6=96=B0=E7=9A=84 @command{guix import egg} =E5=91=BD=E4=BB= =A4")) + (body + (en "The new @command{guix import egg} command allows packagers to +generate a package definition or a template thereof given the name of a +CHICKEN egg package, like so: + +@example +guix import egg sourcehut +@end example + +Run @command{info \"(guix) Invoking guix import\"} for more info.") + (zh "=E6=96=B0=E7=9A=84 @command{guix import egg} =E5=91=BD=E4=BB= =A4=E8=83=BD=E8=AE=A9=E8=B4=A1=E7=8C=AE=E8=80=85=E4=BB=8E=E4=B8=80=E4=B8=AA= CHICKEN egg=E7=94=9F +=E6=88=90=E4=B8=80=E4=B8=AA=E5=8C=85=E8=A3=85=E6=88=96=E5=8C=85=E8=A3=85= =E6=A0=B7=E6=9D=BF=E3=80=82 + +@example +guix import egg sourcehut +@end example + +=E6=83=B3=E4=BA=86=E8=A7=A3=E6=9B=B4=E5=A4=9A=E5=8F=AF=E4=BB=A5=E8=BF=90= =E8=A1=8C @command{info \"(guix) Invoking guix import\"}=E3=80=82"))) +=20 (entry (commit "2161820ebbbab62a5ce76c9101ebaec54dc61586") (title (en "Risk of local privilege escalation during user account creat= ion") diff --git a/guix/import/egg.scm b/guix/import/egg.scm new file mode 100644 index 0000000000..26f8364732 --- /dev/null +++ b/guix/import/egg.scm @@ -0,0 +1,352 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix import egg) + #:use-module (ice-9 ftw) + #:use-module (ice-9 match) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-71) + #:use-module (gcrypt hash) + #:use-module (guix git) + #:use-module (guix i18n) + #:use-module (guix base32) + #:use-module (guix diagnostics) + #:use-module (guix memoization) + #:use-module (guix packages) + #:use-module (guix upstream) + #:use-module (guix build-system) + #:use-module (guix build-system chicken) + #:use-module (guix store) + #:use-module ((guix download) #:select (download-to-store url-fetch)) + #:use-module (guix import utils) + #:use-module ((guix licenses) #:prefix license:) + #:export (egg->guix-package + egg-recursive-import + %egg-updater + + ;; For tests. + guix-package->egg-name)) + +;;; Commentary: +;;; +;;; (guix import egg) provides package importer for CHICKEN eggs. See the +;;; official specification format for eggs +;;; . +;;; +;;; 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. +;;; +;;; * All the eggs are stored as tarballs at +;;; , so we grab the tarball for +;;; the egg from there. +;;; +;;; * The rest of the package fields will be parsed from the PACKAGE.egg f= ile. +;;; +;;; Todos: +;;; +;;; * Support for CHICKEN 4? +;;; +;;; * Some packages will specify a specific version of a depencency in the +;;; PACKAGE.egg file, how should we handle this? +;;; +;;; Code: + + +;;; +;;; Egg metadata fetcher and helper functions. +;;; + +(define package-name-prefix "chicken-") + +(define %eggs-url + (make-parameter "https://code.call-cc.org/egg-tarballs/5")) + +(define %eggs-home-page + (make-parameter "https://wiki.call-cc.org/egg")) + +(define (egg-source-url name version) + "Return the URL to the source tarball for version VERSION of the CHICKEN= egg +NAME." + (string-append (%eggs-url) "/" name "/" name "-" version ".tar.gz")) + +(define (egg-name->guix-name name) + "Return the package name for CHICKEN egg NAME." + (string-append package-name-prefix 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") + (directory commit _ (update-cached-checkout url))) + directory)) + +(define (egg-directory name) + "Return the directory containing the source code for the egg NAME." + (let ((eggs-directory (eggs-repository))) + (string-append eggs-directory "/" name))) + +(define (find-latest-version name) + "Get the latest version of the egg NAME." + (let ((directory (scandir (egg-directory name)))) + (if directory + (last directory) + #f))) + +(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." + (call-with-input-file (or file + (string-append (egg-directory name) "/" + (find-latest-version name) + "/" name ".egg")) + read)) + +(define (guix-name->egg-name name) + "Return the CHICKEN egg name corresponding to the Guix package NAME." + (if (string-prefix? package-name-prefix name) + (string-drop name (string-length package-name-prefix)) + name)) + +(define (guix-package->egg-name package) + "Return the CHICKEN egg name of the Guix CHICKEN PACKAGE." + (or (assq-ref (package-properties package) 'upstream-name) + (guix-name->egg-name (package-name package)))) + +(define (egg-package? package) + "Check if PACKAGE is an CHICKEN egg package." + (and (eq? (package-build-system package) chicken-build-system) + (string-prefix? package-name-prefix (package-name package)))) + +(define string->license + ;; Doesn't seem to use a specific format. + ;; + (match-lambda + ("GPL-2" 'license:gpl2) + ("GPL-2+" 'license:gpl2+) + ("GPL-3" 'license:gpl3) + ("GPL-3+" 'license:gpl3+) + ("GPL" 'license:gpl?) + ("AGPL-3" 'license:agpl3) + ("AGPL" 'license:agpl?) + ("LGPL-2.0" 'license:lgpl2.0) + ("LGPL-2.0+" 'license:lgpl2.0+) + ("LGPL-2.1" 'license:lgpl2.1) + ("LGPL-2.1+" 'license:lgpl2.1+) + ("LGPL-3" 'license:lgpl3) + ("LGPL-3" 'license:lgpl3+) + ("LGPL" 'license:lgpl?) + ("BSD-1-Clause" 'license:bsd-1) + ("BSD-2-Clause" 'license:bsd-2) + ("BSD-3-Clause" 'license:bsd-3) + ("BSD" 'license:bsd?) + ("MIT" 'license:expat) + ("ISC" 'license:isc) + ("Artistic-2" 'license:artistic2.0) + ("Apache-2.0" 'license:asl2.0) + ("Public Domain" 'license:public-domain) + ((x) (string->license x)) + ((lst ...) `(list ,@(map string->license lst))) + (_ #f))) + + +;;; +;;; Egg importer. +;;; + +(define* (egg->guix-package name #:key (file #f) (source #f)) + "Import CHICKEN egg NAME from and return a record type for the +egg, or #f on failure. FILE is the filepath to the NAME.egg file. SOURCE= is +the a ``file-like'' object containing the source code corresonding to the = egg. +If SOURCE is not specified, the tarball for the egg will be downloaded. + +Specifying the SOURCE argument is mainly useful for developing a CHICKEN e= gg +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))) + (if (not egg-content) + (values #f '()) ; egg doesn't exist + (let* ((version* (or (assoc-ref egg-content 'version) + (find-latest-version name))) + (version (if (list? version*) (first version*) version*)) + (source-url (if source #f (egg-source-url name version))) + (tarball (if source + #f + (with-store store + (download-to-store store source-url))))) + + (define egg-home-page + (string-append (%eggs-home-page) "/" name)) + + (define egg-synopsis + (match (assoc-ref egg-content 'synopsis) + ((synopsis) synopsis) + (_ #f))) + + (define egg-licenses + (let ((licenses* + (match (assoc-ref egg-content 'license) + ((license) + (map string->license (string-split license #\/))) + (#f + '())))) + (match licenses* + ((license) license) + ((license1 license2 ...) `(list ,@licenses*))))) + + (define (maybe-symbol->string sym) + (if (symbol? sym) (symbol->string sym) sym)) + + (define (prettify-system-dependency name) + ;; System dependencies sometimes have spaces and/or upper case + ;; letters in them. + ;; + ;; There will probably still be some weird edge cases. + (string-map (lambda (char) + (case char + ((#\space) #\-) + (else char))) + (maybe-symbol->string name))) + + (define* (egg-parse-dependency name #:key (system? #f)) + (define extract-name + (match-lambda + ((name version) name) + (name name))) + + (define (prettify-name name) + (if system? + (prettify-system-dependency name) + (maybe-symbol->string name))) +=20=20=20=20=20=20=20=20=20=20 + (let ((name (prettify-name (extract-name name)))) + ;; Dependencies are sometimes specified as symbols and sometim= es + ;; as strings + (list (string-append (if system? "" package-name-prefix) + name) + (list 'unquote + (string->symbol (string-append + (if system? "" package-name-prefi= x) + name)))))) + + (define egg-propagated-inputs + (let ((dependencies (assoc-ref egg-content 'dependencies))) + (if (list? dependencies) + (map egg-parse-dependency + dependencies) + '()))) + + ;; TODO: Or should these be propagated? + (define egg-inputs + (let ((dependencies (assoc-ref egg-content 'foreign-dependencies= ))) + (if (list? dependencies) + (map (lambda (name) + (egg-parse-dependency name #:system? #t)) + dependencies) + '()))) + + (define egg-native-inputs + (let* ((test-dependencies (or (assoc-ref egg-content + 'test-dependencies) + '())) + (build-dependencies (or (assoc-ref egg-content + 'build-dependencies) + '())) + (test+build-dependencies (append test-dependencies + build-dependencies))) + (match test+build-dependencies + ((_ _ ...) (map egg-parse-dependency + test+build-dependencies)) + (() '())))) + + ;; Copied from (guix import hackage). + (define (maybe-inputs input-type inputs) + (match inputs + (() + '()) + ((inputs ...) + (list (list input-type + (list 'quasiquote inputs)))))) + + (values + `(package + (name ,(egg-name->guix-name name)) + (version ,version) + (source + ,(if source + source + `(origin + (method url-fetch) + (uri ,source-url) + (sha256 + (base32 ,(if tarball + (bytevector->nix-base32-string + (file-sha256 tarball)) + "failed to download tar archive")))))) + (build-system chicken-build-system) + (arguments ,(list 'quasiquote (list #:egg-name name))) + ,@(maybe-inputs 'native-inputs egg-native-inputs) + ,@(maybe-inputs 'inputs egg-inputs) + ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs) + (home-page ,egg-home-page) + (synopsis ,egg-synopsis) + (description #f) + (license ,egg-licenses)) + (filter (lambda (name) + (not (member name '("srfi-4")))) + (map (compose guix-name->egg-name first) + (append egg-propagated-inputs + egg-native-inputs))))))) + +(define egg->guix-package/m ;memoized variant + (memoize egg->guix-package)) + +(define (egg-recursive-import package-name) + (recursive-import package-name + #:repo->guix-package (lambda* (name #:key version repo) + (egg->guix-package/m name)) + #:guix-name egg-name->guix-name)) + + +;;; +;;; Updater. +;;; + +(define (latest-release package) + "Return an @code{} for the latest release of PACKAGE." + (let* ((egg-name (guix-package->egg-name package)) + (version (find-latest-version egg-name)) + (source-url (egg-source-url egg-name version))) + (upstream-source + (package (package-name package)) + (version version) + (urls (list source-url))))) + +(define %egg-updater + (upstream-updater + (name 'egg) + (description "Updater for CHICKEN egg packages") + (pred egg-package?) + (latest latest-release))) + +;;; egg.scm ends here diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index bbd9a3b190..f53d1ac1f4 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -76,8 +76,8 @@ rather than \\n." ;;; Entry point. ;;; =20 -(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "elpa" "gem" - "go" "cran" "crate" "texlive" "json" "opam")) +(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa" + "gem" "go" "cran" "crate" "texlive" "json" "opam")) =20 (define (resolve-importer name) (let ((module (resolve-interface diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm new file mode 100644 index 0000000000..7dbd6fcd5a --- /dev/null +++ b/guix/scripts/import/egg.scm @@ -0,0 +1,107 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts import egg) + #:use-module (guix ui) + #:use-module (guix utils) + #:use-module (guix scripts) + #:use-module (guix import egg) + #:use-module (guix scripts import) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:use-module (ice-9 format) + #:export (guix-import-egg)) + + +;;; +;;; Command-line options. +;;; + +(define %default-options + '()) + +(define (show-help) + (display (G_ "Usage: guix import egg PACKAGE-NAME +Import and convert the egg 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)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix import egg"))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive #t result))) + %standard-import-options)) + + +;;; +;;; Entry point. +;;; + +(define (guix-import-egg . args) + (define (parse-options) + ;; Return the alist of option values. + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) + + (let* ((opts (parse-options)) + (repo (and=3D> (assoc-ref opts 'repo) string->symbol)) + (args (filter-map (match-lambda + (('argument . value) + value) + (_ #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))) + (() + (leave (G_ "too few arguments~%"))) + ((many ...) + (leave (G_ "too many arguments~%")))))) diff --git a/po/guix/POTFILES.in b/po/guix/POTFILES.in index 74cc5ebf9a..8fd944ff22 100644 --- a/po/guix/POTFILES.in +++ b/po/guix/POTFILES.in @@ -7,6 +7,7 @@ gnu/system.scm gnu/services/shepherd.scm gnu/system/mapped-devices.scm gnu/system/shadow.scm +guix/import/egg.scm guix/import/opam.scm gnu/installer.scm gnu/installer/connman.scm @@ -99,6 +100,7 @@ guix/scripts/environment.scm guix/scripts/time-machine.scm guix/scripts/import/cpan.scm guix/scripts/import/crate.scm +guix/scripts/import/egg.scm guix/scripts/import/gem.scm guix/scripts/import/gnu.scm guix/scripts/import/go.scm diff --git a/tests/egg.scm b/tests/egg.scm new file mode 100644 index 0000000000..0884d8d429 --- /dev/null +++ b/tests/egg.scm @@ -0,0 +1,132 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-eggs) + #:use-module (guix import egg) + #:use-module (guix gexp) + #:use-module (guix base32) + #:use-module (gcrypt hash) + #:use-module (guix tests) + #:use-module ((guix build syscalls) #:select (mkdtemp!)) + #:use-module ((guix build utils) #:select (delete-file-recursively mkdir= -p which)) + #:use-module ((guix utils) #:select (call-with-temporary-output-file)) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64) + #:use-module (web uri) + #:use-module (ice-9 match)) + +(define test-egg-1 + '((synopsis "Example egg") + (license "GPL-3/MIT") + (version "1.0.0") + (test-dependencies test srfi-1) + (foreign-dependencies libgit2) + (build-dependencies begin-syntax) + (dependencies datatype) + (author "John Doe"))) + +(define test-egg-2 + '((synopsis "Example egg") + (license "GPL-3+") + (version "0.3") + (test-dependencies test) + (foreign-dependencies libgit2) + (build-dependencies begin-syntax) + (dependencies datatype) + (author "Alice Bobson"))) + +(define test-egg-1-file "/tmp/guix-egg-1") +(define test-egg-2-file "/tmp/guix-egg-2") + +(test-begin "egg") + +(test-equal "guix-package->egg-name" + "bar" + (guix-package->egg-name + (dummy-package "dummy" + (name "chicken-bar")))) + +;; Copied from tests/hackage.scm +(define-syntax-rule (define-package-matcher name pattern) + (define* (name obj) + (match obj + (pattern #t) + (x (pk 'fail x #f))))) + +(define (eval-test-with-egg-file egg-name egg-test egg-file matcher) + (call-with-output-file egg-file + (lambda (port) + (write egg-test port))) + (matcher (egg->guix-package egg-name + #:file egg-file + #:source (plain-file + (string-append egg-name "-egg") + "content")))) + +(define-package-matcher match-chicken-foo + ('package + ('name "chicken-foo") + ('version "1.0.0") + ('source (? file-like? source)) + ('build-system 'chicken-build-system) + ('arguments ('quasiquote ('#:egg-name "foo"))) + ('native-inputs + ('quasiquote + (("chicken-test" ('unquote chicken-test)) + ("chicken-srfi-1" ('unquote chicken-srfi-1)) + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) + ('inputs + ('quasiquote + (("libgit2" ('unquote libgit2))))) + ('propagated-inputs + ('quasiquote + (("chicken-datatype" ('unquote chicken-datatype))))) + ('home-page "https://wiki.call-cc.org/egg/foo") + ('synopsis "Example egg") + ('description #f) + ('license '(list license:gpl3 license:expat)))) + +(define-package-matcher match-chicken-bar + ('package + ('name "chicken-bar") + ('version "0.3") + ('source (? file-like? source)) + ('build-system 'chicken-build-system) + ('arguments ('quasiquote ('#:egg-name "bar"))) + ('native-inputs + ('quasiquote + (("chicken-test" ('unquote chicken-test)) + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) + ('inputs + ('quasiquote + (("libgit2" ('unquote libgit2))))) + ('propagated-inputs + ('quasiquote + (("chicken-datatype" ('unquote chicken-datatype))))) + ('home-page "https://wiki.call-cc.org/egg/bar") + ('synopsis "Example egg") + ('description #f) + ('license 'license:gpl3+))) + +(test-assert "egg->guix-package local file, multiple licenses" + (eval-test-with-egg-file "foo" test-egg-1 test-egg-1-file match-chicken-= foo)) + +(test-assert "egg->guix-package local file, single license" + (eval-test-with-egg-file "bar" test-egg-2 test-egg-2-file match-chicken-= bar)) + +(test-end "egg") base-commit: f463f376e91ccc1fe4ab68d5e822b5d71a1234f5 --=20 2.31.1 From unknown Mon Jun 23 14:59:54 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Xinglu Chen Subject: bug#48697: closed (Re: [PATCH v4] import: Add CHICKEN egg importer.) Message-ID: References: <87tumfuruk.fsf@gnu.org> X-Gnu-PR-Message: they-closed 48697 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 48697@debbugs.gnu.org Date: Thu, 03 Jun 2021 11:11:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1622718662-25715-1" This is a multi-part message in MIME format... ------------=_1622718662-25715-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #48697: [PATCH] import: Add CHICKEN egg importer. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 48697@debbugs.gnu.org. --=20 48697: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D48697 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1622718662-25715-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 48697-done) by debbugs.gnu.org; 3 Jun 2021 11:10:06 +0000 Received: from localhost ([127.0.0.1]:42739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lolEj-0006fK-QD for submit@debbugs.gnu.org; Thu, 03 Jun 2021 07:10:06 -0400 Received: from eggs.gnu.org ([209.51.188.92]:49820) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lolEg-0006ek-Oh for 48697-done@debbugs.gnu.org; Thu, 03 Jun 2021 07:10:03 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:36748) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lolEa-0001P1-Qn; Thu, 03 Jun 2021 07:09:56 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=32990 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lolEa-0006Ch-HM; Thu, 03 Jun 2021 07:09:56 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Xinglu Chen Subject: Re: [PATCH v4] import: Add CHICKEN egg importer. References: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> <0a08cf8ad3ee4db5002e683d48e45f8b1084cd02.1622646776.git.public@yoctocell.xyz> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 Prairial an 229 de la =?utf-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Thu, 03 Jun 2021 13:09:55 +0200 In-Reply-To: <0a08cf8ad3ee4db5002e683d48e45f8b1084cd02.1622646776.git.public@yoctocell.xyz> (Xinglu Chen's message of "Wed, 02 Jun 2021 17:18:22 +0200") Message-ID: <87tumfuruk.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -0.3 (/) X-Debbugs-Envelope-To: 48697-done Cc: 48697-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 (-) Heya, Xinglu Chen skribis: > * guix/import/egg.scm: New file. > * guix/scripts/import/egg.scm: New file. > * tests/egg.scm: New file. > * Makefile.am (MODULES, SCM_TESTS): Register them. > * po/guix/POTFILES.in: Likewise. > * guix/scripts/import.scm (importers): Add egg importer. > * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document i= t. > * etc/news.scm: Add entry. Pushed, thanks! Note that the =E2=80=98etc/news.scm=E2=80=99 bit has to happen in a followu= p commit since it refers to the commit that introduces the change; I made this change. Can=E2=80=99t wait to see eggs! :-) Ludo=E2=80=99. ------------=_1622718662-25715-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 May 2021 12:48:54 +0000 Received: from localhost ([127.0.0.1]:50864 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmFRU-0006Uc-La for submit@debbugs.gnu.org; Thu, 27 May 2021 08:48:53 -0400 Received: from lists.gnu.org ([209.51.188.17]:54362) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmFRS-0006UT-40 for submit@debbugs.gnu.org; Thu, 27 May 2021 08:48:51 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmFRO-0006o8-Gq for guix-patches@gnu.org; Thu, 27 May 2021 08:48:47 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:45932 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 1lmFRG-0004Of-Oe for guix-patches@gnu.org; Thu, 27 May 2021 08:48:43 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622119711; bh=pMI0Zk6pmdgMLyji5MXuyKAisFM7LLEc/zjjXN31Zxw=; h=From:To:Cc:Subject:Date; b=bKmE7NUKlZgfwwiIZvY/6ptVcHKsoIduAbYkpGZXhA9OpIfTNRV+4+xX29Dx+16Tv H9MdUwByHxvghL9BVg5v1klDhV9I2exqF0Y6eYVFpDXDufnksk12QTCvBC6IYLyMIb Dh/rSVqUfWa2henK+eJXEXsDZRJ8HSWjZNk1z8MY= To: guix-patches@gnu.org Subject: [PATCH] import: Add CHICKEN egg importer. Message-Id: Date: Thu, 27 May 2021 14:48:30 +0200 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: 34 X-Spam_score: 3.4 X-Spam_bar: +++ X-Spam_report: (3.4 / 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.499, FROM_SUSPICIOUS_NTLD_FP=1.999, PDS_OTHER_BAD_TLD=1.999, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: 3.2 (+++) 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * guix/scripts/import.scm (importers): Add egg i [...] Content analysis details: (3.2 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -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.0 SPF_HELO_PASS SPF: HELO matches SPF record 1.0 SPF_SOFTFAIL SPF: sender does not match SPF record (softfail) 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.0 RCVD_IN_MSPIKE_H4 RBL: Very Good reputation (+4) [209.51.188.17 listed in wl.mailspike.net] 2.0 FROM_SUSPICIOUS_NTLD_FP From abused NTLD 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 0.0 RCVD_IN_MSPIKE_WL Mailspike good senders X-Debbugs-Envelope-To: submit Cc: raingloom 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: New file. * guix/scripts/import/egg.scm: New file. * tests/egg.scm: New file. * Makefile.am (MODULES, SCM_TESTS): Register them. * guix/scripts/import.scm (importers): Add egg importer. * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document it. --- [ Cc=E2=80=99ing raingloom since you wrote the CHICKEN build system ] This patch adds recursive importer for CHICKEN eggs, the generated packages aren=E2=80=99t entirely complete, though. It gets information fro= m The PACKAGE.egg, which is just a Scheme file that contains a list of lists that specify the metadata for an egg. However, it doesn=E2=80=99t specify a description, so I have just set the =E2=80=98description=E2=80=99 field to = #f for now. The licensing policy for eggs is also a bit vague[1], there is no strict naming format for licenses, and a lot of eggs just specify =E2=80=98BSD=E2= =80=99 rather than =E2=80=98BSD-N-Clause=E2=80=99. The PACKAGE.egg file can also specify system dependencies, but there is no consistent format for this, sometimes strings are used, other times symbols are used, and sometimes the version of the package is also included. The user will have to double check the names and make sure they are correct. I am also unsure about whether the system dependencies should be =E2=80=98propagated-inputs=E2=80=99 or just =E2=80= =98inputs=E2=80=99. [1]: https://wiki.call-cc.org/eggs-licensing Try it out! --8<---------------cut here---------------start------------->8--- ~/src/guix $ ./pre-inst-env guix import egg -r medea Starting download of /tmp/guix-file.nFumLb >From https://code.call-cc.org/egg-tarballs/5/medea/medea-4.tar.gz... medea-4.tar.gz 7KiB 162KiB/s 00:00 [##################] 1= 00.0% Starting download of /tmp/guix-file.8QWL6a >From https://code.call-cc.org/egg-tarballs/5/comparse/comparse-3.tar.gz... =E2=80=A6-3.tar.gz 7KiB 203KiB/s 00:00 [#############= #####] 100.0% Starting download of /tmp/guix-file.hZPs19 >From https://code.call-cc.org/egg-tarballs/5/srfi-13/srfi-13-0.3.1.tar.gz... =E2=80=A63.1.tar.gz 28KiB 328KiB/s 00:00 [#############= #####] 100.0% Starting download of /tmp/guix-file.VMAPo7 >From https://code.call-cc.org/egg-tarballs/5/lazy-seq/lazy-seq-2.tar.gz... =E2=80=A6-2.tar.gz 3KiB 158KiB/s 00:00 [#############= #####] 100.0% Starting download of /tmp/guix-file.6LM9K7 >From https://code.call-cc.org/egg-tarballs/5/trie/trie-2.tar.gz... trie-2.tar.gz 1KiB 1.5MiB/s 00:00 [##################] 1= 00.0% Starting download of /tmp/guix-file.8Yn8L7 >From https://code.call-cc.org/egg-tarballs/5/matchable/matchable-1.1.tar.gz= ... =E2=80=A61.1.tar.gz 14KiB 370KiB/s 00:00 [#############= #####] 100.0% (define-public chicken-srfi-13 (package (name "chicken-srfi-13") (version "0.3.1") (source (origin (method url-fetch) (uri "https://code.call-cc.org/egg-tarballs/5/srfi-13/srfi-13-0.3.1= .tar.gz") (sha256 (base32 "1430grdp9d13rjp7asn5cs7cbcllbv89g49gx95zqlp07y9df6dm")))) (build-system chicken-build-system) (arguments `(#:egg-name "srfi-13")) (native-inputs `(("chicken-test" ,chicken-test))) (propagated-inputs `(("chicken-srfi-14" ,chicken-srfi-14))) (home-page "https://api.call-cc.org/5/doc/srfi-13") (synopsis "SRFI-13 string library") (description #f) (license license:bsd?))) [...] (define-public chicken-medea (package (name "chicken-medea") (version "4") (source (origin (method url-fetch) (uri "https://code.call-cc.org/egg-tarballs/5/medea/medea-4.tar.gz") (sha256 (base32 "1ad7x1sziynjjgxiv70ghbabc1mwa15mdx38wazfzn3nl7ma1hm6")))) (build-system chicken-build-system) (arguments `(#:egg-name "medea")) (native-inputs `(("chicken-test" ,chicken-test))) (propagated-inputs `(("chicken-comparse" ,chicken-comparse) ("chicken-srfi-1" ,chicken-srfi-1) ("chicken-srfi-13" ,chicken-srfi-13) ("chicken-srfi-14" ,chicken-srfi-14) ("chicken-srfi-69" ,chicken-srfi-69))) (home-page "https://api.call-cc.org/5/doc/medea") (synopsis "A JSON parser (and emitter) built with comparse") (description #f) (license license:bsd?))) --8<---------------cut here---------------end--------------->8--- Makefile.am | 3 + doc/guix.texi | 24 +++ guix/import/egg.scm | 363 ++++++++++++++++++++++++++++++++++++ guix/scripts/import.scm | 4 +- guix/scripts/import/egg.scm | 107 +++++++++++ tests/egg.scm | 90 +++++++++ 6 files changed, 589 insertions(+), 2 deletions(-) create mode 100644 guix/import/egg.scm create mode 100644 guix/scripts/import/egg.scm create mode 100644 tests/egg.scm diff --git a/Makefile.am b/Makefile.am index 8db7d6a320..3e72c3ebd0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -248,6 +248,7 @@ MODULES =3D \ guix/import/cpan.scm \ guix/import/cran.scm \ guix/import/crate.scm \ + guix/import/egg.scm \ guix/import/elpa.scm \ guix/import/gem.scm \ guix/import/github.scm \ @@ -293,6 +294,7 @@ MODULES =3D \ guix/scripts/challenge.scm \ guix/scripts/import/crate.scm \ guix/scripts/import/cran.scm \ + guix/scripts/import/egg.scm \ guix/scripts/import/elpa.scm \ guix/scripts/import/gem.scm \ guix/scripts/import/gnu.scm \ @@ -449,6 +451,7 @@ SCM_TESTS =3D \ tests/debug-link.scm \ tests/derivations.scm \ tests/discovery.scm \ + tests/egg.scm \ tests/elpa.scm \ tests/file-systems.scm \ tests/gem.scm \ diff --git a/doc/guix.texi b/doc/guix.texi index e8b0485f78..6a38ff707f 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -11594,6 +11594,28 @@ using this mode, the symbol of the package is made= by appending the version to its name, so that multiple versions of the same package can coexist. @end table + +@item egg +@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 +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). + +@example +guix import egg sourcehut +@end example + +Additional options include: +@table @code +@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 @end table =20 The structure of the @command{guix import} code is modular. It would be @@ -11748,6 +11770,8 @@ the updater for KDE packages; the updater for X.org packages; @item kernel.org the updater for packages hosted on kernel.org; +@item egg +the updater for @uref{https://wiki.call-cc.org/eggs/, Egg} packages; @item elpa the updater for @uref{https://elpa.gnu.org/, ELPA} packages; @item cran diff --git a/guix/import/egg.scm b/guix/import/egg.scm new file mode 100644 index 0000000000..eb342dac32 --- /dev/null +++ b/guix/import/egg.scm @@ -0,0 +1,363 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix import egg) + #:use-module (ice-9 ftw) + #:use-module (ice-9 match) + #:use-module (ice-9 string-fun) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (web uri) + #:use-module (sxml simple) + #:use-module ((sxml xpath) #:hide (filter)) + #:use-module (gcrypt hash) + #:use-module (guix git) + #:use-module (guix i18n) + #:use-module (guix http-client) + #:use-module (guix base32) + #:use-module (guix memoization) + #:use-module (guix packages) + #:use-module (guix upstream) + #:use-module (guix build-system) + #:use-module (guix store) + #:use-module ((guix download) #:select (download-to-store url-fetch)) + #:use-module (guix import utils) + #:use-module ((guix licenses) #:prefix license:) + #:export (egg->guix-package + egg-recursive-import + %egg-updater + + guix-package->egg-name)) + +;;; Commentary: +;;; +;;; (guix import egg) provides package importer for CHICKEN eggs. See the +;;; official specification format for eggs +;;; . +;;; +;;; 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. +;;; +;;; * All the eggs are stored as tarballs at +;;; , so we grab the tarball for +;;; the egg from there. +;;; +;;; * The rest of the package fields will be parsed from the PACKAGE.egg f= ile. +;;; +;;; Todos: +;;; +;;; * Support for CHICKEN 4? +;;; +;;; * Some packages will specify a specific version of a depencency in the +;;; PACKAGE.egg file, how should we handle this? +;;; +;;; Code: + + +;;; +;;; Egg metadata fetcher and helper functions. +;;; + +(define package-name-prefix "chicken-") + +(define %eggs-url + (make-parameter "https://code.call-cc.org/egg-tarballs/5")) + +(define %eggs-home-page + (make-parameter "https://api.call-cc.org/5/doc")) + +(define (egg-source-url name version) + "Return the URL to the source tarball for version VERSION of the CHICKEN= egg +NAME." + (string-append (%eggs-url) "/" name "/" name "-" version ".tar.gz")) + +(define (egg-name->guix-name name) + "Return the package name for CHICKEN egg NAME." + (string-append package-name-prefix name)) + +(define (get-eggs-repository) + "Update or fetch the latest version of the eggs repository and return th= e path +to the repository." + (let*-values (((url) "git://code.call-cc.org/eggs-5-latest") + ((directory commit _) + (update-cached-checkout url))) + directory)) + +(define (egg-directory name) + "Return the directory containing the source code for the egg NAME." + (let ((eggs-directory (get-eggs-repository))) + (string-append eggs-directory "/" name))) + +(define (find-latest-version name) + "Get the latest version of the egg NAME." + (let ((directory (scandir (egg-directory name)))) + (if directory + (last directory) + (begin + (format #t (G_ "Package not found in eggs repository: ~a~%") nam= e) + #f)))) + +(define (get-metadata port) + "Parse the egg metadata from PORT." + (let ((content (read port))) + (close-port port) + content)) + +(define (egg-metadata name) + "Return the package metadata file for the egg NAME." + (let ((version (find-latest-version name))) + (if version + (get-metadata (open-file + (string-append (egg-directory name) "/" + version "/" name ".egg") + "r")) + #f))) + +(define (guix-name->egg-name name) + "Return the CHICKEN egg name corresponding to the Guix package NAME." + (if (string-prefix? package-name-prefix name) + (substring name (string-length package-name-prefix)) + name)) + +(define (guix-package->egg-name package) + "Return the CHICKEN egg name of the Guix CHICKEN PACKAGE." + (let ((upstream-name (assoc-ref + (package-properties package) + 'upstream-name)) + (name (package-name package))) + (if upstream-name + upstream-name + (guix-name->egg-name name)))) + +(define (egg-package? package) + "Check if PACKAGE is an CHICKEN egg package." + (and (eq? (build-system-name (package-build-system package)) 'chicken) + (string-prefix? package-name-prefix (package-name package)))) + +(define string->license + ;; Doesn't seem to use a specific format. + ;; + (match-lambda + ("GPL-2" 'license:gpl2) + ("GPL-3" 'license:gpl3) + ("GPL" 'license:gpl?) + ("AGPL-3" 'license:agpl3) + ("AGPL" 'license:agpl?) + ("LGPL-2.1" 'license:lgpl2.1) + ("LGPL-3" 'license:lgpl3) + ("LGPL" 'license:lgpl?) + ("BSD-2" 'license:bsd-2) + ("BSD-3" 'license:bsd-3) + ("BSD" 'license:bsd?) + ("MIT" 'license:expat) + ("ISC" 'license:isc) + ("Artistic-2" 'license:artistic2.0) + ("Apache-2.0" 'license:asl2.0) + ("Public Domain" 'license:public-domain) + ((x) (string->license x)) + ((lst ...) `(list ,@(map string->license lst))) + (_ #f))) + + +;;; +;;; Egg importer. +;;; + +(define* (egg->guix-package name #:key (port #f) (source #f)) + "Import CHICKEN egg NAME from and return a @code{} record type = for +the egg, or @code{#f} on failure. PORT is the port for the NAME.egg to re= ad +from. SOURCE is the a ``file-like'' object containing the source code +corresonding to the egg. If SOURCE is not specified, the tarball for the = egg +will be downloaded. + +Specifying the SOURCE argument is mainly useful for developing a CHICKEN e= gg +locally. Note that if PORT and SOURCE are specified, +recursive import will not work." + (define egg-content (if port + (get-metadata port) + (egg-metadata name))) + (if (not egg-content) + (values #f '()) ; egg doesn't exist + (let* ((version* (or (assoc-ref egg-content 'version) + (find-latest-version name))) + (version (if (list? version*) (first version*) version*)) + (source-url (if source #f (egg-source-url name version))) + (tarball (if source + #f + (with-store store + (download-to-store store source-url))))) + + (define (safe-append lst1 lst2) + (match (list lst1 lst2) + ((#f #f) #f) + ((lst1 #f) lst1) + ((#f lst2) lst2) + (_ (append lst1 lst2)))) + + (define egg-home-page + (string-append (%eggs-home-page) "/" name)) + + (define egg-synopsis + (let ((synopsis (assoc-ref egg-content 'synopsis))) + (if (list? synopsis) + (first synopsis) + #f))) + + (define egg-license + (let ((license (assoc-ref egg-content 'license))) + (if (list? license) + ;; Multiple licenses are separated by `/'. + (string->license (string-split (first license) #\/)) + #f))) + + (define (prettify-system-dependency name) + (let ((name* (if (symbol? name) + (symbol->string name) + name))) + ;; System dependecies sometimes have spaces and/or upper case + ;; letters in them. + ;; + ;; There will probably still be some weird edge cases. + (string-replace-substring (string-downcase name*) " " ""))) + + (define (maybe-string->symbol str) + (if (string? str) (string->symbol string) str)) + + (define (maybe-symbol->string sym) + (if (symbol? sym) (symbol->string sym) sym)) + + (define* (egg-parse-dependency name #:key (system? #f)) + (let* ((name* (if (list? name) + (first name) ; (name version) + name)) + (name (if system? + (prettify-system-dependency name*) + (maybe-symbol->string name*)))) + ;; Dependencies are sometimes specified as symbols and sometim= es + ;; as strings + (list (string-append (if system? "" package-name-prefix) + name) + (list 'unquote + (string->symbol (string-append + (if system? "" package-name-prefi= x) + name)))))) + + (define egg-propagated-inputs + (let ((dependencies (assoc-ref egg-content 'dependencies))) + (if (list? dependencies) + (map egg-parse-dependency + dependencies) + '()))) + + ;; TODO: Or should these be propagated? + (define egg-inputs + (let ((dependencies (assoc-ref egg-content 'foreign-dependencies= ))) + (if (list? dependencies) + (map (lambda (name) + (egg-parse-dependency name #:system? #t)) + dependencies) + '()))) + + (define egg-native-inputs + (let* ((test-dependencies (assoc-ref egg-content + 'test-dependencies)) + (build-dependencies (assoc-ref egg-content + 'build-dependencies)) + (test+build-dependencies (safe-append + test-dependencies + build-dependencies))) + (if (list? test+build-dependencies) + (map egg-parse-dependency + test+build-dependencies) + '()))) + + ;; Copied from (guix import hackage). + (define (maybe-inputs input-type inputs) + (match inputs + (() + '()) + ((inputs ...) + (list (list input-type + (list 'quasiquote inputs)))))) + + (values + `(package + (name ,(egg-name->guix-name name)) + (version ,version) + (source + ,(if source + source + `(origin + (method url-fetch) + (uri ,source-url) + (sha256 + (base32 ,(if tarball + (bytevector->nix-base32-string + (file-sha256 tarball)) + "failed to download tar archive")))))) + (build-system chicken-build-system) + (arguments ,(list 'quasiquote (list #:egg-name name))) + ,@(maybe-inputs 'native-inputs egg-native-inputs) + ,@(maybe-inputs 'inputs egg-inputs) + ,@(maybe-inputs 'propagated-inputs egg-propagated-inputs) + (home-page ,egg-home-page) + (synopsis ,egg-synopsis) + (description #f) + (license ,egg-license)) + (filter (lambda (name) + (not (member name '("srfi-4")))) + (map (compose guix-name->egg-name first) + (append egg-propagated-inputs + egg-native-inputs))))))) + +(define egg->guix-package/m ;memoized variant + (memoize egg->guix-package)) + +(define (egg-recursive-import package-name) + (recursive-import package-name + #:repo->guix-package (lambda* (name #:key version repo) + (egg->guix-package/m name)) + #:guix-name egg-name->guix-name)) + + +;;; +;;; Updater. +;;; + +(define (latest-release package) + "Return an @code{} for the latest release of PACKAGE." + (let* ((egg-name (guix-package->egg-name package)) + (version (find-latest-version egg-name)) + (source-url (egg-source-url egg-name version))) + (upstream-source + (package (package-name package)) + (version version) + (urls (list source-url))))) + +(define %egg-updater + (upstream-updater + (name 'egg) + (description "Updater for CHICKEN egg packages") + (pred egg-package?) + (latest latest-release))) + +;;; egg.scm ends here diff --git a/guix/scripts/import.scm b/guix/scripts/import.scm index bbd9a3b190..f53d1ac1f4 100644 --- a/guix/scripts/import.scm +++ b/guix/scripts/import.scm @@ -76,8 +76,8 @@ rather than \\n." ;;; Entry point. ;;; =20 -(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "elpa" "gem" - "go" "cran" "crate" "texlive" "json" "opam")) +(define importers '("gnu" "pypi" "cpan" "hackage" "stackage" "egg" "elpa" + "gem" "go" "cran" "crate" "texlive" "json" "opam")) =20 (define (resolve-importer name) (let ((module (resolve-interface diff --git a/guix/scripts/import/egg.scm b/guix/scripts/import/egg.scm new file mode 100644 index 0000000000..7dbd6fcd5a --- /dev/null +++ b/guix/scripts/import/egg.scm @@ -0,0 +1,107 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (guix scripts import egg) + #:use-module (guix ui) + #:use-module (guix utils) + #:use-module (guix scripts) + #:use-module (guix import egg) + #:use-module (guix scripts import) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-11) + #:use-module (srfi srfi-37) + #:use-module (ice-9 match) + #:use-module (ice-9 format) + #:export (guix-import-egg)) + + +;;; +;;; Command-line options. +;;; + +(define %default-options + '()) + +(define (show-help) + (display (G_ "Usage: guix import egg PACKAGE-NAME +Import and convert the egg 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)) + +(define %options + ;; Specification of the command-line options. + (cons* (option '(#\h "help") #f #f + (lambda args + (show-help) + (exit 0))) + (option '(#\V "version") #f #f + (lambda args + (show-version-and-exit "guix import egg"))) + (option '(#\r "recursive") #f #f + (lambda (opt name arg result) + (alist-cons 'recursive #t result))) + %standard-import-options)) + + +;;; +;;; Entry point. +;;; + +(define (guix-import-egg . args) + (define (parse-options) + ;; Return the alist of option values. + (args-fold* args %options + (lambda (opt name arg result) + (leave (G_ "~A: unrecognized option~%") name)) + (lambda (arg result) + (alist-cons 'argument arg result)) + %default-options)) + + (let* ((opts (parse-options)) + (repo (and=3D> (assoc-ref opts 'repo) string->symbol)) + (args (filter-map (match-lambda + (('argument . value) + value) + (_ #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))) + (() + (leave (G_ "too few arguments~%"))) + ((many ...) + (leave (G_ "too many arguments~%")))))) diff --git a/tests/egg.scm b/tests/egg.scm new file mode 100644 index 0000000000..b853f777c4 --- /dev/null +++ b/tests/egg.scm @@ -0,0 +1,90 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright =C2=A9 2021 Xinglu Chen +;;; +;;; This file is part of GNU Guix. +;;; +;;; GNU Guix is free software; you can redistribute it and/or modify it +;;; under the terms of the GNU General Public License as published by +;;; the Free Software Foundation; either version 3 of the License, or (at +;;; your option) any later version. +;;; +;;; GNU Guix is distributed in the hope that it will be useful, but +;;; WITHOUT ANY WARRANTY; without even the implied warranty of +;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;;; GNU General Public License for more details. +;;; +;;; You should have received a copy of the GNU General Public License +;;; along with GNU Guix. If not, see . + +(define-module (test-eggs) + #:use-module (guix import egg) + #:use-module (guix gexp) + #:use-module (guix base32) + #:use-module (gcrypt hash) + #:use-module (guix tests) + #:use-module ((guix build syscalls) #:select (mkdtemp!)) + #:use-module ((guix build utils) #:select (delete-file-recursively mkdir= -p which)) + #:use-module ((guix utils) #:select (call-with-temporary-output-file)) + #:use-module (srfi srfi-1) + #:use-module (srfi srfi-64) + #:use-module (web uri) + #:use-module (ice-9 match)) + +(define test-egg-1 + "((synopsis \"Example egg\") + (license \"GPL-3/MIT\") + (version \"1.0.0\") + (test-dependencies test srfi-1) + (foreign-dependencies libgit2) + (build-dependencies begin-syntax) + (dependencies datatype) + (author \"John Doe\"))") + +(test-begin "egg") + +(test-equal "guix-package->egg-name" + "bar" + (guix-package->egg-name + (dummy-package "dummy" + (name "chicken-bar")))) + +;; Copied from tests/hackage.scm +(define-syntax-rule (define-package-matcher name pattern) + (define* (name obj) + (match obj + (pattern #t) + (x (pk 'fail x #f))))) + +(define (eval-test-with-egg-file egg-test matcher) + (define port (open-input-string egg-test)) + (matcher (egg->guix-package "foo" + #:port port + #:source (plain-file "foo-egg" "content")))) + +(define-package-matcher match-chicken-foo + ('package + ('name "chicken-foo") + ('version "1.0.0") + ('source (? file-like? source)) + ('build-system 'chicken-build-system) + ('arguments ('quasiquote ('#:egg-name "foo"))) + ('native-inputs + ('quasiquote + (("chicken-test" ('unquote chicken-test)) + ("chicken-srfi-1" ('unquote chicken-srfi-1)) + ("chicken-begin-syntax" ('unquote chicken-begin-syntax))))) + ('inputs + ('quasiquote + (("libgit2" ('unquote libgit2))))) + ('propagated-inputs + ('quasiquote + (("chicken-datatype" ('unquote chicken-datatype))))) + ('home-page "https://api.call-cc.org/5/doc/foo") + ('synopsis "Example egg") + ('description #f) + ('license (list 'license:gpl3 'license:expat)))) + +(test-assert "egg->guix-package local file" + (eval-test-with-egg-file test-egg-1 match-chicken-foo)) + +(test-end "egg") base-commit: 23ab7067f32495a8a02710c08b7cfe0e21be7f3f --=20 2.31.1 ------------=_1622718662-25715-1-- From unknown Mon Jun 23 14:59:54 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48697] [PATCH v4] import: Add CHICKEN egg importer. Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 03 Jun 2021 14:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 48697 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 48697-done@debbugs.gnu.org Received: via spool by 48697-done@debbugs.gnu.org id=D48697.162272875219666 (code D ref 48697); Thu, 03 Jun 2021 14:00:02 +0000 Received: (at 48697-done) by debbugs.gnu.org; 3 Jun 2021 13:59:12 +0000 Received: from localhost ([127.0.0.1]:44423 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lonsO-000577-4d for submit@debbugs.gnu.org; Thu, 03 Jun 2021 09:59:12 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:50882 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lonsM-00056v-Db for 48697-done@debbugs.gnu.org; Thu, 03 Jun 2021 09:59:11 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1622728743; bh=KMreXtQKw3tG+dh9OkQle2v2lm3zlN383Zxvps72ZHM=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=LmYbr9DFl6EGRXvORpT3Z5MOowuqydES/5Scq7FNqIlOM/ySc3OJ7Zi7KW8HdYq+R w6swsFnSmDjwSC+45I1fKEHeJRwXDQW54ZYLGqpQ+lskkoA5/6iIhiOrPJ8LZabC4H al+Zq9eTAIeVt4Jp4Gi+tTyv6/sykISESe/dfW7k= In-Reply-To: <87tumfuruk.fsf@gnu.org> References: <9419cea6a6580c244a22d358c754032486f87b1c.1622485631.git.public@yoctocell.xyz> <0a08cf8ad3ee4db5002e683d48e45f8b1084cd02.1622646776.git.public@yoctocell.xyz> <87tumfuruk.fsf@gnu.org> Date: Thu, 03 Jun 2021 15:58:55 +0200 Message-ID: <87czt3f3s0.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 2.9 (++) 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: On Thu, Jun 03 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Heya, > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_T [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 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: 2.9 (++) 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: On Thu, Jun 03 2021, Ludovic =?UTF-8?Q?Court=C3=A8s?= wrote: > Heya, > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_T [...] Content analysis details: (2.9 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record 2.0 PDS_OTHER_BAD_TLD Untrustworthy TLDs [URI: yoctocell.xyz (xyz)] 0.4 RDNS_DYNAMIC Delivered to internal network by host with dynamic-looking rDNS 0.5 FROM_SUSPICIOUS_NTLD From abused NTLD 1.0 BULK_RE_SUSP_NTLD Precedence bulk and RE: from a suspicious TLD -1.0 MAILING_LIST_MULTI Multiple indicators imply a widely-seen list manager --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On Thu, Jun 03 2021, Ludovic Court=C3=A8s wrote: > Heya, > > Xinglu Chen skribis: > >> * guix/import/egg.scm: New file. >> * guix/scripts/import/egg.scm: New file. >> * tests/egg.scm: New file. >> * Makefile.am (MODULES, SCM_TESTS): Register them. >> * po/guix/POTFILES.in: Likewise. >> * guix/scripts/import.scm (importers): Add egg importer. >> * doc/guix.texi (Invoking guix import, Invoking guix refresh): Document = it. >> * etc/news.scm: Add entry. > > Pushed, thanks! > > Note that the =E2=80=98etc/news.scm=E2=80=99 bit has to happen in a follo= wup commit > since it refers to the commit that introduces the change; I made this > change. OK, I will keep this in mind next time. > Can=E2=80=99t wait to see eggs! :-) Me too! :) --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmC44B8VHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5iEcQALtOe5sevu9iSrVRmt536AY494L2 lIlWWkGoakf2zJzcIz7h0+TtEOGNZObuLjA2e+oFvadUxM+I6UxTJupbwA4vmo2+ m/u2wADNwKY69NLNu2qbnije8YA3mMvnE+TBP8Y8DeJrCikZEjyJkEwhY/79uI4v s5aeZPUwiayxceUS6vGl8eJvPExrc0vUqUHSaredBE070rOIzhQU5LF9no4fE19l 1yvnm7kjLJoLwQgyv9nLeoOQ5Z9ebhB6JZoXI1kShKkkguDnvyF9iH6ofJJ/LJ7V 4aY6a0F3K/jDkmoHT2fXTMEipsJbitUdaGIgpUQ1Y0eKoZjfX5vzTGe6XZEOC7Wq uOUubWBJcmlDRUxGAHDFvaAyID0oo7pPtGhkOhjW2sfiSF2gODYi5zbjLlLnEqoB 4f8YK2dpfyzHzfeFUyH8AgoMTklSEqyQYTLngEvnpZO1o0qyso9vr2h8Lzn01Z+3 u7FWWgPBJNnNjDGc+TRiuipKPC46eJWGAH5TpazUNynOHxKhh7Vhb7f/rNqthGdt /frKxAtoGlpkB2K1ffn3x50WuFyU9SrEBKBxNCsOxX2H0VPo9CpOXuy446pWr6nz vvIc///sYmSO09IlaGGHcjbdzw98v+HQHOKCD7BHhTkaojgwJ91Adfhh8NgmPW6z HcfKgyw2CxaFBGjy =oCIN -----END PGP SIGNATURE----- --=-=-=--