debian,vendor: import github.com/snapcore/squashfs and use #4049

Open
wants to merge 9 commits into
from
Next

debian,vendor: import github.com/snapcore/squashfs and use

This PR will add a new vendor dependency github.com/snapcore/squashfs
that is used to provide squashfuse for lxd.
  • Loading branch information...
commit bff17ef731ea8e2bc88a1ab2066b33a2bc8c0e31 @mvo5 mvo5 committed Oct 16, 2017
@@ -20,9 +20,13 @@ Build-Depends: autoconf,
golang-any (>=2:1.6) | golang-1.6,
indent,
init-system-helpers,
- libcap-dev,
libapparmor-dev,
+ libcap-dev,
+ libfuse-dev,
libglib2.0-dev,
+ liblz4-dev,
+ liblzma-dev,
+ liblzo2-dev,
libseccomp-dev,
libudev-dev,
openssh-client,
@@ -32,7 +36,8 @@ Build-Depends: autoconf,
python3-markdown,
squashfs-tools,
udev,
- xfslibs-dev
+ xfslibs-dev,
+ zlib1g-dev
Standards-Version: 3.9.7
Homepage: https://github.com/snapcore/snapd
Vcs-Browser: https://github.com/snapcore/snapd
@@ -116,14 +116,21 @@ endif
$(MAKE) -C data clean
# XXX: hacky
$(MAKE) -C cmd distclean || true
+ # XXX: hacky^2
+ (cd vendor/github.com/snapcore/squashfuse && rm -f snapfuse && make distclean || true )
override_dh_auto_build:
# usually done via `go generate` but that is not supported on powerpc
./mkversion.sh
# Build golang bits
mkdir -p _build/src/$(DH_GOPKG)/cmd/snap/test-data
cp -a cmd/snap/test-data/*.gpg _build/src/$(DH_GOPKG)/cmd/snap/test-data/
+ # dh-golang does not copy no-C/go files, do this manually now
+ cp -a vendor/github.com/snapcore/squashfuse/dummy-* _build/src/github.com/snapcore/snapd/vendor/github.com/snapcore/squashfuse/
+
+ # this is the main go build
dh_auto_build -- $(BUILDFLAGS) $(TAGS) $(GCCGOFLAGS)
+
# Generate static snap-exec and snap-update-ns - it somehow includes CGO so
# we must force a static build here. We need a static snap-{exec,update-ns}
# inside the core snap because not all bases will have a libc
@@ -141,6 +148,9 @@ override_dh_auto_build:
# Generate the real systemd/dbus/env config files
$(MAKE) -C data all
+ # build squashfuse and rename to snapfuse
+ (cd vendor/github.com/snapcore/squashfuse && ./autogen.sh --disable-demo && make && mv squashfuse snapfuse)
+
override_dh_auto_test:
dh_auto_test -- $(GCCGOFLAGS)
# a tested default (production) build should have no test keys
@@ -29,3 +29,6 @@ usr/share/man/man5/snap-discard-ns.5
# for compatibility with ancient snap installs that wrote the shell based
# wrapper scripts instead of the modern symlinks
usr/bin/ubuntu-core-launcher
+
+# install squashfuse as snapfuse to ensure it is available in e.g. lxd
+vendor/github.com/snapcore/snapfuse usr/bin
View
@@ -389,8 +389,7 @@ func useFuse() bool {
return false
}
- _, err := exec.LookPath("squashfuse")
- if err != nil {
+ if !osutil.ExecutableExists("squashfuse") && !osutil.ExecutableExists("snapfuse") {
return false
}
@@ -423,7 +422,14 @@ func (s *systemd) WriteMountUnitFile(name, what, where, fstype string) (string,
fstype = "none"
} else if fstype == "squashfs" && useFuse() {
options = append(options, "allow_other")
- fstype = "fuse.squashfuse"
+ switch {
+ case osutil.ExecutableExists("squashfuse"):
+ fstype = "fuse.squashfuse"
+ case osutil.ExecutableExists("snapfuse"):
+ fstype = "fuse.snapfuse"
+ default:
+ panic("cannot happen because useFuse() ensures on of the two executables is there")
+ }
}
c := fmt.Sprintf(`[Unit]
@@ -70,10 +70,6 @@ execute: |
lxd.lxc exec my-ubuntu -- systemctl restart snapd.service
lxd.lxc exec my-ubuntu -- cat /etc/environment
- # FIXME: workaround for missing squashfuse
- lxd.lxc exec my-ubuntu apt update
- lxd.lxc exec my-ubuntu -- apt install -y squashfuse
-
# FIXME: ensure that the kernel running is recent enough, this
# will only work with an up-to-date xenial kernel (4.4.0-78+)
View
@@ -66,6 +66,12 @@
"revision": "95289a7e0ac17c76737a5ceca3c9471c0adf70c7",
"revisionTime": "2016-07-14T06:47:45Z"
},
+ {
+ "checksumSHA1": "KF1072ga8v3PrfxDqA+6yfFuErU=",
+ "path": "github.com/snapcore/squashfuse",
+ "revision": "ed6f37bbee6537e0598aa7f4f5dafa379be0c73a",
+ "revisionTime": "2017-10-16T10:34:55Z"
+ },
{
"checksumSHA1": "TT1rac6kpQp2vz24m5yDGUNQ/QQ=",
"path": "golang.org/x/crypto/cast5",