summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2021-02-10 20:07:24 +0100
committerMatthias Beyer <mail@beyermatthias.de>2021-02-11 18:22:38 +0100
commitc4efba28515fdf0da16697256ba46c6bfff9086c (patch)
treeabbcf7a9b6cc8dc08d63815e4d73c14158473485 /examples
parentc2fb88e4ea953d4dbc01ffc6341ccb4e9e59290c (diff)
Make the package script "complex"
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'examples')
-rw-r--r--examples/packages/README.md13
-rw-r--r--examples/packages/repo/config.toml6
-rw-r--r--examples/packages/repo/pkg.toml27
3 files changed, 42 insertions, 4 deletions
diff --git a/examples/packages/README.md b/examples/packages/README.md
index 5271689..838dc53 100644
--- a/examples/packages/README.md
+++ b/examples/packages/README.md
@@ -67,3 +67,16 @@ N, M, T and S starting right away.
Multiple versions of one package are not yet considered in this setup.
+
+# The packaging
+
+The packaging script does the following:
+
+* In the "sourcecheck" phase, it checks whether the input is present (that would
+ be the .tar.gz file of the package to compile)
+* In the "depcheck" phase, it checks whether all dependencies are present. This
+ is done to demonstrate what could be done, not because it makes a great deal
+ of sense
+* In the "build" phase, it "builds" a package, by piping the version number of
+ the package itself to the output file.
+
diff --git a/examples/packages/repo/config.toml b/examples/packages/repo/config.toml
index 62275e5..1f099ca 100644
--- a/examples/packages/repo/config.toml
+++ b/examples/packages/repo/config.toml
@@ -24,7 +24,11 @@ database_user = "pgdev"
database_password = "password"
database_name = "butido"
-available_phases = [ "dummy" ]
+available_phases = [
+ "sourcecheck",
+ "depcheck",
+ "build"
+]
[docker]
diff --git a/examples/packages/repo/pkg.toml b/examples/packages/repo/pkg.toml
index aff709b..a16c49c 100644
--- a/examples/packages/repo/pkg.toml
+++ b/examples/packages/repo/pkg.toml
@@ -11,10 +11,31 @@ download_manually = false
[phases]
-dummy.script = '''
- echo "Dummy"
+sourcecheck.script = '''
+ filename="/inputs/src-{{this.sources.src.hash.hash}}.source"
+ [[ -e $filename ]] || {
+ echo "MISSING: $filename"
+ {{state "ERR" "Missing input"}}
+ exit 1
+ }
+'''
+
+depcheck.script = '''
+ {{#each this.dependencies.runtime}}
+ # Try to find sha of dependency {{this}}
+ exp_sha="$(echo {{this}} | sed 's,.*\ =,,' | sha1sum | sed 's,\ \ -,,')"
+ sha1sum /inputs/*pkg | grep "$exp_sha" || {
+ echo "FAILED TO FIND SHA: $exp_sha"
+ {{state "ERR" "Failed to find SHA"}}
+ exit 1
+ }
+ {{/each}}
+'''
+build.script = '''
mkdir /outputs
- touch /outputs/{{this.name}}-{{this.version}}.pkg
+ echo "{{this.version}}" > /outputs/{{this.name}}-{{this.version}}.pkg
+
+ {{state "OK"}}
'''