commit 39d1c13abe1d856726d34ed9388be054351535da
parent 665dfdcdc4c1352779f0e13354d382b2a6bffb12
Author: Matthew Flatt <mflatt@racket-lang.org>
Date: Fri, 4 Jul 2014 08:38:19 +0100
make site: propagate package dependencies, modules, etc. to catalog
original commit: 3f040f7a1a383b2000a5bb250da33b94815ccb0a
Diffstat:
2 files changed, 49 insertions(+), 11 deletions(-)
diff --git a/pkgs/distro-build-pkgs/distro-build-server/pack-built.rkt b/pkgs/distro-build-pkgs/distro-build-server/pack-built.rkt
@@ -13,12 +13,13 @@
(define create-mode 'built)
-(command-line
- #:once-each
- [("--mode") mode "Create package archives for <mode>"
- (set! create-mode (string->symbol mode))]
- #:args ()
- (void))
+(define pkg-info-file
+ (command-line
+ #:once-each
+ [("--mode") mode "Create package archives for <mode>"
+ (set! create-mode (string->symbol mode))]
+ #:args (pkg-info-file)
+ pkg-info-file))
(define build-dir "build")
(define dest-dir (build-path build-dir (~a create-mode)))
@@ -29,9 +30,12 @@
(make-directory* pkg-dest-dir)
(make-directory* catalog-pkg-dir)
+(define pkg-details (call-with-input-file* pkg-info-file read))
+
(for ([pkg (in-list (installed-pkg-names))])
(define native-zip (build-path native-dir (path-add-suffix pkg ".zip")))
(unless (file-exists? native-zip)
+ (define ht (hash-ref pkg-details pkg (hash)))
(define dest-zip (build-path pkg-dest-dir (~a pkg ".zip")))
(pkg-create 'zip pkg
#:source 'name
@@ -46,10 +50,10 @@
(simple-form-path dest-zip)))
'checksum (call-with-input-file* dest-zip sha1)
'name pkg
- 'author "plt@racket-lang.org"
- 'description "library"
- 'tags '()
- 'dependencies '()
- 'modules '())
+ 'author (hash-ref ht 'author "plt@racket-lang.org")
+ 'description (hash-ref ht 'author "library")
+ 'tags (hash-ref ht 'tags '())
+ 'dependencies (hash-ref ht 'dependencies '())
+ 'modules (hash-ref ht 'modules '()))
o)
(newline o)))))
diff --git a/pkgs/distro-build-pkgs/distro-build-server/pkg-info.rkt b/pkgs/distro-build-pkgs/distro-build-server/pkg-info.rkt
@@ -0,0 +1,34 @@
+#lang racket/base
+(require pkg/lib
+ racket/cmdline
+ net/url)
+
+(define dest-file #f)
+
+(define catalog
+ (command-line
+ #:once-each
+ [("-o") file "Output file"
+ (set! dest-file file)]
+ #:args
+ (catalog)
+ catalog))
+
+(define catalog-url
+ (if (regexp-match? #rx"^[a-z]+:" catalog)
+ (string->url catalog-url)
+ (path->url (path->complete-path catalog))))
+
+(define details
+ (parameterize ([current-pkg-catalogs (list catalog-url)])
+ (get-all-pkg-details-from-catalogs)))
+
+(define (write-out o)
+ (write details o)
+ (newline o))
+
+(if dest-file
+ (call-with-output-file* dest-file
+ #:exists 'truncate/replace
+ write-out)
+ (write-out (current-output-port)))