From patchwork Tue May 14 10:19:08 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Arun Isaac X-Patchwork-Id: 13982 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id DFD7B16FF4; Tue, 14 May 2019 11:20:09 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTP id 1C4F016FF2 for ; Tue, 14 May 2019 11:20:09 +0100 (BST) Received: from localhost ([127.0.0.1]:44908 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQUXY-0000iI-MV for patchwork@mira.cbaines.net; Tue, 14 May 2019 06:20:08 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57007) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hQUXU-0000gi-Lf for guix-patches@gnu.org; Tue, 14 May 2019 06:20:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hQUXT-0006W8-1m for guix-patches@gnu.org; Tue, 14 May 2019 06:20:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:33933) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hQUXS-0006Sw-BZ for guix-patches@gnu.org; Tue, 14 May 2019 06:20:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hQUXR-0007x9-Uz for guix-patches@gnu.org; Tue, 14 May 2019 06:20:02 -0400 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?= 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 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: 35684@debbugs.gnu.org Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches > If you don’t mind, you can make it two patches for clarity (one that > defines ‘release->version’, and one that adds the call to ‘sort’) Sure, pleae find attached. From 8192712f8108d0abcd527ff6b16af073c453b780 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. --- 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 --- 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")) - (any release->version - (match (remove pre-release? json) - (() json) ; keep everything - (releases releases)))))) + (match (sort (filter-map release->version + (match (remove pre-release? json) + (() json) ; keep everything + (releases releases))) + version>?) + ((latest-release . _) latest-release) + (() #f))))) (define (latest-release pkg) "Return an for the latest release of PKG." -- 2.21.0