Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/snap-switch
Browse files Browse the repository at this point in the history
  • Loading branch information
mvo5 committed Jul 20, 2017
2 parents 856b7db + a462005 commit 1e29c9e
Show file tree
Hide file tree
Showing 1,060 changed files with 61,863 additions and 19,367 deletions.
16 changes: 10 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,28 @@ po/snappy.pot
.dirstamp
cmd/decode-mount-opts/decode-mount-opts
cmd/libsnap-confine-private/unit-tests
cmd/snap-update-ns/snap-update-ns
cmd/snap-confine/snap-confine
cmd/snap-confine/snap-confine-unit-tests
cmd/snap-confine/snap-confine.apparmor
cmd/snap-confine/unit-tests
cmd/snap-discard-ns/snap-discard-ns
cmd/snap-update-ns/snap-update-ns
cmd/snap-update-ns/unit-tests
cmd/system-shutdown/system-shutdown
cmd/system-shutdown/system-shutdown-unit-tests
cmd/system-shutdown/unit-tests

# manual pages
cmd/*/*.[1-9]

# auto-generated systemd units
data/systemd/*.service

# test-driver
*.log
*.trs

# Automake
Makefile
Makefile.in
# Automake for the cmd/ parts
cmd/Makefile
cmd/Makefile.in
snap-confine-*.tar.gz
.deps

Expand Down
10 changes: 5 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ env:
# SPREAD_LINODE_KEY
- secure: "bzALrfNSLwM0bjceal1PU5rFErvqVhi00Sygx8jruo6htpZay3hrC2sHCKCQKPn1kvCfHidrHX1vnomg5N+B9o25GZEYSjKSGxuvdNDfCZYqPNjMbz5y7xXYfKWgyo+xtrKRM85Nqy121SfRz3KLDvrOLwwreb+pZv8DG1WraFTd7D6rK7nLnnYNUyw665XBMFVnM8ue3Zu9496Ih/TfQXhnNpsZY8xFWte4+cH7JvVCVTs8snjoGVZi3972PzinNkfBgJa24cUzxFMfiN/AwSBXJQKdVv+FsbB4uRgXAqTNwuus7PptiPNxpWWojuhm1Qgbk0XhGIdJxyUYkmNA4UrZ3C29nIRWbuAiHJ6ZWd1ur3dqphqOcgFInltSHkpfEdlL3YK4dCa2SmJESzotUGnyowCUUCXkWdDaZmFTwyK0Y6He9oyXDK5f+/U7SFlPvok0caJCvB9HbTQR1kYdh048I/R+Ht5QrFOZPk21DYWDOYhn7SzthBDZLsaL6n5gX7Y547SsL4B35YVbpaeHzccG6Mox8rI4bqlGFvP1U5i8uXD4uQjJChlVxpmozUEMok9T5RVediJs540p5uc8DQl48Nke02tXzC/XpGAvpnXT7eiiRNW67zOj2QcIV+ni3lBj3HvZeB9cgjzLNrZSl/t9vseqnNwQWpl3V6nd/bU="

matrix:
- RUN=static
- RUN=unit
- RUN=spread
git:
quiet: true

install:
- curl -s -o - http://canihazip.com/s
- sudo apt-get update -qq
- sudo apt-get install -qq squashfs-tools xdelta3
- sudo apt-get install -qq gnupg1 || sudo apt-get install -qq gnupg

script: ./run-checks --$RUN
script:
- ./run-checks --spread
4 changes: 4 additions & 0 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ Add `$GOPATH/bin` to your `PATH`, so you can run the go programs you install:

PATH="$PATH:$GOPATH/bin"

(note `$GOPATH` can actually point to multiple locations, like `$PATH`, so if
your `$GOPATH` is more complex than a single entry you'll need to adjust the
above).

### Getting the snapd sources

The easiest way to get the source for `snapd` is to use the `go get` command.
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[![Build Status][travis-image]][travis-url]
[![Go Report Card][goreportcard-image]][goreportcard-url]

[![codecov][codecov-image]][codecov-url]

## Snaps

Package any app for every Linux desktop, server, cloud or device.
Expand Down Expand Up @@ -40,3 +41,6 @@ Get news and stay up to date on [Twitter](https://twitter.com/snapcraftio),

[coveralls-image]: https://coveralls.io/repos/snapcore/snapd/badge.svg?branch=master&service=github
[coveralls-url]: https://coveralls.io/github/snapcore/snapd?branch=master

[codecov-url]: https://codecov.io/gh/snapcore/snapd
[codecov-image]: https://codecov.io/gh/snapcore/snapd/branch/master/graph/badge.svg
57 changes: 56 additions & 1 deletion arch/arch.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ package arch
import (
"log"
"runtime"
"syscall"
)

// ArchitectureType is the type for a supported snappy architecture
Expand All @@ -38,6 +39,9 @@ func SetArchitecture(newArch ArchitectureType) {
arch = newArch
}

// FIXME: rename all Ubuntu*Architecture() to SnapdArchitecture()
// (or DpkgArchitecture)

// UbuntuArchitecture returns the debian equivalent architecture for the
// currently running architecture.
//
Expand All @@ -62,11 +66,62 @@ func ubuntuArchFromGoArch(goarch string) string {
"ppc64le": "ppc64el",
"s390x": "s390x",
"ppc": "powerpc",
// available in debian and other distros
"ppc64": "ppc64",
}

ubuntuArch := goArchMapping[goarch]
if ubuntuArch == "" {
log.Panicf("unknown goarch %v", goarch)
log.Panicf("unknown goarch %q", goarch)
}

return ubuntuArch
}

// UbuntuKernelArchitecture return 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.
// a snapd:i386 on an amd64 kernel.
func UbuntuKernelArchitecture() string {
var utsname syscall.Utsname
if err := syscall.Uname(&utsname); err != nil {
log.Panicf("cannot get kernel architecture: %v", err)
}

// syscall.Utsname{} is using [65]int8 for all char[] inside it,
// this makes converting it so awkward. The alternative would be
// to use a unsafe.Pointer() to cast it to a [65]byte slice.
// see https://github.com/golang/go/issues/20753
kernelArch := make([]byte, 0, len(utsname.Machine))
for _, c := range utsname.Machine {
if c == 0 {
break
}
kernelArch = append(kernelArch, byte(c))
}

return ubuntuArchFromKernelArch(string(kernelArch))
}

// ubuntuArchFromkernelArch maps the kernel architecture as reported
// via uname() to the dpkg architecture
func ubuntuArchFromKernelArch(utsMachine string) string {
kernelArchMapping := map[string]string{
// kernel ubuntu
"i686": "i386",
"x86_64": "amd64",
"armv7l": "armhf",
"aarch64": "arm64",
"ppc64le": "ppc64el",
"s390x": "s390x",
"ppc": "powerpc",
// available in debian and other distros
"ppc64": "ppc64",
}

ubuntuArch := kernelArchMapping[utsMachine]
if ubuntuArch == "" {
log.Panicf("unknown kernel arch %q", utsMachine)
}

return ubuntuArch
Expand Down
2 changes: 2 additions & 0 deletions arch/arch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ func (ts *ArchTestSuite) TestUbuntuArchitecture(c *C) {
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")
}

func (ts *ArchTestSuite) TestSetArchitecture(c *C) {
Expand Down
4 changes: 4 additions & 0 deletions asserts/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ package asserts

import (
"fmt"
"regexp"
"time"
)

var (
accountValidationCertified = "certified"

// account ids look like snap-ids or a nice identifier
validAccountID = regexp.MustCompile("^(?:[a-z0-9A-Z]{32}|[-a-z0-9]{2,28})$")
)

// Account holds an account assertion, which ties a name for an account
Expand Down
Loading

0 comments on commit 1e29c9e

Please sign in to comment.