[PATCH 0/1] home-state-service-type and tests suite

  • Open
  • quality assurance status badge
Details
4 participants
  • Andrew Tropin
  • Oleg Pykhalov
  • Ludovic Courtès
  • Xinglu Chen
Owner
unassigned
Submitted by
Oleg Pykhalov
Severity
normal

Debbugs page

O
O
Oleg Pykhalov wrote on 23 Oct 2021 11:04
(address . guix-patches@gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211023180446.3362-1-go.wigust@gmail.com
Hi Guix,

This patch adds support for home-state-service-type which copied from the rde
project [1]. The introduction to home state services in documentation is
copied from discussion [2].

Tests passed:

make check-system TESTS="home-state-git"
make check-system TESTS="home-state-rsync"


Oleg Pykhalov (1):
home: services: Add state services.

doc/guix.texi | 32 ++
gnu/home.scm | 12 +
gnu/home/services/state.scm | 210 ++++++++++++
gnu/home/services/utils.scm | 81 ++++-
gnu/home/services/version-control.scm | 442 ++++++++++++++++++++++++++
gnu/local.mk | 2 +
gnu/tests/rsync.scm | 158 ++++++++-
gnu/tests/version-control.scm | 140 +++++++-
guix/scripts/home.scm | 100 +++++-
9 files changed, 1163 insertions(+), 14 deletions(-)
create mode 100644 gnu/home/services/state.scm
create mode 100644 gnu/home/services/version-control.scm

--
2.33.1
O
O
Oleg Pykhalov wrote on 23 Oct 2021 11:06
[PATCH 1/1] home: services: Add state services.
(address . 51359@debbugs.gnu.org)(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
20211023180654.3760-1-go.wigust@gmail.com
* gnu/home.scm (home-environment-compiler): New procedure.
* gnu/home/services/state.scm: New file.
* doc/guix.texi (State Home Services): Document this.
* gnu/home/services/version-control.scm: New file.
* gnu/local.mk (GNU_SYSTEM_MODULES): Add those.
* gnu/home/services/utils.scm
(ini-config?, default-ini-format-section, generic-serialize-ini-config,
generic-serialize-git-ini-config): New procedures.
* gnu/tests/version-control.scm (run-home-state-git-test): New procedure.
(%home-state-git-os, %test-home-state-git): New variables.
* guix/scripts/home.scm
(not-config?, switch-home-program, switch-to-home, local-eval): New procedures.
(save-load-path-excursion): New macro.
(switch-home-program): Use switch-to-home procedure.
* gnu/tests/rsync.scm (run-home-state-rsync-test): New procedures.
(%home-state-rsync-os, %test-home-state-rsync): New variables.
---
doc/guix.texi | 32 ++
gnu/home.scm | 12 +
gnu/home/services/state.scm | 210 ++++++++++++
gnu/home/services/utils.scm | 81 ++++-
gnu/home/services/version-control.scm | 442 ++++++++++++++++++++++++++
gnu/local.mk | 2 +
gnu/tests/rsync.scm | 158 ++++++++-
gnu/tests/version-control.scm | 140 +++++++-
guix/scripts/home.scm | 100 +++++-
9 files changed, 1163 insertions(+), 14 deletions(-)
create mode 100644 gnu/home/services/state.scm
create mode 100644 gnu/home/services/version-control.scm

Toggle diff (550 lines)
diff --git a/doc/guix.texi b/doc/guix.texi
index 63bb22764a..c79f3acfa3 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -35548,6 +35548,7 @@ services)}.
* Shells: Shells Home Services. POSIX shells, Bash, Zsh.
* Mcron: Mcron Home Service. Scheduled User's Job Execution.
* Shepherd: Shepherd Home Service. Managing User's Daemons.
+* State: State Home Services. Managing User's states.
@end menu
@c In addition to that Home Services can provide
@@ -35875,6 +35876,37 @@ mechanism instead (@pxref{Shepherd Services}).
@end table
@end deftp
+@node State Home Services
+@subsection Managing User's states
+
+@cindex state
+@cindex rsync
+@cindex git
+@cindex hg
+
+@command{herd init state} will create all the neccessary dirs, will clone the
+Git repos with projects you work on, restore wallpapers dir from backup
+server via Rsync and so on. That helps at least control and init state
+your software depends on, when you switching to new machine for example.
+
+@defvr {Scheme Variable} home-state-service-type
+This is the type of the @code{state} home service, whose value is a list
+of @code{shepherd-service} objects.
+@end defvr
+
+The following examples demonstrate Git and Rsync configuration:
+
+@example
+(home-environment
+ (services
+ (list
+ (service home-state-service-type
+ (list (state-git "/home/alice/guix-maintenance"
+ "https://git.savannah.gnu.org/git/guix/maintenance.git")
+ (state-rsync "/home/alice/output"
+ "rsync://localhost:873/files/input"))))))
+@end example
+
@node Invoking guix home
@section Invoking @code{guix home}
diff --git a/gnu/home.scm b/gnu/home.scm
index d8134693e5..87d4d54b8e 100644
--- a/gnu/home.scm
+++ b/gnu/home.scm
@@ -23,8 +23,10 @@ (define-module (gnu home)
#:use-module (gnu home services xdg)
#:use-module (gnu home services fontutils)
#:use-module (gnu services)
+ #:use-module (guix gexp)
#:use-module (guix records)
#:use-module (guix diagnostics)
+ #:use-module (guix store)
#:export (home-environment
home-environment?
@@ -104,3 +106,13 @@ (define* (home-environment-with-provenance he config-file)
(inherit he)
(services (cons (service home-provenance-service-type config-file)
(home-environment-user-services he)))))
+
+(define-gexp-compiler (home-environment-compiler (he <home-environment>)
+ system target)
+ ((store-lift
+ (lambda (store)
+ ;; XXX: This is not super elegant but we can't pass SYSTEM and TARGET to
+ ;; 'home-environment-derivation'.
+ (run-with-store store (home-environment-derivation he)
+ #:system system
+ #:target target)))))
diff --git a/gnu/home/services/state.scm b/gnu/home/services/state.scm
new file mode 100644
index 0000000000..f78751b10f
--- /dev/null
+++ b/gnu/home/services/state.scm
@@ -0,0 +1,210 @@
+(define-module (gnu home services state)
+ #:use-module (srfi srfi-1)
+ #:use-module (ice-9 match)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services utils)
+ #:use-module (gnu home services shepherd)
+ #:use-module (gnu home services version-control)
+ #:use-module (gnu packages rsync)
+ #:use-module (gnu packages version-control)
+ #:use-module (gnu services shepherd)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu packages ssh)
+ #:use-module (guix packages)
+ #:use-module (guix gexp)
+ #:use-module (guix monads)
+ #:use-module (guix modules)
+ #:use-module (guix records)
+
+ #:export (home-state-service-type
+ state-generic
+ state-git
+ state-hg
+ state-rsync))
+
+(define* (state-hg path remote #:key (config #f))
+ (state-generic
+ path
+ #:init-gexp
+ #~(lambda* (_ self)
+ (let* ((meta (car (action self 'metadata)))
+ (path (assoc-ref meta 'path))
+ (remote (assoc-ref meta 'remote)))
+ (format #t "Initializing ~a.\n" self)
+ (let* ((port ((@@ (guix build utils) open-pipe-with-stderr)
+ #$(file-append mercurial "/bin/hg") "clone" remote path)))
+ (waitpid WAIT_ANY)
+ (display ((@@ (ice-9 rdelim) read-delimited) "" port))
+ (close-port port))
+
+ (when '#$config
+ (call-with-output-file (string-append path "/.hg/hgrc")
+ (lambda (port) (display (string-append
+ #$@(serialize-hg-config config)) port))))))
+ #:additional-metadata `((remote . ,remote)
+ (general-sync? . #f))))
+
+(define* (state-git path remote #:key (config #f))
+ (state-generic
+ path
+ #:init-gexp
+ #~(lambda* (_ self)
+ (let* ((meta (car (action self 'metadata)))
+ (path (assoc-ref meta 'path))
+ (remote (assoc-ref meta 'remote)))
+ (format #t "Initializing ~a.\n" self)
+ ;; TODO: revisit git clone implementation
+ ;; FIXME: Hang up shepherd if username/password asked
+ (let* ((port ((@@ (guix build utils) open-pipe-with-stderr)
+ #$(file-append git "/bin/git") "clone" remote path)))
+ (waitpid WAIT_ANY)
+ (display ((@@ (ice-9 rdelim) read-delimited) "" port))
+ (close-port port))
+
+ (when #$config
+ (call-with-output-file (string-append path "/.git/config")
+ (lambda (port) (display #$config port))))))
+ #:additional-metadata `((remote . ,remote)
+ (general-sync? . #f))))
+
+(define* (state-rsync path remote)
+ (state-generic
+ path
+ #:init-gexp
+ #~(lambda* (_ self)
+ (let* ((meta (car (action self 'metadata)))
+ (path (assoc-ref meta 'path))
+ (remote (assoc-ref meta 'remote)))
+ (format #t "Initializing ~a.\n" self)
+ ;; TODO: revisit git clone implementation
+ (let* ((port ((@@ (guix build utils) open-pipe-with-stderr)
+ #$(file-append rsync "/bin/rsync") "-aP" remote path)))
+ (waitpid WAIT_ANY)
+ (display ((@@ (ice-9 rdelim) read-delimited) "" port))
+ (close-port port))))
+ #:sync-gexp
+ #~(lambda* (_ self)
+ (let* ((meta (car (action self 'metadata)))
+ (path (assoc-ref meta 'path))
+ (remote (assoc-ref meta 'remote)))
+ (format #t "Synchronizing ~a.\n" self)
+ (let* ((port ((@@ (guix build utils) open-pipe-with-stderr)
+ #$(file-append rsync "/bin/rsync") "-aP" path remote)))
+ (waitpid WAIT_ANY)
+ (display ((@@ (ice-9 rdelim) read-delimited) "" port))
+ (close-port port))))
+ #:additional-metadata `((remote . ,remote)
+ (general-sync? . #t))))
+
+(define* (state-generic
+ path
+ #:key
+ (init-gexp
+ #~(lambda* (_ self)
+ (let ((path (assoc-ref (car (action self 'metadata)) 'path)))
+ (format #t "Initializing ~a.\n" self)
+ (format #t "Creating ~a directory..." path)
+ (mkdir-p path)
+ (display " done\n"))))
+ (sync-gexp
+ #~(lambda* (_ self)
+ (let ((path (assoc-ref (car (action self 'metadata)) 'path)))
+ (format #t "Synchronizing ~a.\n" self)
+ (format #t "Nothing to synchronize.\n"))))
+ (additional-metadata '((general-sync? . #f))))
+ "A function which returns a shepherd-service with all required
+actions for state management, should be used as a basis for other
+state related items like git-state, rsync-state, etc."
+ (let ((self (string->symbol
+ (format #f "state-~a" path))))
+ (shepherd-service
+ (documentation (format #f "Managing state at ~a." path))
+ (provision (list self))
+ (auto-start? #f)
+ (start #~(lambda ()
+ (if (car (action '#$self 'state-exists?))
+ #t
+ (begin
+ (format #t "~a is not initilized yet." '#$self)
+ #f))))
+ (actions (list
+ (shepherd-action
+ (name 'state-exists?)
+ (documentation "Check if state file/directory exists.")
+ (procedure #~(lambda* (#:rest rest)
+ (file-exists? #$path))))
+ (shepherd-action
+ (name 'unchecked-init)
+ (documentation "Do not use this action directly.")
+ (procedure init-gexp))
+ (shepherd-action
+ (name 'metadata)
+ (documentation "Returns metadata related to the state.")
+ (procedure #~(lambda* _
+ (append
+ '((path . #$path)
+ (self . #$self))
+ '#$additional-metadata))))
+ (shepherd-action
+ (name 'sync)
+ (documentation "Sync the state.")
+ (procedure sync-gexp))
+ (shepherd-action
+ (name 'init)
+ (documentation "Generic initialize.")
+ (procedure #~(lambda* (#:rest rest)
+ (if (car (action '#$self 'state-exists?))
+ (format #t "~a already initialized.\n" '#$self)
+ (begin
+ (action '#$self 'unchecked-init '#$self)
+ (start '#$self)))))))))))
+
+(define (add-shepherd-services services)
+ (let* ((service-names
+ (map
+ (lambda (service) (car (shepherd-service-provision service)))
+ services)))
+ (append
+ services
+ (list
+ (shepherd-service
+ (documentation "Init, update and maybe destroy state.")
+ (provision '(state))
+ (auto-start? #t)
+ (start #~(lambda ()
+ (map (lambda (name)
+ (when (car (action name 'state-exists?))
+ (start name)))
+ '#$service-names)))
+ (actions (list
+ (shepherd-action
+ (name 'sync)
+ (documentation
+ "Sync all the state. Highly dependent on state type.")
+ (procedure
+ #~(lambda _
+ (map (lambda (name)
+ (when (assoc-ref (car (action name 'metadata))
+ 'general-sync?)
+ (action name 'sync name)))
+ '#$service-names))))
+ (shepherd-action
+ (name 'init)
+ (documentation "Initialize all the state.")
+ (procedure #~(lambda _
+ (map (lambda (name)
+ (when (not (car (action name 'state-exists?)))
+ (action name 'init)
+ (start name)))
+ '#$service-names)))))))))))
+
+(define home-state-service-type
+ (service-type (name 'home-state)
+ (extensions
+ (list (service-extension
+ home-shepherd-service-type
+ add-shepherd-services)))
+ (default-value '())
+ (compose concatenate)
+ (extend append)
+ (description "A toolset for initializing state.")))
diff --git a/gnu/home/services/utils.scm b/gnu/home/services/utils.scm
index cea75ee896..8f2122dda9 100644
--- a/gnu/home/services/utils.scm
+++ b/gnu/home/services/utils.scm
@@ -21,11 +21,17 @@ (define-module (gnu home services utils)
#:use-module (ice-9 string-fun)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-26)
+ #:use-module (ice-9 match)
+ #:use-module (gnu services configuration)
#:export (maybe-object->string
object->snake-case-string
object->camel-case-string
- list->human-readable-list))
+ list->human-readable-list
+
+ ini-config?
+ generic-serialize-ini-config
+ generic-serialize-git-ini-config))
(define (maybe-object->string object)
"Like @code{object->string} but don't do anyting if OBJECT already is
@@ -103,3 +109,76 @@ (define* (list->human-readable-list lst
word
(maybe-object->string (proc (last lst)))))))
+
+;;;
+;;; Serializers.
+;;;
+
+(define ini-config? list?)
+(define (generic-serialize-ini-config-section section proc)
+ "Format a section from SECTION for an INI configuration.
+Apply the procedure PROC on SECTION after it has been converted to a string"
+ (format #f "[~a]\n" (proc section)))
+
+(define default-ini-format-section
+ (match-lambda
+ ((section subsection)
+ (string-append (maybe-object->string section) " "
+ (maybe-object->string subsection)))
+ (section
+ (maybe-object->string section))))
+
+(define* (generic-serialize-ini-config
+ #:key
+ (combine-ini string-join)
+ (combine-alist string-append)
+ (combine-section-alist string-append)
+ (format-section default-ini-format-section)
+ serialize-field
+ fields)
+ "Create an INI configuration from nested lists FIELDS. This uses
+@code{generic-serialize-ini-config-section} and @{generic-serialize-alist} to
+serialize the section and the association lists, respectively.
+
+@example
+(generic-serialize-ini-config
+ #:serialize-field (lambda (a b) (format #f \"~a = ~a\n\" a b))
+ #:format-section (compose string-capitalize symbol->string)
+ #:fields '((application ((key . value)))))
+@end example
+
+@result{} \"[Application]\nkey = value\n\""
+ (combine-ini
+ (map (match-lambda
+ ((section alist)
+ (combine-section-alist
+ (generic-serialize-ini-config-section section format-section)
+ (generic-serialize-alist combine-alist serialize-field alist))))
+ fields)
+ "\n"))
+
+(define* (generic-serialize-git-ini-config
+ #:key
+ (combine-ini string-join)
+ (combine-alist string-append)
+ (combine-section-alist string-append)
+ (format-section default-ini-format-section)
+ serialize-field
+ fields)
+ "Like @code{generic-serialize-ini-config}, but the section can also
+have a @dfn{subsection}. FORMAT-SECTION will take a list of two
+elements: the section and the subsection."
+ (combine-ini
+ (map (match-lambda
+ ((section subsection alist)
+ (combine-section-alist
+ (generic-serialize-ini-config-section
+ (list section subsection) format-section)
+ (generic-serialize-alist combine-alist serialize-field alist)))
+ ((section alist)
+ (combine-section-alist
+ (generic-serialize-ini-config-section section format-section)
+ (generic-serialize-alist combine-alist serialize-field alist))))
+ fields)
+ "\n"))
+
diff --git a/gnu/home/services/version-control.scm b/gnu/home/services/version-control.scm
new file mode 100644
index 0000000000..afc9c539a7
--- /dev/null
+++ b/gnu/home/services/version-control.scm
@@ -0,0 +1,442 @@
+(define-module (gnu home services version-control)
+ #:use-module (srfi srfi-1)
+ #:use-module (srfi srfi-9)
+ #:use-module (srfi srfi-11)
+ #:use-module (srfi srfi-26)
+ #:use-module (ice-9 match)
+ #:use-module (gnu home services)
+ #:use-module (gnu home services utils)
+ #:use-module (gnu services configuration)
+ #:use-module (gnu packages version-control)
+ #:use-module (guix packages)
+ #:use-module (guix gexp)
+ #:use-module (guix records)
+ #:use-module ((guix import utils) #:select (flatten))
+
+ #:export (home-git-configuration
+ home-git-extension
+ home-git-service-type
+ serialize-git-config
+
+ home-hg-configuration
+ home-hg-extension
+ serialize-hg-config
+ home-hg-service-type))
+
+;;; Commentary:
+;;;
+;;; Version control related services.
+;;;
+;;; Code:
+
+;;;
+;;; Git.
+;;;
+;;; (service home-git-service-type
+;;; (home-git-configuration
+;;; (attributes
+;;; '((* . text=auto)
+;;; (*.sh . "text eol=lf")))
+;;; (ignore
+;;; '("*.so" "*.o"))
+;;; (ignore-extra-content
+;;; "*.dll\n*.exe\n")
+;;; (config
+;;; `((http "https://weak.example.com"
+;;; ((ssl-verify . #f)))
+;;; (gpg
+;;; ((program . ,(file-append gnupg "/bin/gpg"))))
+;;; (sendmail
+;;; ((annotate . #t))))
+;;; (config-extra-content (slurp-file-gexp
+;;; (local-file "./gitconfig")))))
+;;;
+;;; (simple-service
+;;; 'add-something-to-git
+;;; home-git-service-type
+;;; (home-git-extension
+;;; (config
+;;; `((sendmail
+;;; ((annotate . #t)))))))
+
+
+(define (uglify-field-name field-name)
+ "Convert symbol FIELD-NAME to a camel case string.
+@code{symbol-name} => \"@code{symbolName}\"."
+ (let* ((str (symbol->string field-name))
+ (spl-str (string-split str #\-)))
+ (apply string-append
+ (car spl-str)
+ (map string-capitalize (cdr spl-str)))))
+
+(define (serialize-field field-name val)
+ (cond
+ ((boolean? val) (serialize-boolean field-name val))
+ (else
+ (list (format #f "\t~a = " (uglify-field-name field-name))
+ val "\n"))))
+
+(define (serialize-alist field-name val)
+ (generic-serialize-alist append serialize-field val))
+
+(define (serialize-boolean field-name val)
+ (serialize-field field-name (if val "true" "false")))
+
+(define serialize-string serialize-field)
+(define git-config? list?)
+
+(define (serialize-git-section-header name value)
+ (format #f "[~a~a]\n" (uglify-field-name name)
+ (if value (format #f " \"~a\"" value) "")))
+
+(define serialize-git-section
+ (match-lambda
+ ((name options)
+ (cons
+ (serialize-git-section-header name #f)
+ (serialize-alist #f options)))
+ ((name value options)
+ (cons
+ (serialize-git-section-header name value)
+ (serialize-alist #f options)))))
+
+;; TODO: cover it with tests
+(define (serialize-git-config field-name val)
+ #~(string-append #$@(append-map serialize-git-section val)))
+
+(define (git-ignore? patterns)
+ (list-of-strings? patterns))
+(define (serialize-git-ignore field-name val)
+ (string-join val "\n" 'suffix))
+
+(define (git-attributes? attrs)
+ (list? attrs))
+(define (serialize-git-attributes field-name val)
+ (string-join
+ (map
+ (match-lambda
+ ((key . value) (format #f "~a\t~a" key value)))
+ val)
+ "\n"
+ 'suffix))
+
+(define-configuration home-git-extension
+ (attributes
+ (git-attributes '())
+ "Alist of pattern attribute pairs for @file{git/attributes.}")
+ (ignore
+ (git-ignore '())
+ "List of patterns for @file{git/ignore.}")
+ (config
+ (git-config '())
+ "List of git sections. The same format as in
+@code{home-git-configuration}."))
+
+(define-configuration home-git-configuration
+ (package
+ (package git)
+ "The Git package to use.")
+ (attributes
+ (git-attributes '())
+ "Alist of pattern attribute pairs for @file{git/attributes.}")
+ (attributes-extra-content
+ (text-config "")
+ "String or value of string-valued g-exps will be added to the end
+of the @file{git/attributes} file.")
+ (ignore
+ (git-ignore '())
+ "List of patterns for git/ignore.")
+ (ignore-extra-content
This message was truncated. Download the full message here.
X
X
Xinglu Chen wrote on 30 Oct 2021 04:10
Re: [bug#51359] [PATCH 0/1] home-state-service-type and tests suite
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87h7cy7op1.fsf@disroot.org
On Sat, Oct 23 2021, Oleg Pykhalov wrote:

Toggle quote (6 lines)
> Hi Guix,
>
> This patch adds support for home-state-service-type which copied from the rde
> project [1]. The introduction to home state services in documentation is
> copied from discussion [2].

There are still quite a few things that have to be fixed with Guix
Home[1][2][3][4], so I suggest we fix those before adding new services.

Also, Andrew mentioned a while a go that he was going to re-design the
state services; maybe he has some updates on that.

[1]: https://issues.guix.gnu.org/50945 and https://issues.guix.gnu.org/50941
-----BEGIN PGP SIGNATURE-----

iQJJBAEBCAAzFiEEAVhh4yyK5+SEykIzrPUJmaL7XHkFAmF9KDoVHHB1YmxpY0B5
b2N0b2NlbGwueHl6AAoJEKz1CZmi+1x5KnsQALh3PW/BNgTEYKo+69Bh0rWUrZ9o
fBghLvhbvXloqXsZRbsHaIlVMv7Un6ekG/ZM/WCujRmfnr5uHbeRLsPRZZFiOQ3+
kqywVHraY6n/lE4fEZnqiMYww4wdJa+mutZs6z19JZUpBy64QWGHbAPe8gqCNJJV
rY42TyCgH/e2AnDB/48T2r+L6tk0uFE0HWr4nurFWaRCjrDK4hDXyr9bbPRd5dV1
sONaimXCOvwX9IcORhbSYpCJ/tKWWrUM5Z+JIvrdEUaMAW57RYLmrzjNMB2FTMby
dTfPJlJhV0igbjUMdDEIv4R7YBkHcDI9B6+KN4qEJqUPBS4qKNlj+llbuQ3J0PzW
qFoGBMzhKU4UG9RkvTiNZn50cnr5sl8lPdd9mrjivic+IIbtSavHouk243YLOvgl
4grKnNOzuDKZUv85Q4IoyPW1bmIGTNtf/5b44qA38fhVUND876mvn50rfUCFEJ3Y
J1JJLGXoqNXdI8hC+wkfw0Nn5I1D4T2TLYs6LvuhTx48j1amrrZJcVy8x6Iz+VlQ
oH2M9hDmypfx/aSBEINSbYiSzPLPnHKJOCMCk7RD+XKlT2cFjUuJTGczj9wqWjA6
6UtaYerAV0ftMjYvR3lzu7YS3lcpKtDOKxvncU0oQiY8IBXuoaXogpmAxp07cz7z
DZur0acc9Itzf3zl
=wBY0
-----END PGP SIGNATURE-----

L
L
Ludovic Courtès wrote on 9 Mar 2022 15:34
control message for bug #51359
(address . control@debbugs.gnu.org)
87r17a1z0m.fsf@gnu.org
tags 51359 + moreinfo
quit
A
A
Andrew Tropin wrote on 8 Jun 2022 09:10
Re: [bug#51359] [PATCH 0/1] home-state-service-type and tests suite
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)
87edzz9lvv.fsf@trop.in
On 2021-10-23 21:04, Oleg Pykhalov wrote:

Toggle quote (30 lines)
> Hi Guix,
>
> This patch adds support for home-state-service-type which copied from the rde
> project [1]. The introduction to home state services in documentation is
> copied from discussion [2].
>
> Tests passed:
>
> make check-system TESTS="home-state-git"
> make check-system TESTS="home-state-rsync"
>
> [1] https://github.com/abcdw/rde/
> [2] https://lists.sr.ht/~abcdw/rde-devel/%3C87pmzze9nn.fsf%40trop.in%3E#%3CCABrWRW1Fq-8mS=MbWJedUpayj1vFg-YE0oNF3zVTYWBMnp29Lg@mail.gmail.com%3E
>
> Oleg Pykhalov (1):
> home: services: Add state services.
>
> doc/guix.texi | 32 ++
> gnu/home.scm | 12 +
> gnu/home/services/state.scm | 210 ++++++++++++
> gnu/home/services/utils.scm | 81 ++++-
> gnu/home/services/version-control.scm | 442 ++++++++++++++++++++++++++
> gnu/local.mk | 2 +
> gnu/tests/rsync.scm | 158 ++++++++-
> gnu/tests/version-control.scm | 140 +++++++-
> guix/scripts/home.scm | 100 +++++-
> 9 files changed, 1163 insertions(+), 14 deletions(-)
> create mode 100644 gnu/home/services/state.scm
> create mode 100644 gnu/home/services/version-control.scm

Hi Oleg!

Thank you for the patch, but states are very WIP and not ready for
upstream yet IMO. Also, I would like to reevaluate implementation of
git service-type and probably merge it separately.

Sorry for replying slowly :)

Hope I will get back to states in foreseable future and will carefully
rethink, refactor and cleanup the code.

BTW, do you use states? Can you share your experience with it?

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmKgyfQACgkQIgjSCVjB
3rD4mA/+MZzns8/aijc/JD83z1xIWwgI/Iq6sv/+TPGKEkVPfzzlAI0OqApKsE/m
Sj8H7nnQdbttS/xLp0V5aPC2MZpO1qY10msSi2iFaKSivVgLGVYbOkmdXLqIHgp4
4SXeHQKZ/t19DT3UfoUDGz4eGGjQ38K19qlZdb2GX5K1WdYv5k/TtQRe7bIZGAAh
cYLXv2ShoqghJ0zMkulMfxr2+3mBY4mCnv5d7q7WQQdM+nrtSLT+5SDKgQu5FwRn
d/0kFLk/QwjIpXApeCJWNjp0eF0EsyVQXMNp+aOYdwcR1CfCOtJTWUs5ODR3exb7
/EuXd44fXI1rt46n/XBjFpMPQctH7bpG2NDUNrdzZExBhyFVf57uVO1Sc1TDysUa
uEX0mGT7eq87FJTCFDqF9i4obxlkVZwriIBnJx/UPHxs7s17eXDv7C2yN8wMzP1D
xGeiPwqRQbMnnxFOrAZ8INvaCFjqgErOzak/t3O27zIAv1S9PNUYfwf1tMqqTHit
uZi6f4pc8a8V0F1k7RNtD3N4Ip9OueeZYskf4K+/t3CMTGOqcRcrtZ4itmrMeC6K
8Ybik7t6Q4rSM69YifyJ6/5e0GZDMWLLH21nSG7LwL3CZH6DdPKs91BFCGI7sHmB
ZQi/+0tBTLv1Tgd5Wkx2AgglWzW2F90dbhSsKp7e6cW7E1j/wbU=
=oncn
-----END PGP SIGNATURE-----

O
O
Oleg Pykhalov wrote on 8 Jun 2022 10:02
(name . Andrew Tropin)(address . andrew@trop.in)(address . 51359@debbugs.gnu.org)
871qvzgkat.fsf@gmail.com
Hi Andrew,

Andrew Tropin <andrew@trop.in> writes:

[…]

Toggle quote (7 lines)
> Thank you for the patch, but states are very WIP and not ready for
> upstream yet IMO. Also, I would like to reevaluate implementation of
> git service-type and probably merge it separately.
>
> Hope I will get back to states in foreseable future and will carefully
> rethink, refactor and cleanup the code.

If the user's configuration will stay the same, we probably could merge.

Toggle quote (2 lines)
> BTW, do you use states? Can you share your experience with it?

I tried the git state and it worked, don't remember rsync. Also I don't
use it since the patch submitting day, because of plans to rewrite it.

Oleg.
-----BEGIN PGP SIGNATURE-----

iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmKg1joUHGdvLndpZ3Vz
dEBnbWFpbC5jb20ACgkQFn+OpQAa+pw4kg/+JcyqdlTuvpSOiB+XR4htTaQ6WqqS
dCaQT92As8vnFYGXgclSEdvtlPxiKfUzudvksaZ4FMBhzITzfdVMHupBoORwxem9
oTmnzErEmKwexcMJytoRyiIU/Kbzld1KREmS0f78e2N+d3NJD04fdGsGGrSqgJn2
WA4/Q7Zm7HIkMmeBrSY284aQ5oFuW9rNHjKVV7erSQoPqytfSa7wYq3e2RENu9jt
LTkxE1HQ5cTyvk9kciXOnBJBjnZw0VcZAeXUwRFDriEDJM7TXDxserCd2EZATACg
oFxRR6OPgTeXrfTxW/nDnSaj0rVjmMmj4UgPuyYSSniZMBw6wc2gDbb5Ing2qihG
GkujXbDuUP5z+OWN6VaDyIU/idIZVXuGFNKj5eU75SNpDSt/VoWvw37bSrBKrd/C
zXQcf4hVC7Z7sP3yHdO+CzZHTWQ+W0bfqqJ6lvMQ4yf/WAgSOr+wVPteovMCiQu1
YWz8+YElccp3QcMy9FLOes7iGjg4Vssr4z5UcbhIozRvSV9D694lZ5mu4RQutlkU
BSIejd632t/tuqtVKelV8zs90biRMHIii0sHsDFv51MhATzY6R+yFCXo3/sqRnAR
ThJds3BIkzz37x9Q4StWIqTzac9MAJ1zk8J3bWf80J3Is3FxiHiXjlXLV7xDdGMk
b+LAJ+hJ4RnJHLA=
=5Kuq
-----END PGP SIGNATURE-----

A
A
Andrew Tropin wrote on 8 Jun 2022 11:23
(name . Oleg Pykhalov)(address . go.wigust@gmail.com)(address . 51359@debbugs.gnu.org)
878rq7ggk9.fsf@trop.in
On 2022-06-08 20:02, Oleg Pykhalov wrote:

Toggle quote (16 lines)
> Hi Andrew,
>
> Andrew Tropin <andrew@trop.in> writes:
>
> […]
>
>> Thank you for the patch, but states are very WIP and not ready for
>> upstream yet IMO. Also, I would like to reevaluate implementation of
>> git service-type and probably merge it separately.
>>
>> Hope I will get back to states in foreseable future and will carefully
>> rethink, refactor and cleanup the code.
>
> If the user's configuration will stay the same, we probably could merge.
>

Not sure if it will stay the same. The implementation is quite fragile
and for sure should be revisited, maybe the user facing interface can be
organized better as well.

Toggle quote (5 lines)
>> BTW, do you use states? Can you share your experience with it?
>
> I tried the git state and it worked, don't remember rsync. Also I don't
> use it since the patch submitting day, because of plans to rewrite it.

Ok. I think I'll experiment with a new version of states in rde project
first and later will come back to merging it to Guix. It seems as an
important feature, but it's hard to say when I'll get to it.

--
Best regards,
Andrew Tropin
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmKg6SYACgkQIgjSCVjB
3rDHHhAAlgYrlbNThVC6fjb+ETyZV4j1M7aOtH+Lx+KMta388lziG6aKhlgNnYkY
lxnlFtOOnAlf3cuJHHjwnDzmZ/hJX0nb+HYiEG4pUsoUNqv8SDYocLFnw2X2lLWh
ecwxbdEeJzxpzNRWrMYvV1YF48B+Aw0WidSgF9TwTDlnxcPq8CgCssgcKOLo9ZnZ
zpcPmjLn69hZfFRVKWFiWOXWkUirMr1hS5Ma9I4ptVyAI3gXKMfR/uMaxVbjb2CA
yZI5jifQFY5Nj9IWs9/REiwNpEKWPs/H20iEcvtReVqgB/uAb1xYWR6G/p93a+wh
FXZuVHIRvlPUnLXEg2t2qflrjhHD1m5FoDqFyPUnagH3h4r7BXFl6Xq6GdBp3Ecm
gsJw90wxjst1AZxqBooFVusVFuXSFdML0qW7VBA3Mc9ihBJ7z/oFW0n7q6o5Ep1n
Ukq4rsiTV4l2ahtdZx+HqC9BrsNjlSPJ3lP81to/Auv9uJUdYqGCc3WtotqcXWAg
dMGU2opXQSqHdlFq4wUguA3CRG8aQA7G6GCKLPtZxS+3UHfvbllbvX1gc3Fexo1K
FOf//6fCwgPH/qsdU2C3E9lEGmYLzSae+LxrL4RKzP60H/gJGwqavqivZUxYwRej
5P6wEYZ7u+7WzxMblIGAQR4Nrhr1wqsav9DvDi7tqsTTNDVdqx8=
=C37f
-----END PGP SIGNATURE-----

?
Your comment

Commenting via the web interface is currently disabled.

To comment on this conversation send an email to 51359@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 51359
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch