REFACTOR Comment some code
4 files changed, 154 insertions(+), 139 deletions(-)

M README.md
M README.org
M pds.conf
M src/pds/pds.ml
M README.md +125 -138
@@ 1,68 1,68 @@ 
-[![builds.sr.ht status](https://builds.sr.ht/~mmatalka/pds.svg)](https://builds.sr.ht/~mmatalka/pds?)
 
 # Table of Contents
 
-1.  [About](#org37ed777)
-    1.  [Why Does This Exist?](#org285ef2f)
-2.  [Parallelism](#org9e1e1d4)
-3.  [Content Hash Based Builds](#org2638a4b)
-4.  [Terminology](#orgb598af9)
-5.  [Projects](#org93e8b8f)
-    1.  [Ocaml](#orgdab58e2)
-    2.  [Third-party](#org2f57f13)
-6.  [Dependencies](#orgf43bf8d)
-7.  [Configuration](#org33ea3e0)
-    1.  [Configuration Variables For Projects](#org5f8b39e)
-    2.  [Configuration Variables For Tests](#orgc275305)
-    3.  [Outputting the configuration](#org0f2f894)
-8.  [Produced Files](#orgd0b7a84)
-9.  [Documentation](#org6ebe081)
-10. [Selectors](#org0eaadda)
-11. [Changelog](#orgcec6426)
-    1.  [1.0.0](#orge265119)
-    2.  [1.1.0](#org1867e5d)
-    3.  [2.0.0](#org97faa92)
-    4.  [3.0.0](#org18d7186)
-    5.  [3.0.1](#org67e1765)
-    6.  [3.0.2](#orgc9fbf74)
-    7.  [3.0.3](#org9be69a2)
-    8.  [3.0.4](#org35e6376)
-    9.  [3.1.0](#org954bfd0)
-    10. [3.1.1](#org33fb3a5)
-    11. [4.11](#org4510732)
-    12. [4.12](#orga848ce3)
-    13. [4.13](#org67ee755)
-    14. [5.14](#org4af609a)
-    15. [5.15](#org337e98b)
-    16. [5.16](#org020c6d4)
-    17. [5.17 (bug release)](#org2e4e958)
-    18. [5.18](#org8c2af37)
-    19. [5.19](#org355f196)
-    20. [6.20](#orgb6a0ba1)
-    21. [5.21](#org1b30015)
-    22. [5.22](#orgca20045)
-    23. [5.23](#org915a442)
-    24. [5.24](#org5d96b47)
-    25. [5.25](#orgfd99d22)
-    26. [5.26 (bug release)](#org54acee7)
-    27. [5.27](#org160ff18)
-    28. [5.28](#orgf06ccad)
-    29. [5.29](#orgb566ea9)
-    30. [6.43](#orge62ce53)
-    31. [6.44](#orgbe2b13d)
-    32. [6.45](#orgabe5c9a)
-    33. [6.46](#orgd2b9f66)
-    34. [6.47](#org07d242d)
-    35. [6.48](#org6e877c2)
-    36. [6.49](#org8f20c63)
-    37. [6.50](#org38beaf9)
-    38. [6.51](#org768ed1e)
-    39. [6.52](#org4e83350)
-    40. [6.53](#org99d760f)
-    41. [6.54](#orgfe65028)
+1.  [About](#org139b019)
+    1.  [Why Does This Exist?](#orgba406f7)
+2.  [Parallelism](#org930b0cb)
+3.  [Content Hash Based Builds](#org0553b55)
+4.  [Terminology](#org4f12d38)
+5.  [Projects](#orga07c045)
+    1.  [Ocaml](#org1f8d3a7)
+    2.  [Third-party](#org897a4f6)
+6.  [Dependencies](#orgb597842)
+7.  [Configuration](#orgffb315f)
+    1.  [Configuration Variables For Projects](#orgb6d55ac)
+    2.  [Configuration Variables For Tests](#org3f3b1be)
+    3.  [Outputting the configuration](#orga9d7273)
+8.  [Produced Files](#org92f4352)
+9.  [Documentation](#org175922d)
+10. [Selectors](#orgbde22db)
+11. [Changelog](#orgf2bd904)
+    1.  [1.0.0](#org7b8ccf1)
+    2.  [1.1.0](#orge46aacf)
+    3.  [2.0.0](#orgcf4c110)
+    4.  [3.0.0](#org91a14b4)
+    5.  [3.0.1](#org1654b3a)
+    6.  [3.0.2](#org3e0ec0e)
+    7.  [3.0.3](#org720be5e)
+    8.  [3.0.4](#orgf618fa6)
+    9.  [3.1.0](#org4114dc6)
+    10. [3.1.1](#org15d847f)
+    11. [4.11](#orga5eff74)
+    12. [4.12](#org6770f2a)
+    13. [4.13](#org47e0252)
+    14. [5.14](#orgae9489b)
+    15. [5.15](#orgb65e36a)
+    16. [5.16](#orgb4de444)
+    17. [5.17 (bug release)](#orgb932bc8)
+    18. [5.18](#org142cd17)
+    19. [5.19](#orgbb9c801)
+    20. [6.20](#orgccad730)
+    21. [5.21](#org06d02cd)
+    22. [5.22](#orgc436982)
+    23. [5.23](#org08ac998)
+    24. [5.24](#org0c50772)
+    25. [5.25](#orgf39237f)
+    26. [5.26 (bug release)](#org70be396)
+    27. [5.27](#orgc1dbdca)
+    28. [5.28](#org67fc535)
+    29. [5.29](#org7d558bf)
+    30. [6.43](#org39249dd)
+    31. [6.44](#org37433f3)
+    32. [6.45](#org11052fa)
+    33. [6.46](#orgd19261b)
+    34. [6.47](#org6bda573)
+    35. [6.48](#orga8fdff2)
+    36. [6.49](#orgda35140)
+    37. [6.50](#org838d990)
+    38. [6.51](#org1d42781)
+    39. [6.52](#orgacef326)
+    40. [6.53](#org70a7f01)
+    41. [6.54](#org10e93d8)
+    42. [6.55](#orgecb72ad)
 
 
-<a id="org37ed777"></a>
+<a id="org139b019"></a>
 
 # About
 

          
@@ 129,7 129,7 @@ the `build` directory, for example `buil
 `build/test-release`.
 
 
-<a id="org285ef2f"></a>
+<a id="orgba406f7"></a>
 
 ## Why Does This Exist?
 

          
@@ 142,7 142,7 @@ the existing tooling then you should be 
 meant to be non-intrusive.
 
 
-<a id="org9e1e1d4"></a>
+<a id="org930b0cb"></a>
 
 # Parallelism
 

          
@@ 162,7 162,7 @@ the source of the `units Foo and Bar mak
 error.
 
 
-<a id="org2638a4b"></a>
+<a id="org0553b55"></a>
 
 # Content Hash Based Builds
 

          
@@ 182,7 182,7 @@ of the build configuration, this ensure 
 that causes a rebuild.
 
 
-<a id="orgb598af9"></a>
+<a id="org4f12d38"></a>
 
 # Terminology
 

          
@@ 194,7 194,7 @@ that causes a rebuild.
     `library`, this applies only to ocaml projects..
 
 
-<a id="org93e8b8f"></a>
+<a id="orga07c045"></a>
 
 # Projects
 

          
@@ 205,7 205,7 @@ interface, which is `release`, `debug`, 
 and `clean`.
 
 
-<a id="orgdab58e2"></a>
+<a id="org1f8d3a7"></a>
 
 ## Ocaml
 

          
@@ 228,26 228,22 @@ generated.
 <th scope="col" class="org-left">Suffix</th>
 </tr>
 </thead>
-
 <tbody>
 <tr>
 <td class="org-left">Library</td>
 <td class="org-left">cma</td>
 </tr>
 
-
 <tr>
 <td class="org-left">Library</td>
 <td class="org-left">cmxa</td>
 </tr>
 
-
 <tr>
 <td class="org-left">Executable</td>
 <td class="org-left">byte</td>
 </tr>
 
-
 <tr>
 <td class="org-left">Executable</td>
 <td class="org-left">native</td>

          
@@ 256,7 252,7 @@ generated.
 </table>
 
 
-<a id="org2f57f13"></a>
+<a id="org897a4f6"></a>
 
 ## Third-party
 

          
@@ 264,7 260,7 @@ Third party projects do not have a `Make
 to have one which corresponds to the pds interface.
 
 
-<a id="orgf43bf8d"></a>
+<a id="orgb597842"></a>
 
 # Dependencies
 

          
@@ 275,7 271,7 @@ compiled before its dependent project an
 as a dependency in the dependents `Makefile`.
 
 
-<a id="org33ea3e0"></a>
+<a id="orgffb315f"></a>
 
 # Configuration
 

          
@@ 329,7 325,7 @@ An example of building the example direc
     install = false
 
 
-<a id="org5f8b39e"></a>
+<a id="orgb6d55ac"></a>
 
 ## Configuration Variables For Projects
 

          
@@ 353,7 349,6 @@ An example of building the example direc
 <th scope="col" class="org-left">Description</th>
 </tr>
 </thead>
-
 <tbody>
 <tr>
 <td class="org-left">deps</td>

          
@@ 362,7 357,6 @@ An example of building the example direc
 <td class="org-left">List of dependencies both within the project and external</td>
 </tr>
 
-
 <tr>
 <td class="org-left">type</td>
 <td class="org-left">string</td>

          
@@ 370,7 364,6 @@ An example of building the example direc
 <td class="org-left">exec, library - Whether the ocaml project is an executbale or library</td>
 </tr>
 
-
 <tr>
 <td class="org-left">install</td>
 <td class="org-left">bool</td>

          
@@ 378,7 371,6 @@ An example of building the example direc
 <td class="org-left">Whether the built artifacts should be installed</td>
 </tr>
 
-
 <tr>
 <td class="org-left">install<sub>cmd</sub></td>
 <td class="org-left">string</td>

          
@@ 386,7 378,6 @@ An example of building the example direc
 <td class="org-left">If the type is exec, specify the command to be used to install it</td>
 </tr>
 
-
 <tr>
 <td class="org-left">remove<sub>cmd</sub></td>
 <td class="org-left">string</td>

          
@@ 394,7 385,6 @@ An example of building the example direc
 <td class="org-left">If the typs is exec, specify the command to be used to remove it</td>
 </tr>
 
-
 <tr>
 <td class="org-left">project<sub>type</sub></td>
 <td class="org-left">string</td>

          
@@ 402,7 392,6 @@ An example of building the example direc
 <td class="org-left">third-party or ocaml - defaults to ocaml</td>
 </tr>
 
-
 <tr>
 <td class="org-left">extra<sub>compiler</sub><sub>opts</sub></td>
 <td class="org-left">string</td>

          
@@ 410,7 399,6 @@ An example of building the example direc
 <td class="org-left">Extra options to give to the ocaml compiler</td>
 </tr>
 
-
 <tr>
 <td class="org-left">extra<sub>ocamldep</sub><sub>opts</sub></td>
 <td class="org-left">string</td>

          
@@ 418,7 406,6 @@ An example of building the example direc
 <td class="org-left">Extra options to give ot ocamldep</td>
 </tr>
 
-
 <tr>
 <td class="org-left">extra<sub>makefile</sub><sub>lines</sub></td>
 <td class="org-left">string list</td>

          
@@ 426,7 413,6 @@ An example of building the example direc
 <td class="org-left">Extra lines to add to the generated Makefile</td>
 </tr>
 
-
 <tr>
 <td class="org-left">compile<sub>deps</sub></td>
 <td class="org-left">string list</td>

          
@@ 434,7 420,6 @@ An example of building the example direc
 <td class="org-left">List of builds that need to be built prior to this build but are not automatically linked against</td>
 </tr>
 
-
 <tr>
 <td class="org-left">meta<sub>linkopts</sub></td>
 <td class="org-left">string</td>

          
@@ 442,7 427,6 @@ An example of building the example direc
 <td class="org-left">Link options to go into the META file.</td>
 </tr>
 
-
 <tr>
 <td class="org-left">build</td>
 <td class="org-left">bool</td>

          
@@ 479,7 463,7 @@ 5.  `src.<project>.<option>`
 The same precedence applies to test builds.
 
 
-<a id="orgc275305"></a>
+<a id="org3f3b1be"></a>
 
 ## Configuration Variables For Tests
 

          
@@ 494,7 478,7 @@ 2.  `global.test-<build_type>.<option>`
 3.  `tests.<project>.<option>`
 
 
-<a id="org0f2f894"></a>
+<a id="orga9d7273"></a>
 
 ## Outputting the configuration
 

          
@@ 517,32 501,27 @@ output looks like the following:
 <th scope="col" class="org-left">Description</th>
 </tr>
 </thead>
-
 <tbody>
 <tr>
 <td class="org-left">Source Type</td>
 <td class="org-left">"src" or "test", the type of build it is</td>
 </tr>
 
-
 <tr>
 <td class="org-left">Name</td>
 <td class="org-left">The name of the build, "src.&lt;name&gt;" or "test.&lt;name&gt;"</td>
 </tr>
 
-
 <tr>
 <td class="org-left">Build Type</td>
 <td class="org-left">"exec" or "library", empty for test</td>
 </tr>
 
-
 <tr>
 <td class="org-left">Project Type</td>
 <td class="org-left">"ocaml" or "third-party", empty for a test</td>
 </tr>
 
-
 <tr>
 <td class="org-left">Deps</td>
 <td class="org-left">Comma separated list of dependencies</td>

          
@@ 551,7 530,7 @@ output looks like the following:
 </table>
 
 
-<a id="orgd0b7a84"></a>
+<a id="org92f4352"></a>
 
 # Produced Files
 

          
@@ 564,7 543,7 @@ ignored in the form of a `.gitignore`.
     Ocamlrules.mk.in
 
 
-<a id="org6ebe081"></a>
+<a id="org175922d"></a>
 
 # Documentation
 

          
@@ 578,7 557,7 @@ also be set for `ocamldoc` by modifying 
 `extra_makefile_lines`.
 
 
-<a id="org0eaadda"></a>
+<a id="orgbde22db"></a>
 
 # Selectors
 

          
@@ 622,12 601,12 @@ The order of precedence is that the sele
 checked, then the selector for a release.
 
 
-<a id="orgcec6426"></a>
+<a id="orgf2bd904"></a>
 
 # Changelog
 
 
-<a id="orge265119"></a>
+<a id="org7b8ccf1"></a>
 
 ## 1.0.0
 

          
@@ 636,7 615,7 @@ checked, then the selector for a release
 -   Support running tests.
 
 
-<a id="org1867e5d"></a>
+<a id="orge46aacf"></a>
 
 ## 1.1.0
 

          
@@ 645,7 624,7 @@ checked, then the selector for a release
     is useful if a tool needs to be built that will be used to compile a project.
 
 
-<a id="org97faa92"></a>
+<a id="orgcf4c110"></a>
 
 ## 2.0.0
 

          
@@ 654,7 633,7 @@ checked, then the selector for a release
 -   Fill out the documentation more.
 
 
-<a id="org18d7186"></a>
+<a id="org91a14b4"></a>
 
 ## 3.0.0
 

          
@@ 662,7 641,7 @@ checked, then the selector for a release
     understands both installing and uninstalling projects.
 
 
-<a id="org67e1765"></a>
+<a id="org1654b3a"></a>
 
 ## 3.0.1
 

          
@@ 670,14 649,14 @@ checked, then the selector for a release
     after using hll to make the package.
 
 
-<a id="orgc9fbf74"></a>
+<a id="org3e0ec0e"></a>
 
 ## 3.0.2
 
 -   Expand the hll config to pass opam-linter.
 
 
-<a id="org9be69a2"></a>
+<a id="org720be5e"></a>
 
 ## 3.0.3
 

          
@@ 685,7 664,7 @@ checked, then the selector for a release
 -   Specify which version of ocaml pds works with.
 
 
-<a id="org35e6376"></a>
+<a id="orgf618fa6"></a>
 
 ## 3.0.4
 

          
@@ 693,7 672,7 @@ checked, then the selector for a release
 -   Remove examples.
 
 
-<a id="org954bfd0"></a>
+<a id="org4114dc6"></a>
 
 ## 3.1.0
 

          
@@ 701,14 680,14 @@ checked, then the selector for a release
 -   Install `.cmi` files.
 
 
-<a id="org33fb3a5"></a>
+<a id="org15d847f"></a>
 
 ## 3.1.1
 
 -   Fix a bug in generating docs when the project has no dependencies.
 
 
-<a id="org4510732"></a>
+<a id="orga5eff74"></a>
 
 ## 4.11
 

          
@@ 719,21 698,21 @@ checked, then the selector for a release
     name of the output.
 
 
-<a id="orga848ce3"></a>
+<a id="org6770f2a"></a>
 
 ## 4.12
 
 -   Include tests directories in formatted output.
 
 
-<a id="org67ee755"></a>
+<a id="org47e0252"></a>
 
 ## 4.13
 
 -   Make a better error message for the install key, which is required.
 
 
-<a id="org4af609a"></a>
+<a id="orgae9489b"></a>
 
 ## 5.14
 

          
@@ 743,7 722,7 @@ checked, then the selector for a release
 -   Remove PACK support.  Building PACKs is no longer supported.
 
 
-<a id="org337e98b"></a>
+<a id="orgb65e36a"></a>
 
 ## 5.15
 

          
@@ 751,14 730,14 @@ checked, then the selector for a release
 -   Add a changelog and back fill it.
 
 
-<a id="org020c6d4"></a>
+<a id="orgb4de444"></a>
 
 ## 5.16
 
 -   Fix bug in cleanup logic which concatenated multiple deps
 
 
-<a id="org2e4e958"></a>
+<a id="orgb932bc8"></a>
 
 ## 5.17 (bug release)
 

          
@@ 769,7 748,7 @@ checked, then the selector for a release
     first then the .cmo and .cmx are generated.
 
 
-<a id="org8c2af37"></a>
+<a id="org142cd17"></a>
 
 ## 5.18
 

          
@@ 782,7 761,7 @@ checked, then the selector for a release
     it.  This solves it by serializing the build for those cases.
 
 
-<a id="org355f196"></a>
+<a id="orgbb9c801"></a>
 
 ## 5.19
 

          
@@ 790,14 769,14 @@ checked, then the selector for a release
     installs `.cmi` files for all `.ml` files.
 
 
-<a id="orgb6a0ba1"></a>
+<a id="orgccad730"></a>
 
 ## 6.20
 
 -   Removed the `-custom` option from default byte code builds.
 
 
-<a id="org1b30015"></a>
+<a id="org06d02cd"></a>
 
 ## 5.21
 

          
@@ 805,7 784,7 @@ checked, then the selector for a release
     them to be overridden.
 
 
-<a id="orgca20045"></a>
+<a id="orgc436982"></a>
 
 ## 5.22
 

          
@@ 813,28 792,28 @@ checked, then the selector for a release
 -   Tests compile with `OCAML*_LINK_OPTS` just like regular builds.
 
 
-<a id="org915a442"></a>
+<a id="org08ac998"></a>
 
 ## 5.23
 
 -   Fix typo in PARALLEL
 
 
-<a id="org5d96b47"></a>
+<a id="org0c50772"></a>
 
 ## 5.24
 
 -   Build cmti files and install them for every library.
 
 
-<a id="orgfd99d22"></a>
+<a id="orgf39237f"></a>
 
 ## 5.25
 
 -   Support adding linkopts to the META file.
 
 
-<a id="org54acee7"></a>
+<a id="org70be396"></a>
 
 ## 5.26 (bug release)
 

          
@@ 842,14 821,14 @@ checked, then the selector for a release
 -   Add some tests.
 
 
-<a id="org160ff18"></a>
+<a id="orgc1dbdca"></a>
 
 ## 5.27
 
 -   Fix bug in section name for the selector.
 
 
-<a id="orgf06ccad"></a>
+<a id="org67fc535"></a>
 
 ## 5.28
 

          
@@ 857,7 836,7 @@ checked, then the selector for a release
     were not properly looked up.
 
 
-<a id="orgb566ea9"></a>
+<a id="org7d558bf"></a>
 
 ## 5.29
 

          
@@ 866,56 845,56 @@ checked, then the selector for a release
     worked).
 
 
-<a id="orge62ce53"></a>
+<a id="org39249dd"></a>
 
 ## 6.43
 
 -   Move to content based hashing.
 
 
-<a id="orgbe2b13d"></a>
+<a id="org37433f3"></a>
 
 ## 6.44
 
 -   Fix install directive
 
 
-<a id="orgabe5c9a"></a>
+<a id="org11052fa"></a>
 
 ## 6.45
 
 -   Better sqlite error reporting
 
 
-<a id="orgd2b9f66"></a>
+<a id="orgd19261b"></a>
 
 ## 6.46
 
 -   strftime usage that works on Alpine
 
 
-<a id="org07d242d"></a>
+<a id="org6bda573"></a>
 
 ## 6.47
 
 -   Another instance of strftime
 
 
-<a id="org6e877c2"></a>
+<a id="orga8fdff2"></a>
 
 ## 6.48
 
 -   Fix bugs in testing outputs.
 
 
-<a id="org8f20c63"></a>
+<a id="orgda35140"></a>
 
 ## 6.49
 
 -   Improve performance 10x by batching database operations.
 
 
-<a id="org38beaf9"></a>
+<a id="org838d990"></a>
 
 ## 6.50
 

          
@@ 923,30 902,38 @@ checked, then the selector for a release
     that its hash had been changed, when in reality it didn't exist.
 
 
-<a id="org768ed1e"></a>
+<a id="org1d42781"></a>
 
 ## 6.51
 
 -   Remove target files from build dir when a file is deleted
 
 
-<a id="org4e83350"></a>
+<a id="orgacef326"></a>
 
 ## 6.52
 
 -   Fix timezone issues in managing file modification times
 
 
-<a id="org99d760f"></a>
+<a id="org70a7f01"></a>
 
 ## 6.53
 
 -   Add statistics output
 
 
-<a id="orgfe65028"></a>
+<a id="org10e93d8"></a>
 
 ## 6.54
 
 -   Fix typo in statistics
 
+
+<a id="orgecb72ad"></a>
+
+## 6.55
+
+-   Fix tests
+-   Remove dependency on Ocaml 5.1
+

          
M README.org +3 -0
@@ 443,3 443,6 @@ checked, then the selector for a release
 - Add statistics output
 ** 6.54
 - Fix typo in statistics
+** 6.55
+- Fix tests
+- Remove dependency on Ocaml 5.1

          
M pds.conf +9 -1
@@ 33,4 33,12 @@ extra_makefile_lines = ["include $(SRC_D
 [src.snabela]
 install = false
 extra_ocamldep_opts = "-package sedlex"
-deps = [ "process", "containers", "sedlex", "sedlex.ppx", "ppx_deriving", "ppx_deriving.show", "ppx_deriving.eq" ]
+deps = [
+  "containers",
+  "ppx_deriving",
+  "ppx_deriving.eq",
+  "ppx_deriving.show",
+  "process",
+  "sedlex",
+  "sedlex.ppx",
+]

          
M src/pds/pds.ml +17 -0
@@ 177,6 177,23 @@ module Build = struct
         | None -> failwith (sprintf "Missing build %s in config" src))
       srcs
 
+  (* Search for a key searching from the bottom of a hierarchy to the top,
+     taking the first hit.  The order is:
+
+     1. $base.$build_name."selector".$selector.$build_type
+
+     2. $base.$build_name."selector".$selector
+
+     3. $base.$build_name.$build_type
+
+     4. $base.$build_name
+
+     5. "global".$global_prefix$build_type."selector".$selector
+
+     6. "global".$global_prefix$build_type
+
+     If no selector is specified, the selector versions are filtered out.
+   *)
   let lookup ~selector ~global_prefix ~build_type ~base ~build_name ~k build_conf =
     let lookups =
       match selector with