;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2018 Ludovic Courtès ;;; Copyright © 2018 Ricardo Wurmus ;;; ;;; This file is part of GNU Guix. ;;; ;;; GNU Guix is free software; you can redistribute it and/or modify it ;;; under the terms of the GNU General Public License as published by ;;; the Free Software Foundation; either version 3 of the License, or (at ;;; your option) any later version. ;;; ;;; GNU Guix is distributed in the hope that it will be useful, but ;;; WITHOUT ANY WARRANTY; without even the implied warranty of ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ;;; GNU General Public License for more details. ;;; ;;; You should have received a copy of the GNU General Public License ;;; along with GNU Guix. If not, see . (define-module (guix status) #:use-module (guix records) #:use-module (guix i18n) #:use-module ((guix ui) #:select (colorize-string)) #:use-module (guix progress) #:autoload (guix build syscalls) (terminal-columns) #:use-module ((guix build download) #:select (nar-uri-abbreviation)) #:use-module (guix store) #:use-module (guix derivations) #:use-module (srfi srfi-1) #:use-module (srfi srfi-9) #:use-module (srfi srfi-19) #:use-module (srfi srfi-26) #:use-module (ice-9 regex) #:use-module (ice-9 match) #:use-module (ice-9 format) #:use-module (ice-9 binary-ports) #:autoload (ice-9 rdelim) (read-string) #:use-module (rnrs bytevectors) #:use-module ((system foreign) #:select (bytevector->pointer pointer->bytevector)) #:export (build-event-output-port compute-status build-status build-status? build-status-building build-status-downloading build-status-builds-completed build-status-downloads-completed download? download download-item download-uri download-size download-start download-end download-transferred build-status-updater print-build-event print-build-event/quiet print-build-status with-status-report)) ;;; Commentary: ;;; ;;; This module provides facilities to track the status of ongoing builds and ;;; downloads in a given session, as well as tools to report about the current ;;; status to user interfaces. It does so by analyzing the output of ;;; 'current-build-output-port'. The build status is maintained in a ;;; record. ;;; ;;; Code: ;;; ;;; Build status tracking. ;;; ;; Builds and substitutions performed by the daemon. (define-record-type* build-status make-build-status build-status? (building build-status-building ;list of drv (default '())) (downloading build-status-downloading ;list of (default '())) (builds-completed build-status-builds-completed ;list of drv (default '())) (downloads-completed build-status-downloads-completed ;list of store items (default '()))) ;; On-going or completed downloads. Downloads can be stem from substitutes ;; and from "builtin:download" fixed-output derivations. (define-record-type (%download item uri size start end transferred) download? (item download-item) ;store item (uri download-uri) ;string | #f (size download-size) ;integer | #f (start download-start) ;