summaryrefslogtreecommitdiff
diff options
-rw-r--r--arch/arch.go43
-rw-r--r--arch/arch_test.go26
-rw-r--r--cmd/snap-repair/runner.go2
-rw-r--r--cmd/snap-repair/runner_test.go6
-rw-r--r--cmd/snap-seccomp/export_test.go16
-rw-r--r--cmd/snap-seccomp/main.go22
-rw-r--r--cmd/snap-seccomp/main_test.go8
-rw-r--r--daemon/api_test.go2
-rw-r--r--daemon/response.go2
-rw-r--r--errtracker/errtracker.go2
-rw-r--r--errtracker/errtracker_test.go4
-rw-r--r--httputil/useragent.go2
-rw-r--r--interfaces/seccomp/backend.go12
-rw-r--r--interfaces/seccomp/backend_test.go12
-rw-r--r--interfaces/seccomp/export_test.go8
-rw-r--r--overlord/snapstate/check_snap.go2
-rw-r--r--overlord/snapstate/check_snap_test.go2
-rw-r--r--packaging/debian-sid/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch15
-rw-r--r--snap/channel/channel.go2
-rw-r--r--snap/channel/channel_test.go20
-rw-r--r--snap/snapenv/snapenv.go2
-rw-r--r--snap/snapenv/snapenv_test.go6
-rw-r--r--store/store.go2
-rw-r--r--store/store_test.go16
24 files changed, 114 insertions, 120 deletions
diff --git a/arch/arch.go b/arch/arch.go
index d98139476e..9b8a578f36 100644
--- a/arch/arch.go
+++ b/arch/arch.go
@@ -33,33 +33,30 @@ type ArchitectureType string
// change the architecture. This is important to e.g. install
// armhf snaps onto a armhf image that is generated on an amd64
// machine
-var arch = ArchitectureType(ubuntuArchFromGoArch(runtime.GOARCH))
+var arch = ArchitectureType(dpkgArchFromGoArch(runtime.GOARCH))
// SetArchitecture allows overriding the auto detected Architecture
func SetArchitecture(newArch ArchitectureType) {
arch = newArch
}
-// FIXME: rename all Ubuntu*Architecture() to SnapdArchitecture()
-// (or DpkgArchitecture)
-
-// UbuntuArchitecture returns the debian equivalent architecture for the
+// DpkgArchitecture returns the debian equivalent architecture for the
// currently running architecture.
//
// If the architecture does not map any debian architecture, the
// GOARCH is returned.
-func UbuntuArchitecture() string {
+func DpkgArchitecture() string {
return string(arch)
}
-// ubuntuArchFromGoArch maps a go architecture string to the coresponding
-// Ubuntu architecture string.
+// dpkgArchFromGoArch maps a go architecture string to the coresponding
+// Debian equivalent architecture string.
//
// E.g. the go "386" architecture string maps to the ubuntu "i386"
// architecture.
-func ubuntuArchFromGoArch(goarch string) string {
+func dpkgArchFromGoArch(goarch string) string {
goArchMapping := map[string]string{
- // go ubuntu
+ // go dpkg
"386": "i386",
"amd64": "amd64",
"arm": "armhf",
@@ -82,27 +79,27 @@ func ubuntuArchFromGoArch(goarch string) string {
}
}
- ubuntuArch := goArchMapping[goarch]
- if ubuntuArch == "" {
+ dpkgArch := goArchMapping[goarch]
+ if dpkgArch == "" {
log.Panicf("unknown goarch %q", goarch)
}
- return ubuntuArch
+ return dpkgArch
}
-// UbuntuKernelArchitecture return the debian equivalent architecture
+// DpkgKernelArchitecture returns the debian equivalent architecture
// for the current running kernel. This is usually the same as the
-// UbuntuArchitecture - however there maybe cases that you run e.g.
+// DpkgArchitecture - however there maybe cases that you run e.g.
// a snapd:i386 on an amd64 kernel.
-func UbuntuKernelArchitecture() string {
- return ubuntuArchFromKernelArch(osutil.MachineName())
+func DpkgKernelArchitecture() string {
+ return dpkgArchFromKernelArch(osutil.MachineName())
}
-// ubuntuArchFromkernelArch maps the kernel architecture as reported
+// dpkgArchFromkernelArch maps the kernel architecture as reported
// via uname() to the dpkg architecture
-func ubuntuArchFromKernelArch(utsMachine string) string {
+func dpkgArchFromKernelArch(utsMachine string) string {
kernelArchMapping := map[string]string{
- // kernel ubuntu
+ // kernel dpkg
"i686": "i386",
"x86_64": "amd64",
"armv7l": "armhf",
@@ -115,12 +112,12 @@ func ubuntuArchFromKernelArch(utsMachine string) string {
"ppc64": "ppc64",
}
- ubuntuArch := kernelArchMapping[utsMachine]
- if ubuntuArch == "" {
+ dpkgArch := kernelArchMapping[utsMachine]
+ if dpkgArch == "" {
log.Panicf("unknown kernel arch %q", utsMachine)
}
- return ubuntuArch
+ return dpkgArch
}
// IsSupportedArchitecture returns true if the system architecture is in the
diff --git a/arch/arch_test.go b/arch/arch_test.go
index cc5c82c4a9..ef3e6401af 100644
--- a/arch/arch_test.go
+++ b/arch/arch_test.go
@@ -33,24 +33,24 @@ var _ = Suite(&ArchTestSuite{})
type ArchTestSuite struct {
}
-func (ts *ArchTestSuite) TestUbuntuArchitecture(c *C) {
- c.Check(ubuntuArchFromGoArch("386"), Equals, "i386")
- c.Check(ubuntuArchFromGoArch("amd64"), Equals, "amd64")
- c.Check(ubuntuArchFromGoArch("arm"), Equals, "armhf")
- c.Check(ubuntuArchFromGoArch("arm64"), Equals, "arm64")
- c.Check(ubuntuArchFromGoArch("ppc64le"), Equals, "ppc64el")
- c.Check(ubuntuArchFromGoArch("ppc64"), Equals, "ppc64")
- c.Check(ubuntuArchFromGoArch("s390x"), Equals, "s390x")
- c.Check(ubuntuArchFromGoArch("ppc"), Equals, "powerpc")
- c.Check(ubuntuArchFromGoArch("ppc64"), Equals, "ppc64")
+func (ts *ArchTestSuite) TestArchDpkgArchitecture(c *C) {
+ c.Check(dpkgArchFromGoArch("386"), Equals, "i386")
+ c.Check(dpkgArchFromGoArch("amd64"), Equals, "amd64")
+ c.Check(dpkgArchFromGoArch("arm"), Equals, "armhf")
+ c.Check(dpkgArchFromGoArch("arm64"), Equals, "arm64")
+ c.Check(dpkgArchFromGoArch("ppc64le"), Equals, "ppc64el")
+ c.Check(dpkgArchFromGoArch("ppc64"), Equals, "ppc64")
+ c.Check(dpkgArchFromGoArch("s390x"), Equals, "s390x")
+ c.Check(dpkgArchFromGoArch("ppc"), Equals, "powerpc")
+ c.Check(dpkgArchFromGoArch("ppc64"), Equals, "ppc64")
}
-func (ts *ArchTestSuite) TestSetArchitecture(c *C) {
+func (ts *ArchTestSuite) TestArchSetArchitecture(c *C) {
SetArchitecture("armhf")
- c.Assert(UbuntuArchitecture(), Equals, "armhf")
+ c.Assert(DpkgArchitecture(), Equals, "armhf")
}
-func (ts *ArchTestSuite) TestSupportedArchitectures(c *C) {
+func (ts *ArchTestSuite) TestArchSupportedArchitectures(c *C) {
arch = "armhf"
c.Check(IsSupportedArchitecture([]string{"all"}), Equals, true)
c.Check(IsSupportedArchitecture([]string{"amd64", "armhf", "powerpc"}), Equals, true)
diff --git a/cmd/snap-repair/runner.go b/cmd/snap-repair/runner.go
index 91f9fe9770..335f020dd3 100644
--- a/cmd/snap-repair/runner.go
+++ b/cmd/snap-repair/runner.go
@@ -776,7 +776,7 @@ func (run *Runner) Applicable(headers map[string]interface{}) bool {
if err != nil {
return false
}
- if len(archs) != 0 && !strutil.ListContains(archs, arch.UbuntuArchitecture()) {
+ if len(archs) != 0 && !strutil.ListContains(archs, arch.DpkgArchitecture()) {
return false
}
brandModel := fmt.Sprintf("%s/%s", run.state.Device.Brand, run.state.Device.Model)
diff --git a/cmd/snap-repair/runner_test.go b/cmd/snap-repair/runner_test.go
index 279854c6af..2afdf885af 100644
--- a/cmd/snap-repair/runner_test.go
+++ b/cmd/snap-repair/runner_test.go
@@ -782,10 +782,10 @@ func (s *runnerSuite) TestApplicable(c *C) {
{map[string]interface{}{"series": []interface{}{"18", "16"}}, true},
{map[string]interface{}{"series": "18"}, false},
{map[string]interface{}{"series": []interface{}{18}}, false},
- {map[string]interface{}{"architectures": []interface{}{arch.UbuntuArchitecture()}}, true},
+ {map[string]interface{}{"architectures": []interface{}{arch.DpkgArchitecture()}}, true},
{map[string]interface{}{"architectures": []interface{}{"other-arch"}}, false},
- {map[string]interface{}{"architectures": []interface{}{"other-arch", arch.UbuntuArchitecture()}}, true},
- {map[string]interface{}{"architectures": arch.UbuntuArchitecture()}, false},
+ {map[string]interface{}{"architectures": []interface{}{"other-arch", arch.DpkgArchitecture()}}, true},
+ {map[string]interface{}{"architectures": arch.DpkgArchitecture()}, false},
{map[string]interface{}{"models": []interface{}{"my-brand/my-model"}}, true},
{map[string]interface{}{"models": []interface{}{"other-brand/other-model"}}, false},
{map[string]interface{}{"models": []interface{}{"other-brand/other-model", "my-brand/my-model"}}, true},
diff --git a/cmd/snap-seccomp/export_test.go b/cmd/snap-seccomp/export_test.go
index c29030d9f7..48d23d846d 100644
--- a/cmd/snap-seccomp/export_test.go
+++ b/cmd/snap-seccomp/export_test.go
@@ -26,19 +26,19 @@ var (
GoSeccompFeatures = goSeccompFeatures
)
-func MockArchUbuntuArchitecture(f func() string) (restore func()) {
- realArchUbuntuArchitecture := archUbuntuArchitecture
- archUbuntuArchitecture = f
+func MockArchDpkgArchitecture(f func() string) (restore func()) {
+ realArchDpkgArchitecture := archDpkgArchitecture
+ archDpkgArchitecture = f
return func() {
- archUbuntuArchitecture = realArchUbuntuArchitecture
+ archDpkgArchitecture = realArchDpkgArchitecture
}
}
-func MockArchUbuntuKernelArchitecture(f func() string) (restore func()) {
- realArchUbuntuKernelArchitecture := archUbuntuKernelArchitecture
- archUbuntuKernelArchitecture = f
+func MockArchDpkgKernelArchitecture(f func() string) (restore func()) {
+ realArchDpkgKernelArchitecture := archDpkgKernelArchitecture
+ archDpkgKernelArchitecture = f
return func() {
- archUbuntuKernelArchitecture = realArchUbuntuKernelArchitecture
+ archDpkgKernelArchitecture = realArchDpkgKernelArchitecture
}
}
diff --git a/cmd/snap-seccomp/main.go b/cmd/snap-seccomp/main.go
index 8fcf6df74d..81670ce8b2 100644
--- a/cmd/snap-seccomp/main.go
+++ b/cmd/snap-seccomp/main.go
@@ -426,10 +426,10 @@ var seccompResolver = map[string]uint64{
"PTRACE_CONT": C.PTRACE_CONT,
}
-// UbuntuArchToScmpArch takes a dpkg architecture and converts it to
+// DpkgArchToScmpArch takes a dpkg architecture and converts it to
// the seccomp.ScmpArch as used in the libseccomp-golang library
-func UbuntuArchToScmpArch(ubuntuArch string) seccomp.ScmpArch {
- switch ubuntuArch {
+func DpkgArchToScmpArch(dpkgArch string) seccomp.ScmpArch {
+ switch dpkgArch {
case "amd64":
return seccomp.ArchAMD64
case "arm64":
@@ -447,7 +447,7 @@ func UbuntuArchToScmpArch(ubuntuArch string) seccomp.ScmpArch {
case "s390x":
return seccomp.ArchS390X
}
- panic(fmt.Sprintf("cannot map ubuntu arch %q to a seccomp arch", ubuntuArch))
+ panic(fmt.Sprintf("cannot map dpkg arch %q to a seccomp arch", dpkgArch))
}
// important for unit testing
@@ -631,13 +631,13 @@ func parseLine(line string, secFilter *seccomp.ScmpFilter) error {
// used to mock in tests
var (
- archUbuntuArchitecture = arch.UbuntuArchitecture
- archUbuntuKernelArchitecture = arch.UbuntuKernelArchitecture
+ archDpkgArchitecture = arch.DpkgArchitecture
+ archDpkgKernelArchitecture = arch.DpkgKernelArchitecture
)
var (
- ubuntuArchitecture = archUbuntuArchitecture()
- ubuntuKernelArchitecture = archUbuntuKernelArchitecture()
+ dpkgArchitecture = archDpkgArchitecture()
+ dpkgKernelArchitecture = archDpkgKernelArchitecture()
)
// For architectures that support a compat architecture, when the
@@ -653,8 +653,8 @@ func addSecondaryArches(secFilter *seccomp.ScmpFilter) error {
// add a compat architecture for some architectures that
// support it, e.g. on amd64 kernel and userland, we add
// compat i386 syscalls.
- if ubuntuArchitecture == ubuntuKernelArchitecture {
- switch archUbuntuArchitecture() {
+ if dpkgArchitecture == dpkgKernelArchitecture {
+ switch archDpkgArchitecture() {
case "amd64":
compatArch = seccomp.ArchX86
case "arm64":
@@ -672,7 +672,7 @@ func addSecondaryArches(secFilter *seccomp.ScmpFilter) error {
// snaps. While unusual from a traditional Linux distribution
// perspective, certain classes of embedded devices are known
// to use this configuration.
- compatArch = UbuntuArchToScmpArch(archUbuntuKernelArchitecture())
+ compatArch = DpkgArchToScmpArch(archDpkgKernelArchitecture())
}
if compatArch != seccomp.ArchInvalid {
diff --git a/cmd/snap-seccomp/main_test.go b/cmd/snap-seccomp/main_test.go
index 6385834e72..75262367fc 100644
--- a/cmd/snap-seccomp/main_test.go
+++ b/cmd/snap-seccomp/main_test.go
@@ -191,7 +191,7 @@ func (s *snapSeccompSuite) SetUpSuite(c *C) {
// Build 32bit runner on amd64 to test non-native syscall handling.
// Ideally we would build for ppc64el->powerpc and arm64->armhf but
// it seems tricky to find the right gcc-multilib for this.
- if arch.UbuntuArchitecture() == "amd64" && s.canCheckCompatArch {
+ if arch.DpkgArchitecture() == "amd64" && s.canCheckCompatArch {
cmd = exec.Command(cmd.Args[0], cmd.Args[1:]...)
cmd.Args = append(cmd.Args, "-m32")
for i, k := range cmd.Args {
@@ -274,7 +274,7 @@ restart_syscall
// compiler that can produce the required binaries. Currently
// we only test amd64 running i386 here.
if syscallArch != "native" {
- syscallNr, err = seccomp.GetSyscallFromNameByArch(syscallName, main.UbuntuArchToScmpArch(syscallArch))
+ syscallNr, err = seccomp.GetSyscallFromNameByArch(syscallName, main.DpkgArchToScmpArch(syscallArch))
c.Assert(err, IsNil)
switch syscallArch {
@@ -825,10 +825,10 @@ func (s *snapSeccompSuite) TestCompatArchWorks(c *C) {
// https://github.com/seccomp/libseccomp/issues/86
//
// This means we can not just
- // main.MockArchUbuntuArchitecture(t.arch)
+ // main.MockArchDpkgArchitecture(t.arch)
// here because on endian mismatch the arch will *not* be
// added
- if arch.UbuntuArchitecture() == t.arch {
+ if arch.DpkgArchitecture() == t.arch {
s.runBpf(c, t.seccompWhitelist, t.bpfInput, t.expected)
}
}
diff --git a/daemon/api_test.go b/daemon/api_test.go
index 693f023e80..84073438b8 100644
--- a/daemon/api_test.go
+++ b/daemon/api_test.go
@@ -7125,7 +7125,7 @@ func (s *apiSuite) TestErrToResponseNoSnapsDoesNotPanic(c *check.C) {
func (s *apiSuite) TestErrToResponseForRevisionNotAvailable(c *check.C) {
si := &snapInstruction{Action: "frobble", Snaps: []string{"foo"}}
- thisArch := arch.UbuntuArchitecture()
+ thisArch := arch.DpkgArchitecture()
err := &store.RevisionNotAvailableError{
Action: "install",
diff --git a/daemon/response.go b/daemon/response.go
index b10937f522..c542cba82b 100644
--- a/daemon/response.go
+++ b/daemon/response.go
@@ -420,7 +420,7 @@ func SnapRevisionNotAvailable(snapName string, rnaErr *store.RevisionNotAvailabl
kind := errorKindSnapRevisionNotAvailable
msg := rnaErr.Error()
if len(rnaErr.Releases) != 0 && rnaErr.Channel != "" {
- thisArch := arch.UbuntuArchitecture()
+ thisArch := arch.DpkgArchitecture()
values := map[string]interface{}{
"snap-name": snapName,
"action": rnaErr.Action,
diff --git a/errtracker/errtracker.go b/errtracker/errtracker.go
index d55643ec63..5172148183 100644
--- a/errtracker/errtracker.go
+++ b/errtracker/errtracker.go
@@ -429,7 +429,7 @@ func report(errMsg, dupSig string, extra map[string]string) (string, error) {
}
report := map[string]string{
- "Architecture": arch.UbuntuArchitecture(),
+ "Architecture": arch.DpkgArchitecture(),
"SnapdVersion": SnapdVersion,
"DistroRelease": distroRelease(),
"HostSnapdBuildID": hostBuildID,
diff --git a/errtracker/errtracker_test.go b/errtracker/errtracker_test.go
index 33613577c6..cf01819b47 100644
--- a/errtracker/errtracker_test.go
+++ b/errtracker/errtracker_test.go
@@ -167,7 +167,7 @@ func (s *ErrtrackerTestSuite) TestReport(c *C) {
"KernelVersion": osutil.KernelVersion(),
"ErrorMessage": "failed to do stuff",
"DuplicateSignature": "[failed to do stuff]",
- "Architecture": arch.UbuntuArchitecture(),
+ "Architecture": arch.DpkgArchitecture(),
"DidSnapdReExec": "yes",
"ProblemType": "Snap",
@@ -312,7 +312,7 @@ func (s *ErrtrackerTestSuite) TestReportRepair(c *C) {
"SnapdVersion": "some-snapd-version",
"Date": "Fri Feb 17 09:51:00 2017",
"KernelVersion": osutil.KernelVersion(),
- "Architecture": arch.UbuntuArchitecture(),
+ "Architecture": arch.DpkgArchitecture(),
"DidSnapdReExec": "yes",
"ProblemType": "Repair",
diff --git a/httputil/useragent.go b/httputil/useragent.go
index 20c86cb2c8..4c1dc15e5e 100644
--- a/httputil/useragent.go
+++ b/httputil/useragent.go
@@ -64,7 +64,7 @@ func SetUserAgentFromVersion(version string, extraProds ...string) (restore func
// assumption checks out in practice, q.v. https://github.com/zyga/os-release-zoo
userAgent = fmt.Sprintf("snapd/%v (%s)%s %s/%s (%s) linux/%s", version,
strings.Join(extras, "; "), extraProdStr, release.ReleaseInfo.ID,
- release.ReleaseInfo.VersionID, string(arch.UbuntuArchitecture()),
+ release.ReleaseInfo.VersionID, string(arch.DpkgArchitecture()),
sanitizeKernelVersion(osutil.KernelVersion()))
return func() {
userAgent = origUserAgent
diff --git a/interfaces/seccomp/backend.go b/interfaces/seccomp/backend.go
index e0c23e9faa..6108b951bb 100644
--- a/interfaces/seccomp/backend.go
+++ b/interfaces/seccomp/backend.go
@@ -53,11 +53,11 @@ import (
)
var (
- kernelFeatures = release.SecCompActions
- ubuntuKernelArchitecture = arch.UbuntuKernelArchitecture
- releaseInfoId = release.ReleaseInfo.ID
- releaseInfoVersionId = release.ReleaseInfo.VersionID
- requiresSocketcall = requiresSocketcallImpl
+ kernelFeatures = release.SecCompActions
+ dpkgKernelArchitecture = arch.DpkgKernelArchitecture
+ releaseInfoId = release.ReleaseInfo.ID
+ releaseInfoVersionId = release.ReleaseInfo.VersionID
+ requiresSocketcall = requiresSocketcallImpl
snapSeccompVersionInfo = snapSeccompVersionInfoImpl
seccompCompilerLookup = cmd.InternalToolPath
@@ -365,7 +365,7 @@ func (b *Backend) SandboxFeatures() []string {
// - if the kernel architecture is not any of the above, force the use of
// socketcall()
func requiresSocketcallImpl(baseSnap string) bool {
- switch ubuntuKernelArchitecture() {
+ switch dpkgKernelArchitecture() {
case "i386", "s390x":
// glibc sysdeps/unix/sysv/linux/i386/kernel-features.h and
// sysdeps/unix/sysv/linux/s390/kernel-features.h added the
diff --git a/interfaces/seccomp/backend_test.go b/interfaces/seccomp/backend_test.go
index c1b9fe34c1..89e94d6ea3 100644
--- a/interfaces/seccomp/backend_test.go
+++ b/interfaces/seccomp/backend_test.go
@@ -491,7 +491,7 @@ fi`)
func (s *backendSuite) TestRequiresSocketcallByNotNeededArch(c *C) {
testArchs := []string{"amd64", "armhf", "arm64", "powerpc", "ppc64el", "unknownDefault"}
for _, arch := range testArchs {
- restore := seccomp.MockUbuntuKernelArchitecture(func() string { return arch })
+ restore := seccomp.MockDpkgKernelArchitecture(func() string { return arch })
defer restore()
c.Assert(seccomp.RequiresSocketcall(""), Equals, false)
}
@@ -500,7 +500,7 @@ func (s *backendSuite) TestRequiresSocketcallByNotNeededArch(c *C) {
func (s *backendSuite) TestRequiresSocketcallForceByArch(c *C) {
testArchs := []string{"sparc", "sparc64"}
for _, arch := range testArchs {
- restore := seccomp.MockUbuntuKernelArchitecture(func() string { return arch })
+ restore := seccomp.MockDpkgKernelArchitecture(func() string { return arch })
defer restore()
c.Assert(seccomp.RequiresSocketcall(""), Equals, true)
}
@@ -542,7 +542,7 @@ func (s *backendSuite) TestRequiresSocketcallForcedViaUbuntuRelease(c *C) {
for _, t := range tests {
restore = seccomp.MockReleaseInfoId(t.distro)
defer restore()
- restore = seccomp.MockUbuntuKernelArchitecture(func() string { return t.arch })
+ restore = seccomp.MockDpkgKernelArchitecture(func() string { return t.arch })
defer restore()
restore = seccomp.MockReleaseInfoVersionId(t.release)
defer restore()
@@ -581,7 +581,7 @@ func (s *backendSuite) TestRequiresSocketcallForcedViaKernelVersion(c *C) {
}
for _, t := range tests {
- restore := seccomp.MockUbuntuKernelArchitecture(func() string { return t.arch })
+ restore := seccomp.MockDpkgKernelArchitecture(func() string { return t.arch })
defer restore()
restore = osutil.MockKernelVersion(t.version)
defer restore()
@@ -597,7 +597,7 @@ func (s *backendSuite) TestRequiresSocketcallForcedViaBaseSnap(c *C) {
// check is reached
restore := seccomp.MockReleaseInfoId("other")
defer restore()
- restore = seccomp.MockUbuntuKernelArchitecture(func() string { return "i386" })
+ restore = seccomp.MockDpkgKernelArchitecture(func() string { return "i386" })
defer restore()
restore = osutil.MockKernelVersion("4.3")
defer restore()
@@ -613,7 +613,7 @@ func (s *backendSuite) TestRequiresSocketcallNotForcedViaBaseSnap(c *C) {
// check is reached
restore := seccomp.MockReleaseInfoId("other")
defer restore()
- restore = seccomp.MockUbuntuKernelArchitecture(func() string { return "i386" })
+ restore = seccomp.MockDpkgKernelArchitecture(func() string { return "i386" })
defer restore()
restore = osutil.MockKernelVersion("4.3")
defer restore()
diff --git a/interfaces/seccomp/export_test.go b/interfaces/seccomp/export_test.go
index f5c22d4a2e..36b9ec0e6c 100644
--- a/interfaces/seccomp/export_test.go
+++ b/interfaces/seccomp/export_test.go
@@ -54,11 +54,11 @@ func MockRequiresSocketcall(f func(string) bool) (restore func()) {
}
}
-func MockUbuntuKernelArchitecture(f func() string) (restore func()) {
- old := ubuntuKernelArchitecture
- ubuntuKernelArchitecture = f
+func MockDpkgKernelArchitecture(f func() string) (restore func()) {
+ old := dpkgKernelArchitecture
+ dpkgKernelArchitecture = f
return func() {
- ubuntuKernelArchitecture = old
+ dpkgKernelArchitecture = old
}
}
diff --git a/overlord/snapstate/check_snap.go b/overlord/snapstate/check_snap.go
index cf3ff7f04b..d8ba5f0583 100644
--- a/overlord/snapstate/check_snap.go
+++ b/overlord/snapstate/check_snap.go
@@ -320,7 +320,7 @@ func validateInfoAndFlags(info *snap.Info, snapst *SnapState, flags Flags) error
// verify we have a valid architecture
if !arch.IsSupportedArchitecture(info.Architectures) {
- return fmt.Errorf("snap %q supported architectures (%s) are incompatible with this system (%s)", info.InstanceName(), strings.Join(info.Architectures, ", "), arch.UbuntuArchitecture())
+ return fmt.Errorf("snap %q supported architectures (%s) are incompatible with this system (%s)", info.InstanceName(), strings.Join(info.Architectures, ", "), arch.DpkgArchitecture())
}
// check assumes
diff --git a/overlord/snapstate/check_snap_test.go b/overlord/snapstate/check_snap_test.go
index 9bbb7e0c9c..cb263b0f11 100644
--- a/overlord/snapstate/check_snap_test.go
+++ b/overlord/snapstate/check_snap_test.go
@@ -88,7 +88,7 @@ architectures:
err = snapstate.CheckSnap(s.st, "snap-path", "hello", nil, nil, snapstate.Flags{}, nil)
- errorMsg := fmt.Sprintf(`snap "hello" supported architectures (yadayada, blahblah) are incompatible with this system (%s)`, arch.UbuntuArchitecture())
+ errorMsg := fmt.Sprintf(`snap "hello" supported architectures (yadayada, blahblah) are incompatible with this system (%s)`, arch.DpkgArchitecture())
c.Assert(err.Error(), Equals, errorMsg)
}
diff --git a/packaging/debian-sid/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch b/packaging/debian-sid/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch
index 0db9d1e8a4..f6e032a0fd 100644
--- a/packaging/debian-sid/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch
+++ b/packaging/debian-sid/patches/0003-cmd-snap-seccomp-skip-tests-that-use-m32.patch
@@ -24,14 +24,14 @@ Signed-off-by: Zygmunt Krynicki <me@zygoon.pl>
cmd/snap-seccomp/main_test.go | 8 ++++++++
1 file changed, 8 insertions(+)
-diff --git a/cmd/snap-seccomp/main_test.go b/cmd/snap-seccomp/main_test.go
-index d4ca193b2..8977385c2 100644
---- a/cmd/snap-seccomp/main_test.go
-+++ b/cmd/snap-seccomp/main_test.go
-@@ -185,6 +185,14 @@ func (s *snapSeccompSuite) SetUpSuite(c *C) {
+Index: snapd/cmd/snap-seccomp/main_test.go
+===================================================================
+--- snapd.orig/cmd/snap-seccomp/main_test.go
++++ snapd/cmd/snap-seccomp/main_test.go
+@@ -192,6 +192,14 @@ func (s *snapSeccompSuite) SetUpSuite(c
// Ideally we would build for ppc64el->powerpc and arm64->armhf but
// it seems tricky to find the right gcc-multilib for this.
- if arch.UbuntuArchitecture() == "amd64" && s.canCheckCompatArch {
+ if arch.DpkgArchitecture() == "amd64" && s.canCheckCompatArch {
+ // This test fails on Debian amd64
+ // cannot build multi-lib syscall runner: exit status 1
+ // In file included from /usr/include/errno.h:25,
@@ -43,6 +43,3 @@ index d4ca193b2..8977385c2 100644
cmd = exec.Command(cmd.Args[0], cmd.Args[1:]...)
cmd.Args = append(cmd.Args, "-m32")
for i, k := range cmd.Args {
---
-2.17.1
-
diff --git a/snap/channel/channel.go b/snap/channel/channel.go
index 7e57278481..30d652531e 100644
--- a/snap/channel/channel.go
+++ b/snap/channel/channel.go
@@ -69,7 +69,7 @@ func ParseVerbatim(s string, architecture string) (Channel, error) {
}
if architecture == "" {
- architecture = arch.UbuntuArchitecture()
+ architecture = arch.DpkgArchitecture()
}
ch := Channel{
diff --git a/snap/channel/channel_test.go b/snap/channel/channel_test.go
index 62d583eb6f..812a9782b9 100644
--- a/snap/channel/channel_test.go
+++ b/snap/channel/channel_test.go
@@ -38,7 +38,7 @@ func (s storeChannelSuite) TestParse(c *C) {
ch, err := channel.Parse("stable", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Name: "stable",
Track: "",
Risk: "stable",
@@ -48,7 +48,7 @@ func (s storeChannelSuite) TestParse(c *C) {
ch, err = channel.Parse("latest/stable", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Name: "stable",
Track: "",
Risk: "stable",
@@ -58,7 +58,7 @@ func (s storeChannelSuite) TestParse(c *C) {
ch, err = channel.Parse("1.0/edge", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Name: "1.0/edge",
Track: "1.0",
Risk: "edge",
@@ -68,7 +68,7 @@ func (s storeChannelSuite) TestParse(c *C) {
ch, err = channel.Parse("1.0", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Name: "1.0/stable",
Track: "1.0",
Risk: "stable",
@@ -78,7 +78,7 @@ func (s storeChannelSuite) TestParse(c *C) {
ch, err = channel.Parse("1.0/beta/foo", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Name: "1.0/beta/foo",
Track: "1.0",
Risk: "beta",
@@ -88,7 +88,7 @@ func (s storeChannelSuite) TestParse(c *C) {
ch, err = channel.Parse("candidate/foo", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Name: "candidate/foo",
Track: "",
Risk: "candidate",
@@ -116,7 +116,7 @@ func (s storeChannelSuite) TestParseVerbatim(c *C) {
ch, err := channel.ParseVerbatim("sometrack", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Track: "sometrack",
})
c.Check(ch.VerbatimTrackOnly(), Equals, true)
@@ -126,7 +126,7 @@ func (s storeChannelSuite) TestParseVerbatim(c *C) {
ch, err = channel.ParseVerbatim("latest", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Track: "latest",
})
c.Check(ch.VerbatimTrackOnly(), Equals, true)
@@ -146,7 +146,7 @@ func (s storeChannelSuite) TestParseVerbatim(c *C) {
ch, err = channel.ParseVerbatim("latest/stable", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Track: "latest",
Risk: "stable",
})
@@ -157,7 +157,7 @@ func (s storeChannelSuite) TestParseVerbatim(c *C) {
ch, err = channel.ParseVerbatim("latest/stable/foo", "")
c.Assert(err, IsNil)
c.Check(ch, DeepEquals, channel.Channel{
- Architecture: arch.UbuntuArchitecture(),
+ Architecture: arch.DpkgArchitecture(),
Track: "latest",
Risk: "stable",
Branch: "foo",
diff --git a/snap/snapenv/snapenv.go b/snap/snapenv/snapenv.go
index 58e47980b2..03ae4490bc 100644
--- a/snap/snapenv/snapenv.go
+++ b/snap/snapenv/snapenv.go
@@ -112,7 +112,7 @@ func basicEnv(info *snap.Info) map[string]string {
"SNAP_INSTANCE_KEY": info.InstanceKey,
"SNAP_VERSION": info.Version,
"SNAP_REVISION": info.Revision.String(),
- "SNAP_ARCH": arch.UbuntuArchitecture(),
+ "SNAP_ARCH": arch.DpkgArchitecture(),
// see https://github.com/snapcore/snapd/pull/2732#pullrequestreview-18827193
"SNAP_LIBRARY_PATH": "/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void",
"SNAP_REEXEC": os.Getenv("SNAP_REEXEC"),
diff --git a/snap/snapenv/snapenv_test.go b/snap/snapenv/snapenv_test.go
index afa78fc5c0..030f35ede6 100644
--- a/snap/snapenv/snapenv_test.go
+++ b/snap/snapenv/snapenv_test.go
@@ -82,7 +82,7 @@ func (ts *HTestSuite) TestBasic(c *C) {
c.Assert(env, DeepEquals, map[string]string{
"SNAP": fmt.Sprintf("%s/foo/17", dirs.CoreSnapMountDir),
- "SNAP_ARCH": arch.UbuntuArchitecture(),
+ "SNAP_ARCH": arch.DpkgArchitecture(),
"SNAP_COMMON": "/var/snap/foo/common",
"SNAP_DATA": "/var/snap/foo/17",
"SNAP_LIBRARY_PATH": "/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void",
@@ -136,7 +136,7 @@ func (s *HTestSuite) TestSnapRunSnapExecEnv(c *C) {
env := snapEnv(info)
c.Check(env, DeepEquals, map[string]string{
- "SNAP_ARCH": arch.UbuntuArchitecture(),
+ "SNAP_ARCH": arch.DpkgArchitecture(),
"SNAP_LIBRARY_PATH": "/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void",
"SNAP_NAME": "snapname",
"SNAP_INSTANCE_NAME": "snapname",
@@ -178,7 +178,7 @@ func (s *HTestSuite) TestParallelInstallSnapRunSnapExecEnv(c *C) {
env := snapEnv(info)
c.Check(env, DeepEquals, map[string]string{
- "SNAP_ARCH": arch.UbuntuArchitecture(),
+ "SNAP_ARCH": arch.DpkgArchitecture(),
"SNAP_LIBRARY_PATH": "/var/lib/snapd/lib/gl:/var/lib/snapd/lib/gl32:/var/lib/snapd/void",
"SNAP_NAME": "snapname",
"SNAP_INSTANCE_NAME": "snapname_foo",
diff --git a/store/store.go b/store/store.go
index 49ba063acc..ec359cb883 100644
--- a/store/store.go
+++ b/store/store.go
@@ -348,7 +348,7 @@ func New(cfg *Config, dauthCtx DeviceAndAuthContext) *Store {
architecture := cfg.Architecture
if cfg.Architecture == "" {
- architecture = arch.UbuntuArchitecture()
+ architecture = arch.DpkgArchitecture()
}
series := cfg.Series
diff --git a/store/store_test.go b/store/store_test.go
index e963b30e23..ad482dbf4c 100644
--- a/store/store_test.go
+++ b/store/store_test.go
@@ -1997,7 +1997,7 @@ func (s *storeTestSuite) TestInfo(c *C) {
query := r.URL.Query()
c.Check(query.Get("fields"), Equals, "abc,def")
- c.Check(query.Get("architecture"), Equals, arch.UbuntuArchitecture())
+ c.Check(query.Get("architecture"), Equals, arch.DpkgArchitecture())
w.Header().Set("X-Suggested-Currency", "GBP")
w.WriteHeader(200)
@@ -2961,7 +2961,7 @@ func (s *storeTestSuite) TestFind(c *C) {
c.Check(r.URL.Query().Get("fields"), Equals, "abc,def")
c.Check(r.Header.Get("X-Ubuntu-Series"), Equals, release.Series)
- c.Check(r.Header.Get("X-Ubuntu-Architecture"), Equals, arch.UbuntuArchitecture())
+ c.Check(r.Header.Get("X-Ubuntu-Architecture"), Equals, arch.DpkgArchitecture())
c.Check(r.Header.Get("X-Ubuntu-Classic"), Equals, "false")
c.Check(r.Header.Get("X-Ubuntu-Confinement"), Equals, "")
@@ -4452,7 +4452,7 @@ func (s *storeTestSuite) TestSnapAction(c *C) {
c.Check(storeID, Equals, "")
c.Check(r.Header.Get("Snap-Device-Series"), Equals, release.Series)
- c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.UbuntuArchitecture())
+ c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.DpkgArchitecture())
c.Check(r.Header.Get("Snap-Classic"), Equals, "false")
jsonReq, err := ioutil.ReadAll(r.Body)
@@ -4562,7 +4562,7 @@ func (s *storeTestSuite) TestSnapActionNonZeroEpochAndEpochBump(c *C) {
c.Check(storeID, Equals, "")
c.Check(r.Header.Get("Snap-Device-Series"), Equals, release.Series)
- c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.UbuntuArchitecture())
+ c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.DpkgArchitecture())
c.Check(r.Header.Get("Snap-Classic"), Equals, "false")
jsonReq, err := ioutil.ReadAll(r.Body)
@@ -5567,7 +5567,7 @@ func (s *storeTestSuite) testSnapActionGet(action, cohort string, c *C) {
c.Check(storeID, Equals, "")
c.Check(r.Header.Get("Snap-Device-Series"), Equals, release.Series)
- c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.UbuntuArchitecture())
+ c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.DpkgArchitecture())
c.Check(r.Header.Get("Snap-Classic"), Equals, "false")
jsonReq, err := ioutil.ReadAll(r.Body)
@@ -5664,7 +5664,7 @@ func (s *storeTestSuite) TestSnapActionInstallAmend(c *C) {
c.Check(storeID, Equals, "")
c.Check(r.Header.Get("Snap-Device-Series"), Equals, release.Series)
- c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.UbuntuArchitecture())
+ c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.DpkgArchitecture())
c.Check(r.Header.Get("Snap-Classic"), Equals, "false")
jsonReq, err := ioutil.ReadAll(r.Body)
@@ -5834,7 +5834,7 @@ func (s *storeTestSuite) testSnapActionGetWithRevision(action string, c *C) {
c.Check(storeID, Equals, "")
c.Check(r.Header.Get("Snap-Device-Series"), Equals, release.Series)
- c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.UbuntuArchitecture())
+ c.Check(r.Header.Get("Snap-Device-Architecture"), Equals, arch.DpkgArchitecture())
c.Check(r.Header.Get("Snap-Classic"), Equals, "false")
jsonReq, err := ioutil.ReadAll(r.Body)
@@ -6564,7 +6564,7 @@ func (s *storeTestSuite) TestConnectivityCheckHappy(c *C) {
switch r.URL.Path {
case "/v2/snaps/info/core":
c.Check(r.Method, Equals, "GET")
- c.Check(r.URL.Query(), DeepEquals, url.Values{"fields": {"download"}, "architecture": {arch.UbuntuArchitecture()}})
+ c.Check(r.URL.Query(), DeepEquals, url.Values{"fields": {"download"}, "architecture": {arch.DpkgArchitecture()}})
u, err := url.Parse("/download/core")
c.Assert(err, IsNil)
io.WriteString(w,