球拍:获取包校验和
racket: get package checksum
我想在不使用 raco pkg show -l <PKG-NAME>
的情况下获取已安装软件包的校验和。类似于:
(define scribble-checksum (get-checksum "scribble"))
使用 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
我想在不使用 raco pkg show -l <PKG-NAME>
的情况下获取已安装软件包的校验和。类似于:
(define scribble-checksum (get-checksum "scribble"))
使用 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