From unknown Fri Aug 15 21:21:10 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#53060 <53060@debbugs.gnu.org> To: bug#53060 <53060@debbugs.gnu.org> Subject: Status: [PATCH 0/2] Allow the github updater to update git sources Reply-To: bug#53060 <53060@debbugs.gnu.org> Date: Sat, 16 Aug 2025 04:21:10 +0000 retitle 53060 [PATCH 0/2] Allow the github updater to update git sources reassign 53060 guix-patches submitter 53060 Maxime Devos severity 53060 normal tag 53060 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 06 15:48:35 2022 Received: (at submit) by debbugs.gnu.org; 6 Jan 2022 20:48:35 +0000 Received: from localhost ([127.0.0.1]:42474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5ZgT-0005XY-Ks for submit@debbugs.gnu.org; Thu, 06 Jan 2022 15:48:35 -0500 Received: from lists.gnu.org ([209.51.188.17]:36092) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5ZgS-0005XQ-2X for submit@debbugs.gnu.org; Thu, 06 Jan 2022 15:48:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33884) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n5ZgR-0006Zi-Df for guix-patches@gnu.org; Thu, 06 Jan 2022 15:48:27 -0500 Received: from [2a02:1800:110:4::f00:18] (port=40416 helo=michel.telenet-ops.be) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n5ZgO-0000XM-Ts for guix-patches@gnu.org; Thu, 06 Jan 2022 15:48:26 -0500 Received: from ptr-bvsjgyhxw7psv60dyze.18120a2.ip6.access.telenet.be ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by michel.telenet-ops.be with bizsmtp id fYoL260034UW6Th06YoL2Q; Thu, 06 Jan 2022 21:48:20 +0100 Message-ID: <538acb9dc52f6992a5a65846db48f8b7382fb1be.camel@telenet.be> Subject: [PATCH 0/2] Allow the github updater to update git sources From: Maxime Devos To: guix-patches@gnu.org Date: Thu, 06 Jan 2022 21:48:15 +0100 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-Fzx4kT+PzLAft4L0SzRy" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1641502100; bh=8Bg6/J5k4iKiTbRFoEdqjZnVEGjn5t7QwmlHnX2r4LY=; h=Subject:From:To:Date; b=dthgkPwNmDxhTm3UUi/QWotTpq1pKQUQ1tILcVCYJ5qZ1U0yBU2oesJ+zd6Xm+q1j 8LOhNlNvqlOB4DoOGMtUFdDQZ1XAOwZKHAoNjp8Gk566W/z3kyg7l1o4GRZ6JxFbxJ DOYBwgKQvObAeUVrnRNdlXYR9Lg3+YUZjP8VynTz/dtbtbjuTvx3wR90Q6r7kqmwCO nsgU3SNWkvp5LY/PGkqbSrYQEdxo15F0TvteO/jwO8Ez0ekyTkkyxQZNzL7n7jf4z8 7nZJX4wvqbMMBE9Uh9/v2CTzCo1jPt3/dFI5DSayBQ39lFLHwG023rysrQETP1lPCn EBJHjrF4au1Hg== X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a02:1800:110:4::f00:18 (failed) Received-SPF: pass client-ip=2a02:1800:110:4::f00:18; envelope-from=maximedevos@telenet.be; helo=michel.telenet-ops.be X-Spam_score_int: -19 X-Spam_score: -2.0 X-Spam_bar: -- X-Spam_report: (-2.0 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-Fzx4kT+PzLAft4L0SzRy Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Follow-up to=C2=A0. To test, you can do $ make check $ ./pre-inst-env guix refresh -t github -u zig and verify that the version and sha256/base32 has been updated (zig@0.9.0 doesn't work though; patches aren't applying cleanly). Greetings, Maxime. --=-Fzx4kT+PzLAft4L0SzRy Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYddVjxccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7kdbAP9cUen8BQDlmDha8T6+mwJc9Wqw RobZmKxbCSx66+OZCAD/buXq/hA+Wp7zFDnyPxUWJze2Ao032BA2o41y3RNMwAU= =OByh -----END PGP SIGNATURE----- --=-Fzx4kT+PzLAft4L0SzRy-- From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 06 15:50:16 2022 Received: (at 53060) by debbugs.gnu.org; 6 Jan 2022 20:50:16 +0000 Received: from localhost ([127.0.0.1]:42482 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5ZiC-0005av-8H for submit@debbugs.gnu.org; Thu, 06 Jan 2022 15:50:16 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:43218) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5ZiB-0005ah-2i for 53060@debbugs.gnu.org; Thu, 06 Jan 2022 15:50:15 -0500 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by michel.telenet-ops.be with bizsmtp id fYqD260094UW6Th06YqDBT; Thu, 06 Jan 2022 21:50:13 +0100 From: Maxime Devos To: 53060@debbugs.gnu.org Subject: [PATCH 1/2] import/github: Return objects for git-fetch origins. Date: Thu, 6 Jan 2022 20:50:11 +0000 Message-Id: <20220106205012.67352-1-maximedevos@telenet.be> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1641502213; bh=dYJu5z7gAB6SomKy1Tq8oIwY6UsejtiveeCsbVZ4gy4=; h=From:To:Cc:Subject:Date; b=TTi7gE+aWyaOBkWIoIWbd2XVaRzvNMoHqhc7+fOfq2MRhFG93iViDBL4OMSbth3bJ CvnSJEwHMpYmewpxxy2Dn6HpbPQWY3uKYvMjwxpkAPdH6tUxEEVu3NGlHg3pldIqRj FTrgujy1LECElJRrvRFY57TaGNvUvp9bk7srUZicxGMvRKTib0/9UW7rWhUBUxndKe Q7XGf5KlxGMTxkT9BMDXlzUZWZzUpY0CWZFW/o9f/EKh5AsFtRbOjldOPA9CzX6iE9 +B2wBRm8tA1yHm+a1i2FFZiEkuAkNFQUm2j16a33SIjgySA3OtbyvWUYLdzxmnxGVV b0opNPhyMNgsg== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 53060 Cc: Maxime Devos 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.7 (-) * guix/import/github.scm (latest-released-version): Also return the tag. (latest-release): Use this information to return objects when appropriate. --- guix/import/github.scm | 43 ++++++++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 16 deletions(-) diff --git a/guix/import/github.scm b/guix/import/github.scm index 888b148ffb..1adfb8d281 100644 --- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2018 Eric Bavier ;;; Copyright © 2019 Arun Isaac ;;; Copyright © 2019 Efraim Flashner +;;; Copyright © 2022 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +26,7 @@ (define-module (guix import github) #:use-module (srfi srfi-1) #:use-module (srfi srfi-26) #:use-module (srfi srfi-34) + #:use-module (srfi srfi-71) #:use-module (guix utils) #:use-module (guix i18n) #:use-module (guix diagnostics) @@ -181,12 +183,15 @@ (define headers (x x))))) (define (latest-released-version url package-name) - "Return a string of the newest released version name given a string URL like + "Return the newest released version and its tag given a string URL like 'https://github.com/arq5x/bedtools2/archive/v2.24.0.tar.gz' and the name of -the package e.g. 'bedtools2'. Return #f if there is no releases" +the package e.g. 'bedtools2'. Return #f (two values) if there are no +releases." (define (pre-release? x) (assoc-ref x "prerelease")) + ;; This procedure returns (version . tag) pair, or #f + ;; if RELEASE doesn't seyem to correspond to a version. (define (release->version release) (let ((tag (or (assoc-ref release "tag_name") ;a "release" (assoc-ref release "name"))) ;a tag @@ -197,22 +202,22 @@ (define (release->version release) ((and (< name-length (string-length tag)) (string=? (string-append package-name "-") (substring tag 0 (+ name-length 1)))) - (substring tag (+ name-length 1))) + (cons (substring tag (+ name-length 1)) tag)) ;; some tags start with a "v" e.g. "v0.25.0" ;; or with the word "version" e.g. "version.2.1" ;; where some are just the version number ((string-prefix? "version" tag) - (if (char-set-contains? char-set:digit (string-ref tag 7)) - (substring tag 7) - (substring tag 8))) + (cons (if (char-set-contains? char-set:digit (string-ref tag 7)) + (substring tag 7) + (substring tag 8)) tag)) ((string-prefix? "v" tag) - (substring tag 1)) + (cons (substring tag 1) tag)) ;; Finally, reject tags that don't start with a digit: ;; they may not represent a release. ((and (not (string-null? tag)) (char-set-contains? char-set:digit (string-ref tag 0))) - tag) + (cons tag tag)) (else #f)))) (let* ((json (and=> (fetch-releases-or-tags url) @@ -229,14 +234,14 @@ (define (release->version release) (match (remove pre-release? json) (() json) ; keep everything (releases releases))) - version>?) - ((latest-release . _) latest-release) - (() #f))))) + (lambda (x y) (version>? (car x) (car y)))) + (((latest-version . tag) . _) (values latest-version tag)) + (() (values #f #f)))))) (define (latest-release pkg) "Return an for the latest release of PKG." - (define (origin-github-uri origin) - (match (origin-uri origin) + (define (github-uri uri) + (match uri ((? string? url) url) ;surely a github.com URL ((? download:git-reference? ref) @@ -244,14 +249,20 @@ (define (origin-github-uri origin) ((urls ...) (find (cut string-contains <> "github.com") urls)))) - (let* ((source-uri (origin-github-uri (package-source pkg))) + (let* ((original-uri (origin-uri (package-source pkg))) + (source-uri (github-uri original-uri)) (name (package-name pkg)) - (newest-version (latest-released-version source-uri name))) + (newest-version version-tag + (latest-released-version source-uri name))) (if newest-version (upstream-source (package name) (version newest-version) - (urls (list (updated-github-url pkg newest-version)))) + (urls (if (download:git-reference? original-uri) + (download:git-reference + (inherit original-uri) + (commit version-tag)) + (list (updated-github-url pkg newest-version))))) #f))) ; On GitHub but no proper releases (define %github-updater base-commit: 90bc18bcd4d221b53e52f94039d256d2a8edea5b prerequisite-patch-id: 2888bb74d524c7eee9edef94c8f06f099291e7d9 prerequisite-patch-id: 24d16d7354ddca4822f631a883c8e8789c818533 prerequisite-patch-id: ab72bad504c2df472d539b6a8205fed9c89416ab prerequisite-patch-id: 8c91ca86901e3f61d1363d521fa825ac680f60d8 -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Thu Jan 06 15:50:20 2022 Received: (at 53060) by debbugs.gnu.org; 6 Jan 2022 20:50:20 +0000 Received: from localhost ([127.0.0.1]:42484 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5ZiF-0005b5-M4 for submit@debbugs.gnu.org; Thu, 06 Jan 2022 15:50:20 -0500 Received: from michel.telenet-ops.be ([195.130.137.88]:43222) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n5ZiB-0005aj-2r for 53060@debbugs.gnu.org; Thu, 06 Jan 2022 15:50:16 -0500 Received: from localhost.localdomain ([IPv6:2a02:1811:8c09:9d00:3c5f:2eff:feb0:ba5a]) by michel.telenet-ops.be with bizsmtp id fYqD260094UW6Th06YqDBW; Thu, 06 Jan 2022 21:50:13 +0100 From: Maxime Devos To: 53060@debbugs.gnu.org Subject: [PATCH 2/2] import/github: Test it. Date: Thu, 6 Jan 2022 20:50:12 +0000 Message-Id: <20220106205012.67352-2-maximedevos@telenet.be> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220106205012.67352-1-maximedevos@telenet.be> References: <20220106205012.67352-1-maximedevos@telenet.be> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1641502214; bh=Dn8SaHpQ97N/TsbuIfQKi9js25kII1nD80di4Dah7kM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=F/ySSbwJAITHVI0kCkR/i2ur9B20oiCBgCzsdoXhKxOvC1zKzYGUdUZCSMk7X84S/ EcCDUUEkAcfUI+dPMK4/RaC3dCBxHmBbG9DmdKgU1moIrQ0f+EieT0/wXrvr6ZaBm4 3bTCOr0/dMzjbntA9GEU1YNKLg2TjdmiW+LtSWIJD0p+CIbNJQ3nsWLUFwyhFzmOvB MHYFHC8wpI8+qhfpbl+Ix3ni/XwtSLAk85S6UGQ+fprxDrKc5Obnd/iuhhTIPI/Ti3 3hWQdpgn5rPT1NL4hPscCUrnA+FZKkvHBQYKlLmcStl0u2F11mBJt1SUzPuvnIlX0X o94v9PtSzzaOA== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 53060 Cc: Maxime Devos 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.7 (-) * Makefile.am (SCM_TESTS): Register new tests. * guix/import/github.scm (%github-api): New variable. (fetch-releases-or-tags): Use the new variable. * tests/import-github.scm: New file with tests. --- Makefile.am | 1 + guix/import/github.scm | 9 ++- tests/import-github.scm | 139 ++++++++++++++++++++++++++++++++++++++++ 3 files changed, 146 insertions(+), 3 deletions(-) create mode 100644 tests/import-github.scm diff --git a/Makefile.am b/Makefile.am index d6aabac261..c10af6155a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -482,6 +482,7 @@ SCM_TESTS = \ tests/hackage.scm \ tests/home-import.scm \ tests/import-git.scm \ + tests/import-github.scm \ tests/import-utils.scm \ tests/inferior.scm \ tests/lint.scm \ diff --git a/guix/import/github.scm b/guix/import/github.scm index 1adfb8d281..8c1898c0c5 100644 --- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -39,7 +39,10 @@ (define-module (guix import github) #:use-module (guix upstream) #:use-module (guix http-client) #:use-module (web uri) - #:export (%github-updater)) + #:export (%github-api %github-updater)) + +;; For tests. +(define %github-api (make-parameter "https://api.github.com")) (define (find-extension url) "Return the extension of the archive e.g. '.tar.gz' given a URL, or @@ -150,11 +153,11 @@ (define (fetch-releases-or-tags url) 'https://api.github.com/repos/aconchillo/guile-json/releases' returns the empty list." (define release-url - (string-append "https://api.github.com/repos/" + (string-append (%github-api) "/repos/" (github-user-slash-repository url) "/releases")) (define tag-url - (string-append "https://api.github.com/repos/" + (string-append (%github-api) "/repos/" (github-user-slash-repository url) "/tags")) diff --git a/tests/import-github.scm b/tests/import-github.scm new file mode 100644 index 0000000000..979a0fc12b --- /dev/null +++ b/tests/import-github.scm @@ -0,0 +1,139 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2022 Maxime Devos +;;; +;;; 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-import-github) + #:use-module (json) + #:use-module (srfi srfi-35) + #:use-module (srfi srfi-64) + #:use-module (guix git-download) + #:use-module (guix http-client) + #:use-module (guix import github) + #:use-module (guix packages) + #:use-module (guix tests) + #:use-module (guix upstream) + #:use-module (ice-9 match)) + +(test-begin "github") + +(define (call-with-releases thunk tags releases) + (mock ((guix http-client) http-fetch + (lambda* (uri #:key headers) + (unless (string-prefix? "mock://" uri) + (error "the URI ~a should not be used" uri)) + (define components + (string-split (substring uri 8) #\/)) + (pk 'stuff components headers) + (define (scm->json-port scm) + (open-input-string (scm->json-string scm))) + (match components + (("repos" "foo" "foomatics" "releases") + (scm->json-port releases)) + (("repos" "foo" "foomatics" "tags") + (scm->json-port tags)) + (rest (error "TODO ~a" rest))))) + (parameterize ((%github-api "mock://")) + (thunk)))) + +;; Copied from tests/minetest.scm +(define (upstream-source->sexp upstream-source) + (define url (upstream-source-urls upstream-source)) + (unless (git-reference? url) + (error "a is expected")) + `(,(upstream-source-package upstream-source) + ,(upstream-source-version upstream-source) + ,(git-reference-url url) + ,(git-reference-commit url))) + +(define* (expected-sexp new-version new-commit) + `("foomatics" ,new-version "https://github.com/foo/foomatics" ,new-commit)) + +(define (example-package old-version old-commit) + (package + (name "foomatics") + (version old-version) + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/foo/foomatics") + (commit old-commit))) + (sha256 #f) ; not important for following tests + (file-name (git-file-name name version)))) + (build-system #f) + (license #f) + (synopsis #f) + (description #f) + (home-page #f))) + +(define* (found-sexp old-version old-commit tags releases) + (and=> + (call-with-releases (lambda () + ((upstream-updater-latest %github-updater) + (example-package old-version old-commit))) + tags releases) + upstream-source->sexp)) + +(define-syntax-rule (test-release test-case old-version + old-commit new-version new-commit + tags releases) + (test-equal test-case + (expected-sexp new-version new-commit) + (found-sexp old-version old-commit tags releases))) + +(test-release "newest release is choosen" + "1.0.0" "v1.0.0" "1.9" "v1.9" + #() + ;; a mixture of current, older and newer versions + #((("tag_name" . "v0.0")) + (("tag_name" . "v1.0.1")) + (("tag_name" . "v1.9")) + (("tag_name" . "v1.0.0")) + (("tag_name" . "v1.0.2")))) + +(test-release "tags are used when there are no formal releases" + "1.0.0" "v1.0.0" "1.9" "v1.9" + ;; a mixture of current, older and newer versions + #((("name" . "v0.0")) + (("name" . "v1.0.1")) + (("name" . "v1.9")) + (("name" . "v1.0.0")) + (("name" . "v1.0.2"))) + #()) + +(test-release "\"version-\" prefixes are recognised" + "1.0.0" "v1.0.0" "1.9" "version-1.9" + #((("name" . "version-1.9"))) + #()) + +(test-release "prefixes are optional" + "1.0.0" "v1.0.0" "1.9" "1.9" + #((("name" . "1.9"))) + #()) + +(test-release "prefixing by package name is acceptable" + "1.0.0" "v1.0.0" "1.9" "foomatics-1.9" + #((("name" . "foomatics-1.9"))) + #()) + +(test-release "not all prefixes are acceptable" + "1.0.0" "v1.0.0" "1.0.0" "v1.0.0" + #((("name" . "v1.0.0")) + (("name" . "barstatics-1.9"))) + #()) + +(test-end "github") -- 2.34.0 From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 16 17:19:59 2022 Received: (at 53060) by debbugs.gnu.org; 16 Jan 2022 22:20:00 +0000 Received: from localhost ([127.0.0.1]:44388 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9DsV-0002TD-Ls for submit@debbugs.gnu.org; Sun, 16 Jan 2022 17:19:59 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:56778) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9DsS-0002Sv-W2 for 53060@debbugs.gnu.org; Sun, 16 Jan 2022 17:19:58 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 255E8195; Sun, 16 Jan 2022 23:19:50 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zKMnKh3pdDcK; Sun, 16 Jan 2022 23:19:49 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 0ADC618A; Sun, 16 Jan 2022 23:19:48 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#53060: [PATCH 0/2] Allow the github updater to update git sources References: <538acb9dc52f6992a5a65846db48f8b7382fb1be.camel@telenet.be> Date: Sun, 16 Jan 2022 23:19:48 +0100 In-Reply-To: <538acb9dc52f6992a5a65846db48f8b7382fb1be.camel@telenet.be> (Maxime Devos's message of "Thu, 06 Jan 2022 21:48:15 +0100") Message-ID: <87wnizz5kr.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-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: 255E8195 X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DBL_PROHIBIT(0.00)[0.9.0.0:email]; RCPT_COUNT_TWO(0.00)[2]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 53060 Cc: 53060@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: -0.0 (/) Hi, Maxime Devos skribis: > Follow-up to=C2=A0. > > To test, you can do > > $ make check > $ ./pre-inst-env guix refresh -t github -u zig > > and verify that the version and sha256/base32 has been updated > (zig@0.9.0 doesn't work though; patches aren't applying cleanly). Nice, applied! One comment: > +(define (call-with-releases thunk tags releases) > + (mock ((guix http-client) http-fetch > + (lambda* (uri #:key headers) > + (unless (string-prefix? "mock://" uri) > + (error "the URI ~a should not be used" uri)) > + (define components > + (string-split (substring uri 8) #\/)) > + (pk 'stuff components headers) > + (define (scm->json-port scm) > + (open-input-string (scm->json-string scm))) > + (match components > + (("repos" "foo" "foomatics" "releases") > + (scm->json-port releases)) > + (("repos" "foo" "foomatics" "tags") > + (scm->json-port tags)) > + (rest (error "TODO ~a" rest))))) > + (parameterize ((%github-api "mock://")) > + (thunk)))) I think the whole point of having the =E2=80=98%github-api=E2=80=99 paramet= er is that it allows us to mock the HTTP server instead of having to override bindings such as =E2=80=98http-fetch=E2=80=99. I=E2=80=99d have a slight preference for doing that, similar to what is don= e in tests/cpan.scm for instance. WDYT? Thanks, Ludo=E2=80=99. From debbugs-submit-bounces@debbugs.gnu.org Sun Jan 16 17:20:14 2022 Received: (at control) by debbugs.gnu.org; 16 Jan 2022 22:20:14 +0000 Received: from localhost ([127.0.0.1]:44392 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9Dsa-0002Ty-Vl for submit@debbugs.gnu.org; Sun, 16 Jan 2022 17:20:14 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:56796) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9DsY-0002T4-MO for control@debbugs.gnu.org; Sun, 16 Jan 2022 17:20:03 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 529981C6 for ; Sun, 16 Jan 2022 23:19:57 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Wk38CqQVgo45 for ; Sun, 16 Jan 2022 23:19:57 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id EAAC7A4 for ; Sun, 16 Jan 2022 23:19:56 +0100 (CET) Date: Sun, 16 Jan 2022 23:19:56 +0100 Message-Id: <87v8yjz5kj.fsf@gnu.org> To: control@debbugs.gnu.org From: =?utf-8?Q?Ludovic_Court=C3=A8s?= Subject: control message for bug #53060 MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: 529981C6 X-Spamd-Result: default: False [0.61 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[control@debbugs.gnu.org]; RCPT_COUNT_ONE(0.00)[1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; R_MIXED_CHARSET(0.71)[subject]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: control 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.0 (/) close 53060 quit From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 17 05:13:02 2022 Received: (at 53060) by debbugs.gnu.org; 17 Jan 2022 10:13:02 +0000 Received: from localhost ([127.0.0.1]:44822 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9P0S-0005oR-6I for submit@debbugs.gnu.org; Mon, 17 Jan 2022 05:13:02 -0500 Received: from xavier.telenet-ops.be ([195.130.132.52]:41202) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9P0O-0005oH-Ut for 53060@debbugs.gnu.org; Mon, 17 Jan 2022 05:12:54 -0500 Received: from [192.168.179.254] ([188.189.128.58]) by xavier.telenet-ops.be with bizsmtp id jmCq2600U1Fk3F801mCq2k; Mon, 17 Jan 2022 11:12:51 +0100 Message-ID: <92f867a635d71b427a97012e308ed6578b3db4f4.camel@telenet.be> Subject: Re: bug#53060: [PATCH 0/2] Allow the github updater to update git sources From: Maxime Devos To: Ludovic =?ISO-8859-1?Q?Court=E8s?= Date: Mon, 17 Jan 2022 10:12:46 +0000 In-Reply-To: <87wnizz5kr.fsf@gnu.org> References: <538acb9dc52f6992a5a65846db48f8b7382fb1be.camel@telenet.be> <87wnizz5kr.fsf@gnu.org> Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="=-HPlQiW+A6J2pCc/Af1VH" User-Agent: Evolution 3.38.3-1 MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r22; t=1642414371; bh=CXpewoX9N1kYunX3E+xlayhjrsIm6cD1SOq/tCWWdcI=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=X0QtLVgCI43wRp8QpbHZpnZoN4iAAnyelEEF4TFDDkIcqdZl0KDCRXXAZA2nlln0D 764s/EPbevhzYFLV8vrx8z53NK8PubuWQ9gQO+R9Eeb2m7hSLrwHpdeJVS+oG22Hnb wHMOb207xAS0UNSOWdIeVfvIiXIpyb5EuXdZ95hGxxP9+yoNt/5C7vqRIdhIUrv/PO xgweTLWWk/0ct/cEDn9ITVhd6yO1NxueFLi/l7CWoBw5T9J3rdd9pAriRdeKyUs3ov nnINsbhlONNuS3dyvZSeK8ITDNr1iwV74ZH7OO5trH9/0LTURXWIoObqJldZe4wVe0 qXZ1U0XKhMlaQ== X-Spam-Score: -0.7 (/) X-Debbugs-Envelope-To: 53060 Cc: 53060@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.7 (-) --=-HPlQiW+A6J2pCc/Af1VH Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s schreef op zo 16-01-2022 om 23:19 [+0100]: > Hi, >=20 > Maxime Devos skribis: >=20 > > Follow-up to=C2=A0. > >=20 > > To test, you can do > >=20 > > $ make check > > $ ./pre-inst-env guix refresh -t github -u zig > >=20 > > and verify that the version and sha256/base32 has been updated > > (zig@0.9.0 doesn't work though; patches aren't applying cleanly). >=20 > Nice, applied! >=20 > One comment: >=20 > > +(define (call-with-releases thunk tags releases) > > + (mock ((guix http-client) http-fetch [...]) > > + (parameterize ((%github-api "mock://")) > > + (thunk)))) >=20 > I think the whole point of having the =E2=80=98%github-api=E2=80=99 param= eter is that it > allows us to mock the HTTP server instead of having to override bindings > such as =E2=80=98http-fetch=E2=80=99. >=20 > I=E2=80=99d have a slight preference for doing that, similar to what is d= one in > tests/cpan.scm for instance. WDYT? tests/cpan.scm uses 'with-http-server', which I do not find ideal because the answers the HTTP server gives depend on the order the HTTP server was queried, without verifying the URI. Mocking 'http-fetch' allows me not to worry about ordering and allows verifying the URI. It might be possible to modify 'with-http-server' into something (with-http-server*?) that allows looking at the HTTP headers and URI and dynamically generate a response based on that. Due to the mocking, %github-api isn't truly necessary, but having "https://api.github.com" in a single location helps avoiding typos like writing "http://" instead of "https://" somewhere, or adjusting the domain name if GitHub decided to change it for whatever reason (hopefully unlikely?), or if Tor becomes very popular among the general public and GitHub has an ".onion" address, then it could be changed to the ".onion" address easily, ... Greetings, Maxime. --=-HPlQiW+A6J2pCc/Af1VH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part Content-Transfer-Encoding: 7bit -----BEGIN PGP SIGNATURE----- iI0EABYKADUWIQTB8z7iDFKP233XAR9J4+4iGRcl7gUCYeVBHhccbWF4aW1lZGV2 b3NAdGVsZW5ldC5iZQAKCRBJ4+4iGRcl7q3sAP4kMdB9LatxdqyGx9g64mGfbZpD ojbG3MT8OaJwVNEj+wEAtkmuGM5U4iN6AVnjDF++dgyX8gyPdnJTI/UYhOkDjgw= =onMq -----END PGP SIGNATURE----- --=-HPlQiW+A6J2pCc/Af1VH-- From debbugs-submit-bounces@debbugs.gnu.org Mon Jan 17 08:13:19 2022 Received: (at 53060) by debbugs.gnu.org; 17 Jan 2022 13:13:20 +0000 Received: from localhost ([127.0.0.1]:45123 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9Rp1-0004XX-Ma for submit@debbugs.gnu.org; Mon, 17 Jan 2022 08:13:19 -0500 Received: from hera.aquilenet.fr ([185.233.100.1]:43430) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n9Roz-0004XF-LY for 53060@debbugs.gnu.org; Mon, 17 Jan 2022 08:13:18 -0500 Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 448A552F; Mon, 17 Jan 2022 14:13:12 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at aquilenet.fr Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id lC-1nE73ZeKf; Mon, 17 Jan 2022 14:13:11 +0100 (CET) Received: from ribbon (91-160-117-201.subs.proxad.net [91.160.117.201]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 7B9504C4; Mon, 17 Jan 2022 14:13:11 +0100 (CET) From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Maxime Devos Subject: Re: bug#53060: [PATCH 0/2] Allow the github updater to update git sources References: <538acb9dc52f6992a5a65846db48f8b7382fb1be.camel@telenet.be> <87wnizz5kr.fsf@gnu.org> <92f867a635d71b427a97012e308ed6578b3db4f4.camel@telenet.be> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 28 =?utf-8?Q?Niv=C3=B4se?= an 230 de la =?utf-8?Q?R?= =?utf-8?Q?=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, 17 Jan 2022 14:13:11 +0100 In-Reply-To: <92f867a635d71b427a97012e308ed6578b3db4f4.camel@telenet.be> (Maxime Devos's message of "Mon, 17 Jan 2022 10:12:46 +0000") Message-ID: <87o84apkt4.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-Spamd-Bar: / Authentication-Results: hera.aquilenet.fr; none X-Rspamd-Server: hera X-Rspamd-Queue-Id: 448A552F X-Spamd-Result: default: False [-0.10 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MID_RHS_MATCH_FROM(0.00)[] X-Spam-Score: 1.0 (+) X-Debbugs-Envelope-To: 53060 Cc: 53060@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: -0.0 (/) Hi, Maxime Devos skribis: > tests/cpan.scm uses 'with-http-server', which I do not find ideal > because the answers the HTTP server gives depend on the order the > HTTP server was queried, without verifying the URI. Mocking > 'http-fetch' allows me not to worry about ordering and allows verifying > the URI. Good point. > It might be possible to modify 'with-http-server' into something > (with-http-server*?) that allows looking at the HTTP headers and URI > and dynamically generate a response based on that. Yes, that=E2=80=99d be great. > Due to the mocking, %github-api isn't truly necessary, but having > "https://api.github.com" in a single location helps avoiding typos > like writing "http://" instead of "https://" somewhere, or adjusting > the domain name if GitHub decided to change it for whatever reason > (hopefully unlikely?), or if Tor becomes very popular among the general > public and GitHub has an ".onion" address, then it could be changed to > the ".onion" address easily, ... Yes, and also, setting =E2=80=98%github-api=E2=80=99 makes sure we don=E2= =80=99t inadvertently talk to the real GitHub (there was a bug along these lines in the tests of one of the importers a while back.) Thanks, Ludo=E2=80=99. From unknown Fri Aug 15 21:21:10 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 15 Feb 2022 12:24:10 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator