The CommandFromCore helper is currently always looking at the
core snap. With the snapd snap we need to refactor it so that
it uses the snapd snap if available and just falls back to the
core snap.
The osutil.CommandFromCore is not in the rightplace and it also does
not take the snapd snap into account. This PR moves it to the
cmd/cmdutil package (cannot be in cmd because of an import cycle
with cmd/snapinfo.go).
It also tweaks the arguments slightly (no need to pass the
snapMountDir anymore).
Importing `dirs` package in `osutil` leads to import cycles if one attempts to
use `osutils` from packages that are directly or indirectly imported by `dirs`,
such as `release`. It doesn't make any sense for `osutil` to depend on
other non `*util` packages.
Signed-off-by: Maciej Borzecki <maciej.zenon.borzecki@canonical.com>
In golang 1.9 there are richer error constructs returned from certain
operations and tests were very precisely monitoring the result. This
patch adjust tests to work on both golang 1.9 and earlier.
Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
This avoids us having to add a dependency to snapd for xdelta3 (and fixes the issues that snapd 2.0.10 from Ubuntu 16.04.1 won't apt-get upgrade with any new dependencies).
It is slightly complicated because we want to ensure that the correct ld-linux.so is used and also that the correct libraries from core (instead of from the host) are used.