File: manip_seed.py

package info (click to toggle)
snapd 2.72-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 80,412 kB
  • sloc: sh: 16,506; ansic: 16,211; python: 11,213; makefile: 1,919; exp: 190; awk: 58; xml: 22
file content (29 lines) | stat: -rw-r--r-- 674 bytes parent folder | download | duplicates (5)
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
import sys
import yaml
from os import path

with open(sys.argv[1]) as f:
    seed = yaml.load(f)

i = 0
snaps = seed["snaps"]
while i < len(snaps):
    entry = snaps[i]
    if entry["name"] == "pc":
        snaps[i] = {
            "name": "pc",
            "unasserted": True,
            "file": "pc_x1.snap",
        }
        break
    i += 1

for snap in sys.argv[2:]:
    # test-snapd-with-configure_123.snap -> test-snapd-configure
    snapname = path.basename(snap).split("_")[0]
    snaps.append(
        {"name": snapname, "channel": "edge", "file": snap,}
    )

with open(sys.argv[1], "w") as f:
    yaml.dump(seed, stream=f, indent=2, default_flow_style=False)