From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Reza Alizadeh Majd" Subject: Re: query for package updates Date: Thu, 12 Mar 2020 01:00:36 +0330 Message-ID: <0c573dbd-6bd8-4ab0-9674-c75d5c5fa173@www.fastmail.com> References: <58b65c16-f3bd-4503-9870-5d168fcbe69d@www.fastmail.com> <87eeu4a7hf.fsf@ambrevar.xyz> <64253f3e-646a-47d1-83a5-ead90844cbe1@www.fastmail.com> <87ftek89o4.fsf@ambrevar.xyz> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:52648) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jC8wc-0006Yw-Ra for help-guix@gnu.org; Wed, 11 Mar 2020 17:31:15 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jC8wb-0000q3-RP for help-guix@gnu.org; Wed, 11 Mar 2020 17:31:14 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:42117) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jC8wb-0000n0-74 for help-guix@gnu.org; Wed, 11 Mar 2020 17:31:13 -0400 In-Reply-To: <87ftek89o4.fsf@ambrevar.xyz> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+gcggh-help-guix=m.gmane-mx.org@gnu.org Sender: "Help-Guix" To: Pierre Neidhardt , help-guix mailing list 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