From patchwork Sun Oct 3 12:43:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Attila Lendvai X-Patchwork-Id: 33588 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 67C6B27BBE3; Sun, 3 Oct 2021 13:44:28 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 034FD27BBE1 for ; Sun, 3 Oct 2021 13:44:28 +0100 (BST) Received: from localhost ([::1]:36672 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mX0qx-0006jO-4A for patchwork@mira.cbaines.net; Sun, 03 Oct 2021 08:44:27 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41896) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mX0qZ-0006iF-1M for guix-patches@gnu.org; Sun, 03 Oct 2021 08:44:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49791) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mX0qY-0000v9-QW for guix-patches@gnu.org; Sun, 03 Oct 2021 08:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mX0qY-0006J6-OL for guix-patches@gnu.org; Sun, 03 Oct 2021 08:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50878] [PATCH 3/4] guix: build: Factor out and export default-collision-resolver. Resent-From: Attila Lendvai Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 03 Oct 2021 12:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50878 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50878@debbugs.gnu.org Cc: Attila Lendvai Received: via spool by 50878-submit@debbugs.gnu.org id=B50878.163326502824202 (code B ref 50878); Sun, 03 Oct 2021 12:44:02 +0000 Received: (at 50878) by debbugs.gnu.org; 3 Oct 2021 12:43:48 +0000 Received: from localhost ([127.0.0.1]:33102 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mX0qJ-0006II-Sb for submit@debbugs.gnu.org; Sun, 03 Oct 2021 08:43:48 -0400 Received: from mail-wr1-f45.google.com ([209.85.221.45]:34628) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mX0qI-0006Hv-B0 for 50878@debbugs.gnu.org; Sun, 03 Oct 2021 08:43:46 -0400 Received: by mail-wr1-f45.google.com with SMTP id t8so25060566wri.1 for <50878@debbugs.gnu.org>; Sun, 03 Oct 2021 05:43:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cocJj1Sw5JY/LTYomCQ01cjJM+cMkLPQpUHzTmM6/lM=; b=orergwOWwXIfFEXiJS+Dc1q4HcO1hwW77wvoVh3750UnU51QU/ArdIEEqHFnSI5c1K ZloCRq4j1av1gmZp3UlexjXjUewQ/wFTDyF6MkMXIb8BKwJ5TexPD0tiztOWDxJ4uXax X2CeuIUV36LWIi81hRUevB7GlgCf+wnnAEKuODOQxfTOLkxMZDnpxHnetHaFYbqqCLkB ddbCGpcn/g+JG+2BEx1mALYmxKc2V6AhdfmWV9QWJs1DuCTUlI/vYjBksM4K4T7tB9LR FyKyoFzFDzSPC8hF4dMTR5tVFTNgeb/fLFZPrabstaYQakU8dOIGWxWJySgxLbxFwANh 9bxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=cocJj1Sw5JY/LTYomCQ01cjJM+cMkLPQpUHzTmM6/lM=; b=tffNXr1z6lQvdgsglzCmH08o3aqrsYHlrVuEI56v5PedMtdVCItg9vCy5hPayTkXJa PeDHne9a4MrmrkEsd9r+BsJ2YM9LY/HGVZWZsv5ybCkIBACQ/W5niVqdxnMrjNbAvlcV aYLTblQFINwfrGrxVNDjTax6ARUiNpVEeJwPqUhwFA27g6a1acCAJpRXMwCxZhMrEz1P vn7VZUytYEpBBvR9dME23/94GPeXppZfm1zwdoK5+aAu0U6r14DafBFMvNVodALQab28 ibS0hoM7evbOndWK8+ubzaJMFxhf1drehLahWwChU5bZGGMjnyOy7lDgV3BqedNxJaep zy+w== X-Gm-Message-State: AOAM533OQet2xcz3tnfXxoLiehwjNvsoLJ/jARh6O1D+bMS5GC7oK1gj CXhTVrRKZvdeWCSfn0XaRAI0T4odZhY= X-Google-Smtp-Source: ABdhPJy9tZZe+A/b1PximlwVCnvyKvvJz9+P+o2owihwdYFbY1A8GZ44t2O13UBVRX6gTUEYd9OwEA== X-Received: by 2002:adf:9bd3:: with SMTP id e19mr8569555wrc.167.1633265020705; Sun, 03 Oct 2021 05:43:40 -0700 (PDT) Received: from lelap.lan (catv-213-222-131-28.catv.broadband.hu. [213.222.131.28]) by smtp.gmail.com with ESMTPSA id v10sm11800474wri.29.2021.10.03.05.43.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Oct 2021 05:43:40 -0700 (PDT) From: Attila Lendvai Date: Sun, 3 Oct 2021 14:43:02 +0200 Message-Id: <20211003124303.8277-3-attila@lendvai.name> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211003124303.8277-1-attila@lendvai.name> References: <20211003124303.8277-1-attila@lendvai.name> 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" X-getmail-retrieved-from-mailbox: Patches This prepares the stage for new collision resolvers, but no semantic changes. * guix/build/union.scm (resolve-collision/pick-first): New function. (resolve-collision-and-maybe-warn): New function. (default-collision-resolver): New function. --- guix/build/union.scm | 16 ++++++++++------ guix/gexp.scm | 2 +- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/guix/build/union.scm b/guix/build/union.scm index 961ac3298b..9e8c2af4f5 100644 --- a/guix/build/union.scm +++ b/guix/build/union.scm @@ -27,7 +27,7 @@ #:use-module (rnrs io ports) #:export (union-build - warn-about-collision + default-collision-resolver relative-file-name symlink-relative)) @@ -102,10 +102,11 @@ identical, #f otherwise." ;; applications via 'glib-or-gtk-build-system'. '("icon-theme.cache" "gschemas.compiled")) -(define (warn-about-collision files) - "Handle the collision among FILES by emitting a warning and choosing the -first one of THEM." - (let ((file (first files))) +(define (resolve-collision/pick-first files) + (first files)) + +(define (resolve-collision-and-maybe-warn files resolver) + (let ((file (resolver files))) (unless (member (basename file) %harmless-collisions) (format (current-error-port) "~%warning: collision encountered:~%~{ ~a~%~}" @@ -113,11 +114,14 @@ first one of THEM." (format (current-error-port) "warning: choosing ~a~%" file)) file)) +(define (default-collision-resolver files) + (resolve-collision-and-maybe-warn files resolve-collision/pick-first)) + (define* (union-build output inputs #:key (log-port (current-error-port)) (create-all-directories? #f) (symlink symlink) - (resolve-collision warn-about-collision)) + (resolve-collision default-collision-resolver)) "Build in the OUTPUT directory a symlink tree that is the union of all the INPUTS, using SYMLINK to create symlinks. As a special case, if CREATE-ALL-DIRECTORIES?, creates the subdirectories in the output directory to diff --git a/guix/gexp.scm b/guix/gexp.scm index f3d278b3e6..32e8748443 100644 --- a/guix/gexp.scm +++ b/guix/gexp.scm @@ -1983,7 +1983,7 @@ This yields an 'etc' directory containing these two files." (define* (directory-union name things #:key (copy? #f) (quiet? #f) - (resolve-collision 'warn-about-collision)) + (resolve-collision 'default-collision-resolver)) "Return a directory that is the union of THINGS, where THINGS is a list of file-like objects denoting directories. For example: