[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: query for package updates
From: |
Reza Alizadeh Majd |
Subject: |
Re: query for package updates |
Date: |
Thu, 12 Mar 2020 01:00:36 +0330 |
User-agent: |
Cyrus-JMAP/3.1.7-991-g5a577d3-fmstable-20200305v3 |
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