Advertisement
Guest User

Untitled

a guest
Jan 30th, 2015
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.62 KB | None | 0 0
  1. doit DRY-RUN
  2. ===============
  3.  
  4. note use-case result columns:
  5.  
  6. - expected: *expected* by schettion72 :)
  7. - doit: as given by Oliver branch
  8.  
  9.  
  10.  
  11.  
  12. single task with file_dep and target
  13. --------------------------------------
  14.  
  15. dodo.py
  16. ```
  17. def task_single():
  18. return {
  19. 'file_dep': ["existing.txt"],
  20. 'actions': ["cat existing.txt > output1.txt"],
  21. 'targets': ["output1.txt"],
  22. }
  23. ```
  24.  
  25. Makefile
  26. ```
  27. output1.txt: existing.txt
  28. cat existing.txt > output1.txt
  29. ```
  30.  
  31. ```
  32. $ doit --dry-run output1.txt
  33. $ make -n output1.txt
  34. ```
  35.  
  36. use case | expected | make | doit |
  37. ---------------------------|------------|------------|------------|
  38. file dep doesnt exist | ERROR[1] | ERROR[2] | <span background-color="red">run</span> |
  39. task up-to-date | up-to-date | up-to-date | up-to-date |
  40. task not up-to-date | run | run | run |
  41.  
  42. [1] Exception: Dependent file 'existing.txt' does not exist.
  43.  
  44. [2] make: *** No rule to make target `existing.txt', needed by `output1'. Stop.
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. task1.target == task2.file_dep | task1.update == True
  52. -----------------------------------------------------
  53.  
  54.  
  55. dodo.py
  56. ```
  57. def task_chain():
  58. yield {'name': 't1',
  59. 'targets' : ["tmp1"],
  60. 'actions' : ["echo hi1 > tmp1"],
  61. 'uptodate': [True],
  62. }
  63. yield {'name': 't2',
  64. 'file_dep' : ["tmp1"],
  65. 'targets' : ["tmp2"],
  66. 'actions' : ["echo hi2 > tmp2"],
  67. }
  68. ```
  69.  
  70. Makefile
  71. ```
  72. tmp1:
  73. echo hi1 > tmp1
  74.  
  75. tmp2: tmp1
  76. echo hi2 > tmp2
  77. ```
  78.  
  79. ```
  80. $ doit --dry-run chain
  81. $ make -n tmp2
  82. ```
  83.  
  84. use case | expected | make | doit |
  85. ---------------------------|------------|------------|------------|
  86. tmp1 & tmp2 dont exist | run | run | run |
  87. tmp1 & tmp2 exist | up-to-date | up-to-date | up-to-date |
  88. tmp2 doesnt exist | run t2 | run t2 | run t2 |
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95. task1.target == task2.file_dep | make task1 is phony
  96. ------------------------------------------------------
  97.  
  98.  
  99. dodo.py
  100. ```
  101. def task_chain_phony():
  102. yield {'name': 't1',
  103. 'targets' : ["tmp1_phony"],
  104. 'actions' : ["echo hi1 > tmp1_phony"],
  105. }
  106. yield {'name': 't2',
  107. 'file_dep' : ["tmp1_phony"],
  108. 'targets' : ["tmp2_phony"],
  109. 'actions' : ["echo hi2 > tmp2_phony"],
  110. }
  111. ```
  112.  
  113. Makefile
  114. ```
  115. .PHONY: tmp1_phony
  116. tmp1_phony:
  117. echo hi1 > tmp1_phony
  118.  
  119. tmp2_phony: tmp1_phony
  120. echo hi2 > tmp2_phony
  121. ```
  122.  
  123.  
  124. ```
  125. $ doit --dry-run chain_phony
  126. $ make -n tmp2_phony
  127. ```
  128.  
  129. use case | expected | make | doit |
  130. ---------------------------|------------|------------|------------|
  131. tmp1 & tmp2 dont exist | run | run | run |
  132. tmp1 & tmp2 exist | run | run | run |
  133.  
  134. * note that without dry-run doit would re-execute `tmp2` if `tmp1` changed,
  135. while `make` always execute both. doit dry-run assumes that when a task is
  136. executed it would generate a different target than the cached one.
  137.  
  138.  
  139.  
  140.  
  141. task_dep & uptodate
  142. ---------------------
  143.  
  144. `make` has no concept of task_dep so nothing to compare to
  145.  
  146. dodo.py
  147. ```
  148. def task_with_task_dep():
  149. yield {'name': 't1',
  150. 'actions': ["echo hi1"],
  151. 'file_dep': ['t1.in'],
  152. }
  153. yield {'name': 't2',
  154. 'actions': ["echo hi2"],
  155. 'uptodate': [lambda: True],
  156. 'task_dep': ['with_task_dep:t1'],
  157. }
  158. ```
  159.  
  160. ```
  161. $ echo aaa > t1.in
  162. $ doit with_task_dep
  163. . with_task_dep:t1
  164. . with_task_dep:t2
  165. $ doit with_task_dep
  166. -- with_task_dep:t1
  167. -- with_task_dep:t2
  168. $ doit --dry-run with_task_dep
  169. -- with_task_dep:t1
  170. -- with_task_dep:t2
  171. $ echo xxx > t1.in
  172. $ doit --dry-run with_task_dep
  173. . with_task_dep:t1
  174. -- with_task_dep:t2
  175. ```
  176.  
  177. use case | expected | doit |
  178. ---------------------------|-------------|------------|
  179. task_dep needs execution | run | up-to-date |
  180.  
  181. task_dep is also used for purely ordering purpose,
  182. in this case the expected output would be `up-to-date`.
  183.  
  184. Since as of now there is no way to distinguish the 2 use cases
  185. it is safer to assume task_dep really means the `uptodate` check of
  186. t2 would fail.
  187.  
  188.  
  189.  
  190.  
  191. task_dep (without uptodate)
  192. -----------------------------
  193.  
  194. TODO
  195.  
  196.  
  197.  
  198.  
  199. setup-task
  200. -----------
  201.  
  202. TODO
  203.  
  204.  
  205.  
  206.  
  207. calc_dep
  208. ----------
  209.  
  210. TODO
  211.  
  212.  
  213.  
  214. --continue & --keep-going
  215. ----------------------------
  216.  
  217. In `make` there is a strong relation between `--dry-run` and `--keep-going`.
  218. If rule A change causes B to run on dry-run it means that --keep-going would
  219. not execute B if A fails.
  220.  
  221. doit already implements `--continue`. `--dry-run` and `--continue` should hold
  222. the same equivalence of --dry-run and --keep-going on `make`.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement