~brian-murray/ubuntu-cdimage/intel-iot-focal

« back to all changes in this revision

Viewing changes to lib/cdimage/livefs.py

  • Committer: Łukasz 'sil2100' Zemczak
  • Date: 2021-06-25 12:14:06 UTC
  • mfrom: (1946.1.2 cdimage-to-livefs-map)
  • Revision ID: lukasz.zemczak@canonical.com-20210625121406-ftdn618onh6p1brw
Add a etc/cdimage-to-livecd-rootfs-map mapping config file to streamline all the various cdimage->livefs mappings done implicitly in code. We also add the mapping bits for generic arm64 and amd64 images while at it.

Show diffs side-by-side

added added

removed removed

Lines of Context:
67
67
    pass
68
68
 
69
69
 
70
 
def split_arch(arch):
71
 
    arch_bits = arch.split("+", 1)
 
70
def split_arch(config, arch):
 
71
    # To make sure we're compatible with everything before, we need to do the
 
72
    # arch -> livefs_arch mapping here. This way we're consistent with how it
 
73
    # worked previously
 
74
    live_arch = config.livefs_arch_for_arch(arch)
 
75
    arch_bits = live_arch.split("+", 1)
72
76
    if len(arch_bits) == 1:
73
77
        arch_bits.append("")
74
78
    cpuarch, subarch = arch_bits
75
 
 
76
 
    if cpuarch == "amd64" and subarch == "mac":
77
 
        # Use normal amd64 live image on amd64+mac.
78
 
        subarch = ""
79
 
 
80
 
    if cpuarch == "riscv64":
81
 
        # need to specify subarch to get raw.xz instead of qcow2
82
 
        # originally, no subarch was the unleashed image. Add support
83
 
        # for user-friendly subarch names and translate them to u-boot
84
 
        # target names for livecd-rootfs maybe the two will be able to
85
 
        # merge but at the moment, they are very different SOCs.
86
 
        if subarch == "":
87
 
            subarch = "hifive"  # for focal
88
 
        elif subarch == "unleashed":
89
 
            subarch = "sifive_fu540"
90
 
        elif subarch == "unmatched":
91
 
            subarch = "sifive_hifive_unmatched_fu740"
92
 
 
93
79
    return cpuarch, subarch
94
80
 
95
81
 
96
82
def live_builder(config, arch):
97
 
    cpuarch, subarch = split_arch(arch)
 
83
    cpuarch, subarch = split_arch(config, arch)
98
84
    project = config.project
99
85
 
100
86
    path = os.path.join(config.root, "production", "livefs-builders")
126
112
def live_build_options(config, arch):
127
113
    options = []
128
114
 
129
 
    cpuarch, subarch = split_arch(arch)
 
115
    cpuarch, subarch = split_arch(config, arch)
130
116
    if (cpuarch in ("armel", "armhf") and
131
117
            config.image_type == "daily-preinstalled"):
132
118
        if subarch in ("mx5", "omap", "omap4"):
149
135
 
150
136
 
151
137
def live_project(config, arch):
152
 
    project = config.project
153
 
 
154
 
    if project == "livecd-base":
155
 
        liveproject = "base"
156
 
    elif (project == "ubuntu-server" and
157
 
          config.image_type == "daily-preinstalled"):
158
 
        liveproject = "ubuntu-cpc"
159
 
    elif project == "ubuntu-appliance":
160
 
        liveproject = "ubuntu-core"
161
 
    else:
162
 
        liveproject = project
163
 
 
164
 
    cpuarch, subarch = split_arch(arch)
 
138
    liveproject = config.livefs_project_for_arch(arch)
165
139
 
166
140
    if config["CDIMAGE_DVD"]:
167
 
        if project in ("ubuntu", "kubuntu", "edubuntu", "ubuntustudio"):
 
141
        if config.project in ("ubuntu", "kubuntu", "edubuntu", "ubuntustudio"):
168
142
            liveproject += "-dvd"
169
143
 
170
144
    return liveproject
183
157
 
184
158
    command.extend(live_build_options(config, arch))
185
159
 
186
 
    cpuarch, subarch = split_arch(arch)
 
160
    cpuarch, subarch = split_arch(config, arch)
187
161
    if cpuarch:
188
162
        command.extend(["-A", cpuarch])
189
163
    if subarch:
202
176
 
203
177
 
204
178
def live_build_lp_kwargs(config, lp, lp_livefs, arch):
205
 
    cpuarch, subarch = split_arch(arch)
 
179
    cpuarch, subarch = split_arch(config, arch)
206
180
    kwargs = {}
207
181
    metadata_override = {}
208
182
 
254
228
    bits = [config.project]
255
229
    if config.subproject:
256
230
        bits.append(config.subproject)
257
 
    cpuarch, subarch = split_arch(arch)
 
231
    cpuarch, subarch = split_arch(config, arch)
258
232
    bits.append(cpuarch)
259
233
    if subarch:
260
234
        bits.append(subarch)
273
247
    livefs_id_bits = [project]
274
248
    if config.subproject:
275
249
        livefs_id_bits.append(config.subproject)
276
 
    cpuarch, subarch = split_arch(arch)
 
250
    cpuarch, subarch = split_arch(config, arch)
277
251
    if subarch:
278
252
        livefs_id_bits.append(subarch)
279
253
    if config["UBUNTU_DEFAULTS_LOCALE"]:
304
278
 
305
279
 
306
280
def live_lp_info(config, arch):
307
 
    cpuarch, subarch = split_arch(arch)
 
281
    cpuarch, subarch = split_arch(config, arch)
308
282
    want_project_bits = [config.project]
309
283
    if config.subproject:
310
284
        want_project_bits.append(config.subproject)
462
436
    if config["LIVECD_BASE"]:
463
437
        return config["LIVECD_BASE"]
464
438
 
465
 
    cpuarch, subarch = split_arch(arch)
 
439
    cpuarch, subarch = split_arch(config, arch)
466
440
    series = config["DIST"]
467
441
 
468
442
    if config["LIVECD"]:
482
456
 
483
457
 
484
458
def flavours(config, arch):
485
 
    cpuarch, subarch = split_arch(arch)
 
459
    cpuarch, subarch = split_arch(config, arch)
486
460
    project = config.project
487
461
    series = config["DIST"]
488
462
 
550
524
    if item == "ltsp-squashfs" and arch == "amd64":
551
525
        # use i386 LTSP image on amd64 too
552
526
        arch = "i386"
553
 
    cpuarch, subarch = split_arch(arch)
 
527
    cpuarch, subarch = split_arch(config, arch)
554
528
    project = config.project
555
529
    series = config["DIST"]
556
530
    liveproject = live_project(config, arch)