From 3954ead8e715af17d519776127ffccbecb95e71b Mon Sep 17 00:00:00 2001 From: Jay McCarthy Date: Tue, 15 Oct 2013 06:29:07 -0600 Subject: [PATCH] Generate info files for 5.3.6 correctly --- .../meta/pkg-index/official/static.rkt | 28 +++++++++++++++++-- .../meta/pkg-index/official/static/index.js | 24 +++++++++------- .../meta/pkg-index/official/update.rkt | 2 +- 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/pkgs/plt-services/meta/pkg-index/official/static.rkt b/pkgs/plt-services/meta/pkg-index/official/static.rkt index 5a6677186e..b918ddaa51 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static.rkt +++ b/pkgs/plt-services/meta/pkg-index/official/static.rkt @@ -51,14 +51,34 @@ (for ([pkg-name (in-list pkg-list)]) (define ht (file->value (build-path pkgs-path pkg-name))) + (define versions-ht + (hash-set (hash-ref ht 'versions (hash)) + 'default + (hasheq 'source (hash-ref ht 'source "") + 'checksum (hash-ref ht 'checksum "")))) + + (define (hash-ref-or ht ks) + (or (for/or ([k (in-list ks)]) + (hash-ref ht k #f)) + (error 'hash-ref-or "Keys (~v) not found in ~e" ks ht))) + + (define versions-5.3.6 + (hash-ref-or versions-ht '("5.3.6" default))) + (define source-5.3.6 + (hash-ref versions-5.3.6 'source)) + (define checksum-5.3.6 + (hash-ref versions-5.3.6 'checksum)) + (hash-set! pkg-ht pkg-name (hash-set* ht 'name pkg-name + 'source source-5.3.6 + 'checksum checksum-5.3.6 'last-updated (hash-ref ht 'last-updated (current-seconds)) 'last-checked (hash-ref ht 'last-checked (current-seconds)) 'last-edit (hash-ref ht 'last-edit (current-seconds)) - 'versions (hash-ref ht 'versions empty) + 'versions versions-ht 'ring (hash-ref ht 'ring 2) 'tags (hash-ref ht 'tags empty) 'authors (author->list (hash-ref ht 'author ""))))) @@ -159,7 +179,11 @@ (hash-set* ht 'conflicts conflicts - 'source_url (package-url->useful-url (hash-ref ht 'source)) + 'versions + (for/hash ([(v vht) (in-hash (hash-ref ht 'versions))]) + (values v + (hash-set vht 'source_url + (package-url->useful-url (hash-ref vht 'source))))) 'search-terms (let* ([st (hasheq)] [st (for/fold ([st st]) 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 b9a2443b28..ffa9018131 100644 --- a/pkgs/plt-services/meta/pkg-index/official/static/index.js +++ b/pkgs/plt-services/meta/pkg-index/official/static/index.js @@ -77,11 +77,11 @@ $( document ).ready(function() { else { $( "#pi_add_author_row" ).hide(); } - $( "#pi_source" ).html( $('', { text: pkgi['source'], - href: pkgi['source_url'] } )); - make_editbutton ( "pi_source", pkgi['source'], submit_mod_source ); + $( "#pi_source" ).html( $('', { text: pkgi['versions']['default']['source'], + href: pkgi['versions']['default']['source_url'] } )); + make_editbutton ( "pi_source", pkgi['versions']['default']['source'], submit_mod_source ); - $( "#pi_checksum" ).html("").text( pkgi['checksum'] ); + $( "#pi_checksum" ).html("").text( pkgi['versions']['default']['checksum'] ); if ( pkgi['checksum-error'] ) { $( "#pi_checksum" ).append( [ "Error:", $("
").text(pkgi['checksum-error']) ] ); }
 
@@ -100,12 +100,16 @@ $( document ).ready(function() {
                 return [tag, " "]; } } ) ));
 
         $( "#pi_versions" ).html("").append( $.map( pkgi['versions'], function ( vo, v ) {
-            return [ $('').append( $('').html("").append(
-                v, (mypkg_p ? [" ", jslink( "[x]", function () { submit_remove_version(v); }) ] : "") ),
-                                       $('').html(vo['source']) ),
-                     $('').append( $('').html(""),
-                                       $('').html(vo['checksum']) ),
-                     " "]; } ) );
+            if ( v == 'default' ) {
+                return []; }
+            else {
+                return [ $('').append( $('').html("").append(
+                    v, (mypkg_p ? [" ", jslink( "[x]", function () { submit_remove_version(v); }) ] : "") ),
+                                           $('').html( $('', { text: vo['source'],
+                                                                      href: vo['source_url']  } ) ) ),
+                         $('').append( $('').html(""),
+                                           $('').html(vo['checksum']) ),
+                         " "]; } } ) );
         if ( mypkg_p ) {
             $( "#pi_add_version_row" ).show(); }
         else {
diff --git a/pkgs/plt-services/meta/pkg-index/official/update.rkt b/pkgs/plt-services/meta/pkg-index/official/update.rkt
index 22c4559e2c..df1050dabb 100644
--- a/pkgs/plt-services/meta/pkg-index/official/update.rkt
+++ b/pkgs/plt-services/meta/pkg-index/official/update.rkt
@@ -47,7 +47,7 @@
                           (define old-checksum (hash-ref vi 'checksum ""))
                           (define new-checksum
                             (package-url->checksum
-                             (hash-ref vi 'source)))
+                             (hash-ref vi 'source "")))
                           (values v
                                   (hash-set vi 'checksum
                                             (or new-checksum