From: Richard W.M. Jones Date: Mon, 13 Jan 2020 22:53:21 +0000 (+0000) Subject: Start on goals presentation. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=a57461ac33b8c4d0b3caa121cb4ce0f4dadb9243;p=libguestfs-talks.git Start on goals presentation. --- diff --git a/2020-goals/2020-goals.odp b/2020-goals/2020-goals.odp new file mode 100644 index 0000000..5e73701 Binary files /dev/null and b/2020-goals/2020-goals.odp differ diff --git a/2020-goals/notes.txt b/2020-goals/notes.txt index 685a2b5..b03d9e5 100644 --- a/2020-goals/notes.txt +++ b/2020-goals/notes.txt @@ -8,40 +8,86 @@ continuous integration, package ecosystems or anything like that. It's about one tool which is over 40 years old: MAKE. Designed by Stuart Feldman in 1976. +Make is a great tool! It's easy to get started, intuitive, +and wildly successful. If I critize make it's not because I +think it's a bad tool, just that we could do even better if +we addressed some shortcomings. + + TACTIC PROBLEM: - - Only one tactic. - - Others are possible, + +Only one tactic 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: + eg: URL, newer than any file (not all files), Koji build, comparing checksums, test with skip + + PHONY FILE PROBLEM: - - "all" is not like a file + +"test" is not a file. + +If "test" happens to be created, your tests will stop running +silently. + +Experienced users know they can use the .PHONY directive to +avoid this. + +Make doesn't check that when you run a rule that it actually +creates the file that it says it creates. +The new tool called goals does check this. + +It also points to a fundamental issue: the target +is overloaded to mean either a file or a rule name. + + SINGLE PARAMETER PROBLEM: - - %.o: %c only allows a single parameter + +Make recipes can be parameterized, provided you only need +a single parameter. + +If a single parameter is useful, it's not outlandish to +imagine that having two parameters could be useful, or +even more. + + + SHELL PROBLEM: - - How do you quote a file with spaces? - https://stackoverflow.com/questions/15004278/allow-space-in-target-of-gcc-makefile - For a tool whose main job is running shell commands - it has quite a lot of problems with shell commands: + +How do you quote a file with spaces? +https://stackoverflow.com/questions/15004278/allow-space-in-target-of-gcc-makefile + +For a tool whose main job is running shell commands +it has quite a lot of sharp edges when running shell commands. + dest/target: deps cd dest var=1 echo $var > target - - Invisible whitespace is meaningful + - Individual commands are passed to separate shells + - $ has meaning to both shell and make + - Invisible whitespace is meaningful + Let's talk about shell scripting first, because that's easiest to fix: target: foo.o bar.o "target": "foo.o", "bar.o" { - $CC $CFLAGS $< -o $@ %CC %CFLAGS %< -o %@ + ${CC} ${CFLAGS} $< -o $@ %CC %CFLAGS %< -o %@ } The new tool uses a real LALR(1) parser. Filenames have to be @@ -129,16 +175,17 @@ from a list of strings into a list of *test tactics. let tests = wrap ("*test", wildcard ("test-*.sh")) goal check () = : tests - goal test (script) = *test(name) : { ./%name } + goal run (script) = *test(script) : { ./%script } -Another tactic we use is called *built-in-koji, which I +Another tactic we use is called *koji-built, which I use for mass rebuilding Fedora packages in dependency order. -I won't go into the full definition of *built-in-koji since +I won't go into the full definition of *koji-built since interfacing with Koji is quite complicated, but you can write a mass rebuild tool in goals fairly easily: -[SHOW OUTLINE FROM fedora-ocaml-rebuild/Goalfile] + [ DISCUSSION OF FEDORA-OCAML-REBUILD IN SLIDES ] + We saw a couple of standard functions in the test example - @@ -192,17 +239,18 @@ because they point to future ways we might explore this space. | File (name + ".o") -> compile name | ... - - But our pattern matcher is very naive, could it be more complex? - What would that mean? -SCREENSHOT OF ZINC PAPER - - - Goal "functions" may be called by name or by pattern, which is unusual. Is there another programming language which does this? (Prolog actually) + - But our pattern matcher is very naive, could it be more complex? + What would that mean? + + SCREENSHOT OF ZINC PAPER + + - Dependencies have implicit & operator, could we use | and ! operators? What would that mean? Build targets in several different ways? Fallback if a tool isn't available? @@ -221,6 +269,7 @@ TO-DO build ("foo", false) - Anonymous functions + Any code section is potentially a closure let hello = { echo "hello" }