From unknown Fri Jun 13 11:11:00 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35684] import: github: Sort releases before picking the latest one. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 11 May 2019 11:24:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 35684 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: 35684@debbugs.gnu.org X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.15575738236659 (code B ref -1); Sat, 11 May 2019 11:24:02 +0000 Received: (at submit) by debbugs.gnu.org; 11 May 2019 11:23:43 +0000 Received: from localhost ([127.0.0.1]:39971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPQ6R-0001jL-9p for submit@debbugs.gnu.org; Sat, 11 May 2019 07:23:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPQ6O-0001j7-7i for submit@debbugs.gnu.org; Sat, 11 May 2019 07:23:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:45477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPQ6J-00073f-1N for submit@debbugs.gnu.org; Sat, 11 May 2019 07:23:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPQ6H-0002JH-Ll for guix-patches@gnu.org; Sat, 11 May 2019 07:23:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPQ6G-00071m-Ja for guix-patches@gnu.org; Sat, 11 May 2019 07:23:33 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:48632) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPQ6F-0006uv-GD for guix-patches@gnu.org; Sat, 11 May 2019 07:23:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GvIH2PDrXNCnoW9iKHsYC+gn2XclCzzArwsDSymBib0=; b=AF94KYbcQOOnPwk0I7PyOZfjh+ z9I86P1s5fPwh7hD5LYg8WyjBdcIdrCqyFJCt8XFWdnzJXzbKX6mKZLev5EG23vfh3/9LYArgrUNY yNVIV0RHkj2NcgxEfD08e2Eiv/ZtxreVFQW/8et7c7z2oSZVo42j1scJKBclVGZ0te6k=; Received: from [49.206.13.189] (helo=steel) by systemreboot.net with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hPQ6A-0001vZ-WE for guix-patches@gnu.org; Sat, 11 May 2019 16:53:27 +0530 From: Arun Isaac Date: Sat, 11 May 2019 16:53:21 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 139.59.75.54 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.4 (-) 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.4 (--) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Prior to this, for some packages (e.g., osc in (gnu packages build-tools)), `guix refresh' could not find the latest version correctly. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-import-github-Sort-releases-before-picking-the-lates.patch Content-Transfer-Encoding: quoted-printable From=2033f42ea8a33c6e502062708336a5ab8be871c92b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 11 May 2019 16:40:38 +0530 Subject: [PATCH] import: github: Sort releases before picking the latest on= e. * guix/import/github.scm (latest-released-version): Sort releases before picking the first one as the latest. =2D-- guix/import/github.scm | 55 ++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/guix/import/github.scm b/guix/import/github.scm index 4d12339204..a8af318bc8 100644 =2D-- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -183,32 +183,35 @@ API when using a GitHub token") API. This may be fixed by using an access token and setting the environment variable GUIX_GITHUB_TOKEN, for instance one procured from https://github.com/settings/tokens")) =2D (any =2D (lambda (release) =2D (let ((tag (or (hash-ref release "tag_name") ;a "release" =2D (hash-ref release "name"))) ;a tag =2D (name-length (string-length package-name))) =2D (cond =2D ;; some tags include the name of the package e.g. "fdupes-= 1.51" =2D ;; so remove these =2D ((and (< name-length (string-length tag)) =2D (string=3D? (string-append package-name "-") =2D (substring tag 0 (+ name-length 1)))) =2D (substring tag (+ name-length 1))) =2D ;; some tags start with a "v" e.g. "v0.25.0" =2D ;; where some are just the version number =2D ((string-prefix? "v" tag) =2D (substring tag 1)) =2D ;; Finally, reject tags that don't start with a digit: =2D ;; they may not represent a release. =2D ((and (not (string-null? tag)) =2D (char-set-contains? char-set:digit =2D (string-ref tag 0))) =2D tag) =2D (else #f)))) =2D (match (remove pre-release? json) =2D (() json) ; keep everything =2D (releases releases)))))) + (first + (sort + (filter-map + (lambda (release) + (let ((tag (or (hash-ref release "tag_name") ;a "release" + (hash-ref release "name"))) ;a tag + (name-length (string-length package-name))) + (cond + ;; some tags include the name of the package e.g. "fdupes-= 1.51" + ;; so remove these + ((and (< name-length (string-length tag)) + (string=3D? (string-append package-name "-") + (substring tag 0 (+ name-length 1)))) + (substring tag (+ name-length 1))) + ;; some tags start with a "v" e.g. "v0.25.0" + ;; where some are just the version number + ((string-prefix? "v" tag) + (substring tag 1)) + ;; 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) + (else #f)))) + (match (remove pre-release? json) + (() json) ; keep everything + (releases releases))) + version>?))))) =20 (define (latest-release pkg) "Return an for the latest release of PKG." =2D-=20 2.21.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAlzWsKoACgkQLiXui2GA K7NdjwgAqQ/YarcqTl9yArKcCvLRCXq0Ta/Y3ZDRf2qz2mTRs/3bPivIQEG+5oJf BPnlrSA6NQIrku7tM/ryRtNQGag/O8yUEdi496vU7mxa1X6jJlxXYaLOKGat7wp6 ZN6QrjKhx5oUlYUXEtuhRHgLUUlQvTQ95oFhVvP8jf8lC0E3va115Mt3KXMLTm3p easLET250+FnP5P3Q6+L4XtJ0Wwro7Y6UKnpCeUgI9DcZ0FvVYrbMSbx4wTtf1OT 872RXgiB5JCLxXaqUP+G+96U1+sfZWfnu4tX+QYljQ1wNSMUwd9DZ5QlytvHiOQj NtkRv8W24JRwrPVphqCEPcrJ7WkqNg== =vJPD -----END PGP SIGNATURE----- --==-=-=-- From unknown Fri Jun 13 11:11:00 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35684] import: github: Sort releases before picking the latest one. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 12 May 2019 21:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35684 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Arun Isaac Cc: 35684@debbugs.gnu.org Received: via spool by 35684-submit@debbugs.gnu.org id=B35684.155769764028029 (code B ref 35684); Sun, 12 May 2019 21:48:02 +0000 Received: (at 35684) by debbugs.gnu.org; 12 May 2019 21:47:20 +0000 Received: from localhost ([127.0.0.1]:43555 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPwJU-0007I0-0X for submit@debbugs.gnu.org; Sun, 12 May 2019 17:47:20 -0400 Received: from eggs.gnu.org ([209.51.188.92]:42702) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPwJS-0007Hk-1q for 35684@debbugs.gnu.org; Sun, 12 May 2019 17:47:18 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:33894) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPwJK-00022I-RA; Sun, 12 May 2019 17:47:10 -0400 Received: from [2a01:e0a:1d:7270:6a6c:dc17:fc02:cfda] (port=37448 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hPwJK-0003rM-9Z; Sun, 12 May 2019 17:47:10 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: Date: Sun, 12 May 2019 23:47:06 +0200 In-Reply-To: (Arun Isaac's message of "Sat, 11 May 2019 16:53:21 +0530") Message-ID: <87mujrs5ut.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.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: -3.3 (---) Arun Isaac skribis: > Prior to this, for some packages (e.g., osc in (gnu packages > build-tools)), `guix refresh' could not find the latest version > correctly. Good catch. > From 33f42ea8a33c6e502062708336a5ab8be871c92b Mon Sep 17 00:00:00 2001 > From: Arun Isaac > Date: Sat, 11 May 2019 16:40:38 +0530 > Subject: [PATCH] import: github: Sort releases before picking the latest = one. > > * guix/import/github.scm (latest-released-version): Sort releases before > picking the first one as the latest. [...] > + (first > + (sort > + (filter-map > + (lambda (release) > + (let ((tag (or (hash-ref release "tag_name") ;a "release" > + (hash-ref release "name"))) ;a tag > + (name-length (string-length package-name))) > + (cond > + ;; some tags include the name of the package e.g. "fdupe= s-1.51" > + ;; so remove these > + ((and (< name-length (string-length tag)) > + (string=3D? (string-append package-name "-") > + (substring tag 0 (+ name-length 1)))) > + (substring tag (+ name-length 1))) > + ;; some tags start with a "v" e.g. "v0.25.0" > + ;; where some are just the version number > + ((string-prefix? "v" tag) > + (substring tag 1)) > + ;; 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) > + (else #f)))) > + (match (remove pre-release? json) > + (() json) ; keep everything > + (releases releases))) > + version>?))))) LGTM, but=E2=80=A6 =E2=80=A6 while you=E2=80=99re at it, would you mind cleaning this up a bit= ? :-) Namely, I think this big =E2=80=98lambda=E2=80=99 could be given a name and= moved out of the way to make =E2=80=98latest-released-version=E2=80=99 easier to read. = Also, it would probably be reasonable to avoid =E2=80=98first=E2=80=99 and instead w= rite: (match (sort =E2=80=A6) ((first . _) first) (() (leave (G_ "no releases found etc.~%")))) WDYT? :-) If you=E2=80=99d rather leave that for later, you can also just go ahead and commit your patch. Thanks, Ludo=E2=80=99. From unknown Fri Jun 13 11:11:00 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35684] import: github: Sort releases before picking the latest one. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 May 2019 08:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35684 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35684@debbugs.gnu.org Received: via spool by 35684-submit@debbugs.gnu.org id=B35684.155773495116946 (code B ref 35684); Mon, 13 May 2019 08:10:01 +0000 Received: (at 35684) by debbugs.gnu.org; 13 May 2019 08:09:11 +0000 Received: from localhost ([127.0.0.1]:44000 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQ61H-0004PF-1B for submit@debbugs.gnu.org; Mon, 13 May 2019 04:09:11 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:32982) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQ61D-0004Oz-Es for 35684@debbugs.gnu.org; Mon, 13 May 2019 04:09:09 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7uRSojDp+YMRRA5KE66SS0tb40f23E2REhIV/bjHhps=; b=UgxZ7MFRUM4mhkJSXUZb+plE/ mRUSRdRXb8zop6EHSo6TAglGN+Geofh+GTTbAAsNFiJXEQ3J6118PJg1M5s/32vq+tkmqcJdrdmLo K9IsPK+okMfq7GkEOxE8bpkNJl4nBdnFzEA8gZn4bpLkOEfH5faeKHIp148sY+JlDq1Hk=; Received: from [14.139.128.10] (helo=steel) by systemreboot.net with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hQ61A-0001A2-9C; Mon, 13 May 2019 13:39:04 +0530 From: Arun Isaac In-Reply-To: <87mujrs5ut.fsf@gnu.org> References: <87mujrs5ut.fsf@gnu.org> Date: Mon, 13 May 2019 13:38:37 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) 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.0 (-) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > Namely, I think this big =E2=80=98lambda=E2=80=99 could be given a name a= nd moved out of > the way to make =E2=80=98latest-released-version=E2=80=99 easier to read.= Also, it > would probably be reasonable to avoid =E2=80=98first=E2=80=99 and instead= write: > > (match (sort =E2=80=A6) > ((first . _) first) > (() > (leave (G_ "no releases found etc.~%")))) > > WDYT? :-) > > If you=E2=80=99d rather leave that for later, you can also just go ahead = and > commit your patch. No problem! :-) Here is the updated patch. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-import-github-Sort-releases-before-picking-the-lates.patch Content-Transfer-Encoding: quoted-printable From=20d3f28de8fedc41732a07edf2ea91222208ccc73f Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 11 May 2019 16:40:38 +0530 Subject: [PATCH] import: github: Sort releases before picking the latest on= e. * guix/import/github.scm (latest-released-version): Sort releases before picking the first one as the latest. =2D-- guix/import/github.scm | 56 ++++++++++++++++++++++-------------------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/guix/import/github.scm b/guix/import/github.scm index 4d12339204..cdac70420a 100644 =2D-- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -174,6 +174,29 @@ the package e.g. 'bedtools2'. Return #f if there is n= o releases" (define (pre-release? x) (hash-ref x "prerelease")) =20 + (define (release->version release) + (let ((tag (or (hash-ref release "tag_name") ;a "release" + (hash-ref release "name"))) ;a tag + (name-length (string-length package-name))) + (cond + ;; some tags include the name of the package e.g. "fdupes-1.51" + ;; so remove these + ((and (< name-length (string-length tag)) + (string=3D? (string-append package-name "-") + (substring tag 0 (+ name-length 1)))) + (substring tag (+ name-length 1))) + ;; some tags start with a "v" e.g. "v0.25.0" + ;; where some are just the version number + ((string-prefix? "v" tag) + (substring tag 1)) + ;; 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) + (else #f)))) + (let* ((json (fetch-releases-or-tags url))) (if (eq? json #f) (if (%github-token) @@ -183,32 +206,13 @@ API when using a GitHub token") API. This may be fixed by using an access token and setting the environment variable GUIX_GITHUB_TOKEN, for instance one procured from https://github.com/settings/tokens")) =2D (any =2D (lambda (release) =2D (let ((tag (or (hash-ref release "tag_name") ;a "release" =2D (hash-ref release "name"))) ;a tag =2D (name-length (string-length package-name))) =2D (cond =2D ;; some tags include the name of the package e.g. "fdupes-= 1.51" =2D ;; so remove these =2D ((and (< name-length (string-length tag)) =2D (string=3D? (string-append package-name "-") =2D (substring tag 0 (+ name-length 1)))) =2D (substring tag (+ name-length 1))) =2D ;; some tags start with a "v" e.g. "v0.25.0" =2D ;; where some are just the version number =2D ((string-prefix? "v" tag) =2D (substring tag 1)) =2D ;; Finally, reject tags that don't start with a digit: =2D ;; they may not represent a release. =2D ((and (not (string-null? tag)) =2D (char-set-contains? char-set:digit =2D (string-ref tag 0))) =2D tag) =2D (else #f)))) =2D (match (remove pre-release? json) =2D (() json) ; keep everything =2D (releases releases)))))) + (match (sort (filter-map release->version + (match (remove pre-release? json) + (() json) ; keep everything + (releases releases))) + version>?) + ((latest-release . _) latest-release) + (() #f))))) =20 (define (latest-release pkg) "Return an for the latest release of PKG." =2D-=20 2.21.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAlzZJgUACgkQLiXui2GA K7O7jQf/eXgA1csQzNoh9vbbaBl+LkHeniV6rinV/90/ml+2/xkYjFOzmLrL4i7y B1KKfFjgNezcL9AWvr1XJSrPRnZV/ERhSkgIAxSaZPRD7BgkmAfYo2kSBu9XWYjO ljMc72/Oqd2cSxfkGJbNf2sAG/LgabLxnSZ8Avfgh6l77LzCYgCoyt0Ytf/N1PU3 k295117JlnGRoyb0O5lJVKNPk0x7dhz87BU7tTowa1O5hMSrNXiPcXhg5ov1Gx41 sb4sW8asgU7JPxprxVlMe1oHZaY3s0sTgLPkRYc6d8rqkdAooz7TWn48Jy6TaUAw Pb0v8GSAXtkVo0LxWs4agGUw5Tw2yg== =6lPO -----END PGP SIGNATURE----- --==-=-=-- From unknown Fri Jun 13 11:11:00 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35684] import: github: Sort releases before picking the latest one. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Mon, 13 May 2019 13:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35684 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Arun Isaac Cc: 35684@debbugs.gnu.org Received: via spool by 35684-submit@debbugs.gnu.org id=B35684.15577549888137 (code B ref 35684); Mon, 13 May 2019 13:44:02 +0000 Received: (at 35684) by debbugs.gnu.org; 13 May 2019 13:43:08 +0000 Received: from localhost ([127.0.0.1]:44476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQBES-00027A-Gu for submit@debbugs.gnu.org; Mon, 13 May 2019 09:43:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44448) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQBEQ-00026Z-In for 35684@debbugs.gnu.org; Mon, 13 May 2019 09:43:07 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:44760) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQBEK-0003gB-Kd; Mon, 13 May 2019 09:43:00 -0400 Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=43580 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hQBEK-0000qt-3Z; Mon, 13 May 2019 09:43:00 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87mujrs5ut.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 24 =?UTF-8?Q?Flor=C3=A9al?= an 227 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, 13 May 2019 15:42:57 +0200 In-Reply-To: (Arun Isaac's message of "Mon, 13 May 2019 13:38:37 +0530") Message-ID: <87d0kmsc66.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.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: -3.3 (---) Arun Isaac skribis: > From d3f28de8fedc41732a07edf2ea91222208ccc73f Mon Sep 17 00:00:00 2001 > From: Arun Isaac > Date: Sat, 11 May 2019 16:40:38 +0530 > Subject: [PATCH] import: github: Sort releases before picking the latest = one. > > * guix/import/github.scm (latest-released-version): Sort releases before > picking the first one as the latest. Very nice, LGTM! If you don=E2=80=99t mind, you can make it two patches for clarity (one that defines =E2=80=98release->version=E2=80=99, and one that = adds the call to =E2=80=98sort=E2=80=99); otherwise just amend the commit log above to me= ntion =E2=80=98release->version=E2=80=99. Thank you! Ludo=E2=80=99. From unknown Fri Jun 13 11:11:00 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35684] import: github: Sort releases before picking the latest one. Resent-From: Arun Isaac Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 14 May 2019 10:20:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35684 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: 35684@debbugs.gnu.org Received: via spool by 35684-submit@debbugs.gnu.org id=B35684.155782916530504 (code B ref 35684); Tue, 14 May 2019 10:20:01 +0000 Received: (at 35684) by debbugs.gnu.org; 14 May 2019 10:19:25 +0000 Received: from localhost ([127.0.0.1]:47474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQUWq-0007vw-OZ for submit@debbugs.gnu.org; Tue, 14 May 2019 06:19:25 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:44548) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQUWl-0007vh-1c for 35684@debbugs.gnu.org; Tue, 14 May 2019 06:19:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=JwdMWJTDIJpgCWe224nhoN218eYBNAVgz1SzpTE1qDY=; b=eMgQoVVxiMZUe+xFq369gkq6n 0aodnEKucVBBkvmclaKepSema5HOtfQmH67yxGyNm3cCBXigQRwOzrAaoVWqayfkleDURnEvvPCGr oqP/Wuqh8kpaF8BnSFybCnIw9irvGxv5QS80u0URAkK1i/4tg10xfDAhA0TsoUuCMrcio=; Received: from [14.139.128.10] (helo=steel) by systemreboot.net with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hQUWi-0003Tr-4L; Tue, 14 May 2019 15:49:16 +0530 From: Arun Isaac In-Reply-To: <87d0kmsc66.fsf@gnu.org> References: <87mujrs5ut.fsf@gnu.org> <87d0kmsc66.fsf@gnu.org> Date: Tue, 14 May 2019 15:49:08 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) 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.0 (-) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable > If you don=E2=80=99t mind, you can make it two patches for clarity (one t= hat > defines =E2=80=98release->version=E2=80=99, and one that adds the call to= =E2=80=98sort=E2=80=99) Sure, pleae find attached. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-import-github-Improve-readability.patch Content-Transfer-Encoding: quoted-printable From=20c96956bc6e944f9691773640e402c15215078943 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 14 May 2019 15:44:46 +0530 Subject: [PATCH 1/2] import: github: Improve readability. * guix/import/github.scm (latest-released-version)[release->version]: Separ= ate out release->version as a new function. =2D-- guix/import/github.scm | 53 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/guix/import/github.scm b/guix/import/github.scm index 4d12339204..5f4d9c7267 100644 =2D-- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -174,6 +174,29 @@ the package e.g. 'bedtools2'. Return #f if there is n= o releases" (define (pre-release? x) (hash-ref x "prerelease")) =20 + (define (release->version release) + (let ((tag (or (hash-ref release "tag_name") ;a "release" + (hash-ref release "name"))) ;a tag + (name-length (string-length package-name))) + (cond + ;; some tags include the name of the package e.g. "fdupes-1.51" + ;; so remove these + ((and (< name-length (string-length tag)) + (string=3D? (string-append package-name "-") + (substring tag 0 (+ name-length 1)))) + (substring tag (+ name-length 1))) + ;; some tags start with a "v" e.g. "v0.25.0" + ;; where some are just the version number + ((string-prefix? "v" tag) + (substring tag 1)) + ;; 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) + (else #f)))) + (let* ((json (fetch-releases-or-tags url))) (if (eq? json #f) (if (%github-token) @@ -183,32 +206,10 @@ API when using a GitHub token") API. This may be fixed by using an access token and setting the environment variable GUIX_GITHUB_TOKEN, for instance one procured from https://github.com/settings/tokens")) =2D (any =2D (lambda (release) =2D (let ((tag (or (hash-ref release "tag_name") ;a "release" =2D (hash-ref release "name"))) ;a tag =2D (name-length (string-length package-name))) =2D (cond =2D ;; some tags include the name of the package e.g. "fdupes-= 1.51" =2D ;; so remove these =2D ((and (< name-length (string-length tag)) =2D (string=3D? (string-append package-name "-") =2D (substring tag 0 (+ name-length 1)))) =2D (substring tag (+ name-length 1))) =2D ;; some tags start with a "v" e.g. "v0.25.0" =2D ;; where some are just the version number =2D ((string-prefix? "v" tag) =2D (substring tag 1)) =2D ;; Finally, reject tags that don't start with a digit: =2D ;; they may not represent a release. =2D ((and (not (string-null? tag)) =2D (char-set-contains? char-set:digit =2D (string-ref tag 0))) =2D tag) =2D (else #f)))) =2D (match (remove pre-release? json) =2D (() json) ; keep everything =2D (releases releases)))))) + (any release->version + (match (remove pre-release? json) + (() json) ; keep everything + (releases releases)))))) =20 (define (latest-release pkg) "Return an for the latest release of PKG." =2D-=20 2.21.0 --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0002-import-github-Sort-releases-before-picking-the-lates.patch Content-Transfer-Encoding: quoted-printable From=208192712f8108d0abcd527ff6b16af073c453b780 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Tue, 14 May 2019 15:46:19 +0530 Subject: [PATCH 2/2] import: github: Sort releases before picking the latest one. * guix/import/github.scm (latest-released-version): Sort releases before picking the first one as the latest. =2D-- guix/import/github.scm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/guix/import/github.scm b/guix/import/github.scm index 5f4d9c7267..cdac70420a 100644 =2D-- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -206,10 +206,13 @@ API when using a GitHub token") API. This may be fixed by using an access token and setting the environment variable GUIX_GITHUB_TOKEN, for instance one procured from https://github.com/settings/tokens")) =2D (any release->version =2D (match (remove pre-release? json) =2D (() json) ; keep everything =2D (releases releases)))))) + (match (sort (filter-map release->version + (match (remove pre-release? json) + (() json) ; keep everything + (releases releases))) + version>?) + ((latest-release . _) latest-release) + (() #f))))) =20 (define (latest-release pkg) "Return an for the latest release of PKG." =2D-=20 2.21.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAlzalhwACgkQLiXui2GA K7PzBAgAoyQgzvScfXVyu3WxGjqIydu+o3e4bzwrPP7VvZWLMky+km0rYjxqrcyo vAADbQp1jLKOYAiKBFpyHj7p84H9TSv4PY/QMlbRrROgl06SPo64IbN/v8cZCzi4 kq7U0ALlLgj2XapAa1LNoc1stfxR+CTj9QRVdnzXrPBKM58gg8Z0KXPvfQrJBnLh 2i4MMkud9dziXvn3yUGPHvKMKH6k0F1lPJ/iXnXd2zeMnTzVIfPF2CreGg9JXk3i uUbbwtnW9vjBPcawdU4YSGIGrDnIC3nqRjJXKNJk/88wxiMMG+IapkJ1MK5o9v4z CD6IeRzEKc8bWDPi1r8D+HYeilGMdg== =Wc/a -----END PGP SIGNATURE----- --==-=-=-- From unknown Fri Jun 13 11:11:00 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#35684] import: github: Sort releases before picking the latest one. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 14 May 2019 21:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 35684 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Arun Isaac Cc: 35684@debbugs.gnu.org Received: via spool by 35684-submit@debbugs.gnu.org id=B35684.155786759320492 (code B ref 35684); Tue, 14 May 2019 21:00:02 +0000 Received: (at 35684) by debbugs.gnu.org; 14 May 2019 20:59:53 +0000 Received: from localhost ([127.0.0.1]:50034 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQeWf-0005KS-DQ for submit@debbugs.gnu.org; Tue, 14 May 2019 16:59:53 -0400 Received: from eggs.gnu.org ([209.51.188.92]:53470) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQeWd-0005KD-5h for 35684@debbugs.gnu.org; Tue, 14 May 2019 16:59:51 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:42544) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQeWW-0005eE-AZ; Tue, 14 May 2019 16:59:45 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=37420 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1hQeWO-00053y-2m; Tue, 14 May 2019 16:59:39 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87mujrs5ut.fsf@gnu.org> <87d0kmsc66.fsf@gnu.org> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 25 =?UTF-8?Q?Flor=C3=A9al?= an 227 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, 14 May 2019 22:59:34 +0200 In-Reply-To: (Arun Isaac's message of "Tue, 14 May 2019 15:49:08 +0530") Message-ID: <87tvdwwy4p.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Spam-Score: -2.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: -3.3 (---) Arun Isaac skribis: >> If you don=E2=80=99t mind, you can make it two patches for clarity (one = that >> defines =E2=80=98release->version=E2=80=99, and one that adds the call t= o =E2=80=98sort=E2=80=99) > > Sure, pleae find attached. Thank you, it still LGTM. :-) Ludo=E2=80=99. From unknown Fri Jun 13 11:11:00 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: Arun Isaac Subject: bug#35684: closed (Re: [bug#35684] import: github: Sort releases before picking the latest one.) Message-ID: References: X-Gnu-PR-Message: they-closed 35684 X-Gnu-PR-Package: guix-patches Reply-To: 35684@debbugs.gnu.org Date: Wed, 15 May 2019 08:26:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1557908762-13426-1" This is a multi-part message in MIME format... ------------=_1557908762-13426-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #35684: import: github: Sort releases before picking the latest one. 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 35684@debbugs.gnu.org. --=20 35684: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D35684 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1557908762-13426-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 35684-done) by debbugs.gnu.org; 15 May 2019 08:26:00 +0000 Received: from localhost ([127.0.0.1]:50916 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQpEe-0003UL-G3 for submit@debbugs.gnu.org; Wed, 15 May 2019 04:26:00 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:35944) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hQpEa-0003U9-7B for 35684-done@debbugs.gnu.org; Wed, 15 May 2019 04:25:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: References:In-Reply-To:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=LazTNssXLdF1PF3hiqIOgGZIMkSeXdS5sdNmtBDM+qo=; b=kiuKw2vPjxTIb6uycHMk9L1bn 2YOLqCAJvYSvr26Nnv2IYZnvdjiDxuhCA5MyWN7BoR+OkznrYIxiYwljCfEcIlXAMxmeMzCJGFBE1 BOPMdzO2DyM628rsGCBHJ4JOF0Yc0gVks9bxR7Tpf0AYFtX9Q2AdJuoHOznmN1d5OVw70=; Received: from [49.206.13.189] (helo=steel) by systemreboot.net with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hQpEW-0006lG-GN; Wed, 15 May 2019 13:55:52 +0530 From: Arun Isaac To: Ludovic =?utf-8?Q?Court=C3=A8s?= Subject: Re: [bug#35684] import: github: Sort releases before picking the latest one. In-Reply-To: <87tvdwwy4p.fsf@gnu.org> References: <87mujrs5ut.fsf@gnu.org> <87d0kmsc66.fsf@gnu.org> <87tvdwwy4p.fsf@gnu.org> Date: Wed, 15 May 2019 13:55:35 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 35684-done Cc: 35684-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.0 (-) --=-=-= Content-Type: text/plain Pushed to master, thanks! --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAlzbzP8ACgkQLiXui2GA K7MGjAgAx7hqY3JZmUSRupNO1F5QrsdjBCY7vaNZ6ux0C0tgJxaf3uvVQZrN6hNE 4H+4vnApCgoQn4ulZfT6qnZKcocyx9jn5o67rr7aN+dinNxPyLfDCcFmVZ8hLI17 IIV0CqSY3acPwo9j0WNmnrchrRRnBv7Em/bcm3S5hWLyUqG2eprbJxTzNZHXAsup um11iJz2GhEeXMakfrE0cBuh39abysBqjLzQ/s2pM8dx33cyt2cJE2kbw0+WD5TI +1TR5tIR35dVcMRDl7cf4Ka6x5CtMVh+CnXvB9LvBK4vJ2G76Z71GfsVMW0/hLBM YAAQvdUPlZIhSbNmNjx6dAOMQD/+Gg== =iFRv -----END PGP SIGNATURE----- --=-=-=-- ------------=_1557908762-13426-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 11 May 2019 11:23:43 +0000 Received: from localhost ([127.0.0.1]:39971 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPQ6R-0001jL-9p for submit@debbugs.gnu.org; Sat, 11 May 2019 07:23:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:52871) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hPQ6O-0001j7-7i for submit@debbugs.gnu.org; Sat, 11 May 2019 07:23:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:45477) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPQ6J-00073f-1N for submit@debbugs.gnu.org; Sat, 11 May 2019 07:23:35 -0400 Received: from eggs.gnu.org ([209.51.188.92]:39015) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hPQ6H-0002JH-Ll for guix-patches@gnu.org; Sat, 11 May 2019 07:23:34 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_40,URIBL_BLOCKED autolearn=disabled version=3.3.2 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hPQ6G-00071m-Ja for guix-patches@gnu.org; Sat, 11 May 2019 07:23:33 -0400 Received: from mugam.systemreboot.net ([139.59.75.54]:48632) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hPQ6F-0006uv-GD for guix-patches@gnu.org; Sat, 11 May 2019 07:23:32 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=systemreboot.net; s=default; h=Content-Type:MIME-Version:Message-ID:Date: Subject:To:From:Sender:Reply-To:Cc:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=GvIH2PDrXNCnoW9iKHsYC+gn2XclCzzArwsDSymBib0=; b=AF94KYbcQOOnPwk0I7PyOZfjh+ z9I86P1s5fPwh7hD5LYg8WyjBdcIdrCqyFJCt8XFWdnzJXzbKX6mKZLev5EG23vfh3/9LYArgrUNY yNVIV0RHkj2NcgxEfD08e2Eiv/ZtxreVFQW/8et7c7z2oSZVo42j1scJKBclVGZ0te6k=; Received: from [49.206.13.189] (helo=steel) by systemreboot.net with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1hPQ6A-0001vZ-WE for guix-patches@gnu.org; Sat, 11 May 2019 16:53:27 +0530 From: Arun Isaac To: guix-patches@gnu.org Subject: import: github: Sort releases before picking the latest one. Date: Sat, 11 May 2019 16:53:21 +0530 Message-ID: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 139.59.75.54 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Spam-Score: -1.4 (-) 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.4 (--) --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain Prior to this, for some packages (e.g., osc in (gnu packages build-tools)), `guix refresh' could not find the latest version correctly. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-import-github-Sort-releases-before-picking-the-lates.patch Content-Transfer-Encoding: quoted-printable From=2033f42ea8a33c6e502062708336a5ab8be871c92b Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Sat, 11 May 2019 16:40:38 +0530 Subject: [PATCH] import: github: Sort releases before picking the latest on= e. * guix/import/github.scm (latest-released-version): Sort releases before picking the first one as the latest. =2D-- guix/import/github.scm | 55 ++++++++++++++++++++++-------------------- 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/guix/import/github.scm b/guix/import/github.scm index 4d12339204..a8af318bc8 100644 =2D-- a/guix/import/github.scm +++ b/guix/import/github.scm @@ -183,32 +183,35 @@ API when using a GitHub token") API. This may be fixed by using an access token and setting the environment variable GUIX_GITHUB_TOKEN, for instance one procured from https://github.com/settings/tokens")) =2D (any =2D (lambda (release) =2D (let ((tag (or (hash-ref release "tag_name") ;a "release" =2D (hash-ref release "name"))) ;a tag =2D (name-length (string-length package-name))) =2D (cond =2D ;; some tags include the name of the package e.g. "fdupes-= 1.51" =2D ;; so remove these =2D ((and (< name-length (string-length tag)) =2D (string=3D? (string-append package-name "-") =2D (substring tag 0 (+ name-length 1)))) =2D (substring tag (+ name-length 1))) =2D ;; some tags start with a "v" e.g. "v0.25.0" =2D ;; where some are just the version number =2D ((string-prefix? "v" tag) =2D (substring tag 1)) =2D ;; Finally, reject tags that don't start with a digit: =2D ;; they may not represent a release. =2D ((and (not (string-null? tag)) =2D (char-set-contains? char-set:digit =2D (string-ref tag 0))) =2D tag) =2D (else #f)))) =2D (match (remove pre-release? json) =2D (() json) ; keep everything =2D (releases releases)))))) + (first + (sort + (filter-map + (lambda (release) + (let ((tag (or (hash-ref release "tag_name") ;a "release" + (hash-ref release "name"))) ;a tag + (name-length (string-length package-name))) + (cond + ;; some tags include the name of the package e.g. "fdupes-= 1.51" + ;; so remove these + ((and (< name-length (string-length tag)) + (string=3D? (string-append package-name "-") + (substring tag 0 (+ name-length 1)))) + (substring tag (+ name-length 1))) + ;; some tags start with a "v" e.g. "v0.25.0" + ;; where some are just the version number + ((string-prefix? "v" tag) + (substring tag 1)) + ;; 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) + (else #f)))) + (match (remove pre-release? json) + (() json) ; keep everything + (releases releases))) + version>?))))) =20 (define (latest-release pkg) "Return an for the latest release of PKG." =2D-=20 2.21.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEf3MDQ/Lwnzx3v3nTLiXui2GAK7MFAlzWsKoACgkQLiXui2GA K7NdjwgAqQ/YarcqTl9yArKcCvLRCXq0Ta/Y3ZDRf2qz2mTRs/3bPivIQEG+5oJf BPnlrSA6NQIrku7tM/ryRtNQGag/O8yUEdi496vU7mxa1X6jJlxXYaLOKGat7wp6 ZN6QrjKhx5oUlYUXEtuhRHgLUUlQvTQ95oFhVvP8jf8lC0E3va115Mt3KXMLTm3p easLET250+FnP5P3Q6+L4XtJ0Wwro7Y6UKnpCeUgI9DcZ0FvVYrbMSbx4wTtf1OT 872RXgiB5JCLxXaqUP+G+96U1+sfZWfnu4tX+QYljQ1wNSMUwd9DZ5QlytvHiOQj NtkRv8W24JRwrPVphqCEPcrJ7WkqNg== =vJPD -----END PGP SIGNATURE----- --==-=-=-- ------------=_1557908762-13426-1--