From 3f8cd3fde3e4b552c3ee03f9a14de128f0a72bab Mon Sep 17 00:00:00 2001
From: Jay McCarthy
Date: Mon, 14 Oct 2013 14:30:23 -0600
Subject: [PATCH] Fixing some S3/gzip stuff and add package removal
---
.../meta/pkg-index/official/common.rkt | 4 +-
.../meta/pkg-index/official/dynamic.rkt | 12 ++++++
.../meta/pkg-index/official/s3.rkt | 42 ++++++++-----------
.../meta/pkg-index/official/static/index.html | 5 ++-
.../meta/pkg-index/official/static/index.js | 12 +++++-
5 files changed, 45 insertions(+), 30 deletions(-)
diff --git a/pkgs/plt-services/meta/pkg-index/official/common.rkt b/pkgs/plt-services/meta/pkg-index/official/common.rkt
index 6d0880b6c3..b9703e5d49 100644
--- a/pkgs/plt-services/meta/pkg-index/official/common.rkt
+++ b/pkgs/plt-services/meta/pkg-index/official/common.rkt
@@ -49,9 +49,11 @@
(hash-ref pkg-info key
(λ ()
(match key
- [(or 'author 'checksum 'source)
+ [(or 'author 'source)
(error 'pkg "Package ~e is missing a required field: ~e"
(hash-ref pkg-info 'name) key)]
+ ['checksum
+ ""]
['ring
2]
['checksum-error
diff --git a/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt b/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt
index 525465b3b1..5bea8db7f7 100644
--- a/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt
+++ b/pkgs/plt-services/meta/pkg-index/official/dynamic.rkt
@@ -331,6 +331,16 @@
[else
#f]))))
+(define-jsonp/auth
+ (jsonp/package/del
+ ['pkg pkg])
+ (ensure-package-author
+ pkg
+ (λ ()
+ (package-remove! pkg)
+ (signal-static! empty)
+ #f)))
+
(define-jsonp/auth
(jsonp/package/curate
['pkg pkg]
@@ -363,6 +373,7 @@
(dispatch-rules
[("jsonp" "authenticate") jsonp/authenticate]
[("jsonp" "update") jsonp/update]
+ [("jsonp" "package" "del") jsonp/package/del]
[("jsonp" "package" "modify") jsonp/package/modify]
[("jsonp" "package" "version" "add") jsonp/package/version/add]
[("jsonp" "package" "version" "del") jsonp/package/version/del]
@@ -384,6 +395,7 @@
(λ ()
(forever
(sleep (* 24 60 60))
+ (printf "Running scheduled update.\n")
(signal-update! empty))))
(serve/servlet
main-dispatch
diff --git a/pkgs/plt-services/meta/pkg-index/official/s3.rkt b/pkgs/plt-services/meta/pkg-index/official/s3.rkt
index 271881da83..d168bb3ce9 100644
--- a/pkgs/plt-services/meta/pkg-index/official/s3.rkt
+++ b/pkgs/plt-services/meta/pkg-index/official/s3.rkt
@@ -7,45 +7,37 @@
racket/match
"common.rkt")
-(define (make-parent-directory* p)
- (make-directory* (path-only p)))
-
(define s3-config (build-path (find-system-path 'home-dir) ".s3cfg-plt"))
(define s3-bucket "pkgs.racket-lang.org")
-(define static.gz-path (path-add-suffix static-path ".gz"))
-
(define s3cmd-path (find-executable-path "s3cmd"))
(define (upload-all)
- (define root (simple-form-path static-path))
+ (gzip (format "~a/pkgs-all.json" static-path)
+ (format "~a/pkgs-all.json.gz" static-path))
- (for ([f (in-directory root)]
- #:when (file-exists? f))
- (define f.time (file-or-directory-modify-seconds f))
-
- (define rf (find-relative-path root f))
- (define gf (build-path static.gz-path rf))
- (make-parent-directory* gf)
-
- (define g.time
- (if (file-exists? gf)
- (file-or-directory-modify-seconds gf)
- -inf.0))
-
- (when (> f.time g.time)
- (printf "gzipping ~a\n" f)
- (gzip f gf)))
+ (system* s3cmd-path
+ "-c" s3-config
+ "sync"
+ "-m" "application/javascript"
+ "--acl-public"
+ "--add-header" "Content-Encoding: gzip"
+ "--delete-removed"
+ (format "~a/pkgs-all.json.gz" static-path)
+ (format "s3://~a/pkgs-all.json.gz" s3-bucket))
(system* s3cmd-path
"-c" s3-config
"sync"
"-M"
"--acl-public"
- "--add-header" "Content-Encoding:gzip"
"--delete-removed"
- (format "~a/" static.gz-path)
- (format "s3://~a/" s3-bucket)))
+ (format "~a/" static-path)
+ (format "s3://~a/" s3-bucket))
+
+
+
+ (void))
(define (upload-pkgs pkgs)
;; FUTURE make this more efficient
diff --git a/pkgs/plt-services/meta/pkg-index/official/static/index.html b/pkgs/plt-services/meta/pkg-index/official/static/index.html
index 2c16bdbe27..a9119d5c73 100644
--- a/pkgs/plt-services/meta/pkg-index/official/static/index.html
+++ b/pkgs/plt-services/meta/pkg-index/official/static/index.html
@@ -24,9 +24,10 @@
If you enter an unclaimed email address, then an account will
- be created.
+ be created with the password you type in, after you confirm
+ the email address.
Passwords are stored in the delicious bcrypt format, but
- transfered as plain-text over the HTTPS connection.
+ transferred as plain-text over an HTTPS connection.
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 6a527a60fc..b6a33d10c0 100644
--- a/pkgs/plt-services/meta/pkg-index/official/static/index.js
+++ b/pkgs/plt-services/meta/pkg-index/official/static/index.js
@@ -54,6 +54,13 @@ $( document ).ready(function() {
$( "#pi_name" ).text( pkgi['name'] );
make_editbutton ( "pi_name", pkgi['name'], submit_mod_name );
+ if ( mypkg_p ) {
+ $( "#pi_name" ).append( $('