@ -274,27 +274,56 @@ All our tools are designed to be simple to use, to understand, to read.
< red > TODO: spec files, the file format used in `package` , `packaging` and `service` .</ red >
---
< a name = "spec-format" > < / a >
**Spec files.** *our declarative format* < br />
Before presenting our tools, here a file format named `spec` that we tend to use when relevant.
It is *declarative* : we tend not to tell instructions how to do things (copy this file here, download this, etc.) but to describe something (url of the project is `https://example.com/xxx` ).
This way, we can provide an easy to understand format which looks like YAML a lot, but allows us to do much more.
Here a quick example.
```yaml
name: hello
version: 2.10
release: 2
sources: https://ftp.gnu.org/gnu/hello/hello-%{version}.tar.gz
# This is a comment
dependencies:
- gettext
# This is a simple variable instanciation
variable: value
build-dependencies:
- make
# This is a inlined list
list: a, b , c
options:
- configure: --disable-nls
# This is a multiline list
list:
- a
- b
- c
```
And now, we can add `block sections` to it: sometime we < u > do</ u > want to tell instructions.
```yaml
# We have the URL of the tarballs for a software
software-url: 'https://example.com/my-software/'
# ... and we want to get its last version number
# "@watch" is a section, the name "watch" has a meaning in the application reading the file
@watch
curl 'https://ftp.gnu.org/gnu/hello/' -o- 2>/dev/null |
sed -n "/hello-.*\.tar\.gz/{s/\.tar\.gz.*//;s/.*hello-//;p}" |
# the following is simple shell scripting
curl %{software-url} -o- 2>/dev/null | \
sed "s/_my-software.tar.gz//" | \
tail -1
```
Sometime, we want to refer to a file (or directory), and add metadata to it.
```yaml
# as for "@watch", "%configuration" has a meaning in the application reading the file
# this time, the block is named
%configuration postgresql.conf
# within a named block, we find simple declarations as outside the block
name: database configuration
creation-command: my-script.sh -a -b -c
```
---
< red > TODO: explains why it's different / better than other package managers.< / red >
@ -317,6 +346,28 @@ Package's configuration is a list of repositories, authorized package signing ke
Packaging uses simple, declarative recipe files, here some examples: [hello][recipe-hello], [dhcpcd][recipe-dhcpcd], [alsa-utils][recipe-alsautils].
The only required parameters are `name` and `sources` .
```yaml
# GNU Hello example program
name: hello
version: 2.10
release: 2
sources: https://ftp.gnu.org/gnu/hello/hello-%{version}.tar.gz
dependencies:
- gettext
build-dependencies:
- make
options:
- configure: --disable-nls
@watch
curl 'https://ftp.gnu.org/gnu/hello/' -o- 2>/dev/null |
sed -n "/hello-.*\.tar\.gz/{s/\.tar\.gz.*//;s/.*hello-//;p}" |
tail -1
```
< a name = "packaging-build-env" > < / a >
Packaging creates build environments to test packages before validation.
It works as follow:
@ -402,14 +453,14 @@ Remote remote communications are transparent.
C library with Crystal bindings (other languages coming soon)
< pre > < code class = "Crystal" >
```Crystal
require "ipc.cr"
server = IPC::Service.new "MyService"
server.loop do |message|
# ...
end
< / code > < / pre >
```
< red > TODO: show that's easy to write even in plain C.< / red >