
The default `raco pkg' mode should work right for a multiple-version installation (because everything in Racket should work in a multiple-version installation). Along the same lines, `raco pkg' should work if the installation directory is unwriteable. So, the default mode is user-specific and version-specific. Use `--shared' or `-s' for user-specific, all-version installs. By default, `raco pkg show' now shows packages installed in all three modes (installation-wide, user- and version- specific, and user-specific all-version). Use `-i', `-u', or `-s' to show just one of them.
72 lines
3.3 KiB
Racket
72 lines
3.3 KiB
Racket
#lang racket/base
|
|
(require racket/file
|
|
"shelly.rkt"
|
|
"util.rkt")
|
|
|
|
(define (init-update-deps-test)
|
|
(shelly-begin
|
|
(hash-set! *index-ht-1* "pkg-b"
|
|
(hasheq 'checksum
|
|
(file->string "test-pkgs/pkg-b-first.plt.CHECKSUM")
|
|
'source
|
|
"http://localhost:9999/pkg-b-first.plt"))
|
|
$ "raco pkg config --set indexes http://localhost:9990"
|
|
$ "raco pkg install pkg-b"
|
|
$ "racket -e '(require pkg-b)'" =exit> 42
|
|
(hash-set! *index-ht-1* "pkg-b"
|
|
(hasheq 'checksum
|
|
(file->string "test-pkgs/pkg-b-second.plt.CHECKSUM")
|
|
'source
|
|
"http://localhost:9999/pkg-b-second.plt"))
|
|
(hash-set! *index-ht-1* "pkg-a"
|
|
(hasheq 'checksum
|
|
(file->string "test-pkgs/pkg-a-first.plt.CHECKSUM")
|
|
'source
|
|
"http://localhost:9999/pkg-a-first.plt"))))
|
|
|
|
(pkg-tests
|
|
(shelly-case
|
|
"create packages"
|
|
$ "raco pkg create --format plt test-pkgs/pkg-b-second"
|
|
$ "raco pkg create --format plt test-pkgs/pkg-a-first"
|
|
$ "raco pkg create --format plt test-pkgs/pkg-a-second")
|
|
|
|
(with-fake-root
|
|
(shelly-case
|
|
"update and then remove an auto"
|
|
$ "raco pkg config --set indexes http://localhost:9990"
|
|
(hash-set! *index-ht-1* "pkg-b"
|
|
(hasheq 'checksum
|
|
(file->string "test-pkgs/pkg-b-second.plt.CHECKSUM")
|
|
'source
|
|
"http://localhost:9999/pkg-b-second.plt"))
|
|
(hash-set! *index-ht-1* "pkg-a"
|
|
(hasheq 'checksum
|
|
(file->string "test-pkgs/pkg-a-first.plt.CHECKSUM")
|
|
'source
|
|
"http://localhost:9999/pkg-a-first.plt"))
|
|
$ "raco pkg install --deps search-auto pkg-b" =exit> 0 <input= "y\n"
|
|
$ "raco pkg show -u" =stdout> #rx"Package\\(auto\\?\\) Checksum Source\npkg-a\\* [a-f0-9]+ \\(pns pkg-a\\)\npkg-b [a-f0-9]+ \\(pns pkg-b\\)\n"
|
|
$ "racket -e '(require pkg-b)'" =exit> 43
|
|
$ "racket -e '(require pkg-a)'" =exit> 0
|
|
;; remove auto doesn't do anything because everything is needed
|
|
$ "raco pkg remove --auto"
|
|
$ "raco pkg show -u" =stdout> #rx"Package\\(auto\\?\\) Checksum Source\npkg-a\\* [a-f0-9]+ \\(pns pkg-a\\)\npkg-b [a-f0-9]+ \\(pns pkg-b\\)\n"
|
|
$ "racket -e '(require pkg-b)'" =exit> 43
|
|
$ "racket -e '(require pkg-a)'" =exit> 0
|
|
;; pkg-a is now an auto
|
|
(hash-set! *index-ht-1* "pkg-a"
|
|
(hasheq 'checksum
|
|
(file->string "test-pkgs/pkg-a-second.plt.CHECKSUM")
|
|
'source
|
|
"http://localhost:9999/pkg-a-second.plt"))
|
|
$ "raco pkg update -a" =exit> 0
|
|
$ "racket -e '(require pkg-a)'" =exit> 43
|
|
$ "raco pkg remove pkg-b"
|
|
$ "raco pkg show -u" =stdout> #rx"Package\\(auto\\?\\) Checksum Source\npkg-a\\* [a-f0-9]+ \\(pns pkg-a\\)\n"
|
|
$ "racket -e '(require pkg-b)'" =exit> 1
|
|
;; pkg-a is now not needed
|
|
$ "raco pkg remove --auto"
|
|
$ "raco pkg show -u" =stdout> "Package(auto?) Checksum Source\n"
|
|
$ "racket -e '(require pkg-a)'" =exit> 1)))
|