raco pkg catalog-archive: support platform-specific dependencies
This commit is contained in:
parent
5df1b7906b
commit
7ed8ea040e
|
@ -498,6 +498,9 @@ for extracting existing catalog information.
|
||||||
[#:relative-sources? relative-sources? boolean? #f]
|
[#:relative-sources? relative-sources? boolean? #f]
|
||||||
[#:include includes (or/c #f (listof string?)) #f]
|
[#:include includes (or/c #f (listof string?)) #f]
|
||||||
[#:include-deps? include-deps? boolean? #f]
|
[#:include-deps? include-deps? boolean? #f]
|
||||||
|
[#:include-deps-sys+subtype include-deps-sys+subtype (or/c #f (cons/c symbol?
|
||||||
|
path-for-some-system?))
|
||||||
|
#f]
|
||||||
[#:exclude excludes (listof string?) '()]
|
[#:exclude excludes (listof string?) '()]
|
||||||
[#:fast-file-copy? fast-file-copy? boolean? #f]
|
[#:fast-file-copy? fast-file-copy? boolean? #f]
|
||||||
[#:quiet? quiet? boolean? #f]
|
[#:quiet? quiet? boolean? #f]
|
||||||
|
@ -519,6 +522,7 @@ for extracting existing catalog information.
|
||||||
@history[#:added "6.0.1.7"
|
@history[#:added "6.0.1.7"
|
||||||
#:changed "6.0.1.13" @elem{Added the @racket[#:package-exn-handler] argument.}
|
#:changed "6.0.1.13" @elem{Added the @racket[#:package-exn-handler] argument.}
|
||||||
#:changed "7.7.0.1" @elem{Added the @racket[#:include], @racket[#:include-deps?],
|
#:changed "7.7.0.1" @elem{Added the @racket[#:include], @racket[#:include-deps?],
|
||||||
|
@racket[#:include-deps-platform],
|
||||||
@racket[#:exclude], and @racket[#:fast-file-copy?] arguments.}]}
|
@racket[#:exclude], and @racket[#:fast-file-copy?] arguments.}]}
|
||||||
|
|
||||||
@defproc[(pkg-archive-pkgs [dest-dir path-string?]
|
@defproc[(pkg-archive-pkgs [dest-dir path-string?]
|
||||||
|
|
|
@ -1108,6 +1108,10 @@ for @nonterm{key}.
|
||||||
excluded via @DFlag{exclude}.}
|
excluded via @DFlag{exclude}.}
|
||||||
@item{@DFlag{include-deps} --- Modifies the @DFlag{includes} @nonterm{pkg} flag to imply all
|
@item{@DFlag{include-deps} --- Modifies the @DFlag{includes} @nonterm{pkg} flag to imply all
|
||||||
dependencies of @nonterm{pkg}.}
|
dependencies of @nonterm{pkg}.}
|
||||||
|
@item{@DFlag{include-deps-platform} @nonterm{sys} @nonterm{subpath} --- Modifies @DFlag{include-deps}
|
||||||
|
to imply only dependencies that match the platform @nonterm{sys}, which should be
|
||||||
|
a possible result of @racket[(system-type)], and @nonterm{subpath}, which should be
|
||||||
|
a possible result of @racket[(system-library-subpath #f)]}
|
||||||
@item{@DFlag{exclude} @nonterm{pkg} --- Can be specified multiple times. Removes @nonterm{pkg}
|
@item{@DFlag{exclude} @nonterm{pkg} --- Can be specified multiple times. Removes @nonterm{pkg}
|
||||||
from the set of packages in the archive and generated catalog. If @DFlag{include} is
|
from the set of packages in the archive and generated catalog. If @DFlag{include} is
|
||||||
used for the same @nonterm{pkg}, then @DFlag{exclude} takes
|
used for the same @nonterm{pkg}, then @DFlag{exclude} takes
|
||||||
|
@ -1121,8 +1125,8 @@ for @nonterm{key}.
|
||||||
]
|
]
|
||||||
|
|
||||||
@history[#:added "6.0.17"
|
@history[#:added "6.0.17"
|
||||||
#:changed "7.7.0.1" @elem{Added @DFlag{include}, @DFlag{include-deps}, @DFlag{exclude},
|
#:changed "7.7.0.1" @elem{Added @DFlag{include}, @DFlag{include-deps}, @DFlag{include-deps-platform},
|
||||||
and @DFlag{fast-file-copy}.}]
|
@DFlag{exclude}, and @DFlag{fast-file-copy}.}]
|
||||||
}
|
}
|
||||||
|
|
||||||
@subcommand{@command/toc{archive} @nonterm{option} ... @nonterm{dest-dir} @nonterm{pkg} ...
|
@subcommand{@command/toc{archive} @nonterm{option} ... @nonterm{dest-dir} @nonterm{pkg} ...
|
||||||
|
|
|
@ -53,6 +53,9 @@
|
||||||
[pattern (#:str name:id default:expr)
|
[pattern (#:str name:id default:expr)
|
||||||
#:attr (arg-val 1) (list #'name)
|
#:attr (arg-val 1) (list #'name)
|
||||||
#:attr fun #'identity]
|
#:attr fun #'identity]
|
||||||
|
[pattern (#:strs name:id ... default:expr)
|
||||||
|
#:attr (arg-val 1) (syntax->list #'(name ...))
|
||||||
|
#:attr fun #'list]
|
||||||
[pattern (#:num name:id default:expr)
|
[pattern (#:num name:id default:expr)
|
||||||
#:attr (arg-val 1) (list #'name)
|
#:attr (arg-val 1) (list #'name)
|
||||||
#:attr fun #'(string->num 'name)])
|
#:attr fun #'(string->num 'name)])
|
||||||
|
|
|
@ -199,6 +199,7 @@
|
||||||
#:quiet? boolean?
|
#:quiet? boolean?
|
||||||
#:include (or/c #f (listof string?))
|
#:include (or/c #f (listof string?))
|
||||||
#:include-deps? boolean?
|
#:include-deps? boolean?
|
||||||
|
#:include-deps-sys+subpath (or/c #f (cons/c symbol? path-for-some-system?))
|
||||||
#:exclude (or/c #f (listof string?))
|
#:exclude (or/c #f (listof string?))
|
||||||
#:fast-file-copy? boolean?
|
#:fast-file-copy? boolean?
|
||||||
#:package-exn-handler (string? exn:fail? . -> . any))
|
#:package-exn-handler (string? exn:fail? . -> . any))
|
||||||
|
|
|
@ -616,6 +616,7 @@
|
||||||
(include-list (cons pkg (or (include-list) '())))]
|
(include-list (cons pkg (or (include-list) '())))]
|
||||||
#:once-each
|
#:once-each
|
||||||
[#:bool include-deps () "Include dependencies of specified packages"]
|
[#:bool include-deps () "Include dependencies of specified packages"]
|
||||||
|
[(#:strs sys subpath #f) include-deps-platform () "Include one platform's dependencies"]
|
||||||
#:multi
|
#:multi
|
||||||
[(#:str pkg #f) exclude () "Exclude <pkg> from new catalog"
|
[(#:str pkg #f) exclude () "Exclude <pkg> from new catalog"
|
||||||
(exclude-list (cons pkg (exclude-list)))]
|
(exclude-list (cons pkg (exclude-list)))]
|
||||||
|
@ -633,6 +634,9 @@
|
||||||
#:relative-sources? relative
|
#:relative-sources? relative
|
||||||
#:include (include-list)
|
#:include (include-list)
|
||||||
#:include-deps? include-deps
|
#:include-deps? include-deps
|
||||||
|
#:include-deps-sys+subpath (and include-deps-platform
|
||||||
|
(cons (string->symbol (car include-deps-platform))
|
||||||
|
(string->path (cadr include-deps-platform))))
|
||||||
#:exclude (exclude-list)
|
#:exclude (exclude-list)
|
||||||
#:fast-file-copy? fast-file-copy
|
#:fast-file-copy? fast-file-copy
|
||||||
#:package-exn-handler (case pkg-fail
|
#:package-exn-handler (case pkg-fail
|
||||||
|
|
|
@ -11,7 +11,8 @@
|
||||||
"stage.rkt"
|
"stage.rkt"
|
||||||
"desc.rkt"
|
"desc.rkt"
|
||||||
"create.rkt"
|
"create.rkt"
|
||||||
"path.rkt")
|
"path.rkt"
|
||||||
|
"dep.rkt")
|
||||||
|
|
||||||
(provide pkg-catalog-archive)
|
(provide pkg-catalog-archive)
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@
|
||||||
src-catalogs
|
src-catalogs
|
||||||
#:include [include-names #f]
|
#:include [include-names #f]
|
||||||
#:include-deps? [include-deps? #f]
|
#:include-deps? [include-deps? #f]
|
||||||
|
#:include-deps-sys+subpath [include-deps-sys+subpath #f]
|
||||||
#:exclude [exclude-names '()]
|
#:exclude [exclude-names '()]
|
||||||
#:from-config? [from-config? #f]
|
#:from-config? [from-config? #f]
|
||||||
#:state-catalog [state-catalog #f]
|
#:state-catalog [state-catalog #f]
|
||||||
|
@ -45,7 +47,7 @@
|
||||||
(filter-pkgs
|
(filter-pkgs
|
||||||
(parameterize ([db:current-pkg-catalog-file temp-catalog-file])
|
(parameterize ([db:current-pkg-catalog-file temp-catalog-file])
|
||||||
(db:get-pkgs))
|
(db:get-pkgs))
|
||||||
include-names include-deps?
|
include-names include-deps? include-deps-sys+subpath
|
||||||
(cons "racket" exclude-names)
|
(cons "racket" exclude-names)
|
||||||
temp-catalog-file))
|
temp-catalog-file))
|
||||||
;; Reset state catalog to new packages:
|
;; Reset state catalog to new packages:
|
||||||
|
@ -155,7 +157,7 @@
|
||||||
|
|
||||||
;; ----------------------------------------
|
;; ----------------------------------------
|
||||||
|
|
||||||
(define (filter-pkgs pkgs include-names include-deps? exclude-names catalog)
|
(define (filter-pkgs pkgs include-names include-deps? include-deps-sys+subpath exclude-names catalog)
|
||||||
(cond
|
(cond
|
||||||
[(not include-names)
|
[(not include-names)
|
||||||
(if (null? exclude-names)
|
(if (null? exclude-names)
|
||||||
|
@ -181,12 +183,20 @@
|
||||||
(loop (hash-set include-table name #t)
|
(loop (hash-set include-table name #t)
|
||||||
(append
|
(append
|
||||||
(if include-deps?
|
(if include-deps?
|
||||||
(let ([pkg (hash-ref pkg-map name)])
|
(let ([pkg (hash-ref pkg-map name #f)])
|
||||||
(map car
|
(cond
|
||||||
(parameterize ([db:current-pkg-catalog-file catalog])
|
[(not pkg)
|
||||||
(db:get-pkg-dependencies name
|
;; Skip a missing dependency
|
||||||
(db:pkg-catalog pkg)
|
null]
|
||||||
(db:pkg-checksum pkg)))))
|
[else
|
||||||
|
(for/list ([dep (in-list
|
||||||
|
(parameterize ([db:current-pkg-catalog-file catalog])
|
||||||
|
(db:get-pkg-dependencies name
|
||||||
|
(db:pkg-catalog pkg)
|
||||||
|
(db:pkg-checksum pkg))))]
|
||||||
|
#:when (or (not include-deps-sys+subpath)
|
||||||
|
(dependency-for-platform? dep include-deps-sys+subpath)))
|
||||||
|
(car dep))]))
|
||||||
null)
|
null)
|
||||||
(cdr todo-names)))]))])))
|
(cdr todo-names)))]))])))
|
||||||
(for/list ([pkg (in-list pkgs)]
|
(for/list ([pkg (in-list pkgs)]
|
||||||
|
|
|
@ -34,3 +34,7 @@
|
||||||
(define p (dependency-lookup '#:platform dep))
|
(define p (dependency-lookup '#:platform dep))
|
||||||
(or (not p) (matching-platform? p #:cross? #t)))
|
(or (not p) (matching-platform? p #:cross? #t)))
|
||||||
|
|
||||||
|
(define (dependency-for-platform? dep sys+subpath)
|
||||||
|
(define p (dependency-lookup '#:platform dep))
|
||||||
|
(or (not p) (matching-platform? p #:system-type (car sys+subpath)
|
||||||
|
#:system-library-subpath (cdr sys+subpath))))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user