From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id hFfcBn0wxmCaIAEAgWs5BA (envelope-from ) for ; Sun, 13 Jun 2021 18:21:17 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id 6FsPAn0wxmA3RAAA1q6Kng (envelope-from ) for ; Sun, 13 Jun 2021 16:21:17 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 0041518AC3 for ; Sun, 13 Jun 2021 18:21:16 +0200 (CEST) Received: from localhost ([::1]:60442 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lsSrJ-0002I8-IW for larch@yhetil.org; Sun, 13 Jun 2021 12:21:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58704) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsSr9-0002Hl-D7 for bug-guix@gnu.org; Sun, 13 Jun 2021 12:21:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60956) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lsSr8-0007cI-PL for bug-guix@gnu.org; Sun, 13 Jun 2021 12:21:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lsSr8-0001qd-Gh for bug-guix@gnu.org; Sun, 13 Jun 2021 12:21:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#49006: MELPA importer uses the wrong source when called from CLI Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Sun, 13 Jun 2021 16:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 49006 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: 49006@debbugs.gnu.org X-Debbugs-Original-To: bug-guix@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.16236012267038 (code B ref -1); Sun, 13 Jun 2021 16:21:02 +0000 Received: (at submit) by debbugs.gnu.org; 13 Jun 2021 16:20:26 +0000 Received: from localhost ([127.0.0.1]:44269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsSqX-0001pR-FL for submit@debbugs.gnu.org; Sun, 13 Jun 2021 12:20:25 -0400 Received: from lists.gnu.org ([209.51.188.17]:47944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lsSqV-0001pJ-76 for submit@debbugs.gnu.org; Sun, 13 Jun 2021 12:20:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:58636) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lsSqU-0002Fp-PJ for bug-guix@gnu.org; Sun, 13 Jun 2021 12:20:22 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:33876 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 1lsSqS-00072B-09 for bug-guix@gnu.org; Sun, 13 Jun 2021 12:20:22 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1623601215; bh=4C/F91iMI8Ouo4fSUZmr2pv+oY07QcrFN66URJWzzRI=; h=From:To:Subject:Date; b=Q9a4XPkhvtPzHszIa5ZetFSYa/0s+2e3DqKxzEjFKhbtH7jCMIY1rXOZHWwjQPI35 PPdZJtC5Ky0smAAkkimbqUBmm/hWtRW+aNfLzSU8DMP2z6N4BInX0qrArIUe4nLTe4 4SxVYV7z5O4uB4DvtxF/LR0us+4+n54gywLEiHgw= Date: Sun, 13 Jun 2021 18:20:14 +0200 Message-ID: <87fsxl91oh.fsf@yoctocell.xyz> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" 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.498, FROM_SUSPICIOUS_NTLD_FP=1.973, PDS_OTHER_BAD_TLD=1.997, RDNS_DYNAMIC=0.982, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_FILL_THIS_FORM_SHORT=0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1623601276; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:list-id:list-help:list-unsubscribe:list-subscribe: list-post:dkim-signature; bh=8evU1BUHsnuGisKh5yj8yJY2Ne+hrROHY7mDLC+kRAg=; b=Oo6KTfuYVPZq3iS8mGIOOQq19mfmITgOYs7zPHsjVIxe/YtiHGOs+UZHUFZke0J9pX5HIC jN4GaWaHmf/pCluJju1LxT6TVSEsJgMfn+RCyu4dRiWP5g275X4s7m3Eb3zO85QNhc3oxl U3dxfWpvF9H6FYXxFKk971RIAuzvEIt49j5rFOM9Wu1eDsUVW7Wud7coQVRMtO2CCJMeSp 3990hPil7lX3T++uPabFUHpCnDUAlEqKaaabA63L8fTrtQmq+ygfiKi/YMpnlgRO4usrpA SdBSncNBYw6YYn0wCMK8a5XkqESqHiIdX8za6OGPWwGyyVyBzGYN/cNc9oNgTw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623601276; a=rsa-sha256; cv=none; b=kS2o22bt61YU11wdRjfohCHn/ixE8ij8jCncXH66cgQtVuPuFiW1zEmudlhvPN2OuxbcP7 ChSv0yVi5anQHMHzSEVVbVAab05ekJFSLQvgUA5ci7HPUlgWnwKc3me+NIjZe1NqsHL1wc ZrKMG1FodT1yVrrjdwX3GrS/C5LMVL0tZReh04QKq49HKE+Epfu76heBoc4argUhDGadME hG/Iw+b9ydce658YDzkJYpxyOUGjlX5y3yRNCZtgPZa90v4gVwG8543qFE94qUT2UeWEke If2FgWipzEU2aTyqESJ3vtK7+HhWZOKQSQ6gQoGqrR+9Bxjw1n4C/I7oK/jMwQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=Q9a4XPkh; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -3.42 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=Q9a4XPkh; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (policy=none); spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 0041518AC3 X-Spam-Score: -3.42 X-Migadu-Scanner: scn0.migadu.com X-TUID: iQ2m3Vg2IqU/ --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable When importing a package from MELPA, the source for generated package definition points to a (potentially unstable?) MELPA URL. https://melpa.org/packages/PACKAGE-VERSION.tar =2D-8<---------------cut here---------------start------------->8--- ~/src/guix [env]$ ./pre-inst-env guix import elpa -a melpa magit Starting download of /tmp/guix-file.wbtAlA From=20https://melpa.org/packages/magit-20210609.2000.tar... =E2=80=A6609.2000.tar 1.7MiB 472KiB/s 00:04 [#############= #####] 100.0% (package (name "emacs-magit") (version "20210609.2000") (source (origin (method url-fetch) (uri (string-append "https://melpa.org/packages/magit-" version ".tar")) (sha256 (base32 "0pplizxy20i3i9zqm5kfjz4la93gpz8wwh1ybwdwngv5ks7vhdsr")))) (build-system emacs-build-system) (propagated-inputs `(("emacs-dash" ,emacs-dash) ("emacs-git-commit" ,emacs-git-commit) ("emacs-magit-section" ,emacs-magit-section) ("emacs-transient" ,emacs-transient) ("emacs-with-editor" ,emacs-with-editor))) (home-page "https://github.com/magit/magit") (synopsis "A Git porcelain inside Emacs.") (description "Magit is a text-based Git user interface that puts an unmatched focus on streamlining workflows. Commands are invoked using short mnemonic key sequences that take the cursor=E2=80=99s position in the highly actiona= ble interface into account to provide context-sensitive behavior. With Magit you can do nearly everything that you can do when using Git on the command-line, but at greater speed and while taking advantage of advanced features that previously seemed too daunting to use on a daily basis. Many users will find that by using Magit they can become more effective Git user. ") (license #f)) =2D-8<---------------cut here---------------end--------------->8--- However, looking at (guix import elpa), it has a =E2=80=98melpa-recipe->ori= gin=E2=80=99 procedure, which calls the =E2=80=98git-repository->origin=E2=80=99 procedu= re, which returns an origin that uses =E2=80=98git-fetch=E2=80=99. #+begin_src scheme (define (git-repository->origin recipe url) "Fetch origin details from the Git repository at URL for the provided MEL= PA RECIPE." (define ref (cond ((assoc-ref recipe #:branch) =3D> (lambda (branch) (cons 'branch branch))) ((assoc-ref recipe #:commit) =3D> (lambda (commit) (cons 'commit commit))) (else '(branch . "master")))) (let-values (((directory commit) (download-git-repository url ref))) `(origin (method git-fetch) (uri (git-reference (url ,url) (commit ,commit))) (sha256 (base32 ,(bytevector->nix-base32-string (file-hash directory (negate vcs-file?) #t))))))) (define* (melpa-recipe->origin recipe) "Fetch origin details from the MELPA recipe and associated repository for the package named PACKAGE-NAME." (define (github-repo->url repo) (string-append "https://github.com/" repo ".git")) (define (gitlab-repo->url repo) (string-append "https://gitlab.com/" repo ".git")) (match (assq-ref recipe ':fetcher) ('github (git-repository->origin recipe (github-repo->url (assq-ref rec= ipe ':repo)))) ('gitlab (git-repository->origin recipe (gitlab-repo->url (assq-ref rec= ipe ':repo)))) ('git (git-repository->origin recipe (assq-ref recipe ':url))) (#f #f) ; if we're not using melpa then this stops us printing a warn= ing (_ (warning (G_ "Unsupported MELPA fetcher: ~a, falling back to unstabl= e MELPA source.~%") (assq-ref recipe ':fetcher)) #f))) #+end_src =E2=80=98melpa-recipe->origin=E2=80=99 is used in the =E2=80=98elpa-package= ->sexp=E2=80=99 procedure, and takes precedence over the =E2=80=98url-fetch=E2=80=99 origin. Meaning = that =E2=80=98melpa-source=E2=80=99 must have been #f, otherwise it shouldn=E2= =80=99t have used =E2=80=99url-fetch=E2=80=99. #+begin_src scheme (define melpa-source (melpa-recipe->origin melpa-recipe)) (values `(package (name ,(elpa-name->package-name name)) (version ,version) (source ,(or melpa-source ;here (let ((tarball (with-store store (download-to-store store source-= url)))) `(origin (method url-fetch) (uri (string-append ,@(factorize-uri source-url version= ))) (sha256 (base32 ,(if tarball (bytevector->nix-base32-string (file-sha256 tarb= all)) "failed to download package"))))))) ...)) #+end_src What=E2=80=99s weird is that calling =E2=80=98elpa->guix-package=E2=80=99 i= n the REPL generates a package definition that uses =E2=80=99git-fetch=E2=80=99 instead of =E2= =80=99url-fetch=E2=80=99 =2D-8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(guix import elpa) scheme@(guile-user)> (elpa->guix-package "magit" #:repo 'melpa) $2 =3D (package (name "emacs-magit") (version "20210609.2000") (source (ori= gin (method git-fetch) (uri (git-reference (url "https://github.com/magit/m= agit.git") (commit "71f57c5582448be81b02ba53750dd2ea39ed0eaf"))) (sha256 (b= ase32 "16ip50a46nk6xxj8qkpf6rmp28zjc1bhyjj9bfgibim8ywj87dlq")))) (build-sys= tem emacs-build-system) (propagated-inputs (quasiquote (("emacs-dash" (unqu= ote emacs-dash)) ("emacs-git-commit" (unquote emacs-git-commit)) ("emacs-ma= git-section" (unquote emacs-magit-section)) ("emacs-transient" (unquote ema= cs-transient)) ("emacs-with-editor" (unquote emacs-with-editor))))) (argume= nts (quote (#:include (quote ("^lisp/magit$" "^lisp/magit[^/]+.el$" "^lisp/= git-rebase.el$" "^Documentation/magit.texi$" "^Documentation/AUTHORS.md$" "= ^LICENSE$")) #:exclude (quote ("^lisp/magit-libgit.el$" "^lisp/magit-sectio= n.el$"))))) (home-page "https://github.com/magit/magit") (synopsis "A Git p= orcelain inside Emacs.") (description "Magit is a text-based Git user inter= face that puts an unmatched focus\non streamlining workflows. Commands are= invoked using short mnemonic\nkey sequences that take the cursor=E2=80=99s= position in the highly actionable\ninterface into account to provide conte= xt-sensitive behavior.\n\nWith Magit you can do nearly everything that you = can do when using Git\non the command-line, but at greater speed and while = taking advantage\nof advanced features that previously seemed too daunting = to use on a\ndaily basis. Many users will find that by using Magit they ca= n become\nmore effective Git user.\n") (license license:gpl3+)) $3 =3D ("dash" "git-commit" "magit-section" "transient" "with-editor") =2D-8<---------------cut here---------------end--------------->8--- --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmDGMD4VHHB1YmxpY0B5 b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5JEsP/R0HWNNasONb0TW0cQa+QvHook6D 9s87poLRSnWiHwH50d68VHNoxd6D4a59F9Xpa/pncEvThDEp58LR7IrwxnpCjymR aPDETDz6gRJFLwhmCUBqcxLlm4SpOv6NyhVbSXJSs6vF/C8Dt3OR+VzVf6Itp5hP 1snFdK6HzRyLV5U2adLUkc7sFsAZjuQZP/9F8HfcxQoZ2Q7YQUNPWONMl4gtIJaR ru5U+ToOvGicG6fyQylH7wvVY63JCid+9sHiirftJFYHeiL00cWTPYp5m1r9g+LR 2L0QY25tURCu/2pfw92mFRJ034olzrKgpdL81gIeyW9e8L0gmo6BUcf7yD8sh+yk pw53JVYyx1vpJnPPoTyienDwoFM8gIcEwI5epUMYE/ZpJ+3RNHQ6GUwMMykLhHE2 CkKyRSu8Uh7VVimoYiKB0TTeV+5tMjOJvMi7kiXB6ZneEKsohepbsgQKo9swoJYG tuoPfFl1bg+bO2ajPwzieq9DnK2ONata/ma7Z0qN1tJcrV121LKiaJFzSCFdQzcl +U32dQIpx+kauAScyrtyfPQa8r+sTnnLM3B5hq3oWvWudecIkATrYlmjU6I7iqqR gbvQNH8JQ6roKJNPviKmxkUrOH4aV9IYeCMe05lFNhzYz+4U49VsVCSOLRdnTEb0 zJmeFYABXsrjCOAT =pWry -----END PGP SIGNATURE----- --=-=-=--