guix_mirror_bot pushed a commit to branch master
in repository guix.

commit c393c32f26714615d5e9e246bd4e290640bf6638
Author: Nguyễn Gia Phong <[email protected]>
AuthorDate: Sat Oct 17 13:19:20 2026 +0900

    maint: Check channel news on the HEAD commit.
    
    This steps closer to checking the news file that is actually pushed.
    
    * build-aux/check-channel-news.scm: Call all-the-news
      with the repository and its current HEAD.
      Include that commit in the success message.
      (all-the-news): Retrieve the etc/news.scm blob from a repository
      and a commit instead of the checked out file.
    
    Merges: https://codeberg.org/guix/guix/pulls/11897
---
 build-aux/check-channel-news.scm | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/build-aux/check-channel-news.scm b/build-aux/check-channel-news.scm
index eb7b89e4371..dd31c424e0d 100644
--- a/build-aux/check-channel-news.scm
+++ b/build-aux/check-channel-news.scm
@@ -25,17 +25,20 @@
              (guix ui)
              (guix channels)
              (srfi srfi-26)
+             (rnrs bytevectors)
              (ice-9 match))
 
 ;; XXX: These two things are currently private.
 (define read-channel-news (@@ (guix channels) read-channel-news))
 (define channel-news-entries (cut struct-ref <> 0))
 
-(define (all-the-news directory)
-  "Return the <channel-news> read from DIRECTORY, a checkout of the 'guix'
-channel."
-  (call-with-input-file (string-append directory "/etc/news.scm")
-    read-channel-news))
+(define (all-the-news repository commit)
+  "Return the <channel-news> read from the 'guix' channel REPOSITORY at 
COMMIT."
+  (let* ((tree (commit-tree (commit-lookup repository commit)))
+         (oid (tree-entry-id (tree-entry-bypath tree "etc/news.scm")))
+         (blob (blob-lookup repository oid)))
+    (call-with-input-string (utf8->string (blob-content blob))
+      read-channel-news)))
 
 (define (validate-texinfo str type language)
   "Parse STR as a Texinfo fragment and raise an error if that fails."
@@ -72,11 +75,11 @@ existent commit of REPOSITORY and contains only valid 
Texinfo."
                  (channel-news-entry-title entry))
           (apply throw key error rest)))))
 
-(let* ((this-directory (dirname (current-filename)))
-       (top-directory  (string-append this-directory "/.."))
-       (entries        (channel-news-entries (all-the-news top-directory))))
-  (with-repository top-directory repository
+(with-repository (dirname (dirname (current-filename))) repository
+  (let* ((head (reference-target (repository-head repository)))
+         (entries (channel-news-entries (all-the-news repository head))))
     (for-each (cut validate-news-entry repository <>)
               entries)
-    (info (G_ "All ~a channel news entries are valid.~%")
-          (length entries))))
+    (info (G_ "All ~a channel news entries are valid at commit ~a.~%")
+          (length entries)
+          (oid->string head))))

Reply via email to