Including build status and docs on pkgs.

This commit is contained in:
Jay McCarthy 2014-09-08 16:59:19 -04:00
parent c6b3f337e9
commit 891db224a0
6 changed files with 127 additions and 4 deletions

View File

@ -8,9 +8,7 @@
"common.rkt")
(define SUMMARY-HOST "pkg-build.racket-lang.org")
(define SUMMARY-NAME "summary.rktd")
(define SUMMARY-URL (string-append "/" SUMMARY-NAME))
(define SUMMARY-PATH (build-path cache-path SUMMARY-NAME))
(define SUMMARY-ETAG-PATH (build-path cache-path (format "~a.etag" SUMMARY-NAME)))
(define (extract-tag hs)

View File

@ -27,6 +27,9 @@
(define cache-path (build-path root "cache"))
(make-directory* cache-path)
(define SUMMARY-NAME "summary.rktd")
(define SUMMARY-PATH (build-path cache-path SUMMARY-NAME))
(define pkgs-path (build-path root "pkgs"))
(make-directory* pkgs-path)

View File

@ -44,9 +44,22 @@
[x
(error 'convert-to-json-key "~e" x)]))
(define (file->value* p dv)
(if (file-exists? p)
(file->value p)
dv))
;; From pkg-build/summary
(struct doc/main (name path) #:prefab)
(struct doc/extract (name path) #:prefab)
(struct doc/salvage (name path) #:prefab)
(struct doc/none (name) #:prefab)
(struct conflicts/indirect (path) #:prefab)
(define (generate-static)
(define pkg-list (package-list))
(define pkg-ht (make-hash))
(define build-summary (file->value* SUMMARY-PATH (hash)))
(for ([pkg-name (in-list pkg-list)])
(define ht (file->value (build-path pkgs-path pkg-name)))
@ -174,12 +187,28 @@
pkg-url-str]))
(for ([pkg (in-hash-keys pkg-ht)])
(define pb (hash-ref build-summary pkg #f))
(define (pbl k)
(and pb (hash-ref pb k #f)))
(hash-update!
pkg-ht pkg
(λ (ht)
(define conflicts (package-conflicts? pkg))
(hash-set*
ht
'build
(hash 'success-log (pbl 'success-log)
'failure-log (pbl 'failure-log)
'dep-failure-log (pbl 'dep-failure-log)
'conflicts-log (pbl 'conflicts-log)
'docs
(for/list ([d (in-list (or (pbl 'docs) empty))])
(match d
[(doc/main n p) (list "main" n p)]
[(doc/extract n p) (list "extract" n p)]
[(doc/salvage n p) (list "salvage" n p)]
[(doc/none n) (list "none" n)])))
'conflicts conflicts
'versions
(for/hash ([(v vht) (in-hash (hash-ref ht 'versions))])
@ -210,7 +239,36 @@
st)]
[st (if (empty? conflicts)
st
(hash-set st ':conflicts: #t))])
(hash-set st ':conflicts: #t))]
[st (if (pbl 'success-log)
(hash-set st ':build-success: #t)
st)]
[st (if (pbl 'failure-log)
(hash-set st ':build-fail: #t)
st)]
[st (if (pbl 'dep-failure-log)
(hash-set st ':build-dep-fail: #t)
st)]
[st (if (pbl 'conflicts-log)
(hash-set st ':build-conflicts: #t)
st)]
[pb-docs (pbl 'docs)]
[st (if (and pb-docs (cons? pb-docs)
(andmap (λ (d)
(or (doc/main? pb-docs)
(doc/extract? pb-docs)
(doc/salvage? pb-docs)))
pb-docs))
(hash-set st ':docs: #t)
st)]
[st (if (and pb-docs (cons? pb-docs)
(andmap (λ (d)
(or (doc/extract? pb-docs)
(doc/salvage? pb-docs)
(doc/none? pb-docs)))
pb-docs))
(hash-set st ':docs-error: #t)
st)])
st)))))

View File

@ -62,7 +62,9 @@
<tr><td>Ring:</td><td><span id="pi_ring"></span></td></tr>
<tr><td>Authors:</td><td><span id="pi_authors"></span></td></tr>
<tr id="pi_add_author_row"><td></td><td><input type="text" id="pi_add_author_text" class="text ui-widget-content ui-corner-all" /><button id="pi_add_author_button">Add Author</button></td></tr>
<tr><td>Documentation:</td><td><span id="pi_docs"></span></td></tr>
<tr><td>Source:</td><td><span id="pi_source"></span></td></tr>
<tr><td>Build Status</td><td><span id="pi_build"></span></td></tr>
<tr><td>Checksum:</td><td><span id="pi_checksum"></span></td></tr>
<tr><td>Last Updated:</td><td><span id="pi_last_updated"></span></td></tr>
<tr><td>Last Checked:</td><td><span id="pi_last_checked"></span></td></tr>
@ -87,9 +89,11 @@
<tr>
<th></th>
<th>Package</th>
<th>Docs</th>
<th>Authors</th>
<th>Description</th>
<th>Tags</th>
<th>Build</th>
</tr>
</thead>
<tbody id="packages_table">

View File

@ -1,3 +1,4 @@
var build_host = "http://pkg-build.racket-lang.org/";
var dynamic_host = "pkgd.racket-lang.org";
var dynamic_port = 443;
@ -100,6 +101,29 @@ $( document ).ready(function() {
$( "#pi_last_checked" ).text( format_time(pkgi['last-checked']) );
$( "#pi_last_edit" ).text( format_time(pkgi['last-edit']) );
// XXX show the doc[0] content?
$('#pi_docs').html("").append( $.map( pkgi['build']['docs'], function ( doc, i ) {
if ( doc[2] ) {
return $('<a>', { href: build_host + doc[2] } ).html(doc[1]); }
else {
return $('<del>').html(doc[1]); } } ) );
if ( pkgi['build']['failure-log'] ) {
$('#pi_build')
.append($('<span>')
.append($('<a>', { href: build_host + pkgi['build']['failure-log'] }).html( "fails" )));
} else if ( pkgi['build']['success-log'] && pkgi['build']['dep-failure-log'] ) {
$('#pi_build')
.append($('<span>')
.append($('<a>', { href: build_host + pkgi['build']['success-log'] }).html( "succeeds" ))
.append(" with ")
.append($('<a>', { href: build_host + pkgi['build']['dep-failure-log'] }).html( "dependency problems" )));
} else if ( pkgi['build']['success-log'] ) {
$('#pi_build')
.append($('<span>')
.append($('<a>', { href: build_host + pkgi['build']['success-log'] }).html( "succeeds" )));
}
$( "#pi_description" ).text( pkgi['description'] );
make_editbutton ( "pi_description", pkgi['description'], submit_mod_description );
@ -413,6 +437,25 @@ $( document ).ready(function() {
var dom = value['dom_obj'];
var bstatus;
if ( value['build']['failure-log'] ) {
bstatus = $('<td>', {class: 'build_red'})
.append($('<span>')
.append($('<a>', { href: build_host + value['build']['failure-log'] }).html( "fails" )));
} else if ( value['build']['success-log'] && value['build']['dep-failure-log'] ) {
bstatus = $('<td>', {class: 'build_red'})
.append($('<span>')
.append($('<a>', { href: build_host + value['build']['success-log'] }).html( "succeeds" ))
.append(" with ")
.append($('<a>', { href: build_host + value['build']['dep-failure-log'] }).html( "dependency problems" )));
} else if ( value['build']['success-log'] ) {
bstatus = $('<td>', {class: 'build_green'})
.append($('<span>')
.append($('<a>', { href: build_host + value['build']['success-log'] }).html( "succeeds" )));
} else {
bstatus = $('<td>').html("");
}
dom.attr("class", ((now - (60*60*24*2)) < value['last-updated'] ? "recent" : "old"))
.data( "obj", value)
.html("")
@ -421,11 +464,17 @@ $( document ).ready(function() {
.append( curate_span ),
$('<td>').html("")
.append( jslink( value['name'], function () { open_info ( value ); }) ),
$('<td>').append( $.map( value['build']['docs'], function ( doc, i ) {
if ( doc[2] ) {
return $('<a>', { href: build_host + doc[2] } ).html(doc[1]); }
else {
return $('<del>').html(doc[1]); } } ) ),
$('<td>').append( $.map( value['authors'], function ( author, i ) {
return addfilterlink ( author, "author:" + author, "possible" ); } ) ),
$('<td>').text( value['description'] ),
$('<td>').append( $.map( value['tags'], function ( tag, i ) {
return addfilterlink ( tag, tag, "possible" ); } ) )); }
return addfilterlink ( tag, tag, "possible" ); } ) ),
bstatus ); }
var pkgdb = {};
$.getJSON( "/pkgs-all.json.gz", function( resp ) {

View File

@ -155,6 +155,17 @@ tr#pi_delete_row td {
text-align: center;
}
.packages tr td:nth-child(7) {
text-align: center;
}
.packages tr td:nth-child(7) a {
text-decoration: none;
}
.build_green { background-color: #ccffcc; }
.build_yellow { background-color: #ffffcc; }
.build_red { background-color: #ffcccc; }
/* racket nav */
.racketnav {
background-color: #000000;