swh.scm 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018, 2019, 2020, 2021 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. ((? unspecified?) #f)
  309. (lst (json->checksums lst))))
  310. (id directory-entry-id "dir_id")
  311. (length directory-entry-length)
  312. (permissions directory-entry-permissions "perms")
  313. (target-url directory-entry-target-url "target_url"))
  314. ;; <https://archive.softwareheritage.org/api/1/origin/save/>
  315. (define-json-mapping <save-reply> make-save-reply save-reply?
  316. json->save-reply
  317. (origin-url save-reply-origin-url "origin_url")
  318. (origin-type save-reply-origin-type "origin_type")
  319. (request-date save-reply-request-date "save_request_date"
  320. string->date*)
  321. (request-status save-reply-request-status "save_request_status"
  322. string->symbol)
  323. (task-status save-reply-task-status "save_task_status"
  324. (match-lambda
  325. ("not created" 'not-created)
  326. ((? string? str) (string->symbol str)))))
  327. ;; <https://docs.softwareheritage.org/devel/swh-vault/api.html#vault-api-ref>
  328. (define-json-mapping <vault-reply> make-vault-reply vault-reply?
  329. json->vault-reply
  330. (id vault-reply-id)
  331. (fetch-url vault-reply-fetch-url "fetch_url")
  332. (object-id vault-reply-object-id "obj_id")
  333. (object-type vault-reply-object-type "obj_type" string->symbol)
  334. (progress-message vault-reply-progress-message "progress_message")
  335. (status vault-reply-status "status" string->symbol))
  336. ;;;
  337. ;;; RPCs.
  338. ;;;
  339. (define-query (lookup-origin url)
  340. "Return an origin for URL."
  341. (path "/api/1/origin" url "get")
  342. json->origin)
  343. (define-query (lookup-content hash type)
  344. "Return a content for HASH, of the given TYPE--e.g., \"sha256\"."
  345. (path "/api/1/content"
  346. (string-append type ":"
  347. (bytevector->base16-string hash)))
  348. json->content)
  349. (define-query (lookup-revision id)
  350. "Return the revision with the given ID, typically a Git commit SHA1."
  351. (path "/api/1/revision" id)
  352. json->revision)
  353. (define-query (lookup-directory id)
  354. "Return the directory with the given ID."
  355. (path "/api/1/directory" id)
  356. json->directory-entries)
  357. (define (json->directory-entries port)
  358. (map json->directory-entry
  359. (vector->list (json->scm port))))
  360. (define (origin-visits origin)
  361. "Return the list of visits of ORIGIN, a record as returned by
  362. 'lookup-origin'."
  363. (call (swh-url (origin-visits-url origin))
  364. (lambda (port)
  365. (map json->visit (vector->list (json->scm port))))))
  366. (define (visit-snapshot visit)
  367. "Return the snapshot corresponding to VISIT or #f if no snapshot is
  368. available."
  369. (and (visit-snapshot-url visit)
  370. (call (swh-url (visit-snapshot-url visit))
  371. json->snapshot)))
  372. (define (branch-target branch)
  373. "Return the target of BRANCH, either a <revision> or a <release>."
  374. (match (branch-target-type branch)
  375. ('release
  376. (call (swh-url (branch-target-url branch))
  377. json->release))
  378. ('revision
  379. (call (swh-url (branch-target-url branch))
  380. json->revision))))
  381. (define (lookup-origin-revision url tag)
  382. "Return a <revision> corresponding to the given TAG for the repository
  383. coming from URL. Example:
  384. (lookup-origin-revision \"https://github.com/guix-mirror/guix/\" \"v0.8\")
  385. => #<<revision> id: \"44941…\" …>
  386. The information is based on the latest visit of URL available. Return #f if
  387. URL could not be found."
  388. (match (lookup-origin url)
  389. (#f #f)
  390. (origin
  391. (match (filter visit-snapshot-url (origin-visits origin))
  392. ((visit . _)
  393. (let ((snapshot (visit-snapshot visit)))
  394. (match (and=> (find (lambda (branch)
  395. (string=? (string-append "refs/tags/" tag)
  396. (branch-name branch)))
  397. (snapshot-branches snapshot))
  398. branch-target)
  399. ((? release? release)
  400. (release-target release))
  401. ((? revision? revision)
  402. revision)
  403. (#f ;tag not found
  404. #f))))
  405. (()
  406. #f)))))
  407. (define (release-target release)
  408. "Return the revision that is the target of RELEASE."
  409. (match (release-target-type release)
  410. ('revision
  411. (call (swh-url (release-target-url release))
  412. json->revision))))
  413. (define (directory-entry-target entry)
  414. "If ENTRY, a directory entry, has type 'directory, return its list of
  415. directory entries; if it has type 'file, return its <content> object."
  416. (call (swh-url (directory-entry-target-url entry))
  417. (match (directory-entry-type entry)
  418. ('file json->content)
  419. ('directory json->directory-entries))))
  420. (define* (save-origin url #:optional (type "git"))
  421. "Request URL to be saved."
  422. (call (swh-url "/api/1/origin/save" type "url" url) json->save-reply
  423. http-post*))
  424. (define-query (save-origin-status url type)
  425. "Return the status of a /save request for URL and TYPE (e.g., \"git\")."
  426. (path "/api/1/origin/save" type "url" url)
  427. json->save-reply)
  428. (define-query (query-vault id kind)
  429. "Ask the availability of object ID and KIND to the vault, where KIND is
  430. 'directory or 'revision. Return #f if it could not be found, or a
  431. <vault-reply> on success."
  432. ;; <https://docs.softwareheritage.org/devel/swh-vault/api.html#vault-api-ref>
  433. ;; There's a single format supported for directories and revisions and for
  434. ;; now, the "/format" bit of the URL *must* be omitted.
  435. (path "/api/1/vault" (symbol->string kind) id)
  436. json->vault-reply)
  437. (define (request-cooking id kind)
  438. "Request the cooking of object ID and KIND (one of 'directory or 'revision)
  439. to the vault. Return a <vault-reply>."
  440. (call (swh-url "/api/1/vault" (symbol->string kind) id)
  441. json->vault-reply
  442. http-post*))
  443. (define* (vault-fetch id kind
  444. #:key (log-port (current-error-port)))
  445. "Return an input port from which a bundle of the object with the given ID
  446. and KIND (one of 'directory or 'revision) can be retrieved, or #f if the
  447. object could not be found.
  448. For a directory, the returned stream is a gzip-compressed tarball. For a
  449. revision, it is a gzip-compressed stream for 'git fast-import'."
  450. (let loop ((reply (query-vault id kind)))
  451. (match reply
  452. (#f
  453. (and=> (request-cooking id kind) loop))
  454. (_
  455. (match (vault-reply-status reply)
  456. ('done
  457. ;; Fetch the bundle.
  458. (let-values (((response port)
  459. (http-get* (swh-url (vault-reply-fetch-url reply))
  460. #:streaming? #t
  461. #:verify-certificate?
  462. (%verify-swh-certificate?))))
  463. (if (= (response-code response) 200)
  464. port
  465. (begin ;shouldn't happen
  466. (close-port port)
  467. #f))))
  468. ('failed
  469. ;; Upon failure, we're supposed to try again.
  470. (format log-port "SWH vault: failure: ~a~%"
  471. (vault-reply-progress-message reply))
  472. (format log-port "SWH vault: retrying...~%")
  473. (loop (request-cooking id kind)))
  474. ((and (or 'new 'pending) status)
  475. ;; Wait until the bundle shows up.
  476. (let ((message (vault-reply-progress-message reply)))
  477. (when (eq? 'new status)
  478. (format log-port "SWH vault: \
  479. requested bundle cooking, waiting for completion...~%"))
  480. (when (string? message)
  481. (format log-port "SWH vault: ~a~%" message))
  482. ;; Wait long enough so we don't exhaust our maximum number of
  483. ;; requests per hour too fast (as of this writing, the limit is 60
  484. ;; requests per hour per IP address.)
  485. (sleep (if (eq? status 'new) 60 30))
  486. (loop (query-vault id kind)))))))))
  487. ;;;
  488. ;;; High-level interface.
  489. ;;;
  490. (define (commit-id? reference)
  491. "Return true if REFERENCE is likely a commit ID, false otherwise---e.g., if
  492. it is a tag name. This is based on a simple heuristic so use with care!"
  493. (and (= (string-length reference) 40)
  494. (string-every char-set:hex-digit reference)))
  495. (define (call-with-temporary-directory proc) ;FIXME: factorize
  496. "Call PROC with a name of a temporary directory; close the directory and
  497. delete it when leaving the dynamic extent of this call."
  498. (let* ((directory (or (getenv "TMPDIR") "/tmp"))
  499. (template (string-append directory "/guix-directory.XXXXXX"))
  500. (tmp-dir (mkdtemp! template)))
  501. (dynamic-wind
  502. (const #t)
  503. (lambda ()
  504. (proc tmp-dir))
  505. (lambda ()
  506. (false-if-exception (delete-file-recursively tmp-dir))))))
  507. (define* (swh-download url reference output
  508. #:key (log-port (current-error-port)))
  509. "Download from Software Heritage a checkout of the Git tag or commit
  510. REFERENCE originating from URL, and unpack it in OUTPUT. Return #t on success
  511. and #f on failure.
  512. This procedure uses the \"vault\", which contains \"cooked\" directories in
  513. the form of tarballs. If the requested directory is not cooked yet, it will
  514. wait until it becomes available, which could take several minutes."
  515. (match (if (commit-id? reference)
  516. (lookup-revision reference)
  517. (lookup-origin-revision url reference))
  518. ((? revision? revision)
  519. (format log-port "SWH: found revision ~a with directory at '~a'~%"
  520. (revision-id revision)
  521. (swh-url (revision-directory-url revision)))
  522. (call-with-temporary-directory
  523. (lambda (directory)
  524. (match (vault-fetch (revision-directory revision) 'directory
  525. #:log-port log-port)
  526. (#f
  527. (format log-port
  528. "SWH: directory ~a could not be fetched from the vault~%"
  529. (revision-directory revision))
  530. #f)
  531. ((? port? input)
  532. (let ((tar (open-pipe* OPEN_WRITE "tar" "-C" directory "-xzvf" "-")))
  533. (dump-port input tar)
  534. (close-port input)
  535. (let ((status (close-pipe tar)))
  536. (unless (zero? status)
  537. (error "tar extraction failure" status)))
  538. (match (scandir directory)
  539. (("." ".." sub-directory)
  540. (copy-recursively (string-append directory "/" sub-directory)
  541. output
  542. #:log (%make-void-port "w"))
  543. #t))))))))
  544. (#f
  545. #f)))