Commit 6eda9e1d34a0e5d29b9219a009505312b5e73fb6

Thomas de Grivel 2024-07-11T14:42:10

fix style-warnings

diff --git a/core/defs.lisp b/core/defs.lisp
index d8335c9..5ae026f 100644
--- a/core/defs.lisp
+++ b/core/defs.lisp
@@ -53,6 +53,8 @@
           :initform nil
           :reader operations-before)))
 
+(declaim (ftype (function (operation) (values function &optional))
+                operation-generic-function))
 (defgeneric operation-generic-function (op))
 
 ;;  Resource metaclass
@@ -119,7 +121,8 @@
 		      :accessor probed-properties))
   (:metaclass resource-class))
 
-(declaim (ftype (function (resource) string) resource-id))
+(declaim (ftype (function (resource) (values string &optional))
+                resource-id))
 
 (defgeneric resource-additional-specs (resource os))
 (defgeneric resource-probes-properties (resource))
diff --git a/core/operation.lisp b/core/operation.lisp
index 5773017..60f4715 100644
--- a/core/operation.lisp
+++ b/core/operation.lisp
@@ -15,9 +15,6 @@
 
 ;;  Operation methods
 
-(declaim (ftype (function (operation) function) operation-generic-function))
-(defgeneric operation-generic-function (operation))
-
 (defmethod operation-generic-function ((op operation))
   (symbol-function (operation-name op)))
 
diff --git a/unix/darwin.lisp b/unix/darwin.lisp
index 7673a03..01b4112 100644
--- a/unix/darwin.lisp
+++ b/unix/darwin.lisp
@@ -34,9 +34,10 @@
   (list :packages ()))
 
 (defmethod op-host-packages ((host host) (os os-darwin) &key packages)
+  (declare (ignore packages))
   nil)
 
-(defmethod op-hostname ((host host) (os os-unix) &key hostname)
+(defmethod op-hostname ((host host) (os os-darwin) &key hostname)
   (run-as-root "hostname -s " (sh-quote hostname)))
 
 (defmethod probe-group ((group group) (os os-darwin))
@@ -142,7 +143,7 @@
 (defmethod op-update-user ((user user) (os os-darwin)
                            &key ensure uid gid realname home shell
                              login-class groups)
-  (declare (ignore login-class))
+  (declare (ignore login-class realname))
   (sync-groups)
   (let* ((id (resource-id user))
          (sh-id (sh-quote id)))
diff --git a/unix/operations.lisp b/unix/operations.lisp
index bffab3a..ea27c20 100644
--- a/unix/operations.lisp
+++ b/unix/operations.lisp
@@ -106,6 +106,7 @@
 
 (defmethod op-chown ((res vnode) (os os-unix) &key uid gid owner group
                                                 &allow-other-keys)
+  (declare (type (or resource string null) owner group))
   (when (stringp owner)
     (setq owner (resource 'user owner)))
   (when (stringp group)
@@ -118,10 +119,13 @@
     (sync group))
   (when owner
     (sync owner))
-  (let ((u (or (when owner (resource-id owner))
+  (let ((u (if owner
+               (resource-id owner)
                uid))
-        (g (or (when group (resource-id group))
+        (g (if group
+               (resource-id group)
                gid)))
+    (declare (type string u g))
     (run "chown "
          (sh-quote u)
          (when g `(":" ,(sh-quote g)))