2015-10-19 18:55:09 -04:00
|
|
|
|
;;; GNU Guix --- Functional package management for GNU
|
2020-01-15 17:34:46 -05:00
|
|
|
|
;;; Copyright © 2015, 2016, 2017, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
|
2015-10-19 18:55:09 -04:00
|
|
|
|
;;;
|
|
|
|
|
;;; 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 challenge)
|
|
|
|
|
#:use-module (guix ui)
|
|
|
|
|
#:use-module (guix scripts)
|
|
|
|
|
#:use-module (guix store)
|
|
|
|
|
#:use-module (guix utils)
|
2016-07-14 09:25:00 -04:00
|
|
|
|
#:use-module (guix grafts)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
#:use-module (guix monads)
|
|
|
|
|
#:use-module (guix base32)
|
|
|
|
|
#:use-module (guix packages)
|
2020-01-15 17:34:46 -05:00
|
|
|
|
#:use-module ((guix progress) #:hide (dump-port*))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
#:use-module (guix serialization)
|
|
|
|
|
#:use-module (guix scripts substitute)
|
|
|
|
|
#:use-module (rnrs bytevectors)
|
2019-12-07 09:10:39 -05:00
|
|
|
|
#:autoload (guix http-client) (http-fetch)
|
|
|
|
|
#:use-module ((guix build syscalls) #:select (terminal-columns))
|
|
|
|
|
#:use-module (gcrypt hash)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
#:use-module (srfi srfi-1)
|
|
|
|
|
#:use-module (srfi srfi-9)
|
2019-12-07 09:10:39 -05:00
|
|
|
|
#:use-module (srfi srfi-11)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
#:use-module (srfi srfi-26)
|
|
|
|
|
#:use-module (srfi srfi-34)
|
|
|
|
|
#:use-module (srfi srfi-37)
|
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
|
#:use-module (ice-9 vlist)
|
|
|
|
|
#:use-module (ice-9 format)
|
2019-12-07 09:10:39 -05:00
|
|
|
|
#:use-module (ice-9 ftw)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
#:use-module (web uri)
|
2017-01-13 17:30:43 -05:00
|
|
|
|
#:export (compare-contents
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
2017-01-13 17:30:43 -05:00
|
|
|
|
comparison-report?
|
|
|
|
|
comparison-report-item
|
|
|
|
|
comparison-report-result
|
|
|
|
|
comparison-report-local-sha256
|
|
|
|
|
comparison-report-narinfos
|
|
|
|
|
|
|
|
|
|
comparison-report-match?
|
|
|
|
|
comparison-report-mismatch?
|
|
|
|
|
comparison-report-inconclusive?
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
2019-12-07 09:10:39 -05:00
|
|
|
|
differing-files
|
2019-12-07 11:37:08 -05:00
|
|
|
|
call-with-mismatches
|
2019-12-07 09:10:39 -05:00
|
|
|
|
|
2015-10-19 18:55:09 -04:00
|
|
|
|
guix-challenge))
|
|
|
|
|
|
|
|
|
|
;;; Commentary:
|
|
|
|
|
;;;
|
|
|
|
|
;;; Challenge substitute servers, checking whether they provide the same
|
|
|
|
|
;;; binaries as those built locally.
|
|
|
|
|
;;;
|
|
|
|
|
;;; Here we completely bypass the daemon to access substitutes. This is
|
|
|
|
|
;;; because we want to be able to report fine-grain information about
|
|
|
|
|
;;; discrepancies: We need to show the URL of the offending nar, its hash, and
|
|
|
|
|
;;; so on.
|
|
|
|
|
;;;
|
|
|
|
|
;;; Code:
|
|
|
|
|
|
|
|
|
|
(define ensure-store-item ;XXX: move to (guix ui)?
|
|
|
|
|
(@@ (guix scripts size) ensure-store-item))
|
|
|
|
|
|
2017-01-13 17:30:43 -05:00
|
|
|
|
;; Representation of a comparison report for ITEM.
|
|
|
|
|
(define-record-type <comparison-report>
|
|
|
|
|
(%comparison-report item result local-sha256 narinfos)
|
|
|
|
|
comparison-report?
|
|
|
|
|
(item comparison-report-item) ;string, /gnu/store/… item
|
|
|
|
|
(result comparison-report-result) ;'match | 'mismatch | 'inconclusive
|
|
|
|
|
(local-sha256 comparison-report-local-sha256) ;bytevector | #f
|
|
|
|
|
(narinfos comparison-report-narinfos)) ;list of <narinfo>
|
|
|
|
|
|
|
|
|
|
(define-syntax comparison-report
|
|
|
|
|
;; Some sort of a an enum to make sure 'result' is correct.
|
|
|
|
|
(syntax-rules (match mismatch inconclusive)
|
|
|
|
|
((_ item 'match rest ...)
|
|
|
|
|
(%comparison-report item 'match rest ...))
|
|
|
|
|
((_ item 'mismatch rest ...)
|
|
|
|
|
(%comparison-report item 'mismatch rest ...))
|
|
|
|
|
((_ item 'inconclusive rest ...)
|
|
|
|
|
(%comparison-report item 'inconclusive rest ...))))
|
|
|
|
|
|
|
|
|
|
(define (comparison-report-predicate result)
|
|
|
|
|
"Return a predicate that returns true when pass a REPORT that has RESULT."
|
|
|
|
|
(lambda (report)
|
|
|
|
|
(eq? (comparison-report-result report) result)))
|
|
|
|
|
|
|
|
|
|
(define comparison-report-mismatch?
|
|
|
|
|
(comparison-report-predicate 'mismatch))
|
|
|
|
|
|
|
|
|
|
(define comparison-report-match?
|
|
|
|
|
(comparison-report-predicate 'match))
|
|
|
|
|
|
|
|
|
|
(define comparison-report-inconclusive?
|
|
|
|
|
(comparison-report-predicate 'inconclusive))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
|
|
|
|
(define (locally-built? store item)
|
|
|
|
|
"Return true if ITEM was built locally."
|
|
|
|
|
;; XXX: For now approximate it by checking whether there's a build log for
|
|
|
|
|
;; ITEM. There could be false negatives, if logs have been removed.
|
|
|
|
|
(->bool (log-file store item)))
|
|
|
|
|
|
|
|
|
|
(define (query-locally-built-hash item)
|
|
|
|
|
"Return the hash of ITEM, a store item, if ITEM was built locally.
|
|
|
|
|
Otherwise return #f."
|
|
|
|
|
(lambda (store)
|
store: Rename '&nix-error' to '&store-error'.
* guix/store.scm (&nix-error): Rename to...
(&store-error): ... this, and adjust users.
(&nix-connection-error): Rename to...
(&store-connection-error): ... this, and adjust users.
(&nix-protocol-error): Rename to...
(&store-protocol-error): ... this, adjust users.
(&nix-error, &nix-connection-error, &nix-protocol-error): Define these
condition types and their getters as deprecrated aliases.
* build-aux/run-system-tests.scm, guix/derivations.scm,
guix/grafts.scm, guix/scripts/challenge.scm,
guix/scripts/graph.scm, guix/scripts/lint.scm,
guix/scripts/offload.scm, guix/serialization.scm,
guix/ssh.scm, guix/tests.scm, guix/ui.scm,
tests/derivations.scm, tests/gexp.scm, tests/guix-daemon.sh,
tests/packages.scm, tests/store.scm, doc/guix.texi: Adjust to use the
new names.
2019-01-21 11:41:11 -05:00
|
|
|
|
(guard (c ((store-protocol-error? c)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
(values #f store)))
|
|
|
|
|
(if (locally-built? store item)
|
|
|
|
|
(values (query-path-hash store item) store)
|
|
|
|
|
(values #f store)))))
|
|
|
|
|
|
|
|
|
|
(define-syntax-rule (report args ...)
|
|
|
|
|
(format (current-error-port) args ...))
|
|
|
|
|
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(define (compare-contents items servers)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
"Challenge the substitute servers whose URLs are listed in SERVERS by
|
|
|
|
|
comparing the hash of the substitutes of ITEMS that they serve. Return the
|
2017-01-13 17:30:43 -05:00
|
|
|
|
list of <comparison-report> objects.
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
|
|
|
|
This procedure does not authenticate narinfos from SERVERS, nor does it verify
|
|
|
|
|
that they are signed by an authorized public keys. The reason is that, by
|
|
|
|
|
definition, we may want to target unknown servers. Furthermore, no risk is
|
|
|
|
|
taken since we do not import the archives."
|
|
|
|
|
(define (compare item reference)
|
|
|
|
|
;; Return a procedure to compare the hash of ITEM with REFERENCE.
|
|
|
|
|
(lambda (narinfo url)
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(or (not narinfo)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
(let ((value (narinfo-hash->sha256 (narinfo-hash narinfo))))
|
|
|
|
|
(bytevector=? reference value)))))
|
|
|
|
|
|
|
|
|
|
(define (select-reference item narinfos urls)
|
|
|
|
|
;; Return a "reference" narinfo among NARINFOS.
|
|
|
|
|
(match narinfos
|
|
|
|
|
((first narinfos ...)
|
|
|
|
|
(match servers
|
|
|
|
|
((url urls ...)
|
|
|
|
|
(if (not first)
|
|
|
|
|
(select-reference item narinfos urls)
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(narinfo-hash->sha256 (narinfo-hash first))))))))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
|
|
|
|
(mlet* %store-monad ((local (mapm %store-monad
|
|
|
|
|
query-locally-built-hash items))
|
|
|
|
|
(remote -> (append-map (cut lookup-narinfos <> items)
|
|
|
|
|
servers))
|
|
|
|
|
;; No 'assert-valid-narinfo' on purpose.
|
|
|
|
|
(narinfos -> (fold (lambda (narinfo vhash)
|
2015-10-28 06:48:27 -04:00
|
|
|
|
(vhash-cons (narinfo-path narinfo) narinfo
|
|
|
|
|
vhash))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
vlist-null
|
|
|
|
|
remote)))
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(return (map (lambda (item local)
|
|
|
|
|
(match (vhash-fold* cons '() item narinfos)
|
|
|
|
|
(() ;no substitutes
|
|
|
|
|
(comparison-report item 'inconclusive local '()))
|
|
|
|
|
((narinfo)
|
|
|
|
|
(if local
|
|
|
|
|
(if ((compare item local) narinfo (first servers))
|
|
|
|
|
(comparison-report item 'match
|
|
|
|
|
local (list narinfo))
|
|
|
|
|
(comparison-report item 'mismatch
|
|
|
|
|
local (list narinfo)))
|
|
|
|
|
(comparison-report item 'inconclusive
|
|
|
|
|
local (list narinfo))))
|
|
|
|
|
((narinfos ...)
|
|
|
|
|
(let ((reference
|
|
|
|
|
(or local (select-reference item narinfos
|
|
|
|
|
servers))))
|
|
|
|
|
(if (every (compare item reference) narinfos servers)
|
|
|
|
|
(comparison-report item 'match
|
|
|
|
|
local narinfos)
|
|
|
|
|
(comparison-report item 'mismatch
|
|
|
|
|
local narinfos))))))
|
|
|
|
|
items
|
|
|
|
|
local))))
|
|
|
|
|
|
2019-12-07 09:10:39 -05:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Reporting.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (port-sha256* port size)
|
|
|
|
|
;; Like 'port-sha256', but limited to SIZE bytes.
|
|
|
|
|
(let-values (((out get) (open-sha256-port)))
|
|
|
|
|
(dump-port* port out size)
|
|
|
|
|
(close-port out)
|
|
|
|
|
(get)))
|
|
|
|
|
|
|
|
|
|
(define (archive-contents port)
|
|
|
|
|
"Return a list representing the files contained in the nar read from PORT."
|
|
|
|
|
(fold-archive (lambda (file type contents result)
|
|
|
|
|
(match type
|
|
|
|
|
((or 'regular 'executable)
|
|
|
|
|
(match contents
|
|
|
|
|
((port . size)
|
|
|
|
|
(cons `(,file ,type ,(port-sha256* port size))
|
|
|
|
|
result))))
|
|
|
|
|
('directory result)
|
|
|
|
|
('symlink
|
|
|
|
|
(cons `(,file ,type ,contents) result))))
|
|
|
|
|
'()
|
|
|
|
|
port
|
|
|
|
|
""))
|
|
|
|
|
|
|
|
|
|
(define (store-item-contents item)
|
|
|
|
|
"Return a list of files and contents for ITEM in the same format as
|
|
|
|
|
'archive-contents'."
|
|
|
|
|
(file-system-fold (const #t) ;enter?
|
|
|
|
|
(lambda (file stat result) ;leaf
|
|
|
|
|
(define short
|
|
|
|
|
(string-drop file (string-length item)))
|
|
|
|
|
|
|
|
|
|
(match (stat:type stat)
|
|
|
|
|
('regular
|
|
|
|
|
(let ((size (stat:size stat))
|
|
|
|
|
(type (if (zero? (logand (stat:mode stat)
|
|
|
|
|
#o100))
|
|
|
|
|
'regular
|
|
|
|
|
'executable)))
|
|
|
|
|
(cons `(,short ,type
|
|
|
|
|
,(call-with-input-file file
|
|
|
|
|
(cut port-sha256* <> size)))
|
|
|
|
|
result)))
|
|
|
|
|
('symlink
|
|
|
|
|
(cons `(,short symlink ,(readlink file))
|
|
|
|
|
result))))
|
|
|
|
|
(lambda (directory stat result) result) ;down
|
|
|
|
|
(lambda (directory stat result) result) ;up
|
|
|
|
|
(lambda (file stat result) result) ;skip
|
|
|
|
|
(lambda (file stat errno result) result) ;error
|
|
|
|
|
'()
|
|
|
|
|
item
|
|
|
|
|
lstat))
|
|
|
|
|
|
2019-12-07 11:37:08 -05:00
|
|
|
|
(define (call-with-nar narinfo proc)
|
|
|
|
|
"Call PROC with an input port from which it can read the nar pointed to by
|
|
|
|
|
NARINFO."
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(let*-values (((uri compression size)
|
|
|
|
|
(narinfo-best-uri narinfo))
|
|
|
|
|
((port response)
|
|
|
|
|
(http-fetch uri)))
|
|
|
|
|
(define reporter
|
|
|
|
|
(progress-reporter/file (narinfo-path narinfo) size
|
|
|
|
|
#:abbreviation (const (uri-host uri))))
|
|
|
|
|
|
|
|
|
|
(define result
|
|
|
|
|
(call-with-decompressed-port (string->symbol compression)
|
|
|
|
|
(progress-report-port reporter port)
|
2019-12-07 11:37:08 -05:00
|
|
|
|
proc))
|
2019-12-07 09:10:39 -05:00
|
|
|
|
|
|
|
|
|
(close-port port)
|
|
|
|
|
(erase-current-line (current-output-port))
|
|
|
|
|
result))
|
|
|
|
|
|
2019-12-07 11:37:08 -05:00
|
|
|
|
(define (narinfo-contents narinfo)
|
|
|
|
|
"Fetch the nar described by NARINFO and return a list representing the file
|
|
|
|
|
it contains."
|
|
|
|
|
(call-with-nar narinfo archive-contents))
|
|
|
|
|
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(define (differing-files comparison-report)
|
|
|
|
|
"Return a list of files that differ among the nars and possibly the local
|
|
|
|
|
store item specified in COMPARISON-REPORT."
|
|
|
|
|
(define contents
|
|
|
|
|
(map narinfo-contents
|
|
|
|
|
(comparison-report-narinfos comparison-report)))
|
|
|
|
|
|
|
|
|
|
(define local-contents
|
|
|
|
|
(and (comparison-report-local-sha256 comparison-report)
|
|
|
|
|
(store-item-contents (comparison-report-item comparison-report))))
|
|
|
|
|
|
|
|
|
|
(match (apply lset-difference equal?
|
|
|
|
|
(take (delete-duplicates
|
|
|
|
|
(if local-contents
|
|
|
|
|
(cons local-contents contents)
|
|
|
|
|
contents))
|
|
|
|
|
2))
|
|
|
|
|
(((files _ ...) ...)
|
|
|
|
|
files)))
|
|
|
|
|
|
|
|
|
|
(define (report-differing-files comparison-report)
|
|
|
|
|
"Report differences among the nars and possibly the local store item
|
|
|
|
|
specified in COMPARISON-REPORT."
|
|
|
|
|
(match (differing-files comparison-report)
|
|
|
|
|
(()
|
|
|
|
|
#t)
|
|
|
|
|
((files ...)
|
|
|
|
|
(format #t (N_ " differing file:~%"
|
|
|
|
|
" differing files:~%"
|
|
|
|
|
(length files)))
|
|
|
|
|
(format #t "~{ ~a~%~}" files))))
|
|
|
|
|
|
2019-12-07 11:37:08 -05:00
|
|
|
|
(define (call-with-mismatches comparison-report proc)
|
|
|
|
|
"Call PROC with two directories containing the mismatching store items."
|
|
|
|
|
(define local-hash
|
|
|
|
|
(comparison-report-local-sha256 comparison-report))
|
|
|
|
|
|
|
|
|
|
(define narinfos
|
|
|
|
|
(comparison-report-narinfos comparison-report))
|
|
|
|
|
|
|
|
|
|
(call-with-temporary-directory
|
|
|
|
|
(lambda (directory1)
|
|
|
|
|
(call-with-temporary-directory
|
|
|
|
|
(lambda (directory2)
|
|
|
|
|
(define narinfo1
|
|
|
|
|
(if local-hash
|
|
|
|
|
(find (lambda (narinfo)
|
2019-12-14 08:59:32 -05:00
|
|
|
|
(not (bytevector=? (narinfo-hash->sha256
|
|
|
|
|
(narinfo-hash narinfo))
|
|
|
|
|
local-hash)))
|
2019-12-07 11:37:08 -05:00
|
|
|
|
narinfos)
|
|
|
|
|
(first (comparison-report-narinfos comparison-report))))
|
|
|
|
|
|
|
|
|
|
(define narinfo2
|
|
|
|
|
(and (not local-hash)
|
|
|
|
|
(find (lambda (narinfo)
|
|
|
|
|
(not (eq? narinfo narinfo1)))
|
|
|
|
|
narinfos)))
|
|
|
|
|
|
|
|
|
|
(rmdir directory1)
|
|
|
|
|
(call-with-nar narinfo1 (cut restore-file <> directory1))
|
|
|
|
|
(when narinfo2
|
|
|
|
|
(rmdir directory2)
|
|
|
|
|
(call-with-nar narinfo2 (cut restore-file <> directory2)))
|
|
|
|
|
(proc directory1
|
|
|
|
|
(if local-hash
|
|
|
|
|
(comparison-report-item comparison-report)
|
|
|
|
|
directory2)))))))
|
|
|
|
|
|
|
|
|
|
(define %diffoscope-command
|
|
|
|
|
;; Default external diff command. Pass "--exclude-directory-metadata" so
|
|
|
|
|
;; that the mtime/ctime differences are ignored.
|
|
|
|
|
'("diffoscope" "--exclude-directory-metadata=yes"))
|
|
|
|
|
|
|
|
|
|
(define* (report-differing-files/external comparison-report
|
|
|
|
|
#:optional
|
|
|
|
|
(command %diffoscope-command))
|
|
|
|
|
"Run COMMAND to show the file-level differences for the mismatches in
|
|
|
|
|
COMPARISON-REPORT."
|
|
|
|
|
(call-with-mismatches comparison-report
|
|
|
|
|
(lambda (directory1 directory2)
|
|
|
|
|
(apply system*
|
|
|
|
|
(append command
|
|
|
|
|
(list directory1 directory2))))))
|
|
|
|
|
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(define* (summarize-report comparison-report
|
2017-01-13 18:03:32 -05:00
|
|
|
|
#:key
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(report-differences (const #f))
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(hash->string bytevector->nix-base32-string)
|
|
|
|
|
verbose?)
|
2019-12-07 09:10:39 -05:00
|
|
|
|
"Write to the current error port a summary of COMPARISON-REPORT, a
|
|
|
|
|
<comparison-report> object. When VERBOSE?, display matches in addition to
|
|
|
|
|
mismatches and inconclusive reports. Upon mismatch, call REPORT-DIFFERENCES
|
|
|
|
|
with COMPARISON-REPORT."
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(define (report-hashes item local narinfos)
|
|
|
|
|
(if local
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(report (G_ " local hash: ~a~%") (hash->string local))
|
|
|
|
|
(report (G_ " no local build for '~a'~%") item))
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(for-each (lambda (narinfo)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(report (G_ " ~50a: ~a~%")
|
2019-12-04 17:07:03 -05:00
|
|
|
|
(uri->string (narinfo-best-uri narinfo))
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(hash->string
|
|
|
|
|
(narinfo-hash->sha256 (narinfo-hash narinfo)))))
|
|
|
|
|
narinfos))
|
|
|
|
|
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(match comparison-report
|
|
|
|
|
(($ <comparison-report> item 'mismatch local (narinfos ...))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(report (G_ "~a contents differ:~%") item)
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(report-hashes item local narinfos)
|
|
|
|
|
(report-differences comparison-report))
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(($ <comparison-report> item 'inconclusive #f narinfos)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(warning (G_ "could not challenge '~a': no local build~%") item))
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(($ <comparison-report> item 'inconclusive locals ())
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(warning (G_ "could not challenge '~a': no substitutes~%") item))
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(($ <comparison-report> item 'match local (narinfos ...))
|
|
|
|
|
(when verbose?
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(report (G_ "~a contents match:~%") item)
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(report-hashes item local narinfos)))))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
2017-10-26 00:00:17 -04:00
|
|
|
|
(define (summarize-report-list reports)
|
|
|
|
|
"Display the overall summary of REPORTS."
|
|
|
|
|
(let ((total (length reports))
|
|
|
|
|
(inconclusive (count comparison-report-inconclusive? reports))
|
|
|
|
|
(matches (count comparison-report-match? reports))
|
|
|
|
|
(discrepancies (count comparison-report-mismatch? reports)))
|
|
|
|
|
(report (G_ "~h store items were analyzed:~%") total)
|
|
|
|
|
(report (G_ " - ~h (~,1f%) were identical~%")
|
|
|
|
|
matches (* 100. (/ matches total)))
|
|
|
|
|
(report (G_ " - ~h (~,1f%) differed~%")
|
|
|
|
|
discrepancies (* 100. (/ discrepancies total)))
|
|
|
|
|
(report (G_ " - ~h (~,1f%) were inconclusive~%")
|
|
|
|
|
inconclusive (* 100. (/ inconclusive total)))))
|
|
|
|
|
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Command-line options.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (show-help)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "Usage: guix challenge [PACKAGE...]
|
2015-10-19 18:55:09 -04:00
|
|
|
|
Challenge the substitutes for PACKAGE... provided by one or more servers.\n"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-10-19 18:55:09 -04:00
|
|
|
|
--substitute-urls=URLS
|
|
|
|
|
compare build results with those at URLS"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2017-01-13 18:03:32 -05:00
|
|
|
|
-v, --verbose show details about successful comparisons"))
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(display (G_ "
|
|
|
|
|
--diff=MODE show differences according to MODE"))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
(newline)
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-10-19 18:55:09 -04:00
|
|
|
|
-h, --help display this help and exit"))
|
ui: Rename '_' to 'G_'.
This avoids collisions with '_' when the latter is used as a 'match'
pattern for instance. See
<https://lists.gnu.org/archive/html/guix-devel/2017-04/msg00464.html>.
* guix/ui.scm: Rename '_' to 'G_'.
* po/guix/Makevars (XGETTEXT_OPTIONS): Adjust accordingly.
* build-aux/compile-all.scm (warnings): Remove 'format'.
* gnu/packages.scm,
gnu/services.scm,
gnu/services/shepherd.scm,
gnu/system.scm,
gnu/system/shadow.scm,
guix/gnupg.scm,
guix/http-client.scm,
guix/import/cpan.scm,
guix/import/elpa.scm,
guix/import/pypi.scm,
guix/nar.scm,
guix/scripts.scm,
guix/scripts/archive.scm,
guix/scripts/authenticate.scm,
guix/scripts/build.scm,
guix/scripts/challenge.scm,
guix/scripts/container.scm,
guix/scripts/container/exec.scm,
guix/scripts/copy.scm,
guix/scripts/download.scm,
guix/scripts/edit.scm,
guix/scripts/environment.scm,
guix/scripts/gc.scm,
guix/scripts/graph.scm,
guix/scripts/hash.scm,
guix/scripts/import.scm,
guix/scripts/import/cpan.scm,
guix/scripts/import/cran.scm,
guix/scripts/import/crate.scm,
guix/scripts/import/elpa.scm,
guix/scripts/import/gem.scm,
guix/scripts/import/gnu.scm,
guix/scripts/import/hackage.scm,
guix/scripts/import/nix.scm,
guix/scripts/import/pypi.scm,
guix/scripts/import/stackage.scm,
guix/scripts/lint.scm,
guix/scripts/offload.scm,
guix/scripts/pack.scm,
guix/scripts/package.scm,
guix/scripts/perform-download.scm,
guix/scripts/publish.scm,
guix/scripts/pull.scm,
guix/scripts/refresh.scm,
guix/scripts/size.scm,
guix/scripts/substitute.scm,
guix/scripts/system.scm,
guix/ssh.scm,
guix/upstream.scm: Use 'G_' instead of '_'. Most of this change was
obtained by running: "sed -i -e's/(_ "/(G_ "/g' `find -name \*.scm`".
2017-05-03 09:57:02 -04:00
|
|
|
|
(display (G_ "
|
2015-10-19 18:55:09 -04:00
|
|
|
|
-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")))
|
|
|
|
|
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(option '("diff") #t #f
|
|
|
|
|
(lambda (opt name arg result . rest)
|
|
|
|
|
(define mode
|
|
|
|
|
(match arg
|
|
|
|
|
("none" (const #t))
|
|
|
|
|
("simple" report-differing-files)
|
2019-12-07 11:37:08 -05:00
|
|
|
|
("diffoscope" report-differing-files/external)
|
|
|
|
|
((and (? (cut string-prefix? "/" <>)) command)
|
|
|
|
|
(cute report-differing-files/external <>
|
|
|
|
|
(string-tokenize command)))
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(_ (leave (G_ "~a: unknown diff mode~%") arg))))
|
|
|
|
|
|
|
|
|
|
(apply values
|
|
|
|
|
(alist-cons 'difference-report mode result)
|
|
|
|
|
rest)))
|
|
|
|
|
|
2015-10-19 18:55:09 -04:00
|
|
|
|
(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))
|
2017-01-13 18:03:32 -05:00
|
|
|
|
rest)))
|
|
|
|
|
(option '("verbose" #\v) #f #f
|
|
|
|
|
(lambda (opt name arg result . rest)
|
|
|
|
|
(apply values
|
|
|
|
|
(alist-cons 'verbose? #t result)
|
2015-10-19 18:55:09 -04:00
|
|
|
|
rest)))))
|
|
|
|
|
|
|
|
|
|
(define %default-options
|
|
|
|
|
`((system . ,(%current-system))
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(substitute-urls . ,%default-substitute-urls)
|
|
|
|
|
(difference-report . ,report-differing-files)))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
;;;
|
|
|
|
|
;;; Entry point.
|
|
|
|
|
;;;
|
|
|
|
|
|
|
|
|
|
(define (guix-challenge . args)
|
|
|
|
|
(with-error-handling
|
2017-10-27 16:28:00 -04:00
|
|
|
|
(let* ((opts (parse-command-line args %options (list %default-options)
|
|
|
|
|
#:build-options? #f))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
(files (filter-map (match-lambda
|
|
|
|
|
(('argument . file) file)
|
|
|
|
|
(_ #f))
|
|
|
|
|
opts))
|
|
|
|
|
(system (assoc-ref opts 'system))
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(urls (assoc-ref opts 'substitute-urls))
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(diff (assoc-ref opts 'difference-report))
|
2017-01-13 18:03:32 -05:00
|
|
|
|
(verbose? (assoc-ref opts 'verbose?)))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
(leave-on-EPIPE
|
|
|
|
|
(with-store store
|
2016-07-14 09:25:00 -04:00
|
|
|
|
;; Disable grafts since substitute servers normally provide only
|
|
|
|
|
;; ungrafted stuff.
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(parameterize ((%graft? #f)
|
|
|
|
|
(current-terminal-columns (terminal-columns)))
|
2016-07-14 09:25:00 -04:00
|
|
|
|
(let ((files (match files
|
|
|
|
|
(()
|
|
|
|
|
(filter (cut locally-built? store <>)
|
|
|
|
|
(live-paths store)))
|
|
|
|
|
(x
|
|
|
|
|
files))))
|
|
|
|
|
(set-build-options store
|
|
|
|
|
#:use-substitutes? #f)
|
|
|
|
|
|
|
|
|
|
(run-with-store store
|
2017-01-13 17:30:43 -05:00
|
|
|
|
(mlet* %store-monad ((items (mapm %store-monad
|
|
|
|
|
ensure-store-item files))
|
|
|
|
|
(reports (compare-contents items urls)))
|
2019-12-07 09:10:39 -05:00
|
|
|
|
(for-each (cut summarize-report <> #:verbose? verbose?
|
|
|
|
|
#:report-differences diff)
|
2017-01-13 18:03:32 -05:00
|
|
|
|
reports)
|
2017-10-26 00:00:17 -04:00
|
|
|
|
(report "\n")
|
|
|
|
|
(summarize-report-list reports)
|
2017-01-13 17:30:43 -05:00
|
|
|
|
|
|
|
|
|
(exit (cond ((any comparison-report-mismatch? reports) 2)
|
|
|
|
|
((every comparison-report-match? reports) 0)
|
|
|
|
|
(else 1))))
|
2016-07-14 09:25:00 -04:00
|
|
|
|
#:system system))))))))
|
2015-10-19 18:55:09 -04:00
|
|
|
|
|
|
|
|
|
;;; challenge.scm ends here
|