From: Richard W.M. Jones Date: Thu, 20 Feb 2020 11:21:36 +0000 (+0000) Subject: Updated goals talk for tech talk. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=3684e2f574200b0940ed38e057522e538e52edfa;p=libguestfs-talks.git Updated goals talk for tech talk. Tactics -> predicates. Mention other todo items. Other cleanups. --- diff --git a/2020-goals/2020-goals.odp b/2020-goals/2020-goals.odp index 5e73701..6945c11 100644 Binary files a/2020-goals/2020-goals.odp and b/2020-goals/2020-goals.odp differ diff --git a/2020-goals/notes.txt b/2020-goals/notes.txt index fa186eb..f5757bd 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 | ... @@ -280,16 +280,13 @@ TO-DO ---- 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 + - Explain predicates better, Kashyap found it confusing. - 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