Index: datashare-testing/.sretrieve.config ================================================================== --- datashare-testing/.sretrieve.config +++ datashare-testing/.sretrieve.config @@ -1,11 +1,10 @@ [settings] allowed-users matt mrwellan pjhatwal allowed-chars [0-9a-zA-Z\-\.]+ +packages-config packages.config conversion-script import-releases.sh -upstream-file incoming.yaml +upstream-file incoming.yaml [database] location #{scheme (create-directory "/tmp/#{getenv USER}" #t)} -# -[include releases.config] ADDED datashare-testing/packages.config Index: datashare-testing/packages.config ================================================================== --- /dev/null +++ datashare-testing/packages.config @@ -0,0 +1,4 @@ +# release release-status release-date +[kits] +full_v1.60 release WW15.1 +full_v1.60 alpha WW01.2 DELETED datashare-testing/releases.config Index: datashare-testing/releases.config ================================================================== --- datashare-testing/releases.config +++ /dev/null @@ -1,4 +0,0 @@ -# release release-status release-date -[bundle kits] -v1.50 release WW15.1 - Index: sretrieve.scm ================================================================== --- sretrieve.scm +++ sretrieve.scm @@ -80,10 +80,16 @@ retriever TEXT NOT NULL, datetime TIMESTAMP DEFAULT (strftime('%s','now')), srcpath TEXT NOT NULL, comment TEXT DEFAULT '' NOT NULL, state TEXT DEFAULT 'new');" + "CREATE TABLE IF NOT EXISTS bundles + (id INTEGER PRIMARY KEY, + bundle TEXT NOT NULL, + release TEXT NOT NULL, + status TEXT NOT NULL, + event_date TEXT NOT NULL);" ))) (define (sretrieve:register-action db action submitter source-path comment) (exec (sql db "INSERT INTO actions (action,submitter,srcpath,comment) VALUES(?,?,?,?)") @@ -331,10 +337,33 @@ (ini:property-separator #\space) (if (file-exists? fname) ;; (ini:read-ini fname) (read-config fname #f #t) (make-hash-table)))) + +(define (sretrieve:load-packages configdat exe-dir) + (push-directory exe-dir) + (let* ((packages-config (configf:lookup configdat "settings" "packages-config")) + (conversion-script (configf:lookup configdat "settings" "conversion-script")) + (upstream-file (configf:lookup configdat "settings" "upstream-file"))) + (if (file-exists? upstream-file) + (if (or (not (file-exists? packages-config)) ;; if not created call the updater, otherwise call only if upstream newer + (> (file-modification-time upstream-file)(file-modification-time packages-config))) + (handle-exceptions + exn + (print "ERROR: failed to run script " conversion-script " with params " upstream-file " " packages-config) + (let ((pid (process-run conversion-script (list source-path target-dir)))) + (process-wait pid))) + (print "Skipping update of " packages-config " from " upstream-file)) + (print "Skipping update of " packages-config " as " upstream-file " not found")) + (ini:property-separator-patt " * *") + (ini:property-separator #\space) + (let ((res (if (file-exists? fname) + (read-config packages-config #f #t) + (make-hash-table)))) + (pop-directory) + res))) (define (sretrieve:process-action configdat action . args) (let* ((target-dir (configf:lookup configdat "settings" "target-dir")) (user (current-user-name)) (allowed-users (string-split