unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Andrew Tropin <andrew@trop.in>
To: "Ludovic Courtès" <ludo@gnu.org>, 56618@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#56618] [PATCH 1/2] home: Add 'home-generation-base'.
Date: Mon, 18 Jul 2022 15:51:07 +0300	[thread overview]
Message-ID: <87mtd6d1ok.fsf@trop.in> (raw)
In-Reply-To: <20220717152117.23452-1-ludo@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 2595 bytes --]

On 2022-07-17 17:21, Ludovic Courtès wrote:

> * gnu/home.scm (%profile-generation-rx): New variable.
> (home-generation-base): New procedure.
> ---
>  gnu/home.scm | 26 ++++++++++++++++++++++++--
>  1 file changed, 24 insertions(+), 2 deletions(-)
>
> diff --git a/gnu/home.scm b/gnu/home.scm
> index a9f0a469a5..4ddbafe412 100644
> --- a/gnu/home.scm
> +++ b/gnu/home.scm
> @@ -1,5 +1,6 @@
>  ;;; GNU Guix --- Functional package management for GNU
>  ;;; Copyright © 2021 Andrew Tropin <andrew@trop.in>
> +;;; Copyright © 2022 Ludovic Courtès <ludo@gnu.org>
>  ;;;
>  ;;; This file is part of GNU Guix.
>  ;;;
> @@ -27,7 +28,8 @@ (define-module (gnu home)
>    #:use-module (guix diagnostics)
>    #:use-module (guix gexp)
>    #:use-module (guix store)
> -
> +  #:use-module (ice-9 match)
> +  #:use-module (ice-9 regex)
>    #:export (home-environment
>              home-environment?
>              this-home-environment
> @@ -38,7 +40,9 @@ (define-module (gnu home)
>              home-environment-services
>              home-environment-location
>  
> -            home-environment-with-provenance))
> +            home-environment-with-provenance
> +
> +            home-generation-base))
>  
>  ;;; Comment:
>  ;;;
> @@ -114,3 +118,21 @@ (define-gexp-compiler (home-environment-compiler (he <home-environment>)
>        (run-with-store store (home-environment-derivation he)
>                        #:system system
>                        #:target target)))))
> +
> +(define %profile-generation-rx
> +  ;; Regexp that matches profile generation.
> +  (make-regexp "(.*)-([0-9]+)-link$"))
> +
> +(define (home-generation-base file)
> +  "If FILE is a Home generation GC root such as \"guix-home-42-link\",
> +return its corresponding base---e.g., \"guix-home\".  Otherwise return #f.
> +
> +This is similar to the 'generation-profile' procedure but applied to Home
> +generations."
> +  (match (regexp-exec %profile-generation-rx file)
> +    (#f #f)
> +    (m  (let ((profile (match:substring m 1)))

Is home environment and operating system a profile itself?  They reside
in /var/guix/profile, but they have profile/ directory inside, so do
they profiles themselves?  I don't propose any changes, just asking.

> +          ;; Distinguish from a "real" profile and from a system generation.
> +          (and (file-exists? (string-append profile "/on-first-login"))
> +               (file-exists? (string-append profile "/profile/manifest"))
> +               profile)))))

-- 
Best regards,
Andrew Tropin

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]

  parent reply	other threads:[~2022-07-18 12:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-17 15:19 [bug#56618] [PATCH 0/2] Let 'guix gc -d' delete old Home generations Ludovic Courtès
2022-07-17 15:21 ` [bug#56618] [PATCH 1/2] home: Add 'home-generation-base' Ludovic Courtès
2022-07-17 15:21   ` [bug#56618] [PATCH 2/2] guix gc: '--delete-generations' now deletes old Home generations Ludovic Courtès
2022-07-18 12:51   ` Andrew Tropin [this message]
2022-07-19  8:01     ` [bug#56618] [PATCH 1/2] home: Add 'home-generation-base' Ludovic Courtès
2022-07-18 12:59 ` [bug#56618] [PATCH 0/2] Let 'guix gc -d' delete old Home generations Andrew Tropin
2022-07-19  8:28   ` Ludovic Courtès
2022-07-19  9:46     ` Andrew Tropin
2022-07-21  9:07       ` Ludovic Courtès
2022-07-21 20:10         ` Maxim Cournoyer
2022-07-22 12:20           ` Ludovic Courtès
2022-07-25  2:04             ` Maxim Cournoyer
2022-08-01 12:39               ` Ludovic Courtès
2022-07-22 22:42 ` bug#56618: " Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87mtd6d1ok.fsf@trop.in \
    --to=andrew@trop.in \
    --cc=56618@debbugs.gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).