1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277
|
// -*- Mode: Go; indent-tabs-mode: t -*-
/*
* Copyright (C) 2015-2019 Canonical Ltd
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
package seedtest
var SampleSnapYaml = map[string]string{
"core": `name: core
type: os
version: 1.0
`,
"pc-kernel": `name: pc-kernel
type: kernel
version: 1.0
`,
"pc": `name: pc
type: gadget
version: 1.0
`,
"classic-gadget": `name: classic-gadget
version: 1.0
type: gadget
`,
"required": `name: required
type: app
version: 1.0
`,
"classic-snap": `name: classic-snap
type: app
confinement: classic
version: 1.0
`,
"snapd": `name: snapd
type: snapd
version: 1.0
`,
"core18": `name: core18
type: base
version: 1.0
`,
"pc-kernel=18": `name: pc-kernel
type: kernel
version: 1.0
`,
"pc=18": `name: pc
type: gadget
base: core18
version: 1.0
`,
"classic-gadget18": `name: classic-gadget18
version: 1.0
base: core18
type: gadget
`,
"required18": `name: required18
type: app
base: core18
version: 1.0
`,
"core20": `name: core20
type: base
version: 1.0
`,
"pc-kernel=20": `name: pc-kernel
type: kernel
version: 1.0
`,
"pc=20": `name: pc
type: gadget
base: core20
version: 1.0
`,
"required20": `name: required20
type: app
base: core20
version: 1.0
components:
comp1:
type: standard
comp2:
type: standard
`,
"required20+comp1": `component: required20+comp1
type: standard
version: 1.0
`,
"required20+comp1_kernel": `component: required20+comp1
type: kernel-modules
version: 1.0
`,
"required20+comp2": `component: required20+comp2
type: standard
version: 2.0
`,
"required20+unknown": `component: required20+unknown
type: standard
version: 2.0
`,
"aux-info-test": `name: aux-info-test
type: app
base: core20
version: 1.0
links:
contact:
- mailto:author@example.com
`,
"component-test": `name: component-test
type: app
base: core20
version: 1.0
components:
comp1:
type: standard
comp2:
type: standard
comp3:
type: standard
`,
"component-test+comp1": `component: component-test+comp1
type: standard
version: 1.0
`,
"component-test+comp2": `component: component-test+comp2
type: standard
version: 2.0
`,
"component-test+comp3": `component: component-test+comp3
type: standard
version: 2.0
`,
"local-component-test": `name: local-component-test
type: app
base: core20
version: 1.0
components:
comp4:
type: standard
`,
"local-component-test+comp4": `component: local-component-test+comp4
type: standard
version: 1.0
`,
"optional20-a": `name: optional20-a
type: app
base: core20
version: 1.0
`,
"optional20-b": `name: optional20-b
type: app
base: core20
version: 1.0`,
"uboot-gadget=20": `name: uboot-gadget
type: gadget
base: core20
version: 1.0
`,
"arm-kernel=20": `name: arm-kernel
type: kernel
version: 1.0
`,
"test-devmode=20": `name: test-devmode
type: app
base: core20
version: 1.0
confinement: devmode
`,
"core22": `name: core22
type: base
version: 1.0
`,
"core24": `name: core24
type: base
version: 1.0
`,
"pc-kernel=22": `name: pc-kernel
type: kernel
version: 1.0
`,
"pc-kernel=24": `name: pc-kernel
type: kernel
version: 1.0
`,
"pc-kernel=22+kmods": `name: pc-kernel
type: kernel
version: 1.0
components:
kcomp1:
type: kernel-modules
kcomp2:
type: kernel-modules
`,
"pc-kernel=24+kmods": `name: pc-kernel
type: kernel
version: 1.0
components:
kcomp1:
type: kernel-modules
kcomp2:
type: kernel-modules
kcomp3:
type: kernel-modules
`,
"pc-kernel+kcomp1": `component: pc-kernel+kcomp1
type: kernel-modules
version: 1.0
`,
"pc-kernel+kcomp2": `component: pc-kernel+kcomp2
type: kernel-modules
version: 1.0
`,
"pc-kernel+kcomp3": `component: pc-kernel+kcomp3
type: kernel-modules
version: 1.0
`,
"pc=22": `name: pc
type: gadget
base: core22
version: 1.0
`,
"pc=24": `name: pc
type: gadget
base: core24
version: 1.0
`,
"optional22": `name: optional22
type: app
base: core22
version: 1.0
components:
comp1:
type: standard
`,
"optional22+comp1": `component: optional22+comp1
type: standard
version: 1.0
`,
"optional24": `name: optional24
type: app
base: core24
version: 1.0
components:
comp1:
type: standard
`,
"optional24+comp1": `component: optional24+comp1
type: standard
version: 1.0
`,
}
func MergeSampleSnapYaml(snapYaml ...map[string]string) map[string]string {
if len(snapYaml) == 0 {
return nil
}
merged := make(map[string]string, len(snapYaml[0]))
for _, m := range snapYaml {
for yamlKey, yaml := range m {
merged[yamlKey] = yaml
}
}
return merged
}
|