unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nicolas Graves via "Development of GNU Guix and the GNU System distribution." <guix-devel@gnu.org>
To: guix-devel@gnu.org
Subject: avoid Computing Guix derivation when not necessary
Date: Fri, 10 Feb 2023 14:25:31 +0100	[thread overview]
Message-ID: <87v8k9bqk4.fsf@ngraves.fr> (raw)


Hi guix!

I found an working solution to avoid waiting for the `Computing Guix
derivation' part when pulling or else.

Here's my snippet:

```
(use-modules
 (git)
 (guix profiles)
 (srfi srfi-1))

(reduce (lambda (x y) (and x y)) #f
        (map
         (lambda (x)
           (let* ((elts (cdadar (manifest-entry-properties x)))
                  (repository (repository-open (car (assoc-ref elts 'url))))
                  (commit (oid->string
                           (object-id
                            (revparse-single repository
                                             (car (assoc-ref elts 'branch)))))))
             (string= commit (car (assoc-ref elts 'commit)))))
         (manifest-entries (profile-manifest "./.guix-profile/guix"))))
```

For the moment, I'm using a profile and local development directories to
avoid this recomputation when I need to run guix system and guix home,
but I think this could be included to speed up guix pull when no new
commits are found.

The principle is simple: get commit and directory info from the profile
manifest, compare commits, if commits for all channels are the same, do
not try to update the profile.

It may not be as interessing for guix pull (need to pull anyway to get
the last commit...). If you think this can have some use, I can rework
on it for guix ;)

-- 
Best regards,
Nicolas Graves


             reply	other threads:[~2023-02-10 13:26 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-10 13:25 Nicolas Graves via Development of GNU Guix and the GNU System distribution. [this message]
2023-02-12  0:10 ` avoid Computing Guix derivation when not necessary Ludovic Courtès
2023-02-13 10:37   ` zimoun

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=87v8k9bqk4.fsf@ngraves.fr \
    --to=guix-devel@gnu.org \
    --cc=ngraves@ngraves.fr \
    /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).