From: "Reza Alizadeh Majd" <r.majd@pantherx.org>
To: Pierre Neidhardt <mail@ambrevar.xyz>,
help-guix mailing list <help-guix@gnu.org>
Subject: Re: query for package updates
Date: Thu, 12 Mar 2020 01:00:36 +0330 [thread overview]
Message-ID: <0c573dbd-6bd8-4ab0-9674-c75d5c5fa173@www.fastmail.com> (raw)
In-Reply-To: <87ftek89o4.fsf@ambrevar.xyz>
playing with the Guix sources, I wrote following Guile script in order to
check available updates for a profile.
Is it suitable for this purpose or I need to include additional checks
on my script?
(define-module (px tools updater)
#:use-module (guix profiles)
#:use-module (guix utils)
#:use-module (srfi srfi-1)
#:export (check-entry
check-manifest
check-profile))
(define (check-entry entry manifest)
"Recursive update check for a manifest entry"
(let* ((pattern (manifest-pattern
(name (manifest-entry-name entry))
(output (manifest-entry-output entry))))
(previous (manifest-lookup manifest pattern))
(newer? (and previous
(version>? (manifest-entry-version entry)
(manifest-entry-version previous)))))
(fold (lambda (child-entry result)
(or result
(check-entry child-entry manifest)))
newer? (manifest-entry-dependencies entry))))
(define (check-manifest manifest)
"Check if any update available for a manifest"
(fold (lambda (entry previous)
(or previous (check-entry entry manifest)))
#f (manifest-entries manifest)))
(define* (check-profile #:optional (profile %current-profile))
"Check if any update is available for a profile"
(let ((manifest (profile-manifest profile)))
(check-manifest manifest)))
--
Regards
Reza Alizadeh Majd
PantherX Team
next prev parent reply other threads:[~2020-03-11 21:31 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-07 7:50 query for package updates Reza Alizadeh Majd
2020-03-07 8:34 ` Pierre Neidhardt
2020-03-07 9:55 ` Reza Alizadeh Majd
2020-03-07 15:30 ` Pierre Neidhardt
2020-03-11 21:30 ` Reza Alizadeh Majd [this message]
2020-03-14 6:33 ` Reza Alizadeh Majd
2020-03-14 15:26 ` Pierre Neidhardt
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0c573dbd-6bd8-4ab0-9674-c75d5c5fa173@www.fastmail.com \
--to=r.majd@pantherx.org \
--cc=help-guix@gnu.org \
--cc=mail@ambrevar.xyz \
/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 external index
https://git.savannah.gnu.org/cgit/guix.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.