From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id cCwQHKlrC2NPugAAbAwnHQ (envelope-from ) for ; Sun, 28 Aug 2022 15:20:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id sADeG6lrC2N4BwEAauVa8A (envelope-from ) for ; Sun, 28 Aug 2022 15:20:41 +0200 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 34B5523BD7 for ; Sun, 28 Aug 2022 15:20:41 +0200 (CEST) Received: from localhost ([::1]:44402 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oSIDQ-0003Xk-6j for larch@yhetil.org; Sun, 28 Aug 2022 09:20:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59410) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oSICu-0002vj-Or for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:08 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:39841) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oSICu-0002fd-Es for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:08 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oSICu-0006yr-Aj for guix-patches@gnu.org; Sun, 28 Aug 2022 09:20:08 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57460] [PATCH 12/20] refresh: Allow updating to a specific version (kde) Resent-From: Hartmut Goebel Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 28 Aug 2022 13:20:08 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57460 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 57460@debbugs.gnu.org Received: via spool by 57460-submit@debbugs.gnu.org id=B57460.166169278026665 (code B ref 57460); Sun, 28 Aug 2022 13:20:08 +0000 Received: (at 57460) by debbugs.gnu.org; 28 Aug 2022 13:19:40 +0000 Received: from localhost ([127.0.0.1]:57798 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSICR-0006vu-Lg for submit@debbugs.gnu.org; Sun, 28 Aug 2022 09:19:39 -0400 Received: from mout.kundenserver.de ([217.72.192.74]:59383) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oSICA-0006tp-Ph for 57460@debbugs.gnu.org; Sun, 28 Aug 2022 09:19:23 -0400 Received: from hermia.goebel-consult.de ([46.87.137.46]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.183]) with ESMTPSA (Nemesis) id 1N3bCH-1pR5xW0v8F-010aTi for <57460@debbugs.gnu.org>; Sun, 28 Aug 2022 15:19:17 +0200 Received: from lenashee.fritz.box (lenashee.goebel-consult.de [192.168.110.2]) by hermia.goebel-consult.de (Postfix) with ESMTP id 247BE65A42; Sun, 28 Aug 2022 15:18:56 +0200 (CEST) From: Hartmut Goebel Date: Sun, 28 Aug 2022 15:18:38 +0200 Message-Id: X-Mailer: git-send-email 2.30.4 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Provags-ID: V03:K1:wUOoZFisOBafod6k2k9c2ozHRPPdSEYOjZPtTZWQKBiriA6iQte Uo/A2KJXnFGsmLu/ikfoVarNOJGa12R2SakgOdQpN+Gw8EW9+b08nKgM5u2phWanMQgsG8J ylssVJFmzij+LtE7aOfpcA6Qj+iGhOY3LEeHT2UMOPFz5ekAoQ/ppN889+r/4uPRKch6joC 66JWWtOgV0mcXyQ0AVLeA== X-UI-Out-Filterresults: notjunk:1;V03:K0:RD3zSTq95x4=:Qs2VcSnIDCabor0lR9PVSG i6ckBoTamyOOD/PTbX/NtoRdiiYeRs31H9oXEzROQK1nItMVVKBuRnPfwGzx6dmqUrea3qWlF KBlkYsCkiPHyAonkdItNoPsiJdp52IYIxwXksVpp5hp5nMMy2tbHt+87AvE/zK8kAVjK1U3FE 6JmULLh5aF3xQ53f3C9+dH1YO7Q+O6MfHyarF80A06dmScN7IF3vGC/1Na2Yu1iuoLtNE1oEQ aBSYcntElNs5gtqSkPefy5R9SmKH0JORRZK/wi2eiEkqBw7CM68Rix/AonA4rpSRIFWI5yVLm zqXwiROrhW6O0ExcykcDULiVVmRiklmg/LzaAHrgNBgByhjjCzVXrIxq4bTT+UIn3YE9U9us0 gQwFhs2blFNkPHlxE9dWV7DN+pGS7xZZ5yFL+6zK/7PUtadCMZy8QeEbyYapUDlwnJ1iwxtxa zYqYyRci1Nx3ONcVTII72Lbe0smk1Wys2c8EwflQSiP5uFPOm6McWNAOC833f0nAXcDTmPw61 F/LhOvAzPc2+o00/Ajn/eekxr67GY+GVcYeS59Q8qIa25logtnwlsO80oy7YrhWgq7V1mqECd P5oRIGRJuBZ54fO5HF4qu2wNDzNDOQM6OhKwI5OeeZCz6nniFTX7ckIXIvY53DOsL21LREaY+ vI7Wg3GKyvv7AreHRSESHb1NMMYqUWDyG33RcfE7UcSoiLROJyoloBGlK/8e1lrxxkoGrxT1I 0aLgvS9USnB4flv2fnoEurTYZGiOUayLDqw2hKMQAAk1nzIGmBRgbtdDmwY= 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+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1661692841; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=E10Gd7erzEv5kC+6hGkHvNF6klyAWbnDwyZOomWCF8c=; b=K5n06VGf8+nLgdgo+oAJpn6foUUfgrPl5yR8Z31qx3OiFLEDeEGZkUo66He23m7R/COk/U Nf0niehhQfAx2+SUuUD2H+kdDuBDL9vHWg+7lbRscRCzXhaEjv2yI4OzB5UBW2Ie8Ar9gk aYWmuYsV5BqqpXvPi8xc7AjaTViL/pJl0slC+JvU7O+aaYWVEBnrx9KpbHe1Ni6iJtqPWY 6fV8FgHKrfhYGMxakiGCi2y/qiaTIHM5Q6Tzrz+9Eu1uXxnOka9EyggzMVJWCsPMOmge1s oYKxFeYep1Y2FdbT5DAfme5AdVZ95aJAJiiVg2V7wYa4xCJ2DouSx7XEnmhoXw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1661692841; a=rsa-sha256; cv=none; b=V35YwdjNsDXXmPoMlCYlgvF0AlEQHGp+zTDCgrU+Wn76ZsmGdAM0Md7WSGWHEF4VzsAA9u CS7/Oojzo1OhjK8xUqdB6675NHWLFHqBLC1J7bHftX6IvBOnbOZAPmpjkszyNIKFCKZIyF M2tR/wQU+1a7SiCo3IgVcWEy4aUrrf60IqfwMv8LYcW93uCNWp2aImXMOW+Yb5+EoshgrS r9zMBVV9kDk6xNt2r6gVBgxF6P4HoGZDHFHnS/90ZpYzYSV8Oe+qRiB2O0YU9wgGn24I7u oluyyUW/6pHh6Sf3HQg3ir7RnS0qX5ggamMpl7BWXj9oR6tYcj5vTAAaWq5fEg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -0.30 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 34B5523BD7 X-Spam-Score: -0.30 X-Migadu-Scanner: scn0.migadu.com X-TUID: LYCaiYtEueDv * guix/import/kde.scm(latest-kde-release): Rename to (import-kde-release), add keyword-argument 'version'. Rework the code to not sort the relevant files, but just find the requested or latest version. [find-latest-archive-version]: New function. --- guix/import/kde.scm | 58 ++++++++++++++++++++++++++------------------- 1 file changed, 34 insertions(+), 24 deletions(-) diff --git a/guix/import/kde.scm b/guix/import/kde.scm index 510d823a4f..d364e44edb 100644 --- a/guix/import/kde.scm +++ b/guix/import/kde.scm @@ -28,6 +28,7 @@ #:use-module (ice-9 match) #:use-module (ice-9 rdelim) #:use-module (ice-9 regex) + #:use-module (srfi srfi-1) #:use-module (srfi srfi-11) #:use-module (web uri) @@ -149,42 +150,51 @@ Output: (string-join (map version->pattern directory-parts) "/") "/")))) -(define (latest-kde-release package) +(define* (import-kde-release package #:key (version #f)) "Return the latest release of PACKAGE, a KDE package, or #f if it could not be determined." + + (define (find-latest-archive-version archives) + (fold (lambda (file1 file2) + (if (and file2 + (version>? (tarball-sans-extension (basename file2)) + (tarball-sans-extension (basename file1)))) + file2 + file1)) + #f + archives)) + (let* ((uri (string->uri (origin-uri (package-source package)))) (path-rx (uri->kde-path-pattern uri)) (name (package-upstream-name package)) (files (download.kde.org-files)) + ;; select archives for this package (relevant (filter (lambda (file) (and (regexp-exec path-rx file) (release-file? name (basename file)))) - files))) - (match (sort relevant (lambda (file1 file2) - (version>? (tarball-sans-extension - (basename file1)) - (tarball-sans-extension - (basename file2))))) - ((and tarballs (reference _ ...)) - (let* ((version (tarball->version reference)) - (tarballs (filter (lambda (file) - (string=? (tarball-sans-extension - (basename file)) - (tarball-sans-extension - (basename reference)))) - tarballs))) - (upstream-source - (package name) - (version version) - (urls (map (lambda (file) - (string-append "mirror://kde/" file)) - tarballs))))) - (() - #f)))) + files)) + ;; find latest version + (version (or version + (and (not (null? relevant)) + (tarball->version (find-latest-archive-version relevant))))) + ;; find archives matching this version + (archives (filter (lambda (file) + (string=? version (tarball->version file))) + relevant))) + (match archives + (() #f) + (_ + (upstream-source + (package name) + (version version) + (urls (map (lambda (file) + (string-append "mirror://kde/" file)) + archives))))))) + (define %kde-updater (upstream-updater (name 'kde) (description "Updater for KDE packages") (pred (url-prefix-predicate "mirror://kde/")) - (import latest-kde-release))) + (import import-kde-release))) -- 2.30.4