* What’s the weather like?
@ 2017-07-21 15:13 Ludovic Courtès
2017-07-23 7:25 ` Catonano
2017-07-23 7:58 ` Ricardo Wurmus
0 siblings, 2 replies; 13+ messages in thread
From: Ludovic Courtès @ 2017-07-21 15:13 UTC (permalink / raw)
To: guix-devel
[-- Attachment #1: Type: text/plain, Size: 1345 bytes --]
Hello Guix!
Lately we’ve had a lot of nar URLs return 404, mostly for server-side
issues (setup issue on hydra.gnu.org that broke ‘guix publish’ cache
management, and a ‘guix publish’ cache eviction policy that’s too
aggressive.)
The attached tool allows you to query the status a substitute server
(and, as a side effect, triggers a nar regeneration if the server uses
‘guix publish --cache’). So it goes like this:
--8<---------------cut here---------------start------------->8---
$ ./pre-inst-env guix weather --substitute-urls=https://hydra.gnu.org
computing 5,864 package derivations for x86_64-linux...
looking for 6,121 store items on https://hydra.gnu.org...
updating list of substitutes from 'https://hydra.gnu.org'... 100.0%
https://hydra.gnu.org
81.2% substitutes available (4,970 out of 6,121)
17,852.6 MiB of nars (compressed)
46,415.5 MiB on disk (uncompressed)
0.050 seconds per request (306.0 seconds in total)
20.0 requests per second
--8<---------------cut here---------------end--------------->8---
Here it’s telling us that hydra.gnu.org has 81% of the substitutes for
x86_64 of the current public packages (those shown by “guix package
-A”).
We can add multiple -s flags, thought that quickly takes ages,
especially on that box.
Thoughts?
Ludo’.
[-- Attachment #2: the weather program --]
[-- Type: text/plain, Size: 8025 bytes --]
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
;;;
;;; 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 <http://www.gnu.org/licenses/>.
(define-module (guix scripts weather)
#:use-module (guix ui)
#:use-module (guix scripts)
#:use-module (guix packages)
#:use-module (guix derivations)
#:use-module (guix monads)
#:use-module (guix store)
#:use-module (guix grafts)
#:use-module (guix build syscalls)
#:use-module (guix scripts substitute)
#:use-module (gnu packages)
#:use-module (srfi srfi-1)
#:use-module (srfi srfi-19)
#:use-module (srfi srfi-37)
#:use-module (ice-9 match)
#:use-module (ice-9 format)
#:export (guix-weather))
(define (all-packages)
"Return the list of public packages we are going to query."
(fold-packages (lambda (package result)
(match (package-replacement package)
((? package? replacement)
(cons* replacement package result))
(#f
(cons package result))))
'()))
(define* (package-outputs packages
#:optional (system (%current-system)))
"Return the list of outputs of all of PACKAGES for the given SYSTEM."
(define update-progress!
(let ((total (length packages))
(done 0)
(width (max 10 (- (terminal-columns) 10))))
(lambda ()
(set! done (+ 1 done))
(let* ((ratio (/ done total 1.))
(done (inexact->exact (round (* width ratio))))
(left (- width done)))
(format (current-error-port) "~5,1f% [~a~a]\r"
(* ratio 100.)
(make-string done #\#)
(make-string left #\space))
(when (>= done total)
(newline (current-error-port)))
(force-output (current-error-port))))))
(format (current-error-port)
(G_ "computing ~h package derivations for ~a...~%")
(length packages) system)
(foldm %store-monad
(lambda (package result)
(mlet %store-monad ((drv (package->derivation package system
#:graft? #f)))
(update-progress!)
(match (derivation->output-paths drv)
(((names . items) ...)
(return (append items result))))))
'()
packages))
(cond-expand
(guile-2.2
;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds and
;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it.
(define time-monotonic time-tai))
(else #t))
(define (call-with-time thunk kont)
"Call THUNK and pass KONT the elapsed time followed by THUNK's return
values."
(let* ((start (current-time time-monotonic))
(result (call-with-values thunk list))
(end (current-time time-monotonic)))
(apply kont (time-difference end start) result)))
(define-syntax-rule (let/time ((time result exp)) body ...)
(call-with-time (lambda () exp) (lambda (time result) body ...)))
(define (report-server-coverage server items)
"Report the subset of ITEMS available as substitutes on SERVER."
(define MiB (* (expt 2 20) 1.))
(format #t (G_ "looking for ~h store items on ~a...~%")
(length items) server)
(let/time ((time narinfos (lookup-narinfos server items)))
(format #t "~a~%" server)
(let ((obtained (length narinfos))
(requested (length items))
(sizes (filter-map narinfo-file-size narinfos))
(time (+ (time-second time)
(/ (time-nanosecond time) 1e9))))
(format #t (G_ " ~2,1f% substitutes available (~h out of ~h)~%")
(* 100. (/ obtained requested 1.))
obtained requested)
(let ((total (/ (reduce + 0 sizes) MiB)))
(match (length sizes)
((? zero?)
(format #t (G_ "unknown substitute sizes~%")))
(len
(if (= len obtained)
(format #t (G_ " ~,1h MiB of nars (compressed)~%") total)
(format #t (G_ " at least ~,1h MiB of nars (compressed)~%")
total)))))
(format #t (G_ " ~,1h MiB on disk (uncompressed)~%")
(/ (reduce + 0 (map narinfo-size narinfos)) MiB))
(format #t (G_ " ~,3h seconds per request (~,1h seconds in total)~%")
(/ time requested 1.) time)
(format #t (G_ " ~,1h requests per second~%")
(/ requested time 1.)))))
\f
;;;
;;; Command-line options.
;;;
(define (show-help)
(display (G_ "Usage: guix weather [OPTIONS]
Report the availability of substitutes.\n"))
(display (G_ "
--substitute-urls=URLS
check for available substitutes at URLS"))
(display (G_ "
-s, --system=SYSTEM consider substitutes for SYSTEM--e.g., \"i686-linux\""))
(newline)
(display (G_ "
-h, --help display this help and exit"))
(display (G_ "
-V, --version display version information and exit"))
(newline)
(show-bug-report-information))
(define %options
(list (option '(#\h "help") #f #f
(lambda args
(show-help)
(exit 0)))
(option '(#\V "version") #f #f
(lambda args
(show-version-and-exit "guix challenge")))
(option '("substitute-urls") #t #f
(lambda (opt name arg result . rest)
(apply values
(alist-cons 'substitute-urls
(string-tokenize arg)
(alist-delete 'substitute-urls result))
rest)))
(option '(#\s "system") #t #f
(lambda (opt name arg result)
(alist-cons 'system arg result)))))
(define %default-options
`((substitute-urls . ,%default-substitute-urls)))
\f
;;;
;;; Entry point.
;;;
(define (guix-weather . args)
(with-error-handling
(let* ((opts (parse-command-line args %options
(list %default-options)))
(urls (assoc-ref opts 'substitute-urls))
(systems (match (filter-map (match-lambda
(('system . system) system)
(_ #f))
opts)
(() (list (%current-system)))
(systems systems)))
(packages (all-packages))
(items (with-store store
(parameterize ((%graft? #f))
(concatenate
(run-with-store store
(mapm %store-monad
(lambda (system)
(package-outputs packages system))
systems)))))))
(for-each (lambda (server)
(report-server-coverage server items))
urls))))
;;; Local Variables:
;;; eval: (put 'let/time 'scheme-indent-function 1)
;;; End:
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-21 15:13 What’s the weather like? Ludovic Courtès
@ 2017-07-23 7:25 ` Catonano
2017-07-24 9:07 ` Ludovic Courtès
2017-07-23 7:58 ` Ricardo Wurmus
1 sibling, 1 reply; 13+ messages in thread
From: Catonano @ 2017-07-23 7:25 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
[-- Attachment #1: Type: text/plain, Size: 10604 bytes --]
2017-07-21 17:13 GMT+02:00 Ludovic Courtès <ludo@gnu.org>:
> Hello Guix!
>
> Lately we’ve had a lot of nar URLs return 404, mostly for server-side
> issues (setup issue on hydra.gnu.org that broke ‘guix publish’ cache
> management, and a ‘guix publish’ cache eviction policy that’s too
> aggressive.)
>
> The attached tool allows you to query the status a substitute server
> (and, as a side effect, triggers a nar regeneration if the server uses
> ‘guix publish --cache’). So it goes like this:
>
> --8<---------------cut here---------------start------------->8---
> $ ./pre-inst-env guix weather --substitute-urls=https://hydra.gnu.org
> computing 5,864 package derivations for x86_64-linux...
> looking for 6,121 store items on https://hydra.gnu.org...
> updating list of substitutes from 'https://hydra.gnu.org'... 100.0%
> https://hydra.gnu.org
> 81.2% substitutes available (4,970 out of 6,121)
> 17,852.6 MiB of nars (compressed)
> 46,415.5 MiB on disk (uncompressed)
> 0.050 seconds per request (306.0 seconds in total)
> 20.0 requests per second
> --8<---------------cut here---------------end--------------->8---
>
> Here it’s telling us that hydra.gnu.org has 81% of the substitutes for
> x86_64 of the current public packages (those shown by “guix package
> -A”).
>
> We can add multiple -s flags, thought that quickly takes ages,
> especially on that box.
>
> Thoughts?
>
> Ludo’.
>
This message has been sitting here for 2 days without receiving any
comment. How is that ?
This is very interesting but I have a few remarks
First: having never being involved with binaries publishing I don't know
what you mean with
"if the server uses
‘guix publish --cache’"
or with
"We can add multiple -s flags"
Having said that, I think it would be interesting to have the percentage of
missing binaries for a specific operation rathher than for the whole server
For example, if I want to reconfigure my system or if I want to create a VM
image, how many binaries are missing in order to do that ?
But even like this, I think it's useful
Thanks !
> ;;; GNU Guix --- Functional package management for GNU
> ;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
> ;;;
> ;;; 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 <http://www.gnu.org/licenses/>.
>
> (define-module (guix scripts weather)
> #:use-module (guix ui)
> #:use-module (guix scripts)
> #:use-module (guix packages)
> #:use-module (guix derivations)
> #:use-module (guix monads)
> #:use-module (guix store)
> #:use-module (guix grafts)
> #:use-module (guix build syscalls)
> #:use-module (guix scripts substitute)
> #:use-module (gnu packages)
> #:use-module (srfi srfi-1)
> #:use-module (srfi srfi-19)
> #:use-module (srfi srfi-37)
> #:use-module (ice-9 match)
> #:use-module (ice-9 format)
> #:export (guix-weather))
>
>
> (define (all-packages)
> "Return the list of public packages we are going to query."
> (fold-packages (lambda (package result)
> (match (package-replacement package)
> ((? package? replacement)
> (cons* replacement package result))
> (#f
> (cons package result))))
> '()))
>
> (define* (package-outputs packages
> #:optional (system (%current-system)))
> "Return the list of outputs of all of PACKAGES for the given SYSTEM."
> (define update-progress!
> (let ((total (length packages))
> (done 0)
> (width (max 10 (- (terminal-columns) 10))))
> (lambda ()
> (set! done (+ 1 done))
> (let* ((ratio (/ done total 1.))
> (done (inexact->exact (round (* width ratio))))
> (left (- width done)))
> (format (current-error-port) "~5,1f% [~a~a]\r"
> (* ratio 100.)
> (make-string done #\#)
> (make-string left #\space))
> (when (>= done total)
> (newline (current-error-port)))
> (force-output (current-error-port))))))
>
> (format (current-error-port)
> (G_ "computing ~h package derivations for ~a...~%")
> (length packages) system)
>
> (foldm %store-monad
> (lambda (package result)
> (mlet %store-monad ((drv (package->derivation package system
> #:graft? #f)))
> (update-progress!)
> (match (derivation->output-paths drv)
> (((names . items) ...)
> (return (append items result))))))
> '()
> packages))
>
> (cond-expand
> (guile-2.2
> ;; Guile 2.2.2 has a bug whereby 'time-monotonic' objects have seconds
> and
> ;; nanoseconds swapped (fixed in Guile commit 886ac3e). Work around it.
> (define time-monotonic time-tai))
> (else #t))
>
> (define (call-with-time thunk kont)
> "Call THUNK and pass KONT the elapsed time followed by THUNK's return
> values."
> (let* ((start (current-time time-monotonic))
> (result (call-with-values thunk list))
> (end (current-time time-monotonic)))
> (apply kont (time-difference end start) result)))
>
> (define-syntax-rule (let/time ((time result exp)) body ...)
> (call-with-time (lambda () exp) (lambda (time result) body ...)))
>
> (define (report-server-coverage server items)
> "Report the subset of ITEMS available as substitutes on SERVER."
> (define MiB (* (expt 2 20) 1.))
>
> (format #t (G_ "looking for ~h store items on ~a...~%")
> (length items) server)
>
> (let/time ((time narinfos (lookup-narinfos server items)))
> (format #t "~a~%" server)
> (let ((obtained (length narinfos))
> (requested (length items))
> (sizes (filter-map narinfo-file-size narinfos))
> (time (+ (time-second time)
> (/ (time-nanosecond time) 1e9))))
> (format #t (G_ " ~2,1f% substitutes available (~h out of ~h)~%")
> (* 100. (/ obtained requested 1.))
> obtained requested)
> (let ((total (/ (reduce + 0 sizes) MiB)))
> (match (length sizes)
> ((? zero?)
> (format #t (G_ "unknown substitute sizes~%")))
> (len
> (if (= len obtained)
> (format #t (G_ " ~,1h MiB of nars (compressed)~%") total)
> (format #t (G_ " at least ~,1h MiB of nars (compressed)~%")
> total)))))
> (format #t (G_ " ~,1h MiB on disk (uncompressed)~%")
> (/ (reduce + 0 (map narinfo-size narinfos)) MiB))
> (format #t (G_ " ~,3h seconds per request (~,1h seconds in
> total)~%")
> (/ time requested 1.) time)
> (format #t (G_ " ~,1h requests per second~%")
> (/ requested time 1.)))))
>
>
> ;;;
> ;;; Command-line options.
> ;;;
>
> (define (show-help)
> (display (G_ "Usage: guix weather [OPTIONS]
> Report the availability of substitutes.\n"))
> (display (G_ "
> --substitute-urls=URLS
> check for available substitutes at URLS"))
> (display (G_ "
> -s, --system=SYSTEM consider substitutes for SYSTEM--e.g.,
> \"i686-linux\""))
> (newline)
> (display (G_ "
> -h, --help display this help and exit"))
> (display (G_ "
> -V, --version display version information and exit"))
> (newline)
> (show-bug-report-information))
>
> (define %options
> (list (option '(#\h "help") #f #f
> (lambda args
> (show-help)
> (exit 0)))
> (option '(#\V "version") #f #f
> (lambda args
> (show-version-and-exit "guix challenge")))
>
> (option '("substitute-urls") #t #f
> (lambda (opt name arg result . rest)
> (apply values
> (alist-cons 'substitute-urls
> (string-tokenize arg)
> (alist-delete 'substitute-urls
> result))
> rest)))
> (option '(#\s "system") #t #f
> (lambda (opt name arg result)
> (alist-cons 'system arg result)))))
>
> (define %default-options
> `((substitute-urls . ,%default-substitute-urls)))
>
>
> ;;;
> ;;; Entry point.
> ;;;
>
> (define (guix-weather . args)
> (with-error-handling
> (let* ((opts (parse-command-line args %options
> (list %default-options)))
> (urls (assoc-ref opts 'substitute-urls))
> (systems (match (filter-map (match-lambda
> (('system . system) system)
> (_ #f))
> opts)
> (() (list (%current-system)))
> (systems systems)))
> (packages (all-packages))
> (items (with-store store
> (parameterize ((%graft? #f))
> (concatenate
> (run-with-store store
> (mapm %store-monad
> (lambda (system)
> (package-outputs packages system))
> systems)))))))
> (for-each (lambda (server)
> (report-server-coverage server items))
> urls))))
>
> ;;; Local Variables:
> ;;; eval: (put 'let/time 'scheme-indent-function 1)
> ;;; End:
>
>
[-- Attachment #2: Type: text/html, Size: 13574 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-23 7:25 ` Catonano
@ 2017-07-24 9:07 ` Ludovic Courtès
2017-07-24 11:17 ` Vincent Legoll
0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2017-07-24 9:07 UTC (permalink / raw)
To: Catonano; +Cc: guix-devel
Hello!
Catonano <catonano@gmail.com> skribis:
> First: having never being involved with binaries publishing I don't know
> what you mean with
> "if the server uses
> ‘guix publish --cache’"
The ‘--cache’ option instructs ‘guix publish’ to maintain a cache of the
archives it publishes (“nars”):
https://www.gnu.org/software/guix/manual/html_node/Invoking-guix-publish.html
> or with
>
> "We can add multiple -s flags"
One can run “guix weather -s x86_64-linux -s armhf-linux” to get results
for both ARM and x86_64.
> Having said that, I think it would be interesting to have the percentage of
> missing binaries for a specific operation rathher than for the whole server
>
> For example, if I want to reconfigure my system or if I want to create a VM
> image, how many binaries are missing in order to do that ?
You can always use “--dry-run”, which shows a list of what would be
built/downloaded. The possibly long lists it returns are not as easy to
read as we’d like, though.
Ludo’.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-24 9:07 ` Ludovic Courtès
@ 2017-07-24 11:17 ` Vincent Legoll
2017-07-24 13:15 ` Ludovic Courtès
0 siblings, 1 reply; 13+ messages in thread
From: Vincent Legoll @ 2017-07-24 11:17 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hello,
I hope the "weather" naming is only temporary and will migrate
to a better one (more descriptive) before commit.
Don't get me wrong, it's a cool name, for people that already
know about the feature. But for guix newcomers, it will be
confusing, IMHO.
Not knowing what I'm talking about, I'd hazard a guess...
guix substitute --status
or something like that...
WDYT ?
--
Vincent Legoll
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-24 11:17 ` Vincent Legoll
@ 2017-07-24 13:15 ` Ludovic Courtès
2017-07-24 14:48 ` Vincent Legoll
0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2017-07-24 13:15 UTC (permalink / raw)
To: Vincent Legoll; +Cc: guix-devel
Hi,
Vincent Legoll <vincent.legoll@gmail.com> skribis:
> I hope the "weather" naming is only temporary and will migrate
> to a better one (more descriptive) before commit.
>
> Don't get me wrong, it's a cool name, for people that already
> know about the feature. But for guix newcomers, it will be
> confusing, IMHO.
Note that it’s not meant for everyday use either.
> Not knowing what I'm talking about, I'd hazard a guess...
> guix substitute --status
> or something like that...
‘guix substitute’ exists but is an internal command.
‘guix status’ would be too vague.
Naming is hard!
Ludo’, who also has plans for a “guix health” command. :-)
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-24 13:15 ` Ludovic Courtès
@ 2017-07-24 14:48 ` Vincent Legoll
0 siblings, 0 replies; 13+ messages in thread
From: Vincent Legoll @ 2017-07-24 14:48 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
On Mon, Jul 24, 2017 at 3:15 PM, Ludovic Courtès <ludo@gnu.org> wrote:
>> I hope the "weather" naming is only temporary and will migrate
>> to a better one (more descriptive) before commit.
>>
>> Don't get me wrong, it's a cool name, for people that already
>> know about the feature. But for guix newcomers, it will be
>> confusing, IMHO.
>
> Note that it’s not meant for everyday use either.
OK, but when newbs (like me) have problems they start trying
random things, and if the naming is aprroximately right, we won't
even need to ask on the ML...
>> Not knowing what I'm talking about, I'd hazard a guess...
>> guix substitute --status
>> or something like that...
>
> ‘guix substitute’ exists but is an internal command.
>
> ‘guix status’ would be too vague.
>
> Naming is hard!
Yep ;-)
> Ludo’, who also has plans for a “guix health” command. :-)
That one wouldn't be bad
--
Vincent Legoll
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-21 15:13 What’s the weather like? Ludovic Courtès
2017-07-23 7:25 ` Catonano
@ 2017-07-23 7:58 ` Ricardo Wurmus
2017-07-23 10:26 ` Ricardo Wurmus
1 sibling, 1 reply; 13+ messages in thread
From: Ricardo Wurmus @ 2017-07-23 7:58 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Hey Ludo,
> The attached tool allows you to query the status a substitute server
> (and, as a side effect, triggers a nar regeneration if the server uses
> ‘guix publish --cache’).
This is very useful! I’ve been using it for the past two days to
monitor the progress on berlin.guixsd.org
Now if one could pass a manifest or a system configuration to “guix
weather” and it would show how many of the desired packages have
substitutes that would be even more useful. Looking at the concise code
it seems to be an almost trivial change.
Thanks a lot for writing yet another useful extension! And the name is
cute, too :)
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-23 7:58 ` Ricardo Wurmus
@ 2017-07-23 10:26 ` Ricardo Wurmus
2017-07-23 11:02 ` Ricardo Wurmus
0 siblings, 1 reply; 13+ messages in thread
From: Ricardo Wurmus @ 2017-07-23 10:26 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ricardo Wurmus <rekado@elephly.net> writes:
> Now if one could pass a manifest or a system configuration to “guix
> weather” and it would show how many of the desired packages have
> substitutes that would be even more useful. Looking at the concise code
> it seems to be an almost trivial change.
Attached is a patch against “weather.scm” that adds a “--manifest”
option. I used it with my profile’s manifest and got this result:
https://hydra.gnu.org
98.5% substitutes available (263 out of 267)
1,063.4 MiB of nars (compressed)
2,903.9 MiB on disk (uncompressed)
0.275 seconds per request (73.3 seconds in total)
3.6 requests per second
Yay!
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
--- guix/scripts/weather.scm 2017-07-23 12:24:42.094607359 +0200
+++ guix/scripts/weather.scm.more 2017-07-23 12:25:38.284361726 +0200
@@ -1,5 +1,6 @@
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2017 Ludovic Courtès <ludo@gnu.org>
+;;; Copyright © 2017 Ricardo Wurmus <rekado@elephly.net>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -20,6 +21,7 @@
#:use-module (guix ui)
#:use-module (guix scripts)
#:use-module (guix packages)
+ #:use-module (guix profiles)
#:use-module (guix derivations)
#:use-module (guix monads)
#:use-module (guix store)
@@ -168,6 +170,9 @@
(string-tokenize arg)
(alist-delete 'substitute-urls result))
rest)))
+ (option '(#\m "manifest") #t #f
+ (lambda (opt name arg result)
+ (alist-cons 'manifest arg result)))
(option '(#\s "system") #t #f
(lambda (opt name arg result)
(alist-cons 'system arg result)))))
@@ -191,7 +196,13 @@
opts)
(() (list (%current-system)))
(systems systems)))
- (packages (all-packages))
+ (packages (let ((manifest-file (assoc-ref opts 'manifest)))
+ (if (and manifest-file (file-exists? manifest-file))
+ (let* ((user-module (make-user-module '((guix profiles) (gnu))))
+ (manifest (load* manifest-file user-module)))
+ (map manifest-entry-item
+ (manifest-transitive-entries manifest)))
+ (all-packages))))
(items (with-store store
(parameterize ((%graft? #f))
(concatenate
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-23 10:26 ` Ricardo Wurmus
@ 2017-07-23 11:02 ` Ricardo Wurmus
2017-07-25 10:26 ` Ludovic Courtès
0 siblings, 1 reply; 13+ messages in thread
From: Ricardo Wurmus @ 2017-07-23 11:02 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ricardo Wurmus <rekado@elephly.net> writes:
>> Now if one could pass a manifest or a system configuration to “guix
>> weather” and it would show how many of the desired packages have
>> substitutes that would be even more useful. Looking at the concise code
>> it seems to be an almost trivial change.
>
> Attached is a patch against “weather.scm” that adds a “--manifest”
> option.
And here’s the missing addition to the “usage” output:
--- guix/scripts/weather.scm 2017-07-23 12:25:38.284361726 +0200
+++ guix/scripts/weather.scm.more 2017-07-23 13:00:31.021921693 +0200
@@ -145,6 +145,9 @@
--substitute-urls=URLS
check for available substitutes at URLS"))
(display (G_ "
+ --manifest=MANIFEST
+ only look up substitutes for packages specified in MANIFEST"))
+ (display (G_ "
-s, --system=SYSTEM consider substitutes for SYSTEM--e.g., \"i686-linux\""))
(newline)
(display (G_ "
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-23 11:02 ` Ricardo Wurmus
@ 2017-07-25 10:26 ` Ludovic Courtès
2017-07-26 20:22 ` Alex Kost
0 siblings, 1 reply; 13+ messages in thread
From: Ludovic Courtès @ 2017-07-25 10:26 UTC (permalink / raw)
To: Ricardo Wurmus; +Cc: guix-devel
Hello Guix!
Ricardo Wurmus <rekado@elephly.net> skribis:
> Ricardo Wurmus <rekado@elephly.net> writes:
>
>>> Now if one could pass a manifest or a system configuration to “guix
>>> weather” and it would show how many of the desired packages have
>>> substitutes that would be even more useful. Looking at the concise code
>>> it seems to be an almost trivial change.
>>
>> Attached is a patch against “weather.scm” that adds a “--manifest”
>> option.
>
> And here’s the missing addition to the “usage” output:
Awesome.
I went ahead and pushed the new command as commit
585347d7aa3a2a23359b354a550f161d5102c517.
Thank you!
Ludo’.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-25 10:26 ` Ludovic Courtès
@ 2017-07-26 20:22 ` Alex Kost
2017-07-27 9:06 ` Ludovic Courtès
2017-07-27 11:39 ` Ricardo Wurmus
0 siblings, 2 replies; 13+ messages in thread
From: Alex Kost @ 2017-07-26 20:22 UTC (permalink / raw)
To: Ludovic Courtès; +Cc: guix-devel
Ludovic Courtès (2017-07-25 12:26 +0200) wrote:
> Hello Guix!
>
> Ricardo Wurmus <rekado@elephly.net> skribis:
>
>> Ricardo Wurmus <rekado@elephly.net> writes:
>>
>>>> Now if one could pass a manifest or a system configuration to “guix
>>>> weather” and it would show how many of the desired packages have
>>>> substitutes that would be even more useful. Looking at the concise code
>>>> it seems to be an almost trivial change.
>>>
>>> Attached is a patch against “weather.scm” that adds a “--manifest”
>>> option.
>>
>> And here’s the missing addition to the “usage” output:
>
> Awesome.
>
> I went ahead and pushed the new command as commit
> 585347d7aa3a2a23359b354a550f161d5102c517.
Hi, I've noticed that "guix weather" provides "--manifest" long option
but not "-m" short option (as "guix package" does). Would it be better
to add "-m" for consistency with "guix package"?
--
Alex
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-26 20:22 ` Alex Kost
@ 2017-07-27 9:06 ` Ludovic Courtès
2017-07-27 11:39 ` Ricardo Wurmus
1 sibling, 0 replies; 13+ messages in thread
From: Ludovic Courtès @ 2017-07-27 9:06 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> skribis:
> Ludovic Courtès (2017-07-25 12:26 +0200) wrote:
>
>> Hello Guix!
>>
>> Ricardo Wurmus <rekado@elephly.net> skribis:
>>
>>> Ricardo Wurmus <rekado@elephly.net> writes:
>>>
>>>>> Now if one could pass a manifest or a system configuration to “guix
>>>>> weather” and it would show how many of the desired packages have
>>>>> substitutes that would be even more useful. Looking at the concise code
>>>>> it seems to be an almost trivial change.
>>>>
>>>> Attached is a patch against “weather.scm” that adds a “--manifest”
>>>> option.
>>>
>>> And here’s the missing addition to the “usage” output:
>>
>> Awesome.
>>
>> I went ahead and pushed the new command as commit
>> 585347d7aa3a2a23359b354a550f161d5102c517.
>
> Hi, I've noticed that "guix weather" provides "--manifest" long option
> but not "-m" short option (as "guix package" does). Would it be better
> to add "-m" for consistency with "guix package"?
It supports ‘-m’ but ‘--help’ was not showing it. Fixed now.
Thanks,
Ludo’.
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: What’s the weather like?
2017-07-26 20:22 ` Alex Kost
2017-07-27 9:06 ` Ludovic Courtès
@ 2017-07-27 11:39 ` Ricardo Wurmus
1 sibling, 0 replies; 13+ messages in thread
From: Ricardo Wurmus @ 2017-07-27 11:39 UTC (permalink / raw)
To: Alex Kost; +Cc: guix-devel
Alex Kost <alezost@gmail.com> writes:
> Hi, I've noticed that "guix weather" provides "--manifest" long option
> but not "-m" short option (as "guix package" does). Would it be better
> to add "-m" for consistency with "guix package"?
Yes, that would be good. I forgot to provide it when I added
“--manifest” support.
--
Ricardo
GPG: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC
https://elephly.net
^ permalink raw reply [flat|nested] 13+ messages in thread
end of thread, other threads:[~2017-07-27 11:40 UTC | newest]
Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-21 15:13 What’s the weather like? Ludovic Courtès
2017-07-23 7:25 ` Catonano
2017-07-24 9:07 ` Ludovic Courtès
2017-07-24 11:17 ` Vincent Legoll
2017-07-24 13:15 ` Ludovic Courtès
2017-07-24 14:48 ` Vincent Legoll
2017-07-23 7:58 ` Ricardo Wurmus
2017-07-23 10:26 ` Ricardo Wurmus
2017-07-23 11:02 ` Ricardo Wurmus
2017-07-25 10:26 ` Ludovic Courtès
2017-07-26 20:22 ` Alex Kost
2017-07-27 9:06 ` Ludovic Courtès
2017-07-27 11:39 ` Ricardo Wurmus
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).