summaryrefslogtreecommitdiff
path: root/doc/examples
diff options
context:
space:
mode:
authorTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-06-17 21:04:41 -0400
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-06-17 21:37:22 -0400
commit73b930024d164e076275868253f92a47593f2dd8 (patch)
tree1789cbea13738ad4f4fcd7167c6741cb41dcccf5 /doc/examples
parent3f56037896a6f546d6949c70aa65384d78b7a0fc (diff)
downloadbuildstream-73b930024d164e076275868253f92a47593f2dd8.tar.gz
doc: Adding part 2 of the getting started tutorial
o doc/examples/running-commands: New example project of a `manual` build element o doc/sessions/running-commands.run: New session file to capture bst output o doc/source/sessions-stored: Added new generated sessions o doc/source/tutorial/running-commands.rst: New tutorial entry describing how commands are run in the sandbox o tests/examples/running-commands.py: Test case validating the tutorial's assertions
Diffstat (limited to 'doc/examples')
-rw-r--r--doc/examples/running-commands/elements/base.bst5
-rw-r--r--doc/examples/running-commands/elements/base/alpine.bst13
-rw-r--r--doc/examples/running-commands/elements/hello.bst22
-rw-r--r--doc/examples/running-commands/files/src/Makefile12
-rw-r--r--doc/examples/running-commands/files/src/hello.c10
-rw-r--r--doc/examples/running-commands/project.conf12
6 files changed, 74 insertions, 0 deletions
diff --git a/doc/examples/running-commands/elements/base.bst b/doc/examples/running-commands/elements/base.bst
new file mode 100644
index 000000000..1b85a9e8c
--- /dev/null
+++ b/doc/examples/running-commands/elements/base.bst
@@ -0,0 +1,5 @@
+kind: stack
+description: Base stack
+
+depends:
+- base/alpine.bst
diff --git a/doc/examples/running-commands/elements/base/alpine.bst b/doc/examples/running-commands/elements/base/alpine.bst
new file mode 100644
index 000000000..cf85df5bf
--- /dev/null
+++ b/doc/examples/running-commands/elements/base/alpine.bst
@@ -0,0 +1,13 @@
+kind: import
+description: |
+
+ Alpine Linux base runtime
+
+sources:
+- kind: tar
+
+ # This is a post doctored, trimmed down system image
+ # of the Alpine linux distribution.
+ #
+ url: alpine:integration-tests-base.v1.x86_64.tar.xz
+ ref: 3eb559250ba82b64a68d86d0636a6b127aa5f6d25d3601a79f79214dc9703639
diff --git a/doc/examples/running-commands/elements/hello.bst b/doc/examples/running-commands/elements/hello.bst
new file mode 100644
index 000000000..f7f21e01e
--- /dev/null
+++ b/doc/examples/running-commands/elements/hello.bst
@@ -0,0 +1,22 @@
+kind: manual
+description: |
+
+ Building manually
+
+# Depend on the base system
+depends:
+- base.bst
+
+# Stage the files/src directory for building
+sources:
+ - kind: local
+ path: files/src
+
+# Now configure the commands to run
+config:
+
+ build-commands:
+ - make PREFIX="%{prefix}"
+
+ install-commands:
+ - make -j1 PREFIX="%{prefix}" DESTDIR="%{install-root}" install
diff --git a/doc/examples/running-commands/files/src/Makefile b/doc/examples/running-commands/files/src/Makefile
new file mode 100644
index 000000000..8c8425116
--- /dev/null
+++ b/doc/examples/running-commands/files/src/Makefile
@@ -0,0 +1,12 @@
+# Sample makefile for hello.c
+#
+.PHONY: all install
+
+all: hello
+
+install:
+ install -d ${DESTDIR}${PREFIX}/bin
+ install -m 755 hello ${DESTDIR}${PREFIX}/bin
+
+hello: hello.c
+ $(CC) -Wall -o $@ $<
diff --git a/doc/examples/running-commands/files/src/hello.c b/doc/examples/running-commands/files/src/hello.c
new file mode 100644
index 000000000..b53408209
--- /dev/null
+++ b/doc/examples/running-commands/files/src/hello.c
@@ -0,0 +1,10 @@
+/*
+ * hello.c - Simple hello world program
+ */
+#include <stdio.h>
+
+int main(int argc, char *argv[])
+{
+ printf("Hello World\n");
+ return 0;
+}
diff --git a/doc/examples/running-commands/project.conf b/doc/examples/running-commands/project.conf
new file mode 100644
index 000000000..de266178e
--- /dev/null
+++ b/doc/examples/running-commands/project.conf
@@ -0,0 +1,12 @@
+# Unique project name
+name: running-commands
+
+# Required BuildStream format version
+format-version: 9
+
+# Subdirectory where elements are stored
+element-path: elements
+
+# Define an alias for our alpine tarball
+aliases:
+ alpine: https://gnome7.codethink.co.uk/tarballs/