Add a notion of "physical" sysroot, use for remote writing
authorColin Walters <walters@verbum.org>
Tue, 30 May 2017 18:07:13 +0000 (14:07 -0400)
committerAtomic Bot <atomic-devel@projectatomic.io>
Tue, 18 Jul 2017 18:58:06 +0000 (18:58 +0000)
commite0346c149498a7ec7d5c064a9d5485c9dcb693b1
treebb011b7ccbce2ec892077cf447ffee39f0f9a103
parent8b1f1c442810307c938eab5d5aa2eaf6501a6543
Add a notion of "physical" sysroot, use for remote writing

(Note this PR was reverted in <https://github.com/ostreedev/ostree/pull/902>;
 this version should be better)

Using `${sysroot}` to mean the physical storage root: We don't want to write to
`${sysroot}/etc/ostree/remotes.d`, since nothing will read it, and really
`${sysroot}` should just have `/ostree` (ideally). Today the Anaconda rpmostree
code ends up writing there. Fix this by adding a notion of "physical" sysroot.
We determine whether the path is physical by checking for `/sysroot`, which
exists in deployment roots (and there shouldn't be a `${sysroot}/sysroot`).

In order to unit test this, I added a `--sysroot` argument to `remote add`.
However, doing this better would require reworking the command line parsing for
the `remote` argument to support specifying `--repo` or `--sysroot`, and I
didn't quite want to do that yet in this patch.

This second iteration of this patch fixes the bug we hit the first time;
embarassingly enough I broke `ostree remote list` finding system remotes.
The fix is to have `ostree_repo_open()` figure out whether it's the same
as `/ostree/repo` for now.

Down the line...we might consider having the `ostree remote` command line itself
instatiate an `OstreeSysroot` by default, but this maximizes compatibility; we
just have to pay a small cost that `ostree` usage outside of that case like
`ostree static-delta` in a releng Jenkins job or whatever will do this `stat()`
too.

Closes: https://github.com/ostreedev/ostree/issues/892
Closes: #1008
Approved by: mbarnes
13 files changed:
src/libostree/ostree-repo-private.h
src/libostree/ostree-repo.c
src/libostree/ostree-sysroot-private.h
src/libostree/ostree-sysroot.c
src/ostree/ot-main.c
src/ostree/ot-main.h
src/ostree/ot-remote-builtin-add.c
src/ostree/ot-remote-builtin-delete.c
tests/admin-test.sh
tests/installed/itest-remotes.sh [new file with mode: 0755]
tests/test-admin-deploy-grub2.sh
tests/test-admin-deploy-syslinux.sh
tests/test-admin-deploy-uboot.sh