[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/12: services: static-networking: 'eval-when' for code used at expansi
From: |
guix-commits |
Subject: |
01/12: services: static-networking: 'eval-when' for code used at expansion-time. |
Date: |
Tue, 21 Mar 2023 14:15:24 -0400 (EDT) |
civodul pushed a commit to branch master
in repository guix.
commit 0143e3f291842d2cba138515e616948c7ae8c04e
Author: Ludovic Courtès <ludo@gnu.org>
AuthorDate: Mon Mar 20 14:44:19 2023 +0100
services: static-networking: 'eval-when' for code used at expansion-time.
Reported by bjc on #guix.
* gnu/services/base.scm (valid-name, cidr->netmask): Wrap in 'eval-when'
since they are used by "compile-time procedures" (macros).
---
gnu/services/base.scm | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/gnu/services/base.scm b/gnu/services/base.scm
index 190bb8fe24..2c984a0747 100644
--- a/gnu/services/base.scm
+++ b/gnu/services/base.scm
@@ -1,5 +1,5 @@
;;; GNU Guix --- Functional package management for GNU
-;;; Copyright © 2013-2022 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2013-2023 Ludovic Courtès <ludo@gnu.org>
;;; Copyright © 2015, 2016 Alex Kost <alezost@gmail.com>
;;; Copyright © 2015, 2016, 2020 Mark H Weaver <mhw@netris.org>
;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
@@ -703,9 +703,10 @@ to add @var{device} to the kernel's entropy pool. The
service will fail if
;;; /etc/hosts
;;;
-(define (valid-name? name)
- "Return true if @var{name} is likely to be a valid host name."
- (false-if-exception (not (string-any char-set:whitespace name))))
+(eval-when (expand load eval)
+ (define (valid-name? name)
+ "Return true if @var{name} is likely to be a valid host name."
+ (false-if-exception (not (string-any char-set:whitespace name)))))
(define-compile-time-procedure (assert-valid-name (name valid-name?))
"Ensure @var{name} is likely to be a valid host name."
@@ -2664,16 +2665,17 @@ Write, say, @samp{\"~a/24\"} for a 24-bit network
mask.")
ipv6-address?))))
(gateway network-route-gateway (default #f)))
-(define* (cidr->netmask str #:optional (family AF_INET))
- "Given @var{str}, a string in CIDR notation (e.g., \"1.2.3.4/24\"), return
+(eval-when (expand load eval)
+ (define* (cidr->netmask str #:optional (family AF_INET))
+ "Given @var{str}, a string in CIDR notation (e.g., \"1.2.3.4/24\"), return
the netmask as a string like \"255.255.255.0\"."
- (match (string-split str #\/)
- ((ip (= string->number bits))
- (let ((mask (ash (- (expt 2 bits) 1)
- (- (if (= family AF_INET6) 128 32)
- bits))))
- (inet-ntop family mask)))
- (_ #f)))
+ (match (string-split str #\/)
+ ((ip (= string->number bits))
+ (let ((mask (ash (- (expt 2 bits) 1)
+ (- (if (= family AF_INET6) 128 32)
+ bits))))
+ (inet-ntop family mask)))
+ (_ #f))))
(define (cidr->ip str)
"Strip the netmask bit of @var{str}, a CIDR-notation IP/netmask address."
- branch master updated (4f63b4b86d -> 2120c768f2), guix-commits, 2023/03/21
- 01/12: services: static-networking: 'eval-when' for code used at expansion-time.,
guix-commits <=
- 04/12: gnu: vtk: Remove reference to GCC., guix-commits, 2023/03/21
- 03/12: gnu: vtk: Enable OpenMP, TBB, and Open MPI support., guix-commits, 2023/03/21
- 05/12: gnu: fennel: Update to 1.3.0., guix-commits, 2023/03/21
- 06/12: gnu: fnlfmt: Update to 0.3.0., guix-commits, 2023/03/21
- 07/12: gnu: Add dvisvgm., guix-commits, 2023/03/21
- 08/12: gnu: go-filippo-io-age: Update to 1.1.1., guix-commits, 2023/03/21
- 09/12: gnu: pass-age: Update to 1.7.4a1., guix-commits, 2023/03/21
- 10/12: gnu: ssh-to-age: Update to 1.1.2., guix-commits, 2023/03/21
- 12/12: gnu: python-pypandoc: Upgrade to 1.7.5., guix-commits, 2023/03/21
- 02/12: gnu: gnulib: Depend on git-minimal/pinned., guix-commits, 2023/03/21