From patchwork Fri Feb 23 15:48:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 60921 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 47A4027BBEA; Fri, 23 Feb 2024 16:05:52 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6615427BBE2 for ; Fri, 23 Feb 2024 16:05:47 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rdY2J-0000oG-16; Fri, 23 Feb 2024 11:04:31 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXo3-00048Z-Aw for guix-patches@gnu.org; Fri, 23 Feb 2024 10:49:48 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rdXo3-0007GE-1h; Fri, 23 Feb 2024 10:49:47 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rdXoJ-0002AP-Ae; Fri, 23 Feb 2024 10:50:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#69328] [PATCH 05/12] swh: =?utf-8?b?4oCYb3JpZ2luLXZpc2l0cw==?= =?utf-8?b?4oCZ?= takes an optional =?utf-8?b?4oCYbWF44oCZ?= parameter. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 23 Feb 2024 15:50:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69328 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69328@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69328-submit@debbugs.gnu.org id=B69328.17087033628036 (code B ref 69328); Fri, 23 Feb 2024 15:50:03 +0000 Received: (at 69328) by debbugs.gnu.org; 23 Feb 2024 15:49:22 +0000 Received: from localhost ([127.0.0.1]:49225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdXnc-00025F-CD for submit@debbugs.gnu.org; Fri, 23 Feb 2024 10:49:22 -0500 Received: from eggs.gnu.org ([209.51.188.92]:52698) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rdXnP-000225-6h for 69328@debbugs.gnu.org; Fri, 23 Feb 2024 10:49:12 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rdXmw-00077r-A4; Fri, 23 Feb 2024 10:48:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=Hucc6WJuBhVi+/2k46omilZnN1Sg3HuEcy/BKiZe2OU=; b=Gl/wa1tyUSWfaz4b2IJ2 DleR22k5hIhi8YgDRV/0OkAZafL7iQLTXGU8izUgg63zCbL5wYlWiXz1mCUpnV5095BW8eXkVgR4t mcNL0HsqyVwKmERYTax+nhqffFYKQnChj5GmcZxLmreTX2X0gweV4nVb4ku08bSHitQl4YqlSREmc s34JA3XqOI9m8MzF3kptiUcCl0i7KM4WUN4J0jK42S51VYnBr/YjQ0oqpD/a2ypLa10zgCN67F69/ CcCN8ZYR7Y9DhC+I6jKGnlSv5tsRXxj/swyLwTfRbMkigqdizED6TSn8uZXgRhKlFfPpN3xs1xpph iCCr21Zzeo1qoA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 23 Feb 2024 16:48:09 +0100 Message-ID: <61e6c1cb658fb29ec0a55aca5b57f65597c4ac41.1708697539.git.ludo@gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches * guix/swh.scm (origin-visits): Add optional ‘max’ parameter and honor it. Change-Id: I642d7d4b0672b68fb5c7ce2b49161307e13d3c95 --- guix/swh.scm | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/guix/swh.scm b/guix/swh.scm index 83f67423c8..14c65f6806 100644 --- a/guix/swh.scm +++ b/guix/swh.scm @@ -474,10 +474,11 @@ (define* (lookup-directory-by-nar-hash hash #:optional (algorithm 'sha256)) hash) external-id-target)) -(define (origin-visits origin) - "Return the list of visits of ORIGIN, a record as returned by -'lookup-origin'." - (call (swh-url (origin-visits-url origin)) +(define* (origin-visits origin #:optional (max 10)) + "Return the list of the up to MAX latest visits of ORIGIN, a record as +returned by 'lookup-origin'." + (call (string-append (swh-url (origin-visits-url origin)) + "?per_page=" (number->string max)) (lambda (port) (map json->visit (vector->list (json->scm port))))))