diff --git a/README.md b/README.md index 53a4429962370135ebcdcf78c1d54eb25c6c6358..fef98f41eff470a5bb2e6d8f2d562d6d085e2105 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,18 @@ https://forum.ostc-eu.org/t/over-the-air-updates-ota/28/ ## Development -This is a standard go project. Use `go get -booting.oniroproject.org/distro/components/sysota` to get it. Once in the resulting -directory under `$GOPATH`, typically -`~/go/src/booting.oniroproject.org/distro/components/sysota` run `go test ./...` to -run unit tests. There are no integration tests yet. +This is a somewhat typical Go and `make` project. You can use plain `go` to +build and test most things. For a more complete experience, including to access +the set of integration tests and various static analysis tools, you should +install a few more dependencies: + + - `make` + - `zmk` + - `reuse` + - `spread` + +Running `make` will build everything. There's a build-time configuration system. +To create the `configure` script run `make configure`. To try the service out in practice you may want to do this though: @@ -48,13 +55,74 @@ Remember that `uninstall` is stateless, if you want to rename a file, first ## Testing The project has a combination of unit tests, available through the standard go -interface, and integration tests implemented with spread. +interface, and integration tests implemented with spread. To run all kinds of +tests invoke `make check`. This will skip and report tests that depend on tools +you do not have locally. + +Please try not to send patches which regress the test suite. + +## Go Unit Tests + +There's a wide range of standard Go unit tests available. To execute those +simply run: -To execute unit tests run: ``` shell go test ./... ``` +## Go Static Analysis + +SystemOTA uses a wide array of Go static analysis tools, including the standard +`go vet` as well as the third-party: `staticcheck`, `goconst`, `errcheck`, `wsl` +and `ineffassign`. + +All those checks are integrated into `make check` and `make static-check`. The +precise goals for each individual tool can be discovered by tab-completing `make +static-check-go-`. + +The tools are usually not packaged so you should install them directly. Assuming +you are using Go 1.16+ you can do that with with: + +``` shell +go install honnef.co/go/tools/cmd/staticcheck@latest +go install github.com/jgautheron/goconst/cmd/goconst@latest +go install github.com/kisielk/errcheck@latest +go install github.com/bombsimon/wsl/v3/...@latest +go install github.com/gordonklaus/ineffassign@latest +``` + +## REUSE compliance checks + +REUSE is a legal compliance toolchain which, among others, ensures that each +file is accompanied by a machine readable copyright and license. + +REUSE checks are integrated into `make check` and `make static-check`. The +precise goal is `make static-check-reuse`. + +The REUSE toolchain can be installed from the system packager (usually something +like `python3-reuse`) or with `pip` by running: + +``` shell +pip install reuse +``` + +## Spell checker + +SystemOTA uses a `cspell` based spell checker. The same spell checker, along +with the exception database, can be used from Visual Studio Code and from +command line. The list of known exceptions is kept in the file `cspell.json`. + +The spell checker is integrated into `make check` and `make static-check`. The +precise goals `make static-cspell-lint`. + +To install the `cspell` with `npm` by running: + +``` shell +npm install --global cspell +``` + +## Spread system checks + To execute integration tests you will need a working installation of `spread` and `lxd` or `qemu`. Currently Qemu is preferred, as it allows performing mount operations inside the virtual machine. GitLab CI also uses `qemu` as LXD cannot @@ -80,7 +148,14 @@ or virtual machine, with all the build dependencies and cache, around. ## Packaging -While there is no official packaging yet, the build system does support the -standard `configure --prefix=/usr && make && sudo make install` combo. +If you are looking at packaging, the typical `./configure --prefix=/usr && make +&& make install` trio should do the trick but for a real installation you will +need to configure SystemOTA and RAUC inside your operating system image, at least +to select the boot loader and to describe the partition layout to RAUC. You may want to enable the `sysotad.service` systemd unit after installation. + +### Yocto meta-layers + +There's an official meta-layer with SystemOTA in the Oniro repository at +https://booting.oniroproject.org/distro/oniro/ in the `meta-oniro-core` layer. diff --git a/cspell.json b/cspell.json index ea7e0cceabdcf1658ff07f3559b44c7178915a8b..bd7290617ae1c698bc02d4f0a381f1dee2732f46 100644 --- a/cspell.json +++ b/cspell.json @@ -211,6 +211,7 @@ "webterm", // web terminal, a GitLab feature "xattr", // extended attribute "xattrs", // plural form of xattr + "yocto", // Embedded Linux distribution "zmk", // library for make "zstd", // compression format "zyga", // nickname for Zygmunt