X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=2020-goals%2Fnotes.txt;h=e76dff1ab2c02276398155d4f1c8edb9c60c0b72;hb=abde52a439efefe4371ad1f99d288e94163e1308;hp=fa186ebed7343d31c9b163959874d480fdc2febe;hpb=163bb460bd93cda461c20f155642eff314e5d6cb;p=libguestfs-talks.git diff --git a/2020-goals/notes.txt b/2020-goals/notes.txt index fa186eb..e76dff1 100644 --- a/2020-goals/notes.txt +++ b/2020-goals/notes.txt @@ -16,15 +16,15 @@ we addressed some shortcomings. -TACTIC PROBLEM: +PREDICATE PROBLEM: -Only one tactic for solving dependencies. +Only one predicate for solving dependencies. "If the target file doesn't exist, or if it's older than one of the dependencies, then run this recipe." If you think for a little while you'll see that other -tactics are possible: +predicates are possible: eg: URL, newer than any file (not all files), Koji build, comparing checksums, test with skip @@ -125,26 +125,26 @@ if you want you can also run compile ("bar") directly: -Tactics are special rules that we can use to change how we +Predicates are special rules that we can use to change how we determine if a goal needs to be rebuilt. When you see a -filename string, there's an implicit tactic called *file, so +filename string, there's an implicit predicate called is-file, so these are equivalent, because when goals sees a bare string -but it wants a tactic it implicitly uses *file. +but it wants a predicate it implicitly uses is-file. "target" : "foo.o", "bar.o" { ... } - *file("target") : *file("foo.o"), *file("bar.o") { ... } + is-file("target") : is-file("foo.o"), is-file("bar.o") { ... } -Apart from *file being the default tactic, it's not built -into goals. In fact *file is defined in the goals standard +Apart from is-file being the default predicate, it's not built +into goals. In fact is-file is defined in the goals standard library. The special @{...} code section means the code doesn't print verbosely when its running. And "exit 99" -is used by the tactic to indicate that the target needs +is used by the predicate to indicate that the target needs to be rebuilt, but other than that it's all written in ordinary shell script: - tactic *file (filename) = @{ + predicate is-file (filename) = @{ test -f %filename || exit 99 for f in %<; do test %filename -ot "$f" && exit 99 ||: @@ -153,11 +153,11 @@ ordinary shell script: -And you can of course write other tactics in shell script. -Here's a tactic for running test suites. This tactic lets +And you can of course write other predicates in shell script. +Here's a predicate for running test suites. This predicate lets you skip a test by setting an environment variable. - tactic *test (script) = @{ + predicate is-test (script) = @{ # Check if SKIP variable is set. skip_var=$( echo -n SKIP_%script | @@ -168,19 +168,19 @@ you skip a test by setting an environment variable. if test %goals_final_check; then exit 0; else exit 99; fi } -You can use the tactic like this. There's quite a lot to unpack +You can use the predicate like this. There's quite a lot to unpack in this example, but I'll just say that the wildcard function expands to a list of files, and the wrap function changes them -from a list of strings into a list of *test tactics. +from a list of strings into a list of is-test predicates. - let tests = wrap ("*test", wildcard ("test-*.sh")) + let tests = wrap ("is-test", wildcard ("test-*.sh")) goal check () = : tests - goal run (script) = *test(script) : { ./%script } + goal run (script) = is-test(script) : { ./%script } -Another tactic we use is called *koji-built, which I +Another predicate we use is called is-koji-built, which I use for mass rebuilding Fedora packages in dependency order. -I won't go into the full definition of *koji-built since +I won't go into the full definition of is-koji-built since interfacing with Koji is quite complicated, but you can write a mass rebuild tool in goals fairly easily: @@ -232,10 +232,10 @@ because they point to future ways we might explore this space. goal link = "program" : "foo.o" { %CC %CFLAGS %< -o %@ } - - Tactics are constructors + - Predicates are constructors - Targets are patterns - *file ("%name.o") : ... match name with + is-file ("%name.o") : ... match name with | File (name + ".o") -> compile name | ... @@ -277,19 +277,11 @@ TO-DO f ("goals", "0.1") ----- -to do: - - - Explain tactics better, Kashyap found it confusing. - - - Should "tactic" be "predicate"? - Tactics might use ‘is-’ instead of ‘*’, eg. is-file, is-koji-built - - Cover some of the other tools that are better makes. (Note I'm not covering all DAG solvers like Ninja unless they bring something new to the table) - * Plan 9 mk - has alternate build tactics + * Plan 9 mk - has alternate build predicates * https://github.com/casey/just - has functions and multi-parameter rules @@ -300,5 +292,9 @@ to do: * https://web.archive.org/web/20001027183954/http://software-carpentry.codesourcery.com/entries/build/Tromey/Tromey.html - - Explain an advantage is you can use ^C and restart the build. - Also parallel builds just work. + +---- +to do: + + - Explain predicates better, Kashyap found it confusing. +