From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id EGipJCfjKWZFAAAAe85BDQ:P1 (envelope-from ) for ; Thu, 25 Apr 2024 06:59:19 +0200 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id EGipJCfjKWZFAAAAe85BDQ (envelope-from ) for ; Thu, 25 Apr 2024 06:59:19 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=Zc9q9gTJ; 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" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714021159; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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:dkim-signature; bh=yasHRBpWaIqbi/HgdOUj3gkXs98JDrHEX8axByTcj9g=; b=gYdeea7gi4iKSJr0fDRnV9dNStle2ICeHPqypFqRUty0vJ/Zgh5VvxLD9qJAB3yrW1cOEt i5V7IEFfyn9SnhWEiac7TK+2CPKlUdbHHCST2UepoHwixGPnprfTjoz2Y5dENFyFyY4bJQ WCfFSOXGcYN+RrWBHUzKkKYfI+Oozfe53yrStABsH6ndODawZGVDvuYJHsu5g4k0hTR/1i i+73wM3pdfjqF+Q76BcyBhPQ5PgUQl46v6OA3tXI2TuZRsUbcrm9UdZmsHnFNSmHDaQcr8 BXTn4cqcV7ZrML5sDDqBF/qvrVTjnCdz9EUQSSyTLqjJcncPhpiBZnuxahcO8Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none ("invalid DKIM record") header.d=freakingpenguin.com header.s=x header.b=Zc9q9gTJ; 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" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1714021159; a=rsa-sha256; cv=none; b=Ba2CDNpdVFtEI/mymgvV73k9LK9L04NLw/N36VyKMW35SaT0zLJ4NHwdwvbQ6OCREAhEbc RhZOyP1CVTNLALmONQpi/cloDC808rGVH6olRR5mOG8OoeDbCDSF4pqtf+u8xHY2Mp47QF FdPmRs33bnEHml7nnUxB+mfSG1AeyYzRJYFotCS+9auiofnbS7B57lvN924Sh7G1Gh7nNc xGR1jaPs02l5NQMKm4OmDq+waLCEqS3ZL1TcWjqOaQaxTXMx5iYPa5UFL9GRtpvyqmvnjt ydogCIY+c4CVPiTQfi42xNjVl6R0dDsXrnYGsrScpYIBOocOmqxby+atGFl/xA== 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 64597678BF for ; Thu, 25 Apr 2024 06:59:19 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rzrCG-0007yP-Fw; Thu, 25 Apr 2024 00:59:00 -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 1rzrCC-0007y3-QF for guix-patches@gnu.org; Thu, 25 Apr 2024 00:58:56 -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 1rzrCA-0004uP-WB for guix-patches@gnu.org; Thu, 25 Apr 2024 00:58:56 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rzrCR-0000Do-Dn for guix-patches@gnu.org; Thu, 25 Apr 2024 00:59:11 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#70542] [PATCH v2 2/3] file-systems: Add host-to-ip nested function Resent-From: Richard Sent Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 25 Apr 2024 04:59:10 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70542 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 70542@debbugs.gnu.org Cc: Richard Sent Received: via spool by 70542-submit@debbugs.gnu.org id=B70542.1714021120506 (code B ref 70542); Thu, 25 Apr 2024 04:59:10 +0000 Received: (at 70542) by debbugs.gnu.org; 25 Apr 2024 04:58:40 +0000 Received: from localhost ([127.0.0.1]:60333 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzrBo-00006D-V8 for submit@debbugs.gnu.org; Thu, 25 Apr 2024 00:58:38 -0400 Received: from mail-108-mta14.mxroute.com ([136.175.108.14]:36599) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rzrBH-0008Rq-SL for 70542@debbugs.gnu.org; Thu, 25 Apr 2024 00:58:02 -0400 Received: from filter006.mxroute.com ([136.175.111.2] filter006.mxroute.com) (Authenticated sender: mN4UYu2MZsgR) by mail-108-mta14.mxroute.com (ZoneMTA) with ESMTPSA id 18f139dc8f00008ca2.001 for <70542@debbugs.gnu.org> (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384); Thu, 25 Apr 2024 04:57:38 +0000 X-Zone-Loop: 082bd6afa2b500dc65feda76776b6484c3bb71293a4b X-Originating-IP: [136.175.111.2] DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=freakingpenguin.com; s=x; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=yasHRBpWaIqbi/HgdOUj3gkXs98JDrHEX8axByTcj9g=; b=Zc9q9gTJVpcneADfENiWf4LmOb gukNlHmvcKTCeYaLVbR0yYNh+l/MvyNC72ZsRZ5hkP+SNI1vWzf8NxakQboG5pPwgXHzOVrSVrs4a yZ27+wrfGONDJL5k9ix3VQTSVM47tfF6/uVQRg1vSPVFus047l12g2VMj1W9M0Uf3XWRP92pIN1/c e7Ohw9NhSI2hFrxAyYV6wk/2XEPhpVvX2Cu+XLemq/PoKrTVxe8feKIvwlv7LBmH6Mominei9dRTJ YYyb9wk5pGJVo+pfV8pTAIOebhaFx+oOOOnfqofQMkRJkeAAO3/0hYwAM1y5S0XYiDLMrhcjgk57F v2IJX1BA==; From: Richard Sent Date: Thu, 25 Apr 2024 00:56:04 -0400 Message-ID: In-Reply-To: <784e7f59e64d7d8c29f7e0207f5d15727cdd8ba2.1714020965.git.richard@freakingpenguin.com> References: <784e7f59e64d7d8c29f7e0207f5d15727cdd8ba2.1714020965.git.richard@freakingpenguin.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Authenticated-Id: richard@freakingpenguin.com 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-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Spam-Score: -4.89 X-Migadu-Scanner: mx11.migadu.com X-Spam-Score: -4.89 X-Migadu-Queue-Id: 64597678BF X-TUID: z38H9ZK9wOGY * gnu/build/file-systems (mount-file-system): Split out getaddrinfo logic into a dedicated function, (host-to-ip) Change-Id: I522d70a10651ca79533a4fc60b96b884243a3526 --- gnu/build/file-systems.scm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gnu/build/file-systems.scm b/gnu/build/file-systems.scm index 78d779f398..e47ac39ab0 100644 --- a/gnu/build/file-systems.scm +++ b/gnu/build/file-systems.scm @@ -1156,6 +1156,14 @@ (define* (mount-file-system fs #:key (root "/root") (repair (file-system-repair fs))) "Mount the file system described by FS, a object, under ROOT." + (define* (host-to-ip host #:optional service) + "Return the IP address for host, which may be an IP address or a hostname." + (let* ((aa (match (getaddrinfo host service) ((x . _) x))) + (sa (addrinfo:addr aa)) + (inet-addr (inet-ntop (sockaddr:fam sa) + (sockaddr:addr sa)))) + inet-addr)) + (define (mount-nfs source mount-point type flags options) (let* ((idx (string-rindex source #\:)) (host-part (string-take source idx)) @@ -1163,11 +1171,7 @@ (define* (mount-file-system fs #:key (root "/root") (host (match (string-split host-part (string->char-set "[]")) (("" h "") h) ((h) h))) - (aa (match (getaddrinfo host "nfs") ((x . _) x))) - (sa (addrinfo:addr aa)) - (inet-addr (inet-ntop (sockaddr:fam sa) - (sockaddr:addr sa)))) - + (inet-addr (host-to-ip host "nfs"))) ;; Mounting an NFS file system requires passing the address ;; of the server in the addr= option (mount source mount-point type flags @@ -1176,6 +1180,7 @@ (define* (mount-file-system fs #:key (root "/root") (if options (string-append "," options) ""))))) + (let* ((type (file-system-type fs)) (source (canonicalize-device-spec (file-system-device fs))) (target (string-append root "/" -- 2.41.0