Commit Graph

463 Commits

Author SHA1 Message Date
Colin Walters
e731f59007 rust: Split out treefile into its own module
Further prep for adding more code here.  The `lib.rs` then is the
collection of glue functions; perhaps in some ideal future it could
be generated even.

Closes: #1444
Approved by: jlebon
2018-07-05 13:58:22 +00:00
Colin Walters
2894d61fbf build-sys: Make Rust library naming/entrypoint more generic
Prep for adding more functionality beyond treefile bits.

Closes: #1444
Approved by: jlebon
2018-07-05 13:58:22 +00:00
Colin Walters
bac6d634bb build-sys: Move Rust include header under rust/ directory
It makes more sense to have the include live next to the associated
code, just like we do with C, even though the `cargo build` doesn't
touch it.

Closes: #1444
Approved by: jlebon
2018-07-05 13:58:22 +00:00
Colin Walters
d7342731ab Add a treefile option to stop creating /etc/machine-id
We actually want systemd's `ConditionFirstBoot` to fire.  The
primary rationale here is that we're adopting Ignition for Fedora CoreOS,
and having `ConditionFirstBoot=` function will help a lot, as the idea
is it only runs once.

However, I discovered that this breaks the `units` directive for example,
as systemd blows away all the unit state in `/etc`.  The correct thing
to do from the start is to use presets.  We could add an implementation of
`units` which works with this on and instead writes a preset file but...eh.
My plan is to at some point introduce an "epoch" and flip various defaults,
this one, `tmp-is-dir`, the passwd file handling, etc.

See: https://github.com/dustymabe/bootengine/pull/11

Closes: #1425
Approved by: jlebon
2018-06-25 16:19:00 +00:00
Colin Walters
a4a8c7cc96 rust/treefile: Fix mutate-os-release typo
It's tempting to enable this by default in YAML...one step at a
time though.
2018-06-21 11:53:06 -04:00
Jonathan Lebon
293baa222d treefile.rs: Add missing #[serde(rename)] attributes
I was surprised when I fired up GDB and found out that my
`etc-group-members` modifications weren't being obeyed. It turns out
serde was looking for the wrong field name. I did a quick sanity check
and found a few others.

Closes: #1417
Approved by: cgwalters
2018-06-15 18:48:34 +00:00
Colin Walters
85a39dd923 rust/treefile: Buffer writes
Not doing buffering is a perf footgun.  Thanks to @lucab for
the PR on the original code that was copied here.

Equivalent to https://github.com/cgwalters/coreos-assembler/pull/3

Closes: #1405
Approved by: jlebon
2018-06-12 21:25:07 +00:00
Colin Walters
5fec2b1af3 build-sys: Add some gitignore for Rust bits
Just keeping status tidy.

Closes: #1397
Approved by: jlebon
2018-06-11 13:08:41 +00:00
Colin Walters
c997fd99c2 rust: Fix unused-import in release mode
Closes: #1391
Approved by: jlebon
2018-06-06 15:52:48 +00:00
Jonathan Lebon
98ed545e1e rust: Use flat_map for splitting package whitespace
This is mostly for fun, though I do like the final result as well.

Closes: #1390
Approved by: cgwalters
2018-06-05 22:02:34 +00:00
Jonathan Lebon
60d49c3413 rust: Pass through clippy
Some tweaks as suggested by rust-clippy.

Closes: #1390
Approved by: cgwalters
2018-06-05 22:02:34 +00:00
Colin Walters
702daa2335 rust: Fix automake warnings, add unit tests to glibutils
Automake was warning about duplicate `clean-local` definitions, let's
do the nonrecursive automake dance.

And while I'm here, let's add some Rust unit tests that actually run
on `make check` too, since the whole unit testing bits of Rust are
awesome.

(I also tweaked the propagate bits to use the nicer `is_null()` method)

Closes: #1389
Approved by: jlebon
2018-06-05 19:53:41 +00:00
Jonathan Lebon
479406e6a5 Add support for YAML treefiles
Let's modernize and start supporting YAML treefiles. I'll dare make the
sweeping generalization that most people would prefer reading and
writing YAML over JSON.

This takes bits from coreos-assembler[1] that know how to serialize a
YAML file and spit it back out as a JSON and makes it into a shared lib
that we can link against. We could use this eventually for JSON inputs
as well to force a validation check before composing.

If we go this route, we could then turn on `--enable-rust` in FAHC for
now and drop the duplicate code in coreos-assembler.

[1] https://github.com/cgwalters/coreos-assembler

Closes: #1377
Approved by: cgwalters
2018-06-05 13:08:33 +00:00