diff --git a/pkgs/plt-services/meta/pkg-index/official/.gitignore b/pkgs/plt-services/meta/pkg-index/official/.gitignore index 7cb2d9135e..00298008dd 100644 --- a/pkgs/plt-services/meta/pkg-index/official/.gitignore +++ b/pkgs/plt-services/meta/pkg-index/official/.gitignore @@ -1,7 +1,3 @@ /root -/static/pkgs -/static/pkg -/static/pkgs-all -*json -/static/atom.xml -/static.gz +/static-gen +/static-gen.gz diff --git a/pkgs/plt-services/meta/pkg-index/official/common.rkt b/pkgs/plt-services/meta/pkg-index/official/common.rkt index 544df31ff1..6d0880b6c3 100644 --- a/pkgs/plt-services/meta/pkg-index/official/common.rkt +++ b/pkgs/plt-services/meta/pkg-index/official/common.rkt @@ -27,7 +27,8 @@ (define pkgs-path (build-path root "pkgs")) (make-directory* pkgs-path) -(define static-path (build-path src "static")) +(define static.src-path (build-path src "static")) +(define static-path (build-path src "static-gen")) (define (package-list) (sort (map path->string (directory-list pkgs-path)) diff --git a/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt b/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt index 27c78944e9..525465b3b1 100644 --- a/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt +++ b/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt @@ -53,9 +53,11 @@ (package-info p) #hash())) (define new-pi (hash-deep-merge pi more-pi)) - (define updated-pi (let ([now (current-seconds)]) - (for/fold ([pi new-pi]) ([k (in-list '(last-edit last-checked last-updated))]) - (hash-set pi k now)))) + (define updated-pi + (let ([now (current-seconds)]) + (for/fold ([pi new-pi]) + ([k (in-list '(last-edit last-checked last-updated))]) + (hash-set pi k now)))) (package-info-set! p updated-pi) (signal-update! (list p))) (response/sexpr #t)])) @@ -379,7 +381,7 @@ (printf "launching on port ~a\n" port) (signal-static! empty) (thread - (λ () + (λ () (forever (sleep (* 24 60 60)) (signal-update! empty)))) diff --git a/pkgs/plt-services/meta/pkg-index/official/s3.rkt b/pkgs/plt-services/meta/pkg-index/official/s3.rkt index e186114b8a..4a889ae4dc 100644 --- a/pkgs/plt-services/meta/pkg-index/official/s3.rkt +++ b/pkgs/plt-services/meta/pkg-index/official/s3.rkt @@ -11,7 +11,7 @@ (make-directory* (path-only p))) (define s3-config (build-path (find-system-path 'home-dir) ".s3cfg-plt")) -(define s3-bucket "pkg.racket-lang.org") +(define s3-bucket "pkgs.racket-lang.org") (define static.gz-path (path-add-suffix static-path ".gz")) diff --git a/pkgs/plt-services/meta/pkg-index/official/static.rkt b/pkgs/plt-services/meta/pkg-index/official/static.rkt index ddbdf9a399..02e286be25 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static.rkt +++ b/pkgs/plt-services/meta/pkg-index/official/static.rkt @@ -2,6 +2,8 @@ (require web-server/http web-server/dispatch racket/file + racket/port + racket/system racket/match json racket/date @@ -239,14 +241,26 @@ (define (cache url file) (define p (build-path static-path file)) (make-directory* (path-only p)) - (with-output-to-file p - #:exists 'replace - (λ () ((response-output (main-dispatch (url->request url))) (current-output-port)))) - (with-output-to-file (path-add-suffix p #".json") - #:exists 'replace - (λ () (write-json (convert-to-json (file->value p))))) + + (define bs + (with-output-to-bytes + (λ () + ((response-output (main-dispatch (url->request url))) + (current-output-port))))) + (unless (and (file-exists? p) + (bytes=? bs (file->bytes p))) + (with-output-to-file p + #:exists 'replace + (λ () (display bs))) + (with-output-to-file (path-add-suffix p #".json") + #:exists 'replace + (λ () (write-json (convert-to-json (file->value p)))))) (void)) + (system (format "cp -pr ~a/* ~a/" + static.src-path + static-path)) + (cache "/atom.xml" "atom.xml") (cache "/pkgs" "pkgs") (cache "/pkgs-all" "pkgs-all") diff --git a/pkgs/plt-services/meta/pkg-index/official/static/index.js b/pkgs/plt-services/meta/pkg-index/official/static/index.js index 236c10bb02..cbb7fae8d5 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.js +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.js @@ -1,5 +1,8 @@ -var dynamic_host = "pkgd.racket-lang.org"; -var dynamic_port = 443; +// xxx change this once the new dns entries are in +//var dynamic_host = "pkgd.racket-lang.org"; +//var dynamic_port = 443; +var dynamic_host = "plt-etc.byu.edu"; +var dynamic_port = 9004; function dynamic_url ( u ) { return "https://" + dynamic_host + ":" + dynamic_port + u + "?callback=?"; } diff --git a/pkgs/plt-services/meta/pkg-index/sync.sh b/pkgs/plt-services/meta/pkg-index/sync.sh index 02d38ab9c3..d8c4591d07 100755 --- a/pkgs/plt-services/meta/pkg-index/sync.sh +++ b/pkgs/plt-services/meta/pkg-index/sync.sh @@ -1,10 +1,13 @@ #!/bin/sh # planet-compat -rsync -a --progress -h --delete --exclude root --exclude compiled --exclude doc ../../meta/pkg-index/ plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index/ +rsync -a --progress -h --delete --exclude root --exclude static-gen --exclude static-gen.gz --exclude compiled --exclude doc ../../meta/pkg-index/ plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index/ rsync -a --progress -h --delete plt-etc:local/galaxy-roots/planet-compat/ planet-compat/root/ rsync -a --progress -h --delete plt-etc:local/galaxy-roots/official/ official/root/ +rsync -a --progress -h --delete plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index//official/static-gen official/static-gen +rsync -a --progress -h --delete plt-etc:local/new-plt/pkgs/plt-services/meta/pkg-index//official/static-gen.gz official/static-gen.gz + # official rsync -a --progress -h --delete --exclude root --exclude compiled --exclude doc ../../meta/pkg-index/ plt-etc:local/galaxy/meta/pkg-index/