
Packages that are installed as other than a link are not meant to be edited, but work can get lost if a package is edited and then removed or updated. Avoid that work loss by moving removed or updated packages to a trash folder. By default, the trash folder holds up to 512 packages for up to 48 hours. To disable the trash folder (for a given scope), use raco pkg config --set max-trash-packages 0 (I expect that some variant of Greenspun's rule predicted the eventual inclusion of "backup" management in the package system.)
54 lines
1.3 KiB
Racket
54 lines
1.3 KiB
Racket
#lang racket/base
|
|
(require "util.rkt"
|
|
"shelly.rkt")
|
|
|
|
(this-test-is-run-by-the-main-test)
|
|
|
|
(pkg-tests
|
|
(with-fake-root
|
|
(shelly-begin
|
|
|
|
(define (check-empty)
|
|
(shelly-begin
|
|
$ "raco pkg empty-trash -l" =stdout> #rx" \\[(none|does not exist)\\]\n"))
|
|
|
|
(define (add-remove)
|
|
(shelly-begin
|
|
$ "raco pkg install test-pkgs/pkg-test1.zip"
|
|
$ "raco pkg remove pkg-test1"))
|
|
|
|
(define (check-single)
|
|
(shelly-begin
|
|
$ "raco pkg empty-trash -l" =stdout> #rx"Content:\n [0-9]+-0-pkg-test1\n$"))
|
|
|
|
(define (check-double)
|
|
(shelly-begin
|
|
$ "raco pkg empty-trash -l" =stdout> #rx"Content:\n [0-9]+-0-pkg-test1\n [0-9]*-.-pkg-test1\n$"))
|
|
|
|
$ "raco pkg install test-pkgs/pkg-test1.zip"
|
|
$ "raco pkg remove --no-trash pkg-test1"
|
|
(check-empty)
|
|
|
|
|
|
(add-remove)
|
|
(check-single)
|
|
|
|
(add-remove)
|
|
(check-double)
|
|
|
|
$ "raco pkg empty-trash"
|
|
(check-empty)
|
|
|
|
$ "raco pkg config --set trash-max-packages 1"
|
|
(add-remove)
|
|
(check-single)
|
|
(add-remove)
|
|
(check-single)
|
|
$ "raco pkg config --set trash-max-packages 10"
|
|
(add-remove)
|
|
(check-double)
|
|
|
|
$ "raco pkg config --set trash-max-seconds 0"
|
|
(add-remove)
|
|
(check-single))))
|