Megatest

Check-in [3f986ece7b]
Login
Overview
Comment:Process agnostic edits for sretrieve
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | v1.60
Files: files | file ages | folders
SHA1: 3f986ece7b4f1849ad244d60540f51617a4575b9
User & Date: ritikaag on 2016-02-19 11:18:04
Other Links: branch diff | manifest | tags
Context
2016-02-19
14:52
Edits to db.scm check-in: 6437a9c7e9 user: ritikaag tags: v1.60
11:18
Process agnostic edits for sretrieve check-in: 3f986ece7b user: ritikaag tags: v1.60
2016-02-18
23:44
Added last_update for dashboard speedup and added updating the db to -cleanup-db check-in: a887c3412e user: matt tags: v1.60
Changes

Modified sretrieve.scm from [911a84e53e] to [76eaef987d].

44
45
46
47
48
49
50
51

52
53
54

55
56
57
58
59
60
61
44
45
46
47
48
49
50

51
52
53

54
55
56
57
58
59
60
61







-
+


-
+







(include "megatest-fossil-hash.scm")

;;
;; GLOBALS
;;
(define *verbosity* 1)
(define *logging* #f)

(define *exe-name* (pathname-file (car (argv))))
(define *sretrieve:current-tab-number* 0)
(define *args-hash* (make-hash-table))
(define sretrieve:help (conc "Usage: sretrieve [action [params ...]]
(define sretrieve:help (conc "Usage: " *exe-name* " [action [params ...]]

  ls                     : list contents of target area
  get <relversion>       : retrieve data for release <version>
    -m \"message\"       : why retrieved?

  log                    : get listing of recent downloads

114
115
116
117
118
119
120
121

122
123
124
125
126
127
128
114
115
116
117
118
119
120

121
122
123
124
125
126
127
128







-
+







    (if (not path)
	(begin
	  (debug:print 0 "[database]\nlocation /some/path\n\n Is missing from the config file!")
	  (exit 1)))
    (if (and path
	     (directory? path)
	     (file-read-access? path))
	(let* ((dbpath    (conc path "/sretrieve.db"))
	(let* ((dbpath    (conc path "/" *exe-name* ".db"))
	       (writeable (file-write-access? dbpath))
	       (dbexists  (file-exists? dbpath)))
	  (handle-exceptions
	   exn
	   (begin
	     (debug:print 2 "ERROR: problem accessing db " dbpath
			  ((condition-property-accessor 'exn 'message) exn))
444
445
446
447
448
449
450
451

452
453
454
455
456
457
458
459
460
461
462
463
464
444
445
446
447
448
449
450

451
452
453
454
455
456
457
458
459
460
461
462
463
464







-
+













		 (print "Files in " base-dir)
                 (sretrieve:do-as-calling-user
                    (lambda ()
		 (process-execute "/bin/ls" (list base-dir)))))
	       (print "ERROR: No base dir specified!"))))
	((log)
	 (sretrieve:db-do configdat (lambda (db)
				     (print "Listing actions")
				     (print "Logs : ")
				     (query (for-each-row
					     (lambda (row)
					       (apply print (intersperse row " | "))))
					    (sql db "SELECT * FROM actions")))))
	(else
	 (print "ERROR: Unrecognised command. Try \"sretrieve help\""))))
     ;; multi-word commands
     ((null? rema)(print sretrieve:help))
     ((>= (length rema) 2)
      (apply sretrieve:process-action configdat (car rema)(cdr rema)))
     (else (debug:print 0 "ERROR: Unrecognised command. Try \"sretrieve help\"")))))

(main)