Loading plan.lisp +53 −46 Original line number Diff line number Diff line Loading @@ -213,29 +213,36 @@ the action of OPERATION on COMPONENT in the PLAN")) ;; Note that if e.g. LOAD-OP only depends on up-to-date files, but ;; hasn't been done in the current image yet, then it can have a non-T timestamp, ;; yet a NIL done-in-image-p flag. (let* ((stamp-lookup #'(lambda (o c) (if-let (it (plan-action-status plan o c)) (action-stamp it) t))) (out-files (output-files o c)) (in-files (input-files o c)) ;; Three kinds of actions: (nest (block ()) (let ((dep-stamp ; collect timestamp from dependencies (or T if forced or out-of-date) (visit-dependencies plan o c #'(lambda (o c) (if-let (it (plan-action-status plan o c)) (action-stamp it) t))))) ;; out-of-date dependency: don't bother expensively querying the filesystem (when (and (eq dep-stamp t) (not just-done)) (return (values t nil)))) ;; collect timestamps from inputs, and exit early if any is missing (let* ((in-files (input-files o c)) (in-stamps (mapcar #'get-file-stamp in-files)) (missing-in (loop :for f :in in-files :for s :in in-stamps :unless s :collect f)) (latest-in (stamps-latest (cons dep-stamp in-stamps)))) (when (and missing-in (not just-done)) (return (values t nil)))) ;; collect timestamps from outputs, and exit early if any is missing (let* ((out-files (output-files o c)) (out-stamps (mapcar (if just-done 'register-file-stamp 'get-file-stamp) out-files)) (missing-out (loop :for f :in out-files :for s :in out-stamps :unless s :collect f)) (earliest-out (stamps-earliest out-stamps))) (when (and missing-out (not just-done)) (return (values t nil)))) (let* (;; There are three kinds of actions: (out-op (and out-files t)) ; those that create files on the filesystem ;;(image-op (and in-files (null out-files))) ; those that load stuff into the image ;;(null-op (and (null out-files) (null in-files))) ; placeholders that do nothing ;; When was the thing last actually done? (Now, or ask.) (op-time (or just-done (component-operation-time o c))) ;; Accumulated timestamp from dependencies (or T if forced or out-of-date) (dep-stamp (visit-dependencies plan o c stamp-lookup)) ;; Time stamps from the files at hand, and whether any is missing (out-stamps (mapcar (if just-done 'register-file-stamp 'get-file-stamp) out-files)) (in-stamps (mapcar #'get-file-stamp in-files)) (missing-in (loop :for f :in in-files :for s :in in-stamps :unless s :collect f)) (missing-out (loop :for f :in out-files :for s :in out-stamps :unless s :collect f)) (all-present (not (or missing-in missing-out))) ;; Has any input changed since we last generated the files? (earliest-out (stamps-earliest out-stamps)) (latest-in (stamps-latest (cons dep-stamp in-stamps))) (up-to-date-p (stamp<= latest-in earliest-out)) ;; If everything is up to date, the latest of inputs and outputs is our stamp (done-stamp (stamps-latest (cons latest-in out-stamps)))) Loading @@ -246,7 +253,7 @@ the action of OPERATION on COMPONENT in the PLAN")) ~:[~; or ~]~:[~*~;~*its output file~:p~2:*~{ ~S~}~*~]" (action-description o c) missing-in (length missing-in) (and missing-in missing-out) missing-out (length missing-out))) missing-out (length missing-out)))) ;; Note that we use stamp<= instead of stamp< to play nice with generated files. ;; Any race condition is intrinsic to the limited timestamp resolution. (if (or just-done ;; The done-stamp is valid: if we're just done, or Loading Loading
plan.lisp +53 −46 Original line number Diff line number Diff line Loading @@ -213,29 +213,36 @@ the action of OPERATION on COMPONENT in the PLAN")) ;; Note that if e.g. LOAD-OP only depends on up-to-date files, but ;; hasn't been done in the current image yet, then it can have a non-T timestamp, ;; yet a NIL done-in-image-p flag. (let* ((stamp-lookup #'(lambda (o c) (if-let (it (plan-action-status plan o c)) (action-stamp it) t))) (out-files (output-files o c)) (in-files (input-files o c)) ;; Three kinds of actions: (nest (block ()) (let ((dep-stamp ; collect timestamp from dependencies (or T if forced or out-of-date) (visit-dependencies plan o c #'(lambda (o c) (if-let (it (plan-action-status plan o c)) (action-stamp it) t))))) ;; out-of-date dependency: don't bother expensively querying the filesystem (when (and (eq dep-stamp t) (not just-done)) (return (values t nil)))) ;; collect timestamps from inputs, and exit early if any is missing (let* ((in-files (input-files o c)) (in-stamps (mapcar #'get-file-stamp in-files)) (missing-in (loop :for f :in in-files :for s :in in-stamps :unless s :collect f)) (latest-in (stamps-latest (cons dep-stamp in-stamps)))) (when (and missing-in (not just-done)) (return (values t nil)))) ;; collect timestamps from outputs, and exit early if any is missing (let* ((out-files (output-files o c)) (out-stamps (mapcar (if just-done 'register-file-stamp 'get-file-stamp) out-files)) (missing-out (loop :for f :in out-files :for s :in out-stamps :unless s :collect f)) (earliest-out (stamps-earliest out-stamps))) (when (and missing-out (not just-done)) (return (values t nil)))) (let* (;; There are three kinds of actions: (out-op (and out-files t)) ; those that create files on the filesystem ;;(image-op (and in-files (null out-files))) ; those that load stuff into the image ;;(null-op (and (null out-files) (null in-files))) ; placeholders that do nothing ;; When was the thing last actually done? (Now, or ask.) (op-time (or just-done (component-operation-time o c))) ;; Accumulated timestamp from dependencies (or T if forced or out-of-date) (dep-stamp (visit-dependencies plan o c stamp-lookup)) ;; Time stamps from the files at hand, and whether any is missing (out-stamps (mapcar (if just-done 'register-file-stamp 'get-file-stamp) out-files)) (in-stamps (mapcar #'get-file-stamp in-files)) (missing-in (loop :for f :in in-files :for s :in in-stamps :unless s :collect f)) (missing-out (loop :for f :in out-files :for s :in out-stamps :unless s :collect f)) (all-present (not (or missing-in missing-out))) ;; Has any input changed since we last generated the files? (earliest-out (stamps-earliest out-stamps)) (latest-in (stamps-latest (cons dep-stamp in-stamps))) (up-to-date-p (stamp<= latest-in earliest-out)) ;; If everything is up to date, the latest of inputs and outputs is our stamp (done-stamp (stamps-latest (cons latest-in out-stamps)))) Loading @@ -246,7 +253,7 @@ the action of OPERATION on COMPONENT in the PLAN")) ~:[~; or ~]~:[~*~;~*its output file~:p~2:*~{ ~S~}~*~]" (action-description o c) missing-in (length missing-in) (and missing-in missing-out) missing-out (length missing-out))) missing-out (length missing-out)))) ;; Note that we use stamp<= instead of stamp< to play nice with generated files. ;; Any race condition is intrinsic to the limited timestamp resolution. (if (or just-done ;; The done-stamp is valid: if we're just done, or Loading