swh.scm 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018, 2019, 2020 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2020 Jakub Kądziołka <kuba@kadziolka.net>
  4. ;;;
  5. ;;; This file is part of GNU Guix.
  6. ;;;
  7. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  8. ;;; under the terms of the GNU General Public License as published by
  9. ;;; the Free Software Foundation; either version 3 of the License, or (at
  10. ;;; your option) any later version.
  11. ;;;
  12. ;;; GNU Guix is distributed in the hope that it will be useful, but
  13. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  14. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. ;;; GNU General Public License for more details.
  16. ;;;
  17. ;;; You should have received a copy of the GNU General Public License
  18. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  19. (define-module (guix swh)
  20. #:use-module (guix base16)
  21. #:use-module (guix build utils)
  22. #:use-module ((guix build syscalls) #:select (mkdtemp!))
  23. #:use-module (web uri)
  24. #:use-module (web client)
  25. #:use-module (web response)
  26. #:use-module (json)
  27. #:use-module (srfi srfi-1)
  28. #:use-module (srfi srfi-9)
  29. #:use-module (srfi srfi-11)
  30. #:use-module (srfi srfi-19)
  31. #:use-module (ice-9 match)
  32. #:use-module (ice-9 regex)
  33. #:use-module (ice-9 popen)
  34. #:use-module ((ice-9 ftw) #:select (scandir))
  35. #:export (%swh-base-url
  36. %verify-swh-certificate?
  37. %allow-request?
  38. request-rate-limit-reached?
  39. origin?
  40. origin-type
  41. origin-url
  42. origin-visits
  43. lookup-origin
  44. visit?
  45. visit-date
  46. visit-origin
  47. visit-url
  48. visit-snapshot-url
  49. visit-status
  50. visit-number
  51. visit-snapshot
  52. branch?
  53. branch-name
  54. branch-target
  55. release?
  56. release-id
  57. release-name
  58. release-message
  59. release-target
  60. revision?
  61. revision-id
  62. revision-date
  63. revision-directory
  64. lookup-revision
  65. lookup-origin-revision
  66. content?
  67. content-checksums
  68. content-data-url
  69. content-length
  70. lookup-content
  71. directory-entry?
  72. directory-entry-name
  73. directory-entry-type
  74. directory-entry-checksums
  75. directory-entry-length
  76. directory-entry-permissions
  77. lookup-directory
  78. directory-entry-target
  79. save-reply?
  80. save-reply-origin-url
  81. save-reply-origin-type
  82. save-reply-request-date
  83. save-reply-request-status
  84. save-reply-task-status
  85. save-origin
  86. save-origin-status
  87. vault-reply?
  88. vault-reply-id
  89. vault-reply-fetch-url
  90. vault-reply-object-id
  91. vault-reply-object-type
  92. vault-reply-progress-message
  93. vault-reply-status
  94. query-vault
  95. request-cooking
  96. vault-fetch
  97. commit-id?
  98. swh-download))
  99. ;;; Commentary:
  100. ;;;
  101. ;;; This module provides bindings to the HTTP interface of Software Heritage.
  102. ;;; It allows you to browse the archive, look up revisions (such as SHA1
  103. ;;; commit IDs), "origins" (code hosting URLs), content (files), etc. See
  104. ;;; <https://archive.softwareheritage.org/api/> for more information.
  105. ;;;
  106. ;;; The high-level 'swh-download' procedure allows you to download a Git
  107. ;;; revision from Software Heritage, provided it is available.
  108. ;;;
  109. ;;; Code:
  110. (define %swh-base-url
  111. ;; Presumably we won't need to change it.
  112. (make-parameter "https://archive.softwareheritage.org"))
  113. (define %verify-swh-certificate?
  114. ;; Whether to verify the X.509 HTTPS certificate for %SWH-BASE-URL.
  115. (make-parameter #t))
  116. (define (swh-url path . rest)
  117. ;; URLs returned by the API may be relative or absolute. This has changed
  118. ;; without notice before. Handle both cases by detecting whether the path
  119. ;; starts with a domain.
  120. (define root
  121. (if (string-prefix? "/" path)
  122. (string-append (%swh-base-url) path)
  123. path))
  124. (define url
  125. (string-append root (string-join rest "/" 'prefix)))
  126. ;; Ensure there's a trailing slash or we get a redirect.
  127. (if (string-suffix? "/" url)
  128. url
  129. (string-append url "/")))
  130. ;; XXX: Work around a bug in Guile 3.0.2 where #:verify-certificate? would
  131. ;; be ignored (<https://bugs.gnu.org/40486>).
  132. (define* (http-get* uri #:rest rest)
  133. (apply http-request uri #:method 'GET rest))
  134. (define* (http-post* uri #:rest rest)
  135. (apply http-request uri #:method 'POST rest))
  136. (define %date-regexp
  137. ;; Match strings like "2014-11-17T22:09:38+01:00" or
  138. ;; "2018-09-30T23:20:07.815449+00:00"".
  139. (make-regexp "^([0-9]{4})-([0-9]{2})-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})((\\.[0-9]+)?)([+-][0-9]{2}):([0-9]{2})$"))
  140. (define (string->date* str)
  141. "Return a SRFI-19 date parsed from STR, a date string as returned by
  142. Software Heritage."
  143. ;; We can't use 'string->date' because of the timezone format: SWH returns
  144. ;; "+01:00" when the '~z' template expects "+0100". So we roll our own!
  145. (or (and=> (regexp-exec %date-regexp str)
  146. (lambda (match)
  147. (define (ref n)
  148. (string->number (match:substring match n)))
  149. (make-date (let ((ns (match:substring match 8)))
  150. (if ns
  151. (string->number (string-drop ns 1))
  152. 0))
  153. (ref 6) (ref 5) (ref 4)
  154. (ref 3) (ref 2) (ref 1)
  155. (+ (* 3600 (ref 9)) ;time zone
  156. (if (< (ref 9) 0)
  157. (- (ref 10))
  158. (ref 10))))))
  159. str)) ;oops!
  160. (define string*
  161. ;; Converts "string or #nil" coming from JSON to "string or #f".
  162. (match-lambda
  163. ((? string? str) str)
  164. ((? null?) #f) ;Guile-JSON 3.x
  165. ('null #f))) ;Guile-JSON 4.x
  166. (define %allow-request?
  167. ;; Takes a URL and method (e.g., the 'http-get' procedure) and returns true
  168. ;; to keep going. This can be used to disallow requests when
  169. ;; 'request-rate-limit-reached?' returns true, for instance.
  170. (make-parameter (const #t)))
  171. ;; The time when the rate limit for "/origin/save" POST requests and that of
  172. ;; other requests will be reset.
  173. ;; See <https://archive.softwareheritage.org/api/#rate-limiting>.
  174. (define %save-rate-limit-reset-time 0)
  175. (define %general-rate-limit-reset-time 0)
  176. (define (request-rate-limit-reached? url method)
  177. "Return true if the rate limit has been reached for URI."
  178. (define uri
  179. (string->uri url))
  180. (define reset-time
  181. (if (and (eq? method http-post*)
  182. (string-prefix? "/api/1/origin/save/" (uri-path uri)))
  183. %save-rate-limit-reset-time
  184. %general-rate-limit-reset-time))
  185. (< (car (gettimeofday)) reset-time))
  186. (define (update-rate-limit-reset-time! url method response)
  187. "Update the rate limit reset time for URL and METHOD based on the headers in
  188. RESPONSE."
  189. (let ((uri (string->uri url)))
  190. (match (assq-ref (response-headers response) 'x-ratelimit-reset)
  191. ((= string->number (? number? reset))
  192. (if (and (eq? method http-post*)
  193. (string-prefix? "/api/1/origin/save/" (uri-path uri)))
  194. (set! %save-rate-limit-reset-time reset)
  195. (set! %general-rate-limit-reset-time reset)))
  196. (_
  197. #f))))
  198. (define* (call url decode #:optional (method http-get*)
  199. #:key (false-if-404? #t))
  200. "Invoke the endpoint at URL using METHOD. Decode the resulting JSON body
  201. using DECODE, a one-argument procedure that takes an input port. When
  202. FALSE-IF-404? is true, return #f upon 404 responses."
  203. (and ((%allow-request?) url method)
  204. (let*-values (((response port)
  205. (method url #:streaming? #t
  206. #:verify-certificate?
  207. (%verify-swh-certificate?))))
  208. ;; See <https://archive.softwareheritage.org/api/#rate-limiting>.
  209. (match (assq-ref (response-headers response) 'x-ratelimit-remaining)
  210. (#f #t)
  211. ((? (compose zero? string->number))
  212. (update-rate-limit-reset-time! url method response)
  213. (throw 'swh-error url method response))
  214. (_ #t))
  215. (cond ((= 200 (response-code response))
  216. (let ((result (decode port)))
  217. (close-port port)
  218. result))
  219. ((and false-if-404?
  220. (= 404 (response-code response)))
  221. (close-port port)
  222. #f)
  223. (else
  224. (close-port port)
  225. (throw 'swh-error url method response))))))
  226. (define-syntax define-query
  227. (syntax-rules (path)
  228. "Define a procedure that performs a Software Heritage query."
  229. ((_ (name args ...) docstring (path components ...)
  230. json->value)
  231. (define (name args ...)
  232. docstring
  233. (call (swh-url components ...) json->value)))))
  234. ;; <https://archive.softwareheritage.org/api/1/origin/https://github.com/guix-mirror/guix/get>
  235. (define-json-mapping <origin> make-origin origin?
  236. json->origin
  237. (visits-url origin-visits-url "origin_visits_url")
  238. (type origin-type)
  239. (url origin-url))
  240. ;; <https://archive.softwareheritage.org/api/1/origin/52181937/visits/>
  241. (define-json-mapping <visit> make-visit visit?
  242. json->visit
  243. (date visit-date "date" string->date*)
  244. (origin visit-origin)
  245. (url visit-url "origin_visit_url")
  246. (snapshot-url visit-snapshot-url "snapshot_url" string*) ;string | #f
  247. (status visit-status "status" string->symbol) ;'full | 'partial | 'ongoing
  248. (number visit-number "visit"))
  249. ;; <https://archive.softwareheritage.org/api/1/snapshot/4334c3ed4bb208604ed780d8687fe523837f1bd1/>
  250. (define-json-mapping <snapshot> make-snapshot snapshot?
  251. json->snapshot
  252. (branches snapshot-branches "branches" json->branches))
  253. ;; This is used for the "branches" field of snapshots.
  254. (define-record-type <branch>
  255. (make-branch name target-type target-url)
  256. branch?
  257. (name branch-name)
  258. (target-type branch-target-type) ;release | revision
  259. (target-url branch-target-url))
  260. (define (json->branches branches)
  261. (map (match-lambda
  262. ((key . value)
  263. (make-branch key
  264. (string->symbol
  265. (assoc-ref value "target_type"))
  266. (assoc-ref value "target_url"))))
  267. branches))
  268. ;; <https://archive.softwareheritage.org/api/1/release/1f44934fb6e2cefccbecd4fa347025349fa9ff76/>
  269. (define-json-mapping <release> make-release release?
  270. json->release
  271. (id release-id)
  272. (name release-name)
  273. (message release-message)
  274. (target-type release-target-type "target_type" string->symbol)
  275. (target-url release-target-url "target_url"))
  276. ;; <https://archive.softwareheritage.org/api/1/revision/359fdda40f754bbf1b5dc261e7427b75463b59be/>
  277. (define-json-mapping <revision> make-revision revision?
  278. json->revision
  279. (id revision-id)
  280. (date revision-date "date" string->date*)
  281. (directory revision-directory)
  282. (directory-url revision-directory-url "directory_url"))
  283. ;; <https://archive.softwareheritage.org/api/1/content/>
  284. (define-json-mapping <content> make-content content?
  285. json->content
  286. (checksums content-checksums "checksums" json->checksums)
  287. (data-url content-data-url "data_url")
  288. (file-type-url content-file-type-url "filetype_url")
  289. (language-url content-language-url "language_url")
  290. (length content-length)
  291. (license-url content-license-url "license_url"))
  292. (define (json->checksums checksums)
  293. (map (match-lambda
  294. ((key . value)
  295. (cons key (base16-string->bytevector value))))
  296. checksums))
  297. ;; <https://archive.softwareheritage.org/api/1/directory/27c69c5d298a43096a53affbf881e7b13f17bdcd/>
  298. (define-json-mapping <directory-entry> make-directory-entry directory-entry?
  299. json->directory-entry
  300. (name directory-entry-name)
  301. (type directory-entry-type "type"
  302. (match-lambda
  303. ("dir" 'directory)
  304. (str (string->symbol str))))
  305. (checksums directory-entry-checksums "checksums"
  306. (match-lambda
  307. (#f #f)
  308. (lst (json->checksums lst))))
  309. (id directory-entry-id "dir_id")
  310. (length directory-entry-length)
  311. (permissions directory-entry-permissions "perms")
  312. (target-url directory-entry-target-url "target_url"))
  313. ;; <https://archive.softwareheritage.org/api/1/origin/save/>
  314. (define-json-mapping <save-reply> make-save-reply save-reply?
  315. json->save-reply
  316. (origin-url save-reply-origin-url "origin_url")
  317. (origin-type save-reply-origin-type "origin_type")
  318. (request-date save-reply-request-date "save_request_date"
  319. string->date*)
  320. (request-status save-reply-request-status "save_request_status"
  321. string->symbol)
  322. (task-status save-reply-task-status "save_task_status"
  323. (match-lambda
  324. ("not created" 'not-created)
  325. ((? string? str) (string->symbol str)))))
  326. ;; <https://docs.softwareheritage.org/devel/swh-vault/api.html#vault-api-ref>
  327. (define-json-mapping <vault-reply> make-vault-reply vault-reply?
  328. json->vault-reply
  329. (id vault-reply-id)
  330. (fetch-url vault-reply-fetch-url "fetch_url")
  331. (object-id vault-reply-object-id "obj_id")
  332. (object-type vault-reply-object-type "obj_type" string->symbol)
  333. (progress-message vault-reply-progress-message "progress_message")
  334. (status vault-reply-status "status" string->symbol))
  335. ;;;
  336. ;;; RPCs.
  337. ;;;
  338. (define-query (lookup-origin url)
  339. "Return an origin for URL."
  340. (path "/api/1/origin" url "get")
  341. json->origin)
  342. (define-query (lookup-content hash type)
  343. "Return a content for HASH, of the given TYPE--e.g., \"sha256\"."
  344. (path "/api/1/content"
  345. (string-append type ":"
  346. (bytevector->base16-string hash)))
  347. json->content)
  348. (define-query (lookup-revision id)
  349. "Return the revision with the given ID, typically a Git commit SHA1."
  350. (path "/api/1/revision" id)
  351. json->revision)
  352. (define-query (lookup-directory id)
  353. "Return the directory with the given ID."
  354. (path "/api/1/directory" id)
  355. json->directory-entries)
  356. (define (json->directory-entries port)
  357. (map json->directory-entry
  358. (vector->list (json->scm port))))
  359. (define (origin-visits origin)
  360. "Return the list of visits of ORIGIN, a record as returned by
  361. 'lookup-origin'."
  362. (call (swh-url (origin-visits-url origin))
  363. (lambda (port)
  364. (map json->visit (vector->list (json->scm port))))))
  365. (define (visit-snapshot visit)
  366. "Return the snapshot corresponding to VISIT or #f if no snapshot is
  367. available."
  368. (and (visit-snapshot-url visit)
  369. (call (swh-url (visit-snapshot-url visit))
  370. json->snapshot)))
  371. (define (branch-target branch)
  372. "Return the target of BRANCH, either a <revision> or a <release>."
  373. (match (branch-target-type branch)
  374. ('release
  375. (call (swh-url (branch-target-url branch))
  376. json->release))
  377. ('revision
  378. (call (swh-url (branch-target-url branch))
  379. json->revision))))
  380. (define (lookup-origin-revision url tag)
  381. "Return a <revision> corresponding to the given TAG for the repository
  382. coming from URL. Example:
  383. (lookup-origin-revision \"https://github.com/guix-mirror/guix/\" \"v0.8\")
  384. => #<<revision> id: \"44941…\" …>
  385. The information is based on the latest visit of URL available. Return #f if
  386. URL could not be found."
  387. (match (lookup-origin url)
  388. (#f #f)
  389. (origin
  390. (match (filter visit-snapshot-url (origin-visits origin))
  391. ((visit . _)
  392. (let ((snapshot (visit-snapshot visit)))
  393. (match (and=> (find (lambda (branch)
  394. (string=? (string-append "refs/tags/" tag)
  395. (branch-name branch)))
  396. (snapshot-branches snapshot))
  397. branch-target)
  398. ((? release? release)
  399. (release-target release))
  400. ((? revision? revision)
  401. revision)
  402. (#f ;tag not found
  403. #f))))
  404. (()
  405. #f)))))
  406. (define (release-target release)
  407. "Return the revision that is the target of RELEASE."
  408. (match (release-target-type release)
  409. ('revision
  410. (call (swh-url (release-target-url release))
  411. json->revision))))
  412. (define (directory-entry-target entry)
  413. "If ENTRY, a directory entry, has type 'directory, return its list of
  414. directory entries; if it has type 'file, return its <content> object."
  415. (call (swh-url (directory-entry-target-url entry))
  416. (match (directory-entry-type entry)
  417. ('file json->content)
  418. ('directory json->directory-entries))))
  419. (define* (save-origin url #:optional (type "git"))
  420. "Request URL to be saved."
  421. (call (swh-url "/api/1/origin/save" type "url" url) json->save-reply
  422. http-post*))
  423. (define-query (save-origin-status url type)
  424. "Return the status of a /save request for URL and TYPE (e.g., \"git\")."
  425. (path "/api/1/origin/save" type "url" url)
  426. json->save-reply)
  427. (define-query (query-vault id kind)
  428. "Ask the availability of object ID and KIND to the vault, where KIND is
  429. 'directory or 'revision. Return #f if it could not be found, or a
  430. <vault-reply> on success."
  431. ;; <https://docs.softwareheritage.org/devel/swh-vault/api.html#vault-api-ref>
  432. ;; There's a single format supported for directories and revisions and for
  433. ;; now, the "/format" bit of the URL *must* be omitted.
  434. (path "/api/1/vault" (symbol->string kind) id)
  435. json->vault-reply)
  436. (define (request-cooking id kind)
  437. "Request the cooking of object ID and KIND (one of 'directory or 'revision)
  438. to the vault. Return a <vault-reply>."
  439. (call (swh-url "/api/1/vault" (symbol->string kind) id)
  440. json->vault-reply
  441. http-post*))
  442. (define* (vault-fetch id kind
  443. #:key (log-port (current-error-port)))
  444. "Return an input port from which a bundle of the object with the given ID
  445. and KIND (one of 'directory or 'revision) can be retrieved, or #f if the
  446. object could not be found.
  447. For a directory, the returned stream is a gzip-compressed tarball. For a
  448. revision, it is a gzip-compressed stream for 'git fast-import'."
  449. (let loop ((reply (query-vault id kind)))
  450. (match reply
  451. (#f
  452. (and=> (request-cooking id kind) loop))
  453. (_
  454. (match (vault-reply-status reply)
  455. ('done
  456. ;; Fetch the bundle.
  457. (let-values (((response port)
  458. (http-get* (swh-url (vault-reply-fetch-url reply))
  459. #:streaming? #t
  460. #:verify-certificate?
  461. (%verify-swh-certificate?))))
  462. (if (= (response-code response) 200)
  463. port
  464. (begin ;shouldn't happen
  465. (close-port port)
  466. #f))))
  467. ('failed
  468. ;; Upon failure, we're supposed to try again.
  469. (format log-port "SWH vault: failure: ~a~%"
  470. (vault-reply-progress-message reply))
  471. (format log-port "SWH vault: retrying...~%")
  472. (loop (request-cooking id kind)))
  473. ((and (or 'new 'pending) status)
  474. ;; Wait until the bundle shows up.
  475. (let ((message (vault-reply-progress-message reply)))
  476. (when (eq? 'new status)
  477. (format log-port "SWH vault: \
  478. requested bundle cooking, waiting for completion...~%"))
  479. (when (string? message)
  480. (format log-port "SWH vault: ~a~%" message))
  481. ;; Wait long enough so we don't exhaust our maximum number of
  482. ;; requests per hour too fast (as of this writing, the limit is 60
  483. ;; requests per hour per IP address.)
  484. (sleep (if (eq? status 'new) 60 30))
  485. (loop (query-vault id kind)))))))))
  486. ;;;
  487. ;;; High-level interface.
  488. ;;;
  489. (define (commit-id? reference)
  490. "Return true if REFERENCE is likely a commit ID, false otherwise---e.g., if
  491. it is a tag name. This is based on a simple heuristic so use with care!"
  492. (and (= (string-length reference) 40)
  493. (string-every char-set:hex-digit reference)))
  494. (define (call-with-temporary-directory proc) ;FIXME: factorize
  495. "Call PROC with a name of a temporary directory; close the directory and
  496. delete it when leaving the dynamic extent of this call."
  497. (let* ((directory (or (getenv "TMPDIR") "/tmp"))
  498. (template (string-append directory "/guix-directory.XXXXXX"))
  499. (tmp-dir (mkdtemp! template)))
  500. (dynamic-wind
  501. (const #t)
  502. (lambda ()
  503. (proc tmp-dir))
  504. (lambda ()
  505. (false-if-exception (delete-file-recursively tmp-dir))))))
  506. (define* (swh-download url reference output
  507. #:key (log-port (current-error-port)))
  508. "Download from Software Heritage a checkout of the Git tag or commit
  509. REFERENCE originating from URL, and unpack it in OUTPUT. Return #t on success
  510. and #f on failure.
  511. This procedure uses the \"vault\", which contains \"cooked\" directories in
  512. the form of tarballs. If the requested directory is not cooked yet, it will
  513. wait until it becomes available, which could take several minutes."
  514. (match (if (commit-id? reference)
  515. (lookup-revision reference)
  516. (lookup-origin-revision url reference))
  517. ((? revision? revision)
  518. (format log-port "SWH: found revision ~a with directory at '~a'~%"
  519. (revision-id revision)
  520. (swh-url (revision-directory-url revision)))
  521. (call-with-temporary-directory
  522. (lambda (directory)
  523. (match (vault-fetch (revision-directory revision) 'directory
  524. #:log-port log-port)
  525. (#f
  526. (format log-port
  527. "SWH: directory ~a could not be fetched from the vault~%"
  528. (revision-directory revision))
  529. #f)
  530. ((? port? input)
  531. (let ((tar (open-pipe* OPEN_WRITE "tar" "-C" directory "-xzvf" "-")))
  532. (dump-port input tar)
  533. (close-port input)
  534. (let ((status (close-pipe tar)))
  535. (unless (zero? status)
  536. (error "tar extraction failure" status)))
  537. (match (scandir directory)
  538. (("." ".." sub-directory)
  539. (copy-recursively (string-append directory "/" sub-directory)
  540. output
  541. #:log (%make-void-port "w"))
  542. #t))))))))
  543. (#f
  544. #f)))