Skip to content

Commit

Permalink
Merge in main branch and resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
jawn-smith committed Jan 13, 2023
2 parents 5a827c8 + bf93df3 commit baea7c5
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 47 deletions.
15 changes: 8 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ require (
github.com/go-git/go-git/v5 v5.4.2
github.com/google/uuid v1.3.0
github.com/invopop/jsonschema v0.4.0
github.com/jessevdk/go-flags v1.5.0
github.com/klauspost/compress v1.15.11
github.com/snapcore/snapd v0.0.0-20220927112420-6e453dafb812
github.com/ulikunitz/xz v0.5.10
github.com/jessevdk/go-flags v1.5.1-0.20210607101731-3927b71304df
github.com/xeipuuv/gojsonschema v1.2.0
gopkg.in/yaml.v2 v2.4.0
)

require github.com/ulikunitz/xz v0.5.10 // indirect

require (
github.com/snapcore/secboot v0.0.0-20220905094328-6a625ee231d3 // indirect
github.com/snapcore/secboot v0.0.0-20220922155412-5d2b29ff0ee2 // indirect
github.com/snapcore/snapd v0.0.0-20230110165810-bb2514455dea
github.com/xanzy/ssh-agent v0.3.0 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
Expand All @@ -38,7 +38,7 @@ require (
github.com/Microsoft/go-winio v0.4.16 // indirect
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 // indirect
github.com/acomagu/bufpipe v1.0.3 // indirect
github.com/canonical/go-efilib v0.0.0-20210909101908-41435fa545d4 // indirect
github.com/canonical/go-efilib v0.3.1-0.20220815143333-7e5151412e93 // indirect
github.com/canonical/go-sp800.108-kdf v0.0.0-20210314145419-a3359f2d21b9 // indirect
github.com/canonical/go-sp800.90a-drbg v0.0.0-20210314144037-6eeb1040d6c3 // indirect
github.com/canonical/go-tpm2 v0.0.0-20210827151749-f80ff5afff61 // indirect
Expand All @@ -48,6 +48,7 @@ require (
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-git/go-billy/v5 v5.3.1 // indirect
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 // indirect
github.com/imdario/mergo v0.3.12 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
Expand All @@ -56,7 +57,7 @@ require (
github.com/mitchellh/go-homedir v1.1.0 // indirect
github.com/mvo5/goconfigparser v0.0.0-20201015074339-50f22f44deb5 // indirect
github.com/pierrec/lz4 v2.3.0+incompatible // indirect
github.com/pkg/xattr v0.4.1 // indirect
github.com/pkg/xattr v0.4.1
github.com/sergi/go-diff v1.1.0 // indirect
github.com/sirupsen/logrus v1.7.0 // indirect
github.com/snapcore/bolt v1.3.2-0.20210908134111-63c8bfcf7af8 // indirect
Expand Down
21 changes: 10 additions & 11 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239 h1:kFOfPq6dUM1hTo
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/canonical/go-efilib v0.0.0-20210909101908-41435fa545d4 h1:rSWREoNHHbcIC1iQeKKraBlsDm7cmKg8eS+N48jMVKA=
github.com/canonical/go-efilib v0.0.0-20210909101908-41435fa545d4/go.mod h1:9Sr9kd7IhQPYqaU5nut8Ky97/CtlhHDzQncQnrULgDM=
github.com/canonical/go-efilib v0.3.1-0.20220815143333-7e5151412e93 h1:F0bRDzPy/j2IX/iIWqCEA23S1nal+f7A+/vLyj6Ye+4=
github.com/canonical/go-efilib v0.3.1-0.20220815143333-7e5151412e93/go.mod h1:9b2PNAuPcZsB76x75/uwH99D8CyH/A2y4rq1/+bvplg=
github.com/canonical/go-sp800.108-kdf v0.0.0-20210314145419-a3359f2d21b9 h1:USzKjrfWo/ESzozv2i3OMM7XDgxrZRvaHFrKkIKRtwU=
github.com/canonical/go-sp800.108-kdf v0.0.0-20210314145419-a3359f2d21b9/go.mod h1:Zrs3YjJr+w51u0R/dyLh/oWt/EcBVdLPCVFYC4daW5s=
github.com/canonical/go-sp800.90a-drbg v0.0.0-20210314144037-6eeb1040d6c3 h1:oe6fCvaEpkhyW3qAicT0TnGtyht/UrgvOwMcEgLb7Aw=
Expand Down Expand Up @@ -53,8 +53,9 @@ github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/gorilla/mux v1.7.4-0.20190701202633-d83b6ffe499a h1:Rhv8JUcDkZJkUmzzjpysRtn5joJ/3T8Lt9QpdJZUz1c=
github.com/gorilla/mux v1.7.4-0.20190701202633-d83b6ffe499a/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs=
github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
github.com/gvalkov/golang-evdev v0.0.0-20191114124502-287e62b94bcb/go.mod h1:SAzVFKCRezozJTGavF3GX8MBUruETCqzivVLYiywouA=
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0 h1:i462o439ZjprVSFSZLZxcsoAe592sZB1rci2Z8j4wdk=
github.com/iancoleman/orderedmap v0.0.0-20190318233801-ac98e3ecb4b0/go.mod h1:N0Wam8K1arqPXNWjMo21EXnBPOPp36vB07FNRdD2geA=
Expand All @@ -64,15 +65,13 @@ github.com/invopop/jsonschema v0.4.0 h1:Yuy/unfgCnfV5Wl7H0HgFufp/rlurqPOOuacqyBy
github.com/invopop/jsonschema v0.4.0/go.mod h1:O9uiLokuu0+MGFlyiaqtWxwqJm41/+8Nj0lD7A36YH0=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jessevdk/go-flags v1.4.1-0.20180927143258-7309ec74f752/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
github.com/jessevdk/go-flags v1.5.0 h1:1jKYvbxEjfUl0fmqTCOfonvskHHXMjBySTLW4y9LFvc=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/jessevdk/go-flags v1.5.1-0.20210607101731-3927b71304df h1:JTDw/M13b6dZmEJI/vfcCLENqcjUHi9UBry+R0pjh5Q=
github.com/jessevdk/go-flags v1.5.1-0.20210607101731-3927b71304df/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/juju/ratelimit v1.0.1 h1:+7AIFJVQ0EQgq/K9+0Krm7m530Du7tIz0METWzN0RgY=
github.com/juju/ratelimit v1.0.1/go.mod h1:qapgC/Gy+xNh9UxzV13HGGl/6UXNN+ct+vwSgWNm/qk=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 h1:DowS9hvgyYSX4TO5NpyC606/Z4SxnNYbT+WX27or6Ck=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
github.com/klauspost/compress v1.15.11 h1:Lcadnb3RKGin4FYM/orgq0qde+nc15E5Cbqg4B9Sx9c=
github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
Expand Down Expand Up @@ -113,11 +112,11 @@ github.com/snapcore/bolt v1.3.2-0.20210908134111-63c8bfcf7af8/go.mod h1:Z6z3sf12
github.com/snapcore/go-gettext v0.0.0-20191107141714-82bbea49e785/go.mod h1:D3SsWAXK7wCCBZu+Vk5hc1EuKj/L3XN1puEMXTU4LrQ=
github.com/snapcore/go-gettext v0.0.0-20201130093759-38740d1bd3d2 h1:nETXPg0CiJrMAwC2gqkcam9BiBWYGvTsSYRfrjOz2Kg=
github.com/snapcore/go-gettext v0.0.0-20201130093759-38740d1bd3d2/go.mod h1:D3SsWAXK7wCCBZu+Vk5hc1EuKj/L3XN1puEMXTU4LrQ=
github.com/snapcore/secboot v0.0.0-20220905094328-6a625ee231d3 h1:58BNTUsb16y89bcfYRU23V9ykMhOHHGy9zrVKgKFiqU=
github.com/snapcore/secboot v0.0.0-20220905094328-6a625ee231d3/go.mod h1:72paVOkm4sJugXt+v9ItmnjXgO921D8xqsbH2OekouY=
github.com/snapcore/secboot v0.0.0-20220922155412-5d2b29ff0ee2 h1:sPC5tmNoJ6H8Pu9OHZiYP1YIAlG98Nm44CYS9nliPz0=
github.com/snapcore/secboot v0.0.0-20220922155412-5d2b29ff0ee2/go.mod h1:72paVOkm4sJugXt+v9ItmnjXgO921D8xqsbH2OekouY=
github.com/snapcore/snapd v0.0.0-20201005140838-501d14ac146e/go.mod h1:3xrn7QDDKymcE5VO2rgWEQ5ZAUGb9htfwlXnoel6Io8=
github.com/snapcore/snapd v0.0.0-20220927112420-6e453dafb812 h1:dVhWt4aHNjxUyHFjAs/56O+883CMV6G7Oz7U/JuQLZw=
github.com/snapcore/snapd v0.0.0-20220927112420-6e453dafb812/go.mod h1:IIRpg6/P+gndMxKk1ZxPUJ2Z9Q80+PVFhvyq3rCgHeY=
github.com/snapcore/snapd v0.0.0-20230110165810-bb2514455dea h1:sKRBg9nQLoYJ11ySb7EHOdYJFTBoKXHDr8aLZcFet2Q=
github.com/snapcore/snapd v0.0.0-20230110165810-bb2514455dea/go.mod h1:smkkw6QWeTo9l8t9gxqLcbFzBOPZpeJxa2bHZWWcTYY=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
Expand Down
9 changes: 4 additions & 5 deletions internal/statemachine/common_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,21 +234,20 @@ func (stateMachine *StateMachine) populateBootfsContents() error {

// now call LayoutVolume to get a LaidOutVolume we can use
// with a mountedFilesystemWriter
layoutConstraints := gadget.LayoutConstraints{}
layoutOptions := &gadget.LayoutOptions{
SkipResolveContent: false,
IgnoreContent: false,
GadgetRootDir: filepath.Join(stateMachine.tempDirs.unpack, "gadget"),
KernelRootDir: filepath.Join(stateMachine.tempDirs.unpack, "kernel"),
}
laidOutVolume, err := gadgetLayoutVolume(volume, layoutConstraints, layoutOptions)
laidOutVolume, err := gadgetLayoutVolume(volume, layoutOptions)
if err != nil {
return fmt.Errorf("Error laying out bootfs contents: %s", err.Error())
}

for ii, laidOutStructure := range laidOutVolume.LaidOutStructure {
var targetDir string
if laidOutStructure.Role == gadget.SystemSeed {
if laidOutStructure.Role() == gadget.SystemSeed {
targetDir = stateMachine.tempDirs.rootfs
} else {
targetDir = filepath.Join(stateMachine.tempDirs.volumes,
Expand All @@ -261,8 +260,8 @@ func (stateMachine *StateMachine) populateBootfsContents() error {
// signed bootloader image which has this path embedded, so
// we need to install our files to there.
if !stateMachine.IsSeeded &&
(laidOutStructure.Role == gadget.SystemBoot ||
laidOutStructure.Label == gadget.SystemBoot) {
(laidOutStructure.Role() == gadget.SystemBoot ||
laidOutStructure.Label() == gadget.SystemBoot) {
if err := stateMachine.handleSecureBoot(volume, targetDir); err != nil {
return err
}
Expand Down
17 changes: 2 additions & 15 deletions internal/statemachine/snap_states.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func (stateMachine *StateMachine) prepareImage() error {
imageOpts.Preseed = snapStateMachine.Opts.Preseed
imageOpts.PreseedSignKey = snapStateMachine.Opts.PreseedSignKey
imageOpts.AppArmorKernelFeaturesDir = snapStateMachine.Opts.AppArmorKernelFeaturesDir
imageOpts.SeedManifestPath = filepath.Join(stateMachine.commonFlags.OutputDir, "seed.manifest")

customizations := *new(image.Customizations)
if snapStateMachine.Opts.DisableConsoleConf {
Expand Down Expand Up @@ -127,19 +128,5 @@ func (stateMachine *StateMachine) generateSnapManifest() error {
// snaps.manifest
outputPath := filepath.Join(stateMachine.commonFlags.OutputDir, "snaps.manifest")
snapsDir := filepath.Join(stateMachine.tempDirs.rootfs, "system-data", "var", "lib", "snapd", "snaps")
err := WriteSnapManifest(snapsDir, outputPath)
if err != nil {
return err
}

// seed.manifest
outputPath = filepath.Join(stateMachine.commonFlags.OutputDir, "seed.manifest")
if stateMachine.IsSeeded {
snapsDir = filepath.Join(stateMachine.tempDirs.rootfs, "snaps")
} else {
snapsDir = filepath.Join(stateMachine.tempDirs.rootfs, "system-data", "var", "lib", "snapd", "seed", "snaps")
}
err = WriteSnapManifest(snapsDir, outputPath)

return err
return WriteSnapManifest(snapsDir, outputPath)
}
8 changes: 2 additions & 6 deletions internal/statemachine/snap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,9 @@ func TestGenerateSnapManifest(t *testing.T) {
// Check if manifests got generated and if they have expected contents
// For both UC20+ and regular images
var testResultMap map[string][]string
if tc.seeded {
testResultMap = map[string][]string{
"seed.manifest": {"foo 1.23", "uc20specific 345"},
}
} else {
if !tc.seeded {
testResultMap = map[string][]string{
"snaps.manifest": {"foo 1.23", "bar 1.23_version", "baz 234"},
"seed.manifest": {"foo 1.23", "test 1234"},
}
}
for manifest, snapList := range testResultMap {
Expand Down Expand Up @@ -443,6 +438,7 @@ func TestSnapFlagSyntax(t *testing.T) {
asserter.AssertErrNil(err, true)
defer os.RemoveAll(workDir)
stateMachine.stateMachineFlags.WorkDir = workDir
stateMachine.commonFlags.OutputDir = workDir

err = stateMachine.Setup()
asserter.AssertErrNil(err, true)
Expand Down
2 changes: 1 addition & 1 deletion internal/statemachine/state_machine_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func mockCheckTags(interface{}, string) (string, error) {
func mockCopyBlobSuccess([]string) error {
return nil
}
func mockLayoutVolume(*gadget.Volume, gadget.LayoutConstraints, *gadget.LayoutOptions) (*gadget.LaidOutVolume, error) {
func mockLayoutVolume(*gadget.Volume, *gadget.LayoutOptions) (*gadget.LaidOutVolume, error) {
return nil, fmt.Errorf("Test Error")
}
func mockNewMountedFilesystemWriter(*gadget.LaidOutStructure,
Expand Down
4 changes: 2 additions & 2 deletions snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ summary: Create Ubuntu images
description: |
Official tool for building Ubuntu images, currently supporing Ubuntu Core
snap-based images and preinstalled Ubuntu classic images.
version: 3.0+snap1~beta11
version: 3.0+snap1~beta12
grade: stable
confinement: classic
base: core20
base: core22
source-code: https://github.com/canonical/ubuntu-image
issues: https://bugs.launchpad.net/ubuntu-image/+filebug

Expand Down
1 change: 1 addition & 0 deletions spread.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ prepare: |
apt install -y snapd libc6-dev gcc-multilib
snap install core20 --channel=latest/edge
snap install --classic snapcraft
snap install --classic go --channel=1.19/stable
unset SHELL
snapcraft --destructive-mode
snap install --classic --dangerous ubuntu-image_*.snap
Expand Down

0 comments on commit baea7c5

Please sign in to comment.