球拍:得到包校验和

时间:2016-01-23 14:36:20

标签: package version racket

我想在不使用raco pkg show -l <PKG-NAME>的情况下获取已安装软件包的校验和。类似的东西:

(define scribble-checksum (get-checksum "scribble"))

1 个答案:

答案 0 :(得分:3)

使用pkg/lib API:

#lang racket/base

(require racket/format pkg/lib)

(define (get-checksum str)
  (define tbl (installed-pkg-table #:scope 'installation))
  (define info (hash-ref tbl str))
  (define chk (pkg-info-checksum info))
  (~a chk #:max-width 8))

然后你可以做以下事情:

(get-checksum "typed-racket")
;; Returns: "f53314a2" for me, today