ostree/rust-bindings/rust/README.md

124 lines
4.1 KiB
Markdown
Raw Normal View History

2019-05-16 19:30:59 +03:00
# ostree-rs
2020-07-23 16:10:04 +03:00
[![pipeline status](https://gitlab.com/fkrull/ostree-rs/badges/main/pipeline.svg)](https://gitlab.com/fkrull/ostree-rs/commits/main)
2019-05-16 22:31:52 +03:00
[![Crates.io](https://img.shields.io/crates/v/ostree.svg)](https://crates.io/crates/ostree)
2020-07-23 16:10:04 +03:00
[![main-docs](https://img.shields.io/badge/docs-main-brightgreen.svg)](https://fkrull.gitlab.io/ostree-rs/ostree)
2018-10-18 21:13:48 +03:00
**Rust** bindings for [libostree](https://ostree.readthedocs.io).
2018-10-18 21:13:48 +03:00
libostree is both a shared library and suite of command line tools that combines
a "git-like" model for committing and downloading bootable filesystem trees,
along with a layer for deploying them and managing the bootloader configuration.
2019-05-16 23:23:34 +03:00
> **Note**: this crate was renamed from the `libostree` crate.
2018-10-18 21:13:48 +03:00
## Status
2019-06-13 23:07:32 +03:00
Most bindings that can be auto-generated are being auto-generated by now.
Anything that is not yet supported by the crate probably requires handwritten
bindings. These will most likely be added on an as-needed basis.
2018-10-18 21:13:48 +03:00
## Using
### Requirements
2019-05-16 22:31:52 +03:00
The `ostree` crate requires libostree and the libostree development headers.
2020-07-24 15:23:24 +03:00
On Debian and Ubuntu:
```ShellSession
$ sudo apt-get install libostree-1 libostree-dev
```
2020-07-24 15:23:24 +03:00
On Fedora and CentOS:
```ShellSession
$ sudo dnf install ostree-libs ostree-devel
```
2018-10-18 21:13:48 +03:00
### Installing
To use the crate, add it to your `Cargo.toml`:
```toml
[dependencies]
2020-07-24 16:24:00 +03:00
ostree = "0.8"
```
2018-10-18 21:13:48 +03:00
To use features from later libostree versions, you need to specify the release
2019-05-16 19:30:59 +03:00
version as well:
```toml
2019-05-16 22:31:52 +03:00
[dependencies.ostree]
2020-07-24 16:24:00 +03:00
version = "0.8"
2020-03-06 15:16:05 +03:00
features = ["v2020_1"]
```
2018-10-18 21:13:48 +03:00
## Developing
2019-05-16 22:31:52 +03:00
The `ostree` and `ostree-sys` crates can be built and tested using regular
2019-05-16 19:30:59 +03:00
Cargo commands.
2018-10-18 21:13:48 +03:00
### Generated code
Most code is generated based on the gir files using the
[gir](https://github.com/gtk-rs/gir) tool. These parts can be regenerated using
the included Makefile:
```ShellSession
2019-05-24 22:51:34 +03:00
$ make gir
2018-10-18 21:13:48 +03:00
```
Run the following command to update the bundled gir files:
```ShellSession
$ make update-gir-files
```
The `OSTree-1.0.gir` file needs to be updated manually, either from a recent
2020-07-24 15:23:24 +03:00
distribution package or by building from source.
2018-10-18 21:13:48 +03:00
### Documentation
The libostree API documentation is not included in the code by default because
of its LGPL license. This means normal `cargo doc` runs don't include API docs
2018-10-18 23:02:43 +03:00
for the generated code. Run the `merge-lgpl-docs` Makefile target to include
the API docs in the source so they can be consumed by `cargo doc`:
2018-10-18 21:13:48 +03:00
```ShellSession
2018-10-18 23:02:43 +03:00
$ make merge-lgpl-docs
2018-10-18 21:13:48 +03:00
```
Keep in mind that if you build the crate with the API docs included, it's
2018-10-18 23:02:43 +03:00
effectively LGPL-licensed and you need to comply with the LGPL requirements
(specifically, allowing users of your end product to swap out the LGPL'd
parts).
2019-05-16 19:30:59 +03:00
CI includes the LGPL docs in the documentation build.
2018-10-18 21:13:48 +03:00
### Updating ostree
* update the bundled `gir/OSTree-1.0.gir` file
* `make gir` to regenerate the generated code
2020-07-24 15:23:24 +03:00
* update the example feature level in `README.md` in case of a new feature level
2018-10-18 21:13:48 +03:00
### Releases
Releases can be done using the publish_* jobs in the pipeline. There's no
2020-07-24 15:23:24 +03:00
versioning helper so version bumps need to be done manually.
2018-10-18 21:13:48 +03:00
The version needs to be changed in the following places (if applicable):
* in `sys/Cargo.toml` for the -sys crate version
* in the `ostree-sys =` dependency in `Cargo.toml`
* in `Cargo.toml` for the main crate version
* in `README.md` in the *Installing* section in case of major version bumps
Then tag the commit as `ostree/x.y.z` and/or `ostree-sys/x.y.z`. This will run
the crates.io deployment jobs. Main and -sys crate don't have to be released in
lockstep.
2019-06-14 10:19:21 +03:00
## License
2019-05-16 22:31:52 +03:00
The `ostree` crate is licensed under the MIT license. See the LICENSE file for
2018-10-18 21:13:48 +03:00
details.
2018-10-18 21:13:48 +03:00
libostree itself is licensed under the LGPL2+. See its
[licensing information](https://ostree.readthedocs.io#licensing) for more
information.
The libostree GIR file (`gir-files/OSTree-1.0.gir`) is derived from the
libostree source code and is also licensed under the LGPL2+. A copy of the
LGPL version 2 is included in the LICENSE.LGPL2 file.
The remaining GIR files (`gir-files/*.gir`) are from the glib project and
are licensed under the LGPL2.1+. A copy of the LGPL version 2.1 is included
in the LICENSE.LGPL2.1 file.