channels.scm 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2018-2023 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2018 Ricardo Wurmus <rekado@elephly.net>
  4. ;;; Copyright © 2019 Jan (janneke) Nieuwenhuizen <janneke@gnu.org>
  5. ;;; Copyright © 2021 Brice Waegeneire <brice@waegenei.re>
  6. ;;;
  7. ;;; This file is part of GNU Guix.
  8. ;;;
  9. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  10. ;;; under the terms of the GNU General Public License as published by
  11. ;;; the Free Software Foundation; either version 3 of the License, or (at
  12. ;;; your option) any later version.
  13. ;;;
  14. ;;; GNU Guix is distributed in the hope that it will be useful, but
  15. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  16. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. ;;; GNU General Public License for more details.
  18. ;;;
  19. ;;; You should have received a copy of the GNU General Public License
  20. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  21. (define-module (guix channels)
  22. #:use-module (git)
  23. #:use-module (guix git)
  24. #:use-module (guix git-authenticate)
  25. #:use-module ((guix openpgp)
  26. #:select (openpgp-public-key-fingerprint
  27. openpgp-format-fingerprint))
  28. #:use-module (guix base16)
  29. #:use-module (guix records)
  30. #:use-module (guix gexp)
  31. #:use-module (guix monads)
  32. #:use-module (guix profiles)
  33. #:use-module (guix packages)
  34. #:use-module (guix progress)
  35. #:use-module (guix derivations)
  36. #:use-module (guix combinators)
  37. #:use-module (guix diagnostics)
  38. #:use-module (guix sets)
  39. #:use-module (guix store)
  40. #:use-module (guix i18n)
  41. #:use-module (srfi srfi-1)
  42. #:use-module (srfi srfi-2)
  43. #:use-module (srfi srfi-9)
  44. #:use-module (srfi srfi-11)
  45. #:use-module (srfi srfi-26)
  46. #:use-module (srfi srfi-34)
  47. #:use-module (srfi srfi-35)
  48. #:autoload (guix describe) (current-channels) ;XXX: circular dep
  49. #:autoload (guix self) (whole-package make-config.scm)
  50. #:autoload (guix inferior) (gexp->derivation-in-inferior) ;FIXME: circular dep
  51. #:autoload (guix quirks) (%quirks %patches applicable-patch? apply-patch)
  52. #:use-module (ice-9 format)
  53. #:use-module (ice-9 match)
  54. #:use-module (ice-9 vlist)
  55. #:export (channel
  56. channel?
  57. channel-name
  58. channel-url
  59. channel-branch
  60. channel-commit
  61. channel-introduction
  62. channel-location
  63. channel-introduction?
  64. make-channel-introduction
  65. channel-introduction-first-signed-commit
  66. channel-introduction-first-commit-signer
  67. openpgp-fingerprint->bytevector
  68. openpgp-fingerprint
  69. %default-guix-channel
  70. %default-channels
  71. guix-channel?
  72. repository->guix-channel
  73. channel-instance?
  74. channel-instance-channel
  75. channel-instance-commit
  76. channel-instance-checkout
  77. authenticate-channel
  78. latest-channel-instances
  79. checkout->channel-instance
  80. latest-channel-derivation
  81. channel-instance->sexp
  82. channel-instances->manifest
  83. %channel-profile-hooks
  84. channel-instances->derivation
  85. ensure-forward-channel-update
  86. profile-channels
  87. manifest-entry-channel
  88. sexp->channel
  89. channel->code
  90. channel-news-entry?
  91. channel-news-entry-commit
  92. channel-news-entry-tag
  93. channel-news-entry-title
  94. channel-news-entry-body
  95. channel-news-for-commit))
  96. ;;; Commentary:
  97. ;;;
  98. ;;; This module implements "channels." A channel is usually a source of
  99. ;;; package definitions. There's a special channel, the 'guix' channel, that
  100. ;;; provides all of Guix, including its commands and its documentation.
  101. ;;; User-defined channels are expected to typically provide a bunch of .scm
  102. ;;; files meant to be added to the '%package-search-path'.
  103. ;;;
  104. ;;; This module provides tools to fetch and update channels from a Git
  105. ;;; repository and to build them.
  106. ;;;
  107. ;;; Code:
  108. (define-record-type* <channel> channel make-channel
  109. channel?
  110. (name channel-name)
  111. (url channel-url)
  112. (branch channel-branch (default "master"))
  113. (commit channel-commit (default #f))
  114. (introduction channel-introduction (default #f))
  115. (location channel-location
  116. (default (current-source-location)) (innate)))
  117. ;; Channel introductions. A "channel introduction" provides a commit/signer
  118. ;; pair that specifies the first commit of the authentication process as well
  119. ;; as its signer's fingerprint. Introductions are used to bootstrap trust in
  120. ;; a channel.
  121. (define-record-type <channel-introduction>
  122. (%make-channel-introduction first-signed-commit first-commit-signer)
  123. channel-introduction?
  124. (first-signed-commit channel-introduction-first-signed-commit) ;hex string
  125. (first-commit-signer channel-introduction-first-commit-signer)) ;bytevector
  126. (define (make-channel-introduction commit signer)
  127. "Return a new channel introduction: COMMIT is the introductory where
  128. authentication starts, and SIGNER is the OpenPGP fingerprint (a bytevector) of
  129. the signer of that commit."
  130. (%make-channel-introduction commit signer))
  131. (define (openpgp-fingerprint->bytevector str)
  132. "Convert STR, an OpenPGP fingerprint (hexadecimal string with whitespace),
  133. to the corresponding bytevector."
  134. (base16-string->bytevector
  135. (string-downcase (string-filter char-set:hex-digit str))))
  136. (define-syntax openpgp-fingerprint
  137. (lambda (s)
  138. "Convert STR, an OpenPGP fingerprint (hexadecimal string with whitespace),
  139. to the corresponding bytevector."
  140. (syntax-case s ()
  141. ((_ str)
  142. (string? (syntax->datum #'str))
  143. (openpgp-fingerprint->bytevector (syntax->datum #'str)))
  144. ((_ str)
  145. #'(openpgp-fingerprint->bytevector str)))))
  146. (define %guix-channel-introduction
  147. ;; Introduction of the official 'guix channel. The chosen commit is the
  148. ;; first one that introduces '.guix-authorizations' on the 'staging'
  149. ;; branch that was eventually merged in 'master'. Any branch starting
  150. ;; before that commit cannot be merged or it will be rejected by 'guix pull'
  151. ;; & co.
  152. (make-channel-introduction
  153. "9edb3f66fd807b096b48283debdcddccfea34bad" ;2020-05-26
  154. (openpgp-fingerprint ;mbakke
  155. "BBB0 2DDF 2CEA F6A8 0D1D E643 A2A0 6DF2 A33A 54FA")))
  156. (define %default-channel-url
  157. ;; URL of the default 'guix' channel.
  158. "https://git.savannah.gnu.org/git/guix.git")
  159. (define %default-guix-channel
  160. (channel
  161. (name 'guix)
  162. (branch "master")
  163. (url %default-channel-url)
  164. (introduction %guix-channel-introduction)))
  165. (define %default-channels
  166. ;; Default list of channels.
  167. (list %default-guix-channel))
  168. (define (guix-channel? channel)
  169. "Return true if CHANNEL is the 'guix' channel."
  170. (eq? 'guix (channel-name channel)))
  171. (define (ensure-default-introduction chan)
  172. "If CHAN represents the \"official\" 'guix' channel and lacks an
  173. introduction, add it."
  174. (if (and (guix-channel? chan)
  175. (not (channel-introduction chan))
  176. (string=? (channel-url chan) %default-channel-url))
  177. (channel (inherit chan)
  178. (introduction %guix-channel-introduction))
  179. chan))
  180. (define* (repository->guix-channel directory
  181. #:key
  182. (introduction %guix-channel-introduction))
  183. "Look for a Git repository in DIRECTORY or its ancestors and return a
  184. channel that uses that repository and the commit HEAD currently points to; use
  185. INTRODUCTION as the channel's introduction. Return #f if no Git repository
  186. could be found at DIRECTORY or one of its ancestors."
  187. (catch 'git-error
  188. (lambda ()
  189. (with-repository (repository-discover directory) repository
  190. (let* ((head (repository-head repository))
  191. (commit (oid->string (reference-target head))))
  192. (channel
  193. (inherit %default-guix-channel)
  194. (url (repository-working-directory repository))
  195. (commit commit)
  196. (branch (reference-shorthand head))
  197. (introduction introduction)))))
  198. (const #f)))
  199. (define-record-type <channel-instance>
  200. (channel-instance channel commit checkout)
  201. channel-instance?
  202. (channel channel-instance-channel)
  203. (commit channel-instance-commit)
  204. (checkout channel-instance-checkout))
  205. (define-record-type <channel-metadata>
  206. (channel-metadata directory dependencies news-file keyring-reference url)
  207. channel-metadata?
  208. (directory channel-metadata-directory) ;string with leading slash
  209. (dependencies channel-metadata-dependencies) ;list of <channel>
  210. (news-file channel-metadata-news-file) ;string | #f
  211. (keyring-reference channel-metadata-keyring-reference) ;string
  212. (url channel-metadata-url)) ;string | #f
  213. (define %default-keyring-reference
  214. ;; Default value of the 'keyring-reference' field.
  215. "keyring")
  216. (define (channel-reference channel)
  217. "Return the \"reference\" for CHANNEL, an sexp suitable for
  218. 'latest-repository-commit'."
  219. (match (channel-commit channel)
  220. (#f `(branch . ,(channel-branch channel)))
  221. (commit `(tag-or-commit . ,(channel-commit channel)))))
  222. (define sexp->channel-introduction
  223. (match-lambda
  224. (('channel-introduction ('version 0)
  225. ('commit commit) ('signer signer)
  226. _ ...)
  227. (make-channel-introduction commit (openpgp-fingerprint signer)))
  228. (x #f)))
  229. (define (read-channel-metadata port)
  230. "Read from PORT channel metadata in the format expected for the
  231. '.guix-channel' file. Return a <channel-metadata> record, or raise an error
  232. if valid metadata could not be read from PORT."
  233. (match (read port)
  234. (('channel ('version 0) properties ...)
  235. (let ((directory (and=> (assoc-ref properties 'directory) first))
  236. (dependencies (or (assoc-ref properties 'dependencies) '()))
  237. (news-file (and=> (assoc-ref properties 'news-file) first))
  238. (url (and=> (assoc-ref properties 'url) first))
  239. (keyring-reference
  240. (or (and=> (assoc-ref properties 'keyring-reference) first)
  241. %default-keyring-reference)))
  242. (channel-metadata
  243. (cond ((not directory) "/") ;directory
  244. ((string-prefix? "/" directory) directory)
  245. (else (string-append "/" directory)))
  246. (map (lambda (item) ;dependencies
  247. (let ((get (lambda* (key #:optional default)
  248. (or (and=> (assoc-ref item key) first) default))))
  249. (and-let* ((name (get 'name))
  250. (url (get 'url))
  251. (branch (get 'branch "master")))
  252. (channel
  253. (name name)
  254. (branch branch)
  255. (url url)
  256. (commit (get 'commit))
  257. (introduction (and=> (get 'introduction)
  258. sexp->channel-introduction))))))
  259. dependencies)
  260. news-file
  261. keyring-reference
  262. url)))
  263. ((and ('channel ('version version) _ ...) sexp)
  264. (raise (condition
  265. (&message (message "unsupported '.guix-channel' version"))
  266. (&error-location
  267. (location (source-properties->location
  268. (source-properties sexp)))))))
  269. (sexp
  270. (raise (condition
  271. (&message (message "invalid '.guix-channel' file"))
  272. (&error-location
  273. (location (source-properties->location
  274. (source-properties sexp)))))))))
  275. (define (read-channel-metadata-from-source source)
  276. "Return a channel-metadata record read from channel's SOURCE/.guix-channel
  277. description file, or return the default channel-metadata record if that file
  278. doesn't exist."
  279. (catch 'system-error
  280. (lambda ()
  281. (call-with-input-file (string-append source "/.guix-channel")
  282. read-channel-metadata))
  283. (lambda args
  284. (if (= ENOENT (system-error-errno args))
  285. (channel-metadata "/" '() #f %default-keyring-reference #f)
  286. (apply throw args)))))
  287. (define (channel-instance-metadata instance)
  288. "Return a channel-metadata record read from the channel INSTANCE's
  289. description file or its default value."
  290. (read-channel-metadata-from-source (channel-instance-checkout instance)))
  291. (define (channel-instance-dependencies instance)
  292. "Return the list of channels that are declared as dependencies for the given
  293. channel INSTANCE."
  294. (channel-metadata-dependencies (channel-instance-metadata instance)))
  295. (define (apply-patches checkout commit patches)
  296. "Apply the matching PATCHES to CHECKOUT, modifying files in place. The
  297. result is unspecified."
  298. (let loop ((patches patches))
  299. (match patches
  300. (() #t)
  301. ((patch rest ...)
  302. (when (applicable-patch? patch checkout commit)
  303. (apply-patch patch checkout))
  304. (loop rest)))))
  305. (define commit-short-id
  306. (compose (cut string-take <> 7) oid->string commit-id))
  307. (define* (authenticate-channel channel checkout commit
  308. #:key (keyring-reference-prefix "origin/"))
  309. "Authenticate the given COMMIT of CHANNEL, available at CHECKOUT, a
  310. directory containing a CHANNEL checkout. Raise an error if authentication
  311. fails."
  312. (define intro
  313. (channel-introduction channel))
  314. (define cache-key
  315. (string-append "channels/" (symbol->string (channel-name channel))))
  316. (define keyring-reference
  317. (channel-metadata-keyring-reference
  318. (read-channel-metadata-from-source checkout)))
  319. (define (make-reporter start-commit end-commit commits)
  320. (format (current-error-port)
  321. (G_ "Authenticating channel '~a', commits ~a to ~a (~h new \
  322. commits)...~%")
  323. (channel-name channel)
  324. (commit-short-id start-commit)
  325. (commit-short-id end-commit)
  326. (length commits))
  327. (progress-reporter/bar (length commits)))
  328. (define authentic-commits
  329. ;; Consider the currently-used commit of CHANNEL as authentic so
  330. ;; authentication can skip it and all its closure.
  331. (match (find (lambda (candidate)
  332. (eq? (channel-name candidate) (channel-name channel)))
  333. (current-channels))
  334. (#f '())
  335. (channel
  336. (if (channel-commit channel)
  337. (list (channel-commit channel))
  338. '()))))
  339. ;; XXX: Too bad we need to re-open CHECKOUT.
  340. (with-repository checkout repository
  341. (authenticate-repository repository
  342. (string->oid
  343. (channel-introduction-first-signed-commit intro))
  344. (channel-introduction-first-commit-signer intro)
  345. #:end (string->oid commit)
  346. #:keyring-reference
  347. (string-append keyring-reference-prefix
  348. keyring-reference)
  349. #:authentic-commits authentic-commits
  350. #:make-reporter make-reporter
  351. #:cache-key cache-key)))
  352. (define* (latest-channel-instance store channel
  353. #:key (patches %patches)
  354. starting-commit
  355. (authenticate? #f)
  356. (validate-pull
  357. ensure-forward-channel-update))
  358. "Return the latest channel instance for CHANNEL. When STARTING-COMMIT is
  359. true, call VALIDATE-PULL with CHANNEL, STARTING-COMMIT, the target commit, and
  360. their relation. When AUTHENTICATE? is false, CHANNEL is not authenticated."
  361. (define (dot-git? file stat)
  362. (and (string=? (basename file) ".git")
  363. (eq? 'directory (stat:type stat))))
  364. (let-values (((channel)
  365. (ensure-default-introduction channel))
  366. ((checkout commit relation)
  367. (update-cached-checkout (channel-url channel)
  368. #:ref (channel-reference channel)
  369. #:starting-commit starting-commit)))
  370. (when relation
  371. (validate-pull channel starting-commit commit relation))
  372. (if authenticate?
  373. (if (channel-introduction channel)
  374. (authenticate-channel channel checkout commit)
  375. (begin
  376. (when (file-exists?
  377. (string-append checkout "/.guix-authorizations"))
  378. (warning (and=> (channel-location channel)
  379. source-properties->location)
  380. (G_ "channel '~a' lacks 'introduction' field but \
  381. '.guix-authorizations' found\n")
  382. (channel-name channel)))
  383. ;; TODO: Warn for all the channels once the authentication interface
  384. ;; is public.
  385. (when (guix-channel? channel)
  386. (raise (make-compound-condition
  387. (formatted-message (G_ "channel '~a' lacks an \
  388. introduction and cannot be authenticated~%")
  389. (channel-name channel))
  390. (condition
  391. (&fix-hint
  392. (hint (G_ "Add the missing introduction to your
  393. channels file to address the issue. Alternatively, you can pass
  394. @option{--disable-authentication}, at the risk of running unauthenticated and
  395. thus potentially malicious code.")))))))))
  396. (warning (G_ "channel authentication disabled~%")))
  397. (when (guix-channel? channel)
  398. ;; Apply the relevant subset of PATCHES directly in CHECKOUT. This is
  399. ;; safe to do because 'switch-to-ref' eventually does a hard reset.
  400. (apply-patches checkout commit patches))
  401. (let* ((name (url+commit->name (channel-url channel) commit))
  402. (checkout (add-to-store store name #t "sha256" checkout
  403. #:select? (negate dot-git?))))
  404. (channel-instance channel commit checkout))))
  405. (define (ensure-forward-channel-update channel start commit relation)
  406. "Raise an error if RELATION is not 'ancestor, meaning that START is not an
  407. ancestor of COMMIT, unless CHANNEL specifies a commit.
  408. This procedure implements a channel update policy meant to be used as a
  409. #:validate-pull argument."
  410. (match relation
  411. ('ancestor #t)
  412. ('self #t)
  413. (_
  414. (raise (make-compound-condition
  415. (condition
  416. (&message (message
  417. (format #f (G_ "\
  418. aborting update of channel '~a' to commit ~a, which is not a descendant of ~a")
  419. (channel-name channel)
  420. commit start))))
  421. ;; If the user asked for a specific commit, they might want
  422. ;; that to happen nevertheless, so tell them about the
  423. ;; relevant 'guix pull' option.
  424. (if (channel-commit channel)
  425. (condition
  426. (&fix-hint
  427. (hint (G_ "Use @option{--allow-downgrades} to force
  428. this downgrade."))))
  429. (condition
  430. (&fix-hint
  431. (hint (G_ "This could indicate that the channel has
  432. been tampered with and is trying to force a roll-back, preventing you from
  433. getting the latest updates. If you think this is not the case, explicitly
  434. allow non-forward updates."))))))))))
  435. (define (channel-instance-primary-url instance)
  436. "Return the primary URL advertised for INSTANCE, or #f if there is no such
  437. information."
  438. (channel-metadata-url (channel-instance-metadata instance)))
  439. (define* (latest-channel-instances store channels
  440. #:key
  441. (current-channels '())
  442. (authenticate? #t)
  443. (validate-pull
  444. ensure-forward-channel-update))
  445. "Return a list of channel instances corresponding to the latest checkouts of
  446. CHANNELS and the channels on which they depend.
  447. When AUTHENTICATE? is true, authenticate the subset of CHANNELS that has a
  448. \"channel introduction\".
  449. CURRENT-CHANNELS is the list of currently used channels. It is compared
  450. against the newly-fetched instances of CHANNELS, and VALIDATE-PULL is called
  451. for each channel update and can choose to emit warnings or raise an error,
  452. depending on the policy it implements."
  453. ;; Only process channels that are unique, or that are more specific than a
  454. ;; previous channel specification.
  455. (define (ignore? channel others)
  456. (member channel others
  457. (lambda (a b)
  458. (and (eq? (channel-name a) (channel-name b))
  459. (or (channel-commit b)
  460. (not (or (channel-commit a)
  461. (channel-commit b))))))))
  462. (define (current-commit name)
  463. ;; Return the current commit for channel NAME.
  464. (any (lambda (channel)
  465. (and (eq? (channel-name channel) name)
  466. (channel-commit channel)))
  467. current-channels))
  468. (let loop ((channels channels)
  469. (previous-channels '()))
  470. ;; Accumulate a list of instances. A list of processed channels is also
  471. ;; accumulated to decide on duplicate channel specifications.
  472. (define-values (resulting-channels instances)
  473. (fold2 (lambda (channel previous-channels instances)
  474. (if (ignore? channel previous-channels)
  475. (values previous-channels instances)
  476. (begin
  477. (format (current-error-port)
  478. (G_ "Updating channel '~a' from Git repository at '~a'...~%")
  479. (channel-name channel)
  480. (channel-url channel))
  481. (let* ((current (current-commit (channel-name channel)))
  482. (instance
  483. (latest-channel-instance store channel
  484. #:authenticate?
  485. authenticate?
  486. #:validate-pull
  487. validate-pull
  488. #:starting-commit
  489. current)))
  490. (when authenticate?
  491. ;; CHANNEL is authenticated so we can trust the
  492. ;; primary URL advertised in its metadata and warn
  493. ;; about possibly stale mirrors.
  494. (let ((primary-url (channel-instance-primary-url
  495. instance)))
  496. (unless (or (not primary-url)
  497. (channel-commit channel)
  498. (string=? primary-url (channel-url channel)))
  499. (warning (G_ "pulled channel '~a' from a mirror \
  500. of ~a, which might be stale~%")
  501. (channel-name channel)
  502. primary-url))))
  503. (let-values (((new-instances new-channels)
  504. (loop (channel-instance-dependencies instance)
  505. previous-channels)))
  506. (values (append (cons channel new-channels)
  507. previous-channels)
  508. (append (cons instance new-instances)
  509. instances)))))))
  510. previous-channels
  511. '() ;instances
  512. channels))
  513. (let ((instance-name (compose channel-name channel-instance-channel)))
  514. ;; Remove all earlier channel specifications if they are followed by a
  515. ;; more specific one.
  516. (values (delete-duplicates instances
  517. (lambda (a b)
  518. (eq? (instance-name a) (instance-name b))))
  519. resulting-channels))))
  520. (define* (checkout->channel-instance checkout
  521. #:key commit
  522. (url checkout) (name 'guix))
  523. "Return a channel instance for CHECKOUT, which is assumed to be a checkout
  524. of COMMIT at URL. Use NAME as the channel name."
  525. (let* ((commit (or commit (make-string 40 #\0)))
  526. (channel (channel (name name)
  527. (commit commit)
  528. (url url))))
  529. (channel-instance channel commit checkout)))
  530. (define %self-build-file
  531. ;; The file containing code to build Guix. This serves the same purpose as
  532. ;; a makefile, and, similarly, is intended to always keep this name.
  533. "build-aux/build-self.scm")
  534. (define %pull-version
  535. ;; This is the version of the 'guix pull' protocol. It specifies what's
  536. ;; expected from %SELF-BUILD-FILE. The initial version ("0") was when we'd
  537. ;; place a set of compiled Guile modules in ~/.config/guix/latest.
  538. 1)
  539. (define (standard-module-derivation name source core dependencies)
  540. "Return a derivation that builds with CORE, a Guix instance, the Scheme
  541. modules in SOURCE and that depend on DEPENDENCIES, a list of lowerable
  542. objects. The assumption is that SOURCE contains package modules to be added
  543. to '%package-module-path'."
  544. (let* ((metadata (read-channel-metadata-from-source source))
  545. (directory (channel-metadata-directory metadata)))
  546. (define build
  547. ;; This is code that we'll run in CORE, a Guix instance, with its own
  548. ;; modules and so on. That way, we make sure these modules are built for
  549. ;; the right Guile version, with the right dependencies, and that they get
  550. ;; to see the right (gnu packages …) modules.
  551. (with-extensions dependencies
  552. #~(begin
  553. (use-modules (guix build compile)
  554. (guix build utils)
  555. (srfi srfi-26))
  556. (define go
  557. (string-append #$output "/lib/guile/" (effective-version)
  558. "/site-ccache"))
  559. (define scm
  560. (string-append #$output "/share/guile/site/"
  561. (effective-version)))
  562. (define optimizations-for-level
  563. ;; Guile 3.0 provides this procedure but Guile 2.2 didn't.
  564. ;; Since this code may be executed by either version, we can't
  565. ;; rely on its availability.
  566. (or (and=> (false-if-exception
  567. (resolve-interface '(system base optimize)))
  568. (lambda (iface)
  569. (module-ref iface 'optimizations-for-level)))
  570. (const '())))
  571. (define -O1
  572. ;; Optimize for package module compilation speed.
  573. (optimizations-for-level 1))
  574. (let* ((subdir #$directory)
  575. (source (string-append #$source subdir)))
  576. (compile-files source go (find-files source "\\.scm$")
  577. #:optimization-options (const -O1))
  578. (mkdir-p (dirname scm))
  579. (symlink (string-append #$source subdir) scm))
  580. scm)))
  581. (gexp->derivation-in-inferior name build core)))
  582. (define* (guile-for-source source #:optional (quirks %quirks))
  583. "Return the Guile package to use when building SOURCE or #f if the default
  584. '%guile-for-build' should be good enough."
  585. (let loop ((quirks quirks))
  586. (match quirks
  587. (()
  588. #f)
  589. (((predicate . guile) rest ...)
  590. (if (predicate source) (guile) (loop rest))))))
  591. (define (call-with-guile guile thunk)
  592. (lambda (store)
  593. (values (parameterize ((%guile-for-build
  594. (if guile
  595. (package-derivation store guile)
  596. (%guile-for-build))))
  597. (run-with-store store (thunk)))
  598. store)))
  599. (define-syntax-rule (with-guile guile exp ...)
  600. "Set GUILE as the '%guile-for-build' parameter for the dynamic extent of
  601. EXP, a series of monadic expressions."
  602. (call-with-guile guile (lambda ()
  603. (mbegin %store-monad exp ...))))
  604. (define (with-trivial-build-handler mvalue)
  605. "Run MVALUE, a monadic value, with a \"trivial\" build handler installed
  606. that unconditionally resumes the continuation."
  607. (lambda (store)
  608. (with-build-handler (lambda (continue . _)
  609. (continue #t))
  610. (values (run-with-store store mvalue)
  611. store))))
  612. (define* (build-from-source instance
  613. #:key core verbose? (dependencies '()) system)
  614. "Return a derivation to build Guix from INSTANCE, using the self-build
  615. script contained therein. When CORE is true, build package modules under
  616. SOURCE using CORE, an instance of Guix. By default, build for the current
  617. system, or SYSTEM if specified."
  618. (define name
  619. (symbol->string
  620. (channel-name (channel-instance-channel instance))))
  621. (define source
  622. (channel-instance-checkout instance))
  623. (define commit
  624. (channel-instance-commit instance))
  625. ;; Running the self-build script makes it easier to update the build
  626. ;; procedure: the self-build script of the Guix-to-be-installed contains the
  627. ;; right dependencies, build procedure, etc., which the Guix-in-use may not
  628. ;; know.
  629. (define script
  630. (string-append source "/" %self-build-file))
  631. (if (file-exists? script)
  632. (let ((build (save-module-excursion
  633. (lambda ()
  634. ;; Disable deprecation warnings; it's OK for SCRIPT to
  635. ;; use deprecated APIs and the user doesn't have to know
  636. ;; about it.
  637. (parameterize ((guix-warning-port
  638. (%make-void-port "w")))
  639. (primitive-load script)))))
  640. (guile (guile-for-source source)))
  641. ;; BUILD must be a monadic procedure of at least one argument: the
  642. ;; source tree.
  643. ;;
  644. ;; Note: BUILD can return #f if it does not support %PULL-VERSION. In
  645. ;; the future we'll fall back to a previous version of the protocol
  646. ;; when that happens.
  647. (with-guile guile
  648. ;; BUILD is usually quite costly. Install a "trivial" build handler
  649. ;; so we don't bounce an outer build-accumulator handler that could
  650. ;; cause us to redo half of the BUILD computation several times just
  651. ;; to realize it gives the same result.
  652. (with-trivial-build-handler
  653. (build source
  654. #:verbose? verbose? #:version commit
  655. #:system system
  656. #:channel-metadata (channel-instance->sexp instance)
  657. #:pull-version %pull-version))))
  658. ;; Build a set of modules that extend Guix using the standard method.
  659. (standard-module-derivation name source core dependencies)))
  660. (define* (build-channel-instance instance system
  661. #:optional core (dependencies '()))
  662. "Return, as a monadic value, the derivation for INSTANCE, a channel
  663. instance, for SYSTEM. DEPENDENCIES is a list of extensions providing Guile
  664. modules that INSTANCE depends on."
  665. (build-from-source instance
  666. #:core core
  667. #:dependencies dependencies
  668. #:system system))
  669. (define (resolve-dependencies instances)
  670. "Return a procedure that, given one of the elements of INSTANCES, returns
  671. list of instances it depends on."
  672. (define channel-instance-name
  673. (compose channel-name channel-instance-channel))
  674. (define table ;map a name to an instance
  675. (fold (lambda (instance table)
  676. (vhash-consq (channel-instance-name instance)
  677. instance table))
  678. vlist-null
  679. instances))
  680. (define edges
  681. (fold (lambda (instance edges)
  682. (fold (lambda (channel edges)
  683. (let ((name (channel-name channel)))
  684. (match (vhash-assq name table)
  685. ((_ . target)
  686. (vhash-consq instance target edges)))))
  687. edges
  688. (channel-instance-dependencies instance)))
  689. vlist-null
  690. instances))
  691. (lambda (instance)
  692. (vhash-foldq* cons '() instance edges)))
  693. (define* (channel-instance-derivations instances #:key system)
  694. "Return the list of derivations to build INSTANCES, in the same order as
  695. INSTANCES. Build for the current system by default, or SYSTEM if specified."
  696. (define core-instance
  697. ;; The 'guix' channel is treated specially: it's an implicit dependency of
  698. ;; all the other channels.
  699. (find (lambda (instance)
  700. (guix-channel? (channel-instance-channel instance)))
  701. instances))
  702. (define edges
  703. (resolve-dependencies instances))
  704. (define (instance->derivation instance)
  705. (mlet %store-monad ((system (if system (return system) (current-system))))
  706. (mcached (if (eq? instance core-instance)
  707. (build-channel-instance instance system)
  708. (mlet %store-monad ((core (instance->derivation core-instance))
  709. (deps (mapm %store-monad instance->derivation
  710. (edges instance))))
  711. (build-channel-instance instance system core deps)))
  712. instance
  713. system)))
  714. (unless core-instance
  715. (let ((loc (and=> (any (compose channel-location channel-instance-channel)
  716. instances)
  717. source-properties->location)))
  718. (raise (apply make-compound-condition
  719. (condition
  720. (&message (message "'guix' channel is lacking")))
  721. (condition
  722. (&fix-hint (hint (G_ "Make sure your list of channels
  723. contains one channel named @code{guix} providing the core of Guix."))))
  724. (if loc
  725. (list (condition (&error-location (location loc))))
  726. '())))))
  727. (mapm %store-monad instance->derivation instances))
  728. (define (whole-package-for-legacy name modules)
  729. "Return a full-blown Guix package for MODULES, a derivation that builds Guix
  730. modules in the old ~/.config/guix/latest style."
  731. (define packages
  732. (resolve-interface '(gnu packages guile)))
  733. (define modules+compiled
  734. ;; Since MODULES contains both .scm and .go files at its root, re-bundle
  735. ;; it so that it has share/guile/site and lib/guile, which is what
  736. ;; 'whole-package' expects.
  737. (computed-file (derivation-name modules)
  738. (with-imported-modules '((guix build utils))
  739. #~(begin
  740. (use-modules (guix build utils))
  741. (define version
  742. (effective-version))
  743. (define share
  744. (string-append #$output "/share/guile/site"))
  745. (define lib
  746. (string-append #$output "/lib/guile/" version))
  747. (mkdir-p share) (mkdir-p lib)
  748. (symlink #$modules (string-append share "/" version))
  749. (symlink #$modules (string-append lib "/site-ccache"))))))
  750. (letrec-syntax ((list (syntax-rules (->)
  751. ((_)
  752. '())
  753. ((_ (module -> variable) rest ...)
  754. (cons (module-ref (resolve-interface
  755. '(gnu packages module))
  756. 'variable)
  757. (list rest ...)))
  758. ((_ variable rest ...)
  759. (cons (module-ref packages 'variable)
  760. (list rest ...))))))
  761. (whole-package name modules+compiled
  762. ;; In the "old style", %SELF-BUILD-FILE would simply return a
  763. ;; derivation that builds modules. We have to infer what the
  764. ;; dependencies of these modules were.
  765. (list guile-json-3 guile-git guile-bytestructures
  766. (ssh -> guile-ssh) (tls -> gnutls))
  767. #:guile (default-guile))))
  768. (define (old-style-guix? drv)
  769. "Return true if DRV corresponds to a ~/.config/guix/latest style of
  770. derivation."
  771. ;; Here we rely on a gross historical fact: that derivations produced by the
  772. ;; "old style" (before commit 8a0d9bc8a3f153159d9e239a151c0fa98f1e12d8,
  773. ;; dated May 30, 2018) did not depend on "guix-command.drv".
  774. (not (find (lambda (input)
  775. (string=? "guix-command"
  776. (derivation-name
  777. (derivation-input-derivation input))))
  778. (derivation-inputs drv))))
  779. (define (channel-instance->sexp instance)
  780. "Return an sexp representation of INSTANCE, a channel instance."
  781. (let* ((commit (channel-instance-commit instance))
  782. (channel (channel-instance-channel instance))
  783. (intro (channel-introduction channel)))
  784. `(repository
  785. (version 0)
  786. (url ,(channel-url channel))
  787. (branch ,(channel-branch channel))
  788. (commit ,commit)
  789. (name ,(channel-name channel))
  790. ,@(if intro
  791. `((introduction
  792. (channel-introduction
  793. (version 0)
  794. (commit
  795. ,(channel-introduction-first-signed-commit
  796. intro))
  797. (signer
  798. ,(openpgp-format-fingerprint
  799. (channel-introduction-first-commit-signer
  800. intro))))))
  801. '()))))
  802. (define* (channel-instances->manifest instances #:key system)
  803. "Return a profile manifest with entries for all of INSTANCES, a list of
  804. channel instances. By default, build for the current system, or SYSTEM if
  805. specified."
  806. (define (instance->entry instance drv)
  807. (let ((commit (channel-instance-commit instance))
  808. (channel (channel-instance-channel instance)))
  809. (manifest-entry
  810. (name (symbol->string (channel-name channel)))
  811. (version (string-take commit 7))
  812. (item (if (guix-channel? channel)
  813. (if (old-style-guix? drv)
  814. (whole-package-for-legacy (string-append name "-" version)
  815. drv)
  816. drv)
  817. drv))
  818. (properties
  819. `((source ,(channel-instance->sexp instance)))))))
  820. (mlet* %store-monad ((derivations (channel-instance-derivations instances
  821. #:system system))
  822. (entries -> (map instance->entry instances derivations)))
  823. (return (manifest entries))))
  824. (define (package-cache-file manifest)
  825. "Build a package cache file for the instance in MANIFEST. This is meant to
  826. be used as a profile hook."
  827. ;; Note: Emit a profile in format version 3, which was introduced in 2017
  828. ;; and is readable by Guix since before version 1.0. This ensures that the
  829. ;; Guix in MANIFEST is able to read the manifest file created for its own
  830. ;; profile below. See <https://issues.guix.gnu.org/56441>.
  831. (let ((profile (profile (content manifest) (hooks '())
  832. (format-version 3))))
  833. (define build
  834. #~(begin
  835. (use-modules (gnu packages))
  836. (if (defined? 'generate-package-cache)
  837. (begin
  838. ;; Delegate package cache generation to the inferior.
  839. (format (current-error-port)
  840. "Generating package cache for '~a'...~%"
  841. #$profile)
  842. ;; This script runs through (primitive-load), which by default
  843. ;; doesn't print backtraces when it encounters an exception,
  844. ;; so manually do it. Use with-throw-handler because it is
  845. ;; supported by all Guile versions.
  846. (with-throw-handler #t
  847. (lambda () (generate-package-cache #$output))
  848. (lambda (key . args)
  849. (backtrace))))
  850. (mkdir #$output))))
  851. (define channels
  852. (map (compose string->symbol manifest-entry-name)
  853. (manifest-entries manifest)))
  854. (gexp->derivation-in-inferior "guix-package-cache" build
  855. profile
  856. ;; If the Guix in PROFILE is too old and
  857. ;; lacks 'guix repl', don't build the cache
  858. ;; instead of failing.
  859. #:silent-failure? #t
  860. #:properties `((type . profile-hook)
  861. (hook . package-cache)
  862. (channels . ,channels))
  863. #:local-build? #t)))
  864. (define %channel-profile-hooks
  865. ;; The default channel profile hooks.
  866. (cons package-cache-file %default-profile-hooks))
  867. (define (channel-instances->derivation instances)
  868. "Return the derivation of the profile containing INSTANCES, a list of
  869. channel instances."
  870. (mlet %store-monad ((manifest (channel-instances->manifest instances)))
  871. ;; Emit a profile in format version so that, if INSTANCES denotes an old
  872. ;; Guix, it can still read that profile, for instance for the purposes of
  873. ;; 'guix describe'.
  874. (profile-derivation manifest
  875. #:hooks %channel-profile-hooks
  876. #:format-version 3)))
  877. (define latest-channel-instances*
  878. (store-lift latest-channel-instances))
  879. (define* (latest-channel-derivation #:optional (channels %default-channels)
  880. #:key
  881. (current-channels '())
  882. (validate-pull
  883. ensure-forward-channel-update))
  884. "Return as a monadic value the derivation that builds the profile for the
  885. latest instances of CHANNELS. CURRENT-CHANNELS and VALIDATE-PULL are passed
  886. to 'latest-channel-instances'."
  887. (mlet %store-monad ((instances
  888. (latest-channel-instances* channels
  889. #:current-channels
  890. current-channels
  891. #:validate-pull
  892. validate-pull)))
  893. (channel-instances->derivation instances)))
  894. (define* (sexp->channel sexp #:optional (name 'channel))
  895. "Read SEXP, a provenance sexp as created by 'channel-instance->sexp'; use
  896. NAME as the channel name if SEXP does not specify it. Return #f if the sexp
  897. does not have the expected structure."
  898. (match sexp
  899. (('repository ('version 0)
  900. ('url url)
  901. ('branch branch)
  902. ('commit commit)
  903. rest ...)
  904. ;; Historically channel sexps did not include the channel name. It's OK
  905. ;; for channels created by 'channel-instances->manifest' because the
  906. ;; entry name is the channel name, but it was missing for entries created
  907. ;; by 'manifest-entry-with-provenance'.
  908. (channel (name (match (assq 'name rest)
  909. (#f name)
  910. (('name name) name)))
  911. (url url)
  912. (branch branch)
  913. (commit commit)
  914. (introduction
  915. (match (assq 'introduction rest)
  916. (#f #f)
  917. (('introduction intro)
  918. (sexp->channel-introduction intro))))))
  919. (_ #f)))
  920. (define (manifest-entry-channel entry)
  921. "Return the channel ENTRY corresponds to, or #f if that information is
  922. missing or unreadable. ENTRY must be an entry created by
  923. 'channel-instances->manifest', with the 'source' property."
  924. (let ((name (string->symbol (manifest-entry-name entry))))
  925. (match (assq-ref (manifest-entry-properties entry) 'source)
  926. ((sexp)
  927. (sexp->channel sexp name))
  928. (_
  929. ;; No channel information for this manifest entry.
  930. ;; XXX: Pre-0.15.0 Guix did not provide that information,
  931. ;; but there's not much we can do in that case.
  932. #f))))
  933. (define (profile-channels profile)
  934. "Return the list of channels corresponding to entries in PROFILE. If
  935. PROFILE is not a profile created by 'guix pull', return the empty list."
  936. (filter-map manifest-entry-channel
  937. ;; Show most recently installed packages last.
  938. (reverse
  939. (manifest-entries (profile-manifest profile)))))
  940. (define* (channel->code channel #:key (include-introduction? #t))
  941. "Return code (an sexp) to build CHANNEL. When INCLUDE-INTRODUCTION? is
  942. true, include its introduction, if any."
  943. (let ((intro (and include-introduction?
  944. (channel-introduction channel))))
  945. `(channel
  946. (name ',(channel-name channel))
  947. (url ,(channel-url channel))
  948. (branch ,(channel-branch channel))
  949. ,@(if (channel-commit channel)
  950. `((commit ,(channel-commit channel)))
  951. '())
  952. ,@(if intro
  953. `((introduction (make-channel-introduction
  954. ,(channel-introduction-first-signed-commit intro)
  955. (openpgp-fingerprint
  956. ,(openpgp-format-fingerprint
  957. (channel-introduction-first-commit-signer
  958. intro))))))
  959. '()))))
  960. ;;;
  961. ;;; News.
  962. ;;;
  963. ;; Channel news.
  964. (define-record-type <channel-news>
  965. (channel-news entries)
  966. channel-news?
  967. (entries channel-news-entries)) ;list of <channel-news-entry>
  968. ;; News entry, associated with a specific commit of the channel.
  969. (define-record-type <channel-news-entry>
  970. (channel-news-entry commit tag title body)
  971. channel-news-entry?
  972. (commit channel-news-entry-commit) ;hex string | #f
  973. (tag channel-news-entry-tag) ;#f | string
  974. (title channel-news-entry-title) ;list of language tag/string pairs
  975. (body channel-news-entry-body)) ;list of language tag/string pairs
  976. (define (sexp->channel-news-entry entry)
  977. "Return the <channel-news-entry> record corresponding to ENTRY, an sexp."
  978. (define (pair language message)
  979. (cons (symbol->string language) message))
  980. (match entry
  981. (('entry ((and (or 'commit 'tag) type) commit-or-tag)
  982. ('title ((? symbol? title-tags) (? string? titles)) ...)
  983. ('body ((? symbol? body-tags) (? string? bodies)) ...)
  984. _ ...)
  985. (channel-news-entry (and (eq? type 'commit) commit-or-tag)
  986. (and (eq? type 'tag) commit-or-tag)
  987. (map pair title-tags titles)
  988. (map pair body-tags bodies)))
  989. (_
  990. (raise (condition
  991. (&message (message "invalid channel news entry"))
  992. (&error-location
  993. (location (source-properties->location
  994. (source-properties entry)))))))))
  995. (define (read-channel-news port)
  996. "Read a channel news feed from PORT and return it as a <channel-news>
  997. record."
  998. (match (false-if-exception (read port))
  999. (('channel-news ('version 0) entries ...)
  1000. (channel-news (map sexp->channel-news-entry entries)))
  1001. (('channel-news ('version version) _ ...)
  1002. ;; This is an unsupported version from the future. There's nothing wrong
  1003. ;; with that (the user may simply need to upgrade the 'guix' channel to
  1004. ;; be able to read it), so silently ignore it.
  1005. (channel-news '()))
  1006. (#f
  1007. (raise (condition
  1008. (&message (message "syntactically invalid channel news file")))))
  1009. (sexp
  1010. (raise (condition
  1011. (&message (message "invalid channel news file"))
  1012. (&error-location
  1013. (location (source-properties->location
  1014. (source-properties sexp)))))))))
  1015. (define (resolve-channel-news-entry-tag repository entry)
  1016. "If ENTRY has its 'commit' field set, return ENTRY. Otherwise, lookup
  1017. ENTRY's 'tag' in REPOSITORY and return ENTRY with its 'commit' field set to
  1018. the field its 'tag' refers to. A 'git-error' exception is raised if the tag
  1019. cannot be found."
  1020. (if (channel-news-entry-commit entry)
  1021. entry
  1022. (let* ((tag (channel-news-entry-tag entry))
  1023. (reference (reference-lookup repository
  1024. (string-append "refs/tags/" tag)))
  1025. (target (reference-target reference))
  1026. (oid (let ((obj (object-lookup repository target)))
  1027. (if (= OBJ-TAG (object-type obj)) ;annotated tag?
  1028. (tag-target-id (tag-lookup repository target))
  1029. target))))
  1030. (channel-news-entry (oid->string oid) tag
  1031. (channel-news-entry-title entry)
  1032. (channel-news-entry-body entry)))))
  1033. (define* (channel-news-for-commit channel new #:optional old)
  1034. "Return a list of <channel-news-entry> for CHANNEL between commits OLD and
  1035. NEW. When OLD is omitted or is #f, return all the news entries of CHANNEL."
  1036. (catch 'git-error
  1037. (lambda ()
  1038. (let* ((checkout (update-cached-checkout (channel-url channel)
  1039. #:ref `(commit . ,new)))
  1040. (metadata (read-channel-metadata-from-source checkout))
  1041. (news-file (channel-metadata-news-file metadata))
  1042. (news-file (and news-file
  1043. (string-append checkout "/" news-file))))
  1044. (if (and news-file (file-exists? news-file))
  1045. (with-repository checkout repository
  1046. (let* ((news (call-with-input-file news-file
  1047. (lambda (port)
  1048. (set-port-encoding! port
  1049. (or (file-encoding port)
  1050. "UTF-8"))
  1051. (read-channel-news port))))
  1052. (entries (map (lambda (entry)
  1053. (resolve-channel-news-entry-tag repository
  1054. entry))
  1055. (channel-news-entries news))))
  1056. (if old
  1057. (let* ((new (commit-lookup repository (string->oid new)))
  1058. (old (commit-lookup repository (string->oid old)))
  1059. (commits (list->set
  1060. (map (compose oid->string commit-id)
  1061. (commit-difference new old)))))
  1062. (filter (lambda (entry)
  1063. (set-contains? commits
  1064. (channel-news-entry-commit entry)))
  1065. entries))
  1066. entries)))
  1067. '())))
  1068. (lambda (key error . rest)
  1069. ;; If commit NEW or commit OLD cannot be found, then something must be
  1070. ;; wrong (for example, the history of CHANNEL was rewritten and these
  1071. ;; commits no longer exist upstream), so quietly return the empty list.
  1072. (if (= GIT_ENOTFOUND (git-error-code error))
  1073. '()
  1074. (apply throw key error rest)))))
  1075. ;;; Local Variables:
  1076. ;;; eval: (put 'with-guile 'scheme-indent-function 1)
  1077. ;;; End: