fix(cli): inconsistent system hash between sessions

sxhash doesn't guarantee hashes are consistent across Emacs sessions, so
use md5 instead. Also simplifies what's getting hashed;
`system-configuration` is a sufficient substitute for both `system-type`
and what I wanted to glean from changes in
`system-configuration-features`.

Amend: 80e9263b85
Close: #8030
Ref: #8024
Co-authored-by: yaaama <yaaama@users.noreply.github.com>
This commit is contained in:
Henrik Lissner 2024-08-29 15:19:18 -04:00
parent 83fedf1fff
commit 7f175ab6d9
No known key found for this signature in database
GPG key ID: B60957CA074D39A3

View file

@ -79,7 +79,7 @@ OPTIONS:
(when (and old-version (not (equal old-version emacs-version)))
(print! (warn "Emacs version has changed since last sync (from %s to %s)") old-version emacs-version)
(setq to-rebuild t))
(when (and (integerp hash)
(when (and (stringp hash)
(not (equal hash (doom-sync--system-hash))))
(print! (warn "Your system has changed since last sync"))
(setq to-rebuild t))
@ -113,7 +113,8 @@ OPTIONS:
;;; Helpers
(defun doom-sync--system-hash ()
(sxhash (list doom-local-dir system-type system-configuration-features)))
(secure-hash
'md5 (mapconcat #'identity (list doom-local-dir system-configuration))))
(defun doom-sync--abort-warning-h ()
(print! (warn "Script was abruptly aborted, leaving Doom in an incomplete state!"))