aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/host.lisp8
-rw-r--r--src/package.lisp1
-rw-r--r--src/propspec.lisp2
3 files changed, 10 insertions, 1 deletions
diff --git a/src/host.lisp b/src/host.lisp
index 1eae634..b58c023 100644
--- a/src/host.lisp
+++ b/src/host.lisp
@@ -48,6 +48,14 @@
:hostattrs (copy-list (hostattrs host))
:propspec (host-propspec host)))
+(defmacro with-preserve-hostattrs (&body forms)
+ "Evaluate FORMS then throw away any newly added hostattrs.
+Useful in property combinators when you need to run some :HOSTATTRS
+subroutines but ignore any new hostattrs they may push. Shouldn't be used in
+properties."
+ `(let ((*host* (shallow-copy-host *host*)))
+ ,@forms))
+
(defgeneric preprocess-host (host)
(:documentation
"Convert a host into a fresh preprocessed host if necessary, and
diff --git a/src/package.lisp b/src/package.lisp
index 1d1281e..2c802ad 100644
--- a/src/package.lisp
+++ b/src/package.lisp
@@ -132,6 +132,7 @@
#:make-child-host
#:hostattrs
#:preprocess-host
+ #:with-preserve-hostattrs
;; deployment.lisp
#:defdeploy
diff --git a/src/propspec.lisp b/src/propspec.lisp
index 99eaa4f..67e8c18 100644
--- a/src/propspec.lisp
+++ b/src/propspec.lisp
@@ -343,7 +343,7 @@ apply the elements of REQUIREMENTS in reverse order."
;; run the :HOSTATTRS subroutine but throw away any
;; new hostattrs; when unapplying, the :HOSTATTRS
;; subroutine is only to check compatibility
- (let ((*host* (shallow-copy-host *host*)))
+ (with-preserve-hostattrs
(apply #'propattrs psym args)))
:apply (get psym 'unapply)
:unapply (get psym 'papply)