From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id uHIaH9g1/GbkbQAA62LTzQ:P1 (envelope-from ) for ; Tue, 01 Oct 2024 17:48:08 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:4876::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id uHIaH9g1/GbkbQAA62LTzQ (envelope-from ) for ; Tue, 01 Oct 2024 19:48:08 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=SQJCcyJ7; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b="Hd8Gfu/j"; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727804888; a=rsa-sha256; cv=none; b=XvjHniVOcsSXUgDo+PXTk1UUgwkZghsrp06Mre/FIV2E3oPH4A+a37FRUirqbOucCLvbNS KNKyuG7vkOEF+CCno4d8W2Uuap+escfmKAu6WCmaM9bX/hK9WxG0L6hcQXgfmkdmZxzuei LYg3UYAzG3VnDZg3CnvncsCt7pvRCV+ht+d6FeVBTKVLv2+ihurYkXN6+KXe47ySLFGI56 jplDNhncFcktacRLMs1G89hSbSFFEFNTr/5f1ETgBflaf+U5BpxQKBUEFQBR+ei8c6uB0m oKlt3fvO2r0+VhZeABD97F9tz08FRTp1BBxVC8v0zboYdJLBp/t4HhMVdBeeMA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=SQJCcyJ7; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b="Hd8Gfu/j"; dmarc=pass (policy=none) header.from=gnu.org; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727804888; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: 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:dkim-signature; bh=85SIt1M0T4d53TWhbDlFi9IV8dqtJ0/FttAj7MqHNTQ=; b=a3F39KkUWk0Y4k8vQgIbHvaKZwDtg8iKWWbkka6U+QWJJGPtLaN3UwH3cWneLUm+HwsBrZ 8svi6y22vPeAUjaK9V+S/611/WVBVFjTudnyIliHqxSC2VAxZdGlDRCec7X+SJi6kNWbiz m43hyK26xUcJKCncQOsVBBPjQc9yXif0YWNNhkBO9KQcmOQKgpXe0AAUD8eS525ZYGqpPK O8ELn+T29JT6l/PjiwiYzp4btX7GW3M8re/uxnnIDR1tyXdv6/qT1dVOs3a9Di1ck4iDXm cyOrQwC33FKZkHLNMbMohbRU+Tvf983vbMObFFZcCvTrJ//H3/PEPUC0s73UMw== 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 019ED1E2B3 for ; Tue, 01 Oct 2024 19:48:08 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sveIK-0000SD-PI; Tue, 01 Oct 2024 10:56:08 -0400 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 1sveIF-0000MD-U8 for guix-patches@gnu.org; Tue, 01 Oct 2024 10:56:04 -0400 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 1sveIE-0006zy-Kx for guix-patches@gnu.org; Tue, 01 Oct 2024 10:56:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=85SIt1M0T4d53TWhbDlFi9IV8dqtJ0/FttAj7MqHNTQ=; b=SQJCcyJ7leISPcbbJgLfilTm/GyNYIDwY/PkRxUdGPsFsnpy43ChRhkU4oHPs+G1ORf8Qn1GvhtVcMqymNg0EMUg7plSe9SloRtM1KVkvmPCbp41c+OekeNf8X6fyME+zIxJ3UqfAI85CNRG6WxT+HUDDw3HPn3RUXhl1FAX1u5Kl6IC4RcKA+LWLhfXo3rq7JCaGFJwJ4CFSSL+ETx9IuJLCQgZMY0ugjmw+5HnvBtbqTqLduDBYwEOrwp+rhNF4Ac/qK4ZGs6bRZFUJms9Jy4mE0YKhFcVpm/wTs8Y/QFvacKF4N33TdFE10gp1umzNT13zSZc3R/HkZ6P2JczNA==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sveID-0003Xn-KC for guix-patches@gnu.org; Tue, 01 Oct 2024 10:56:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73439] [PATCH v4 1/4] import: Add %libreoffice-updater. References: <20240923122128.14126-1-ngraves@ngraves.fr> In-Reply-To: <20240923122128.14126-1-ngraves@ngraves.fr> Resent-From: Nicolas Graves Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Tue, 01 Oct 2024 14:56:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 73439 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 73439@debbugs.gnu.org Cc: Nicolas Graves Received: via spool by 73439-submit@debbugs.gnu.org id=B73439.172779451213576 (code B ref 73439); Tue, 01 Oct 2024 14:56:01 +0000 Received: (at 73439) by debbugs.gnu.org; 1 Oct 2024 14:55:12 +0000 Received: from localhost ([127.0.0.1]:51826 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sveHQ-0003Wt-3o for submit@debbugs.gnu.org; Tue, 01 Oct 2024 10:55:12 -0400 Received: from 10.mo576.mail-out.ovh.net ([46.105.73.241]:60289) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sveHM-0003Uc-GP for 73439@debbugs.gnu.org; Tue, 01 Oct 2024 10:55:10 -0400 Received: from director9.ghost.mail-out.ovh.net (unknown [10.109.148.126]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id 4XJ1FR2SCvz25yY for <73439@debbugs.gnu.org>; Tue, 1 Oct 2024 14:55:07 +0000 (UTC) Received: from ghost-submission-55b549bf7b-jgpcj (unknown [10.110.113.182]) by director9.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 0AED61FEAE; Tue, 1 Oct 2024 14:55:07 +0000 (UTC) Received: from ngraves.fr ([37.59.142.98]) by ghost-submission-55b549bf7b-jgpcj with ESMTPSA id yGtWN0oN/Gbj3wAAjiXYSA (envelope-from ); Tue, 01 Oct 2024 14:55:07 +0000 X-OVh-ClientIp: 86.246.19.221 Date: Tue, 1 Oct 2024 16:54:56 +0200 Message-ID: <20241001145505.9409-1-ngraves@ngraves.fr> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 957859349950554850 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrvddujedgkedtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeeuleejvdeggfekteehtdeftddufffhvddtuddutefhfefhkefgfeetfefhheekhfenucffohhmrghinhepghhnuhdrohhrghdpughotghumhgvnhhtfhhouhhnuggrthhiohhnrdhorhhgnecukfhppeduvdejrddtrddtrddupdekiedrvdegiedrudelrddvvddupdefjedrheelrddugedvrdelkeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepihhnvghtpeduvdejrddtrddtrddupdhmrghilhhfrhhomhepnhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrpdhnsggprhgtphhtthhopedupdhrtghpthhtohepjeefgeefleesuggvsggsuhhgshdrghhnuhdrohhrghdpoffvtefjohhsthepmhhoheejiedpmhhouggvpehsmhhtphhouhht DKIM-Signature: a=rsa-sha256; bh=85SIt1M0T4d53TWhbDlFi9IV8dqtJ0/FttAj7MqHNTQ=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1727794507; v=1; b=Hd8Gfu/j/hZUQPc0rfEFiiXV8Dlu3PmcrcZDDyJHAMBh4j/BS2zTCQdVjCaFWPWhdnDbOjY9 3cREqeSG1tjGTzT3lCdM3nxU7JSoBeMmjw43CJCckj0JUM9/Yiaq9sZ3ITXmO9h/l6TWXU+io6H VpAYkRuAkRYpsIBi5jtyaoyr1a7XIJmhDzj4I2ptoA+BK9Su9kbbDq72CfRroqrgwYydwQfOZ6V QeGrPB4/4KmYGnSh2Kl/5dauyPlsGwZnNeyy7CaVr2FDExtRxac6rs7ifnHUl/ZNljcic+26Ceh uG1N/M1gl8tddWmjWtd4xg7gnvBMiOur1IWc9/gu8Bkdw== 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: , Reply-to: Nicolas Graves X-ACL-Warn: , Nicolas Graves via Guix-patches From: Nicolas Graves via Guix-patches via Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -3.48 X-Spam-Score: -3.48 X-Migadu-Queue-Id: 019ED1E2B3 X-Migadu-Scanner: mx10.migadu.com X-TUID: m80vx/Tlkojc Change-Id: I481b1175db531c4fea4a57838fe190f679cd1a85 --- Makefile.am | 1 + guix/import/libreoffice.scm | 98 +++++++++++++++++++++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 guix/import/libreoffice.scm diff --git a/Makefile.am b/Makefile.am index e9801283f8..e4e4fb5a19 100644 --- a/Makefile.am +++ b/Makefile.am @@ -306,6 +306,7 @@ MODULES = \ guix/import/json.scm \ guix/import/kde.scm \ guix/import/launchpad.scm \ + guix/import/libreoffice.scm \ guix/import/minetest.scm \ guix/import/npm-binary.scm \ guix/import/opam.scm \ diff --git a/guix/import/libreoffice.scm b/guix/import/libreoffice.scm new file mode 100644 index 0000000000..65d20f0432 --- /dev/null +++ b/guix/import/libreoffice.scm @@ -0,0 +1,98 @@ +;;; GNU Guix --- Functional package management for GNU +;;; Copyright © 2024 Nicolas Graves +;;; +;;; 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 (guix import libreoffice) + #:use-module (web client) + #:use-module (sxml match) + #:use-module (sxml simple) + #:use-module (guix i18n) + #:use-module (guix diagnostics) + #:use-module (guix packages) + #:use-module (guix upstream) + #:use-module (guix utils) + #:use-module (ice-9 textual-ports) + #:use-module (srfi srfi-26) + #:use-module (srfi srfi-71) + #:export (%libreoffice-updater)) + +(define archive-prefix + "https://downloadarchive.documentfoundation.org/libreoffice/old/") +(define libreoffice-latest-url (string-append archive-prefix "latest/src/")) + +(define (libreoffice-latest-version) + (let* ((response port (http-get libreoffice-latest-url + #:streaming? #t)) + (content (get-string-all port)) + ;; xml->sxml is not flexible enough for html. + ;; For instance, tags don't have closing . + ;; This trick preprocesses html to extract all tags in + ;; a wrapper, which sxml-match can handle well. + (xml (xml->sxml + (string-append + "<" + (string-join + (filter (cute string-prefix? "a " <>) + (string-split content #\<)) + "<") + ">") + #:trim-whitespace? #t))) + (sxml-match + xml + ((*TOP* + (body + (a (@ (href "?C=N;O=D")) "Name") + (a (@ (href "?C=M;O=A")) "Last modified") + (a (@ (href "?C=S;O=A")) "Size") + (a (@ (href "/libreoffice/old/latest/")) "Parent Directory") + (a (@ (href ,link)) ,name) + . ,rest)) + (if (and (string-prefix? "libreoffice-" name) + (string-suffix? ".tar.xz" name)) + (string-drop + (string-drop-right name (string-length ".tar.xz")) + (string-length "libreoffice-")) + (raise + (formatted-message (G_ "Could not extract version from '~a'") + name))))))) + +(define* (latest-release package #:key (version #f)) + "Return an for the latest-release of PACKAGE." + (let* ((name (package-name package)) + (version (or version (libreoffice-latest-version)))) + (upstream-source + (package name) + (version version) + (urls (list + (string-append + archive-prefix version "/src/libreoffice-" version ".tar.xz") + (string-append + "https://download.documentfoundation.org/libreoffice/src/" + (version-prefix version 3) "/libreoffice-" version ".tar.xz")))))) + +(define (libreoffice-package? package) + "Return true if PACKAGE is LibreOffice." + (string=? (package-name package) "libreoffice")) + +(define %libreoffice-updater + (upstream-updater + (name 'libreoffice) + (description "Updater for Libreoffice package") + (pred libreoffice-package?) + (import latest-release))) + +;; libreoffice.scm ends here. -- 2.46.0