From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 2AdDBWFh8WZxIAAA62LTzQ:P1 (envelope-from ) for ; Mon, 23 Sep 2024 12:38:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id 2AdDBWFh8WZxIAAA62LTzQ (envelope-from ) for ; Mon, 23 Sep 2024 14:38:57 +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="mlw2GaE/"; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b=q8D0SU1i; 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"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1727095137; 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=dThq4fEIGCFfB2SaVJnJLmfceg5CBjNLAhEtPXNI/hH03cHOsMt5IH/MaCRMNJnG3SSba/ 7dcdcrs8hVbFHKxZymWzHP+KVGQPO6gtfTsSfb102nON1cUcMhUB57FHZrRjvTJdksHxCI If+QxVLdJf0XBoldDGRwuJm5HI28VAVM7FXbemc4p2LBorYjcGqmTf/8TXdpgUNp5i28N8 ZcxI89pC0aQosmAHS2/ikITnAsv/vpxGgcFcPXs61avzahGMT85psvQW9B+mKU5VFjPFp0 sg6wrEJG4k7kfT62vG6bcw8HE8rFGhi1NggdNSn1Ok1YFumWtCiIycXltu+OYg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1727095137; a=rsa-sha256; cv=none; b=eFcVNbDpsp4BWm4QkdlHCEJLgBIGVUC9fRQTI49LMTVwmwl0CAgK2VXUwVDAGtsUibWijw zLobqdVQ/1er2zQyTh6mIelGrsnNNXMwAXBG1cPprgGwQhIiAawc6U7sR9h3JoNtGybKeK fPLvPPtZfEsCjHfht9LcGlvZkvNYtyBf6MNC/3yYWy4ShNMbLisSR0Ptk6Yz1EbtxNUNS7 1s5Y6vhZg1qFIXqhfks8c+GLHlu7wVMCO4Nwsv+pmlWcgjChPayORMHFFX/xLKo2jtNkdN ScLweL0W+xp7p9wILTmkLp1ebtvwfU57qEglWx/xQCWNts/w88N/VOFrrI2tqA== 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="mlw2GaE/"; dkim=fail ("headers rsa verify failed") header.d=ngraves.fr header.s=ovhmo4487190-selector1 header.b=q8D0SU1i; 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"; dmarc=pass (policy=none) header.from=gnu.org 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 A7D157FE26 for ; Mon, 23 Sep 2024 14:38:56 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ssiKz-0002Ik-Q1; Mon, 23 Sep 2024 08:38:45 -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 1ssiKu-0002I3-Lc for guix-patches@gnu.org; Mon, 23 Sep 2024 08:38:41 -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 1ssiKu-00069C-AJ for guix-patches@gnu.org; Mon, 23 Sep 2024 08:38:40 -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=mlw2GaE/2j/FtqNfektqq75nRhpUznpSG0RcLeP8FKHmCaggMJjBWT368JicM/l03uktRPU/wvo5FfqvuRySi+ACjJve0WsqBUqVrAOQp90oRFaQfhkprMOiuiUC3YcWJMIL3E8CJjvqxN5hTZpD2jbzzb3xFFQK02i59nBWk1eGA60ixtvfpxVPtdHrSFRdnuEyADZ67d5+v3xJUIwvZInTXUSK2hXKEm/yKYRlzzl8IolkSZCro6Qk0oo3xHJNJx3QE9xGFspc2aONE95SKstIIiGym/3whaPehH8Cwmfk1Z1c/dRFpiofJqTG64bG+eIbITRdc7M3S2RqhkFhnQ==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ssiLG-00033l-KL for guix-patches@gnu.org; Mon, 23 Sep 2024 08:39:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#73439] [PATCH 01/10] 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: Mon, 23 Sep 2024 12:39:02 +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.172709508411578 (code B ref 73439); Mon, 23 Sep 2024 12:39:02 +0000 Received: (at 73439) by debbugs.gnu.org; 23 Sep 2024 12:38:04 +0000 Received: from localhost ([127.0.0.1]:43415 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssiKJ-00030a-QP for submit@debbugs.gnu.org; Mon, 23 Sep 2024 08:38:04 -0400 Received: from 10.mo575.mail-out.ovh.net ([46.105.79.203]:36905) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ssiKG-000300-FX for 73439@debbugs.gnu.org; Mon, 23 Sep 2024 08:38:02 -0400 Received: from director8.ghost.mail-out.ovh.net (unknown [10.109.176.51]) by mo575.mail-out.ovh.net (Postfix) with ESMTP id 4XC2ZR2TxVz1rJG for <73439@debbugs.gnu.org>; Mon, 23 Sep 2024 12:37:35 +0000 (UTC) Received: from ghost-submission-55b549bf7b-kdxks (unknown [10.111.182.85]) by director8.ghost.mail-out.ovh.net (Postfix) with ESMTPS id E903D1FEB6; Mon, 23 Sep 2024 12:37:33 +0000 (UTC) Received: from ngraves.fr ([37.59.142.105]) by ghost-submission-55b549bf7b-kdxks with ESMTPSA id yXE/Iw1h8WYAvAAAtSRi6A (envelope-from ); Mon, 23 Sep 2024 12:37:33 +0000 X-OVh-ClientIp: 87.88.185.218 Date: Mon, 23 Sep 2024 14:37:15 +0200 Message-ID: <20240923123731.18571-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: 6993808746609763042 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: 0 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeeftddrudelledgheeiucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecuhedttdenucenucfjughrpefhvfevufffkffogggtgfesthekredtredtjeenucfhrhhomheppfhitgholhgrshcuifhrrghvvghsuceonhhgrhgrvhgvshesnhhgrhgrvhgvshdrfhhrqeenucggtffrrghtthgvrhhnpeeuleejvdeggfekteehtdeftddufffhvddtuddutefhfefhkefgfeetfefhheekhfenucffohhmrghinhepghhnuhdrohhrghdpughotghumhgvnhhtfhhouhhnuggrthhiohhnrdhorhhgnecukfhppeduvdejrddtrddtrddupdekjedrkeekrddukeehrddvudekpdefjedrheelrddugedvrddutdehnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpehnghhrrghvvghssehnghhrrghvvghsrdhfrhdpnhgspghrtghpthhtohepuddprhgtphhtthhopeejfeegfeelseguvggssghughhsrdhgnhhurdhorhhgpdfovfetjfhoshhtpehmohehjeehpdhmohguvgepshhmthhpohhuth DKIM-Signature: a=rsa-sha256; bh=85SIt1M0T4d53TWhbDlFi9IV8dqtJ0/FttAj7MqHNTQ=; c=relaxed/relaxed; d=ngraves.fr; h=From; s=ovhmo4487190-selector1; t=1727095055; v=1; b=q8D0SU1iZlOXXoCQUfIAwArGYw9Nd86lI+f8r8t/57ko2gOOV2ubta1D9O2n7hbSUD3ECGB+ 6ea7+BSZii7OiJFLgVvK2rC+SH3XeTmlZQehcIZchcUqwvsI/zYQB+cjcn6RfMr4o3HIJLkk9U/ UgnheHUc8kZ9ZR7wMg7n+I3DJx6D7sfeDH1Jt1xWHY1qDUXycAyIwF+u9rC5RzcHXF09AUFKjPp SZBLH/QTRZDqAJvOKKE1h0wwXgQcFMeuIFwUqZw+9YQnAdDrtocHVrpQa7vT59DVHKApSW/9+R3 xALPYi6LEJG4tvnDqUUu+x92mmmv6DCV4fuDgQ7MkUFfw== 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -6.72 X-Migadu-Queue-Id: A7D157FE26 X-Spam-Score: -6.72 X-TUID: JD1fHyijZ14Q 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