Skip to content

Instantly share code, notes, and snippets.

@Metaxal
Last active November 12, 2021 14:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Metaxal/13c4effc483c5ef9f5797ace4950f97a to your computer and use it in GitHub Desktop.
Save Metaxal/13c4effc483c5ef9f5797ace4950f97a to your computer and use it in GitHub Desktop.
When installing a new version of racket, run this script instead of just `raco pkg migrate <version-number-you-have-to-remember>`
#!/usr/bin/racket
#lang racket/base
;;; License: [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0) or
;;; [MIT license](http://opensource.org/licenses/MIT) at your option.
;; When installing a new version of Racket,
;; running this script setups all existing packages that had been installed
;; in the *user* scope.
;;
;; Notes:
;; * installation-wide packages are not migrated.
;; In particular, bundled packages that were updated with `raco pkg update --link ...`,
;; for example, will not be migrated and the bundled packages will take their place.
;; (Moreover, since this script is run with the new version of Racket, it's difficult
;; to discover these packages.)
;; * 'releases' and 'snapshot' packages are separated, and this script will migrate
;; only from the same type.
(require racket/string
racket/future
pkg/path
setup/setup)
(define h (read-pkgs-db 'user))
(define pkgs (hash-keys h))
(displayln (string-join (sort pkgs string<?) "\n"))
(setup #:pkgs pkgs #:make-doc-index? #t #:jobs (min (processor-count) 8)) ; no benefit after 8?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment