89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
;; Run a shell command and return the output as a string
(define (shell cmd)
(let* ((output (cmd-run->list cmd))
(res (car output))
(status (cadr output)))
(if (equal? status 0)
(string-intersperse
res
"\n")
(begin
(with-output-to-port (current-error-port)
(print "ERROR: " cmd " returned bad exit code " status))
""))))
;; Lookup a value in runconfigs based on -reqtarg or -target
(define (runconfigs-get config var)
|
|
|
|
>
>
|
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
;; Run a shell command and return the output as a string
(define (shell cmd)
(let* ((output (cmd-run->list cmd))
(res (car output))
(status (cadr output)))
(if (equal? status 0)
(let ((outres (string-intersperse
res
"\n")))
(debug:print 4 "INFO: shell result:\n" outres)
outres)
(begin
(with-output-to-port (current-error-port)
(print "ERROR: " cmd " returned bad exit code " status))
""))))
;; Lookup a value in runconfigs based on -reqtarg or -target
(define (runconfigs-get config var)
|
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
(configf:section-rx ( x section-name ) (loop (configf:read-line inp res) section-name #f #f))
(configf:key-sys-pr ( x key cmd ) (if allow-system
(let ((alist (hash-table-ref/default res curr-section-name '()))
(val-proc (lambda ()
(let* ((cmdres (cmd-run->list cmd))
(status (cadr cmdres))
(res (car cmdres)))
(if (not (eq? status 0))
(begin
(debug:print 0 "ERROR: problem with " inl ", return code " status)
(exit 1)))
(if (null? res)
""
(string-intersperse res " "))))))
(hash-table-set! res curr-section-name
(config:assoc-safe-add alist
key
|
>
|
>
|
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
|
(configf:section-rx ( x section-name ) (loop (configf:read-line inp res) section-name #f #f))
(configf:key-sys-pr ( x key cmd ) (if allow-system
(let ((alist (hash-table-ref/default res curr-section-name '()))
(val-proc (lambda ()
(let* ((cmdres (cmd-run->list cmd))
(status (cadr cmdres))
(res (car cmdres)))
(debug:print 4 "INFO: " inl "\n => " (string-intersperse res "\n"))
(if (not (eq? status 0))
(begin
(debug:print 0 "ERROR: problem with " inl ", return code " status
" output: " cmdres)
(exit 1)))
(if (null? res)
""
(string-intersperse res " "))))))
(hash-table-set! res curr-section-name
(config:assoc-safe-add alist
key
|