From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id mLh/EYG2uGa77wAA62LTzQ:P1 (envelope-from ) for ; Sun, 11 Aug 2024 13:02:57 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e16b::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id mLh/EYG2uGa77wAA62LTzQ (envelope-from ) for ; Sun, 11 Aug 2024 15:02:57 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=ChgupHcV; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=KY9QqCl2; 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=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1723381377; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: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=JeWDk95aP1rLpDgnQg9hgjaEq9E0FpUpaBdvKv+m8w8=; b=bZ8CC2r+EjHi5dCKbNmo7qaOfMmY93zXkujvAXEBKQVfEDS2KUgp1WzH1sIbU07CBC0hNb xu/o0bCFsI01zFTYpDABSYoeMzPT+xnMZPMCz1YOl4FZYmZ0AlJe3+VaJUUzyMQa+aaV9f 2jcUa90qbJn8yUCfStG2gt5ExGfx5kGuZP/Ap30IJ+HnNPpzrvNfIwicjUzJtjfb/1I2bF cgVRl69xv1zP7Q0aP7la1VHZXSz5vlY3ksXo619NZrD7bGbqY6msFK37qGLOOT8O+08GQe 6NH/QKbatv1N9JYBIJBL+rbdWlXHMxFvXp3FToncKIOEFUGA6IzRssnw5VtKIw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=ChgupHcV; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20230601 header.b=KY9QqCl2; 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=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=gmail.com (policy=none) ARC-Seal: i=1; s=key1; d=yhetil.org; t=1723381377; a=rsa-sha256; cv=none; b=PcXWlj7PvPqbx86vI99mF8Q7IAGZyzE3cDunwPdEM1EGAdFWip/Yy3a5Yxq/LQsFd4OVLb K6dEuTR4ed4m96sOaGAgNpSW0thGH440Ul0/RAe0FBVrY/IHr1+UCNvj0t3I7TD8OiLOxA cQOcs8MI7QwyjKfk4gOgvBqdlaeEFdXhuzy3sRrRoCLb7rVTlTdKRGH3t9BmhtqapSbS2j CkBda3T9NkvSjRS9NHet3VPpNRxZ5C0GWRcp5cMORoAXTlH9QtZlbxqYLiXGhT3XN9/PxU 4zutk4tTgx6GvrThyofm7htsUA+a/Mb1wwXZkD5CTMtpAMhsCzEMtES5z3zANA== 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 6CE2D50D28 for ; Sun, 11 Aug 2024 15:02:56 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sd8DY-0003S0-KS; Sun, 11 Aug 2024 09:02:41 -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 1sd8DR-0003PK-57 for guix-patches@gnu.org; Sun, 11 Aug 2024 09:02:34 -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 1sd8DQ-0003QM-Qs for guix-patches@gnu.org; Sun, 11 Aug 2024 09:02:32 -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:References:In-Reply-To:To:Subject; bh=JeWDk95aP1rLpDgnQg9hgjaEq9E0FpUpaBdvKv+m8w8=; b=ChgupHcVgaqfqR2cnsIDKEoO53BB1dJkuBDfGeAtUx0NGt6btzMm+BJWcsfzLd5b6Rg9i6tODd2lIs5S1sndK9g38oy0dYGmqruGRRnBraZ54Ak6+NBePajHmj1Ka6IM7G66LX+ENFNVqiEAad/u19f9HTj3Bc3jIJCzh3tc+GdqjiEAehz3wnxWjbATKe4TeF/lNnmbDI0xqUJgvNC8yHvu6ArBGDPInVixNTfbG+rWWZ8SIHn9UX8nibuRpphFOS7QlFBcwKtv8ouD7eq2YuUHuTs8MNNTvyTeuz5YTgtbHn9QgNIDMaHPZlNSQwXNbTSORaCLZpY/yyML5o9H2g==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sd8Du-0003j7-7z; Sun, 11 Aug 2024 09:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#72406] [PATCH emacs-team WIP v4 01/24] build-system: emacs: Define package-with-explicit-emacs. Resent-From: Liliana Marie Prikler Original-Sender: "Debbugs-submit" Resent-CC: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com, guix-patches@gnu.org Resent-Date: Sun, 11 Aug 2024 13:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72406 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 72406@debbugs.gnu.org Cc: gemmaro.dev@gmail.com, andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com X-Debbugs-Original-Xcc: andrew@trop.in, cox.katherine.e+guix@gmail.com, liliana.prikler@gmail.com Received: via spool by 72406-submit@debbugs.gnu.org id=B72406.172338136814121 (code B ref 72406); Sun, 11 Aug 2024 13:03:02 +0000 Received: (at 72406) by debbugs.gnu.org; 11 Aug 2024 13:02:48 +0000 Received: from localhost ([127.0.0.1]:40939 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd8Df-0003fg-F8 for submit@debbugs.gnu.org; Sun, 11 Aug 2024 09:02:47 -0400 Received: from mail-ed1-f68.google.com ([209.85.208.68]:50577) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sd8Db-0003eb-HJ for 72406@debbugs.gnu.org; Sun, 11 Aug 2024 09:02:44 -0400 Received: by mail-ed1-f68.google.com with SMTP id 4fb4d7f45d1cf-5b8c2a611adso4195023a12.1 for <72406@debbugs.gnu.org>; Sun, 11 Aug 2024 06:02:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723381267; x=1723986067; darn=debbugs.gnu.org; h=mime-version:cc:to:subject:date:from:references:in-reply-to :message-id:from:to:cc:subject:date:message-id:reply-to; bh=JeWDk95aP1rLpDgnQg9hgjaEq9E0FpUpaBdvKv+m8w8=; b=KY9QqCl2jqRWFKFUoRPkEIjUP+ZnTsesQE+Z+ci85v1TNSs5B122TpHMAndFNk2fnM ErjLCJY+ld6yhhQi6h7XbMuS3/PQXKM00lXWq9VFSuDZbL8UDauFE49G6SYLCDtE5d+5 Y5tI6JPdmQQcaUh4Mhi6QA4pFpjWa3Vul/tzygsUWNGprtmxsi8atvbuqcKV46o5HRY+ iKqQQ0hy4YdnmPSOHLnXKxizQWPExbNEiqXCTnqNcnaruKv8ftlZzohDdoWnnNRmbewU 07wpHD0dNoA0iimZhNVg8YsycpIy7YdfxJramKoEoy4rTSLFuJEED3I8lS2F6qpfZ8dz 2zSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723381267; x=1723986067; h=mime-version:cc:to:subject:date:from:references:in-reply-to :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=JeWDk95aP1rLpDgnQg9hgjaEq9E0FpUpaBdvKv+m8w8=; b=E6amzUnRQdJdHX1VKf84NA5KPhOHVEjpuYTPBMNIXHG8quKw2cp9Pk41XMEjvlENRj q9eqyhLwN5YMxQs4dKfSvSFEChcK38O9q03fcRZS3SLdy+74pgloMNtrGvd4B6cnNfy+ 97EaB5c4K7xzLt2qlsxJpdqqchjit7g4BADrK6HagSYV3I5nfoC1xCoptLqPNILygGm4 GwK8Hn0/rRcyI4dQUBouEssr4RBrQmyDAtZ5D4hKJEljgqV8i2CKLIep9aVApg0b44I8 fPbXxAgAe6QiRYBdAttuBO1R5ic3rO4NZ2lD6PVWY2nUAnTa3oj5oH2bxG6ZzYa1s1vB Zsow== X-Gm-Message-State: AOJu0YyQb/5CGmiJglmrwR5cPwKq1uTZ2vOtOYGLjuCmI0p69aMuMT6d 4j6h7iBYG0+CUg7A6WEG4d2BXTH64NnlFlD6zazRJpyC8QEMP1hy3tWJe+Ja X-Google-Smtp-Source: AGHT+IECWPWFrsevfVkHeawcqEBzZul2qh8MwM0z0tOlxIUmFWp35A1I8AlBOwytVCfaPjaRPX/8BQ== X-Received: by 2002:a05:6402:849:b0:5af:a605:cd84 with SMTP id 4fb4d7f45d1cf-5bd0a68d4b1mr4628402a12.33.1723381266577; Sun, 11 Aug 2024 06:01:06 -0700 (PDT) Received: from lumine.fritz.box (85-127-20-124.dsl.dynamic.surfer.at. [85.127.20.124]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5bd1a5dfc9fsm1320046a12.66.2024.08.11.06.01.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 11 Aug 2024 06:01:06 -0700 (PDT) Message-ID: <19bb476657c13cc5ab2181de6259249a441942cc.1723381182.git.liliana.prikler@gmail.com> In-Reply-To: References: From: Liliana Marie Prikler Date: Sun, 11 Aug 2024 14:58:42 +0200 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+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-Queue-Id: 6CE2D50D28 X-Migadu-Scanner: mx13.migadu.com X-Migadu-Spam-Score: -5.39 X-Spam-Score: -5.39 X-TUID: cDBVIZyJE0fi * guix/build-system/emacs.scm (package-with-explicit-emacs): New procedure. --- guix/build-system/emacs.scm | 51 +++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/guix/build-system/emacs.scm b/guix/build-system/emacs.scm index ebf97a5344..3a11738496 100644 --- a/guix/build-system/emacs.scm +++ b/guix/build-system/emacs.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Federico Beffa ;;; Copyright © 2020 Morgan Smith +;;; Copyright © 2024 Liliana Marie Prikler ;;; ;;; This file is part of GNU Guix. ;;; @@ -128,4 +129,54 @@ (define emacs-build-system (description "The build system for Emacs packages") (lower lower))) +(define* (package-with-explicit-emacs emacs old-prefix new-prefix + #:key variant-property) + "Return a procedure of one argument, P. The procedure creates a package with +the same fields as P, which is assumed to use EMACS-BUILD-SYSTEM, such that +it is compiled with EMACS instead. The inputs are changed recursively +accordingly. If the name of P starts with OLD-PREFIX, this is replaced by +NEW-PREFIX; otherwise, NEW-PREFIX is prepended to the name. + +When VARIANT-PROPERTY is present, it is used as a key to search for +pre-defined variants of this transformation recorded in the 'properties' field +of packages. The property value must be the promise of a package. This is a +convenient way for package writers to force the transformation to use +pre-defined variants." + (define package-variant + (if variant-property + (lambda (package) + (assq-ref (package-properties package) + variant-property)) + (const #f))) + + (define (transform pkg) + (cond + ;; If VARIANT-PROPERTY is present, use that. + ((package-variant pkg) + => force) + + ;; Otherwise build the new package object graph. + ((eq? (package-build-system pkg) emacs-build-system) + (package/inherit pkg + (location (package-location pkg)) + (name (let ((name (package-name pkg))) + (string-append new-prefix + (if (string-prefix? old-prefix name) + (substring name + (string-length old-prefix)) + name)))) + (arguments + (let ((emacs (if (promise? emacs) + (force emacs) + emacs))) + (ensure-keyword-arguments (package-arguments pkg) + `(#:emacs ,emacs)))))) + (else pkg))) + + (define (cut? pkg) + (or (not (eq? (package-build-system pkg) emacs-build-system)) + (package-variant pkg))) + + (package-mapping transform cut?)) + ;;; emacs.scm ends here -- 2.45.2