help-guix
[Top][All Lists]
Advanced

[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: Sat, 14 Mar 2020 10:03:25 +0330
User-agent: Cyrus-JMAP/3.1.7-991-g5a577d3-fmstable-20200305v3

Just wanted to ping this up/

does anyone have any suggestion about following script, that I wrote
to check about available package updates for a profile? 


On Thu, Mar 12, 2020, at 1:00 AM, Reza Alizadeh Majd wrote:
> 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
> 
>

-- 
Regards
Reza Alizadeh Majd
PantherX Team



reply via email to

[Prev in Thread] Current Thread [Next in Thread]