Index: Makefile ================================================================== --- Makefile +++ Makefile @@ -168,9 +168,11 @@ mv deploytarg/deploytarg deploytarg/dboard # DATASHAREO=configf.o common.o process.o tree.o dcommon.o margs.o launch.o gutils.o db.o synchash.o server.o \ # megatest-version.o tdb.o ods.o mt.o keys.o datashare-testing/datashare : datashare.scm $(OFILES) + mkdir -p /tmp/$(USER)/datashare /tmp/$(USER)/datashare/disk1 csc datashare.scm $(OFILES) -o datashare-testing/datashare datashare : datashare-testing/datashare - ./datashare-testing/datashare + BASEPATH=/tmp/$(USER)/basepath ./datashare-testing/datashare + Index: datashare-testing/.datashare.config ================================================================== --- datashare-testing/.datashare.config +++ datashare-testing/.datashare.config @@ -1,22 +1,34 @@ # Read in the users vars first (so the offical data cannot be overridden -[include datastore.config] +[include ~/.datashare.config] + +# Read in local overrides +[include datashare.config] + +# Replace [storage] with settings entry - more secure +[settings] + +storage /tmp/#{getenv USER}/datashare/disk1 \ + /tmp/#{getenv USER}/datashare/disk2 -[storage] -1 /tmp/datastore/eng +basepath #{getenv BASEPATH} [areas] synthesis asic/synthesis verilog asic/verilog customlibs custom/oalibs -[target] -basepath #{getenv BASEPATH} - [quality] 0 untested 1 lightly tested 2 tested 3 full QA [database] -location /tmp/datastore +location /tmp/#{getenv USER}/datashare + +[pathmaps] +SHELF /tmp/#{getenv USER}/theshelf + +[buildmethods] +customlibs make setup;make install + Index: datashare.scm ================================================================== --- datashare.scm +++ datashare.scm @@ -233,14 +233,30 @@ (create-directory targ-path #t) (process-run "rsync" (list "-av" source-path targ-path)) #t)) ;; #t on success (define (datastore:get-best-storage configdat) - (let ((store-areas (configf:get-section configdat "storage"))) - (print "store-areas:") - (pp store-areas) - (cadar store-areas))) + (let* ((storage (configf:lookup configdat "setup" "storage")) + (store-areas (if storage (string-split storage) '()))) + (datastore:find-most-space store-areas))) + +(define (datastore:find-most-space paths) + (fold (lambda (area res) + ;; (print "area=" area " res=" res) + (let ((maxspace (car res)) + (currpath (cdr res))) + ;; (print currpath " " maxspace) + (if (file-write-access? area) + (let ((currspace (with-input-from-pipe + (conc "df --output=avail " area) + (lambda ()(read)(read))))) + (if (> currspace maxspace) + (cons currspace area) + res)) + res))) + (cons 0 #f) + paths)) ;;====================================================================== ;; GUI ;;====================================================================== @@ -276,11 +292,11 @@ ;; (copy-link (iup:toggle #:expand "HORIZONTAL")) ;; (iteration (iup:textbox #:expand "YES" #:size "20x")) ;; (iteration (iup:textbox #:expand "HORIZONTAL" #:size "20x")) (comment-tb (iup:textbox #:expand "YES" #:multiline "YES")) (source-tb (iup:textbox #:expand "HORIZONTAL" - #:value (or (configf:lookup configdat "target" "basepath") + #:value (or (configf:lookup configdat "settings" "basepath") ""))) (publish (lambda (publish-type) (let* ((area-num (or (string->number (iup:attribute areas-sel "VALUE")) 0)) (area-dat (if (> area-num 0)(list-ref areas (- area-num 1))'("NOT SELECTED" "NOT SELECTED"))) (area-path (cadr area-dat)) @@ -343,14 +359,16 @@ (area-filter "%") (version-filter "%") (iter-filter ">= 0") (dat (make-hash-table)) ;; reverse lookup (apply (iup:button "Apply")) - (source (iup:textbox)) (submitter (iup:label "" #:expand "HORIZONTAL")) (date-submitted (iup:label "" #:expand "HORIZONTAL")) - (source-data (iup:label "" #:expand "HORIZONTAL")) + (comment (iup:label "" #:expand "HORIZONTAL")) + (copy-link (iup:label "" #:expand "HORIZONTAL")) + (quality (iup:label "" #:expand "HORIZONTAL")) + ;; (source-data (iup:label "" #:expand "HORIZONTAL")) (tb (iup:treebox #:value 0 #:name "Packages" #:expand "YES" #:addexpanded "NO" @@ -359,12 +377,36 @@ ;; (print "obj: " obj ", id: " id ", state: " state) (let* ((path (datastore:lst->path (cdr (tree:node->path obj id)))) (record (hash-table-ref/default dat path #f))) (if record (begin - (iup:attribute-set! submitter "TITLE" (datastore:pkg-get-submitter record)) - (iup:attribute-set! date-submitted "TITLE" (time->string (seconds->local-time (datastore:pkg-get-datetime record)))))) + (iup:attribute-set! submitter "TITLE" (datastore:pkg-get-submitter record)) + (iup:attribute-set! date-submitted "TITLE" (time->string (seconds->local-time (datastore:pkg-get-datetime record)))) + (iup:attribute-set! comment "TITLE" (datastore:pkg-get-comment record)) + (iup:attribute-set! quality "TITLE" (datastore:pkg-get-quality record)) + (iup:attribute-set! copy-link "TITLE" (datastore:pkg-get-store_type record)) + )) + (print "id=" id " path=" path " record=" record);; (tree:node->path obj id) " run-id: " run-id) + )))) + (tb2 (iup:treebox + #:value 0 + #:name "Packages" + #:expand "YES" + #:addexpanded "NO" + #:selection-cb + (lambda (obj id state) + ;; (print "obj: " obj ", id: " id ", state: " state) + (let* ((path (datastore:lst->path (cdr (tree:node->path obj id)))) + (record (hash-table-ref/default dat path #f))) + (if record + (begin + (iup:attribute-set! submitter "TITLE" (datastore:pkg-get-submitter record)) + (iup:attribute-set! date-submitted "TITLE" (time->string (seconds->local-time (datastore:pkg-get-datetime record)))) + (iup:attribute-set! comment "TITLE" (datastore:pkg-get-comment record)) + (iup:attribute-set! quality "TITLE" (datastore:pkg-get-quality record)) + (iup:attribute-set! copy-link "TITLE" (datastore:pkg-get-store_type record)) + )) (print "id=" id " path=" path " record=" record);; (tree:node->path obj id) " run-id: " run-id) )))) (refresh (lambda (obj) (let ((db (datashare:open-db configdat))) (for-each @@ -380,13 +422,22 @@ ;; (print "path=" path " pkgitem=" pkgitem) (hash-table-set! dat path pkgitem))) (datashare:get-pkgs db area-filter version-filter iter-filter)) (sqlite3:finalize! db))))) (iup:vbox - tb + (iup:hbox tb tb2) (iup:hbox (iup:button "Refresh" #:action refresh) apply) - (iup:hbox (iup:label "Submitter:" #:size label-size)(iup:hbox submitter)(iup:label "Date submitted:" #:size label-size)) + (iup:hbox (iup:label "Submitter: ") ;; #:size label-size) + submitter + (iup:label "Submitted on: ") ;; #:size label-size) + date-submitted) + (iup:hbox (iup:label "Data stored: ") + copy-link + (iup:label "Quality: ") + quality) + (iup:hbox (iup:label "Comment: ") + comment) ))))) (define (datashare:manage-view configdat) (iup:vbox (iup:hbox