~xubuntu-dev/ubuntu-cdimage/xubuntu-base

« back to all changes in this revision

Viewing changes to lib/cdimage/livefs.py

  • Committer: Sean Davis
  • Date: 2018-03-28 10:32:07 UTC
  • mfrom: (1559.1.156 ubuntu-cdimage)
  • Revision ID: smd.seandavis@gmail.com-20180328103207-o6s9d6h0hxxh8eqc
Merge lp:ubuntu-cdimage rev 1715

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
except ImportError:
34
34
    from urllib2 import URLError, unquote, urlopen
35
35
 
36
 
from cdimage import osextras
 
36
from cdimage import osextras, sign
37
37
from cdimage.config import Series, Touch
38
38
from cdimage.launchpad import get_launchpad
39
39
from cdimage.log import logger
121
121
        elif subarch in ("ac100", "nexus7"):
122
122
            options.extend(["-f", "plain"])
123
123
 
124
 
    if (config.project in ("ubuntu-core", "ubuntu-touch", "ubuntu-pd") or
 
124
    if (config.project in ("ubuntu-base", "ubuntu-core", "ubuntu-touch",
 
125
                           "ubuntu-touch-custom") or
125
126
        (config.project == "ubuntu-desktop-next" and
126
127
         config.subproject == "system-image")):
127
128
        options.extend(["-f", "plain"])
145
146
        liveproject = "base"
146
147
    elif project == "tocd3.1":
147
148
        liveproject = "tocd"
 
149
    elif project == "ubuntu-touch-custom":
 
150
        liveproject = "ubuntu-touch"
 
151
    elif (project == "ubuntu-server" and
 
152
          config.image_type == "daily-preinstalled"):
 
153
        liveproject = "ubuntu-cpc"
148
154
    else:
149
155
        liveproject = project
150
156
 
181
187
    if subarch:
182
188
        command.extend(["-s", subarch])
183
189
 
184
 
    if config["PROPOSED"]:
 
190
    if config.get("PROPOSED", "0") not in ("", "0"):
185
191
        command.append("-p")
186
192
    if config.series:
187
193
        command.extend(["-d", config.series])
212
218
        kwargs["unique_key"] = subarch
213
219
        metadata_override["subarch"] = subarch
214
220
 
215
 
    if config["PROPOSED"]:
 
221
    if config.get("PROPOSED", "0") not in ("", "0"):
216
222
        kwargs["pocket"] = "Proposed"
217
223
        metadata_override["proposed"] = True
218
224
    elif config["DIST"].is_latest:
223
229
    if config["EXTRA_PPAS"]:
224
230
        metadata_override["extra_ppas"] = config["EXTRA_PPAS"].split()
225
231
 
 
232
    if config["CHANNEL"]:
 
233
        try:
 
234
            kwargs["unique_key"] += "_" + config["CHANNEL"]
 
235
        except KeyError:
 
236
            kwargs["unique_key"] = config["CHANNEL"]
 
237
 
 
238
        metadata_override["channel"] = config["CHANNEL"]
 
239
 
226
240
    if metadata_override:
227
241
        kwargs["metadata_override"] = metadata_override
228
242
 
295
309
    image_type = config.image_type
296
310
 
297
311
    path = os.path.join(config.root, "production", "livefs-launchpad")
 
312
    if not os.path.exists(path):
 
313
        path = os.path.join(config.root, "etc", "livefs-launchpad")
298
314
    if os.path.exists(path):
299
315
        with open(path) as f:
300
316
            for line in f:
530
546
            return ["cell"]
531
547
        elif series <= "oneiric":
532
548
            return ["powerpc", "powerpc64-smp"]
533
 
        else:
 
549
        elif series <= "xenial":
534
550
            return ["powerpc-smp", "powerpc64-smp"]
 
551
        else:
 
552
            return ["powerpc-smp", "generic"]
535
553
    elif cpuarch == "ppc64el":
536
554
        return ["generic"]
537
555
    elif cpuarch == "s390x":
631
649
 
632
650
    if item in (
633
651
        "cloop", "squashfs", "manifest", "manifest-desktop", "manifest-remove",
634
 
        "size", "ext2", "ext3", "ext4", "rootfs.tar.gz", "custom.tar.gz",
635
 
        "device.tar.gz", "azure.device.tar.gz", "raspi2.device.tar.gz",
636
 
        "plano.device.tar.gz", "tar.xz", "iso",
 
652
        "manifest-minimal-remove", "size", "ext2", "ext3", "ext4",
 
653
        "rootfs.tar.gz", "custom.tar.gz", "device.tar.gz",
 
654
        "azure.device.tar.gz", "raspi2.device.tar.gz", "plano.device.tar.gz",
 
655
        "tar.xz", "iso", "os.snap", "kernel.snap", "disk1.img.xz",
 
656
        "dragonboard.kernel.snap", "raspi2.kernel.snap", "installer.squashfs",
 
657
        "img.xz", "model-assertion"
637
658
    ):
638
659
        if project == "tocd3":
639
660
            # auto-purged - reverting to plan B
646
667
            for url in urls_for(
647
668
                    "livecd.%s.%s-nexus7" % (liveproject_subarch, item)):
648
669
                yield url
 
670
        elif item == "disk1.img.xz":
 
671
            for url in urls_for(
 
672
                    "livecd.%s.%s" % (liveproject, item)):
 
673
                yield url
649
674
        else:
650
675
            for url in urls_for("livecd.%s.%s" % (liveproject_subarch, item)):
651
676
                yield url
656
681
            base = "livecd.%s.%s-%s" % (liveproject_subarch, item, flavour)
657
682
            for url in urls_for(base):
658
683
                yield url
659
 
 
660
684
    elif item in (
661
685
        "boot-%s+%s.img" % (target.ubuntu_arch, target.subarch)
662
686
            for target in Touch.list_targets_by_ubuntu_arch(arch)
803
827
        target = os.path.join(output_dir, "%s.%s" % (arch, item))
804
828
        try:
805
829
            osextras.fetch(config, urls[0], target)
 
830
            if item in ["squashfs", "server-squashfs"]:
 
831
                sign.sign_cdimage(config, target)
806
832
            found = True
807
833
        except osextras.FetchError:
808
834
            pass
843
869
        got_image = False
844
870
        for arch in config.arches:
845
871
            if config["CDIMAGE_PREINSTALLED"]:
846
 
                if download_live_items(config, arch, "ext4"):
 
872
                if project == "ubuntu-server":
 
873
                    if download_live_items(config, arch, "disk1.img.xz"):
 
874
                        got_image = True
 
875
                    else:
 
876
                        continue
 
877
                elif download_live_items(config, arch, "ext4"):
847
878
                    got_image = True
848
879
                elif download_live_items(config, arch, "ext3"):
849
880
                    got_image = True
858
889
                    got_image = True
859
890
                else:
860
891
                    continue
 
892
            elif download_live_items(config, arch, "img.xz"):
 
893
                got_image = True
861
894
            elif download_live_items(config, arch, "cloop"):
862
895
                got_image = True
863
896
            elif download_live_items(config, arch, "squashfs"):
 
897
                download_live_items(config, arch, "installer.squashfs")
864
898
                got_image = True
865
899
            elif download_live_items(config, arch, "rootfs.tar.gz"):
866
900
                got_image = True
869
903
            else:
870
904
                continue
871
905
            if (series >= "dapper" and
872
 
                    (project != "ubuntu-core" or
873
 
                        config.image_type == "daily-preinstalled") and
 
906
                    project != "ubuntu-base" and
874
907
                    not config["CDIMAGE_SQUASHFS_BASE"] and
875
908
                    config.subproject != "wubi"):
876
909
                download_live_items(config, arch, "kernel")
882
915
            download_live_items(config, arch, "manifest")
883
916
            if not download_live_items(config, arch, "manifest-remove"):
884
917
                download_live_items(config, arch, "manifest-desktop")
 
918
            download_live_items(config, arch, "manifest-minimal-remove")
885
919
            download_live_items(config, arch, "size")
886
920
 
887
921
            if (config["UBUNTU_DEFAULTS_LOCALE"] or
889
923
                    config.subproject == "wubi"):
890
924
                continue
891
925
 
892
 
            if (project not in ("livecd-base", "ubuntu-core",
 
926
            if (project not in ("livecd-base", "ubuntu-base", "ubuntu-core",
893
927
                                "kubuntu-active") and
894
928
                    (project != "ubuntu-desktop-next" or
895
929
                     config.subproject == "system-image") and
923
957
                            config, arch, "wubi.exe",
924
958
                            "Install %s" % autorun_project)
925
959
 
926
 
            if project not in ("livecd-base", "ubuntu-core",
 
960
            if project not in ("livecd-base", "ubuntu-base", "ubuntu-core",
927
961
                               "ubuntu-desktop-next", "edubuntu"):
928
962
                if (project in ("kubuntu-active", "ubuntu-netbook",
929
963
                                "ubuntu-moblin-remix") or
930
964
                        config["CDIMAGE_DVD"] or
931
965
                        series >= "maverick"):
932
966
                    download_live_items(config, arch, "usb-creator")
 
967
            if project == "ubuntu-core" and config["CDIMAGE_LIVE"]:
 
968
                download_live_items(config, arch, "model-assertion")
933
969
 
934
970
        if not got_image:
935
971
            raise NoFilesystemImages("No filesystem images found.")
936
972
 
937
 
    if config.project in ("ubuntu-touch", "ubuntu-pd"):
 
973
    if config.project in ("ubuntu-touch", "ubuntu-touch-custom"):
938
974
        for arch in config.arches:
939
975
            for abootimg in (
940
976
                "boot-%s+%s.img" % (target.ubuntu_arch, target.subarch)
965
1001
 
966
1002
    if config.project == "ubuntu-core":
967
1003
        for arch in config.arches:
 
1004
            download_live_items(config, arch, "os.snap")
 
1005
            download_live_items(config, arch, "kernel.snap")
968
1006
            if arch == "amd64":
969
1007
                for devarch in ("azure", "plano"):
970
1008
                    download_live_items(config, arch, "%s.device.tar.gz" %
971
1009
                                        devarch)
972
1010
            if arch == "armhf":
973
1011
                download_live_items(config, arch, "raspi2.device.tar.gz")
 
1012
                download_live_items(config, arch, "raspi2.kernel.snap")
 
1013
            if arch == "arm64":
 
1014
                download_live_items(config, arch, "dragonboard.kernel.snap")
974
1015
 
975
1016
    if (project == "edubuntu" and config["CDIMAGE_INSTALL"] and
976
1017
            series <= "hardy"):