Browse code

minimal-iso: Creating photon minimal-iso

- Addded a new target 'minimal-iso' in Makefile
* This generates photon-minimal-*.iso and corresponding debug iso
* Size of minimal-iso is 263MB and size of debug iso is 1166M
- minimal-iso skips photon flavour selection(edge, developer and ostree) UI

Change-Id: I945d74e13c0fbca700cfd6a18467fdac42b68f87
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/8254
Tested-by: gerrit-photon <photon-checkins@vmware.com>
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>

Piyush Gupta authored on 2019/10/15 23:01:15
Showing 8 changed files
... ...
@@ -30,6 +30,7 @@ PHOTON_SOURCES ?= sources
30 30
 endif
31 31
 
32 32
 FULL_PACKAGE_LIST_FILE := build_install_options_all.json
33
+MINIMAL_PACKAGE_LIST_FILE := build_install_options_minimal.json
33 34
 
34 35
 ifdef PHOTON_PUBLISH_RPMS_PATH
35 36
 PHOTON_PUBLISH_RPMS := publish-rpms-cached
... ...
@@ -136,6 +137,29 @@ packages-minimal: check-tools photon-stage $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURC
136 136
 		$(PACKAGE_WEIGHTS) \
137 137
 		--threads ${THREADS}
138 138
 
139
+packages-initrd: check-tools photon-stage $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) generate-dep-lists
140
+	@echo "Building all initrd package RPMS..."
141
+	@echo ""
142
+	@cd $(PHOTON_PKG_BUILDER_DIR) && \
143
+	$(PHOTON_PACKAGE_BUILDER) \
144
+		--spec-path $(PHOTON_SPECS_DIR) \
145
+		--rpm-path $(PHOTON_RPMS_DIR) \
146
+		--source-path $(PHOTON_SRCS_DIR) \
147
+		--build-root-path $(PHOTON_CHROOT_PATH) \
148
+		--packages-json-input $(PHOTON_DATA_DIR)/packages_installer_initrd.json \
149
+		--log-path $(PHOTON_LOGS_DIR) \
150
+		--log-level $(LOGLEVEL) \
151
+		--publish-RPMS-path $(PHOTON_PUBLISH_RPMS_DIR) \
152
+		--pullsources-config $(PHOTON_PULLSOURCES_CONFIG) \
153
+		--dist-tag $(PHOTON_DIST_TAG) \
154
+		--build-number $(PHOTON_BUILD_NUMBER) \
155
+		--release-version $(PHOTON_RELEASE_VERSION) \
156
+		--pkginfo-file $(PHOTON_PKGINFO_FILE) \
157
+		$(PHOTON_RPMCHECK_FLAGS) \
158
+		$(PUBLISH_BUILD_DEPENDENCIES) \
159
+		$(PACKAGE_WEIGHTS) \
160
+		--threads ${THREADS}
161
+
139 162
 packages: check-docker-py check-tools photon-stage $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) check-spec-files generate-dep-lists
140 163
 	@echo "Building all RPMS..."
141 164
 	@echo ""
... ...
@@ -325,10 +349,27 @@ iso: check-tools photon-stage $(PHOTON_PACKAGES) ostree-repo
325 325
 		--log-level $(LOGLEVEL) \
326 326
 		--rpm-path $(PHOTON_STAGE)/RPMS \
327 327
 		--srpm-path $(PHOTON_STAGE)/SRPMS \
328
-		--package-list-file $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \
328
+		--package-list-file $(PHOTON_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \
329 329
 		--generated-data-path $(PHOTON_STAGE)/common/data \
330 330
 		--pkg-to-rpm-map-file $(PHOTON_PKGINFO_FILE)
331 331
 
332
+minimal-iso: check-tools photon-stage $(PHOTON_PUBLISH_XRPMS) packages-minimal packages-initrd
333
+	@echo "Building Photon Minimal ISO..."
334
+	@$(PHOTON_REPO_TOOL) $(PHOTON_RPMS_DIR)
335
+	@$(CP) -f $(PHOTON_DATA_DIR)/$(MINIMAL_PACKAGE_LIST_FILE) $(PHOTON_GENERATED_DATA_DIR)/
336
+	@cd $(PHOTON_IMAGE_BUILDER_DIR) && \
337
+	sudo $(PHOTON_IMAGE_BUILDER) \
338
+                --iso-path $(PHOTON_STAGE)/photon-minimal-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUM).iso \
339
+                --debug-iso-path $(PHOTON_STAGE)/photon-minimal-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \
340
+                --log-path $(PHOTON_STAGE)/LOGS \
341
+                --log-level $(LOGLEVEL) \
342
+                --rpm-path $(PHOTON_STAGE)/RPMS \
343
+                --srpm-path $(PHOTON_STAGE)/SRPMS \
344
+                --package-list-file $(PHOTON_DATA_DIR)/$(MINIMAL_PACKAGE_LIST_FILE) \
345
+                --generated-data-path $(PHOTON_STAGE)/common/data \
346
+                --pkg-to-rpm-map-file $(PHOTON_PKGINFO_FILE) \
347
+                --pkg-to-be-copied-conf-file $(PHOTON_GENERATED_DATA_DIR)/$(MINIMAL_PACKAGE_LIST_FILE)
348
+
332 349
 src-iso: check-tools photon-stage $(PHOTON_PACKAGES)
333 350
 	@echo "Building Photon Full Source ISO..."
334 351
 	@cd $(PHOTON_IMAGE_BUILDER_DIR) && \
335 352
new file mode 100644
... ...
@@ -0,0 +1,7 @@
0
+{
1
+    "minimal" : {
2
+        "title" : "Photon Minimal",
3
+        "packagelist_file" : "packages_minimal.json",
4
+        "visible" : false
5
+    }
6
+}
0 7
new file mode 100644
... ...
@@ -0,0 +1,67 @@
0
+{
1
+    "packages": [
2
+        "filesystem",
3
+        "glibc",
4
+        "zlib",
5
+        "file",
6
+        "gmp",
7
+        "libgcc",
8
+        "libstdc++",
9
+        "bash",
10
+        "sed",
11
+        "haveged",
12
+        "ncurses-terminfo",
13
+        "bzip2",
14
+        "pkg-config",
15
+        "python3-curses",
16
+        "ncurses",
17
+        "cracklib",
18
+        "cracklib-dicts",
19
+        "python3-cracklib",
20
+        "shadow",
21
+        "coreutils",
22
+        "grep",
23
+        "readline",
24
+        "findutils",
25
+        "xz",
26
+        "util-linux",
27
+        "e2fsprogs",
28
+        "libffi",
29
+        "expat",
30
+        "linux",
31
+        "cpio",
32
+        "Linux-PAM",
33
+        "attr",
34
+        "libcap",
35
+        "systemd",
36
+        "dbus",
37
+        "gzip",
38
+        "sqlite",
39
+        "nspr",
40
+        "nss",
41
+        "popt",
42
+        "lua",
43
+        "rpm",
44
+        "gptfdisk",
45
+        "tar",
46
+        "hawkey",
47
+        "python3",
48
+        "python3-libs",
49
+        "pcre",
50
+        "glib",
51
+        "tdnf",
52
+        "python3-requests",
53
+        "grub2",
54
+        "grub2-pc",
55
+        "grub2-efi",
56
+        "efivar",
57
+        "efibootmgr",
58
+        "dracut",
59
+        "curl",
60
+        "dosfstools",
61
+        "ostree",
62
+        "ostree-grub2",
63
+        "ostree-libs",
64
+        "lvm2"
65
+                 ]
66
+}
... ...
@@ -2,6 +2,8 @@
2 2
     "packages": [
3 3
                  "minimal",
4 4
                  "linux",
5
-                 "initramfs"
5
+                 "initramfs",
6
+                 "linux-esx",
7
+                 "lvm2"
6 8
                  ]
7 9
 }
... ...
@@ -16,6 +16,7 @@ import modules.commons
16 16
 import random
17 17
 import curses
18 18
 import stat
19
+import re
19 20
 from logger import Logger
20 21
 from commandutils import CommandUtils
21 22
 from jsonwrapper import JsonWrapper
... ...
@@ -745,6 +746,10 @@ class Installer(object):
745 745
                 regex = re.compile(r'(?!linux-[0-9].*)')
746 746
                 self.install_config['packages'] = list(filter(regex.match,self.install_config['packages']))
747 747
             self.install_config['packages'].append('linux-esx')
748
+        else:
749
+            regex = re.compile(r'(?!linux-esx-[0-9].*)')
750
+            self.install_config['packages'] = list(filter(regex.match,self.install_config['packages']))
751
+
748 752
 
749 753
     def _add_packages_to_install(self, package):
750 754
         """
... ...
@@ -48,6 +48,11 @@ class PackageSelector(object):
48 48
         base_path = os.path.dirname(options_file)
49 49
         package_list = []
50 50
 
51
+        if len(options_sorted) == 1:
52
+            if 'packagelist_file' not in self.install_config:
53
+                self.install_config['packagelist_file'] = list(options_sorted)[0][1]['packagelist_file']
54
+                list(options_sorted)[0][1]['visible'] = True
55
+
51 56
         default_selected = 0
52 57
         visible_options_cnt = 0
53 58
         for install_option in options_sorted:
... ...
@@ -77,4 +82,7 @@ class PackageSelector(object):
77 77
         return ActionResult(True, {'custom': True})
78 78
 
79 79
     def display(self):
80
+        if 'packagelist_file' in self.install_config:
81
+            return ActionResult(None, {"inactive_screen": True})
82
+
80 83
         return self.window.do_action()
... ...
@@ -34,7 +34,7 @@ def create_pkg_list_to_copy_to_iso(build_install_option, output_data_path):
34 34
     packages = []
35 35
     for install_option in options_sorted:
36 36
         if install_option[0] != "iso":
37
-            file_path = os.path.join(output_data_path, install_option[1]["file"])
37
+            file_path = os.path.join(output_data_path, install_option[1]["packagelist_file"])
38 38
             package_list_json = Utils.jsonread(file_path)
39 39
             packages = packages + package_list_json["packages"]
40 40
     return packages
... ...
@@ -120,12 +120,15 @@ def createIso(options):
120 120
             create_additional_file_list_to_copy_in_iso(
121 121
                 os.path.abspath(options.stage_path), options.package_list_file))
122 122
 
123
+        initrd_pkg_list_file = os.path.join(os.path.dirname(options.package_list_file), 'packages_installer_initrd.json')
124
+        initrd_pkgs = " ".join(Utils.jsonread(initrd_pkg_list_file)["packages"])
125
+
123 126
         retval = subprocess.call([script_directory + '/iso/mk-install-iso.sh',
124 127
                                   options.installer_path,
125 128
                                   working_directory, options.iso_path,
126 129
                                   options.rpm_path, options.package_list_file,
127 130
                                   rpm_list, options.stage_path, files_to_copy,
128
-                                  options.generated_data_path])
131
+                                  options.generated_data_path, initrd_pkgs])
129 132
 
130 133
         if retval:
131 134
             raise Exception("Unable to create install ISO")
... ...
@@ -30,6 +30,7 @@ OUTPUT_DATA_PATH=$7
30 30
 PHOTON_COMMON_DIR=$(dirname "${PACKAGE_LIST_FILE}")
31 31
 PACKAGE_LIST_FILE_BASE_NAME=$(basename "${PACKAGE_LIST_FILE}")
32 32
 INITRD=${WORKINGDIR}/photon-chroot
33
+PACKAGES=$8
33 34
 
34 35
 rm -rf $WORKINGDIR/*
35 36
 mkdir -p $INITRD
... ...
@@ -58,14 +59,6 @@ EOF
58 58
 
59 59
 rpm --root $INITRD --initdb --dbpath /var/lib/rpm
60 60
 
61
-PACKAGES="filesystem glibc zlib file gmp libgcc libstdc++ bash sed haveged ncurses-terminfo \
62
-    bzip2 pkg-config python3-curses ncurses cracklib cracklib-dicts python3-cracklib \
63
-    shadow coreutils grep readline findutils xz util-linux e2fsprogs \
64
-    libffi expat linux cpio Linux-PAM attr libcap systemd dbus \
65
-    gzip sqlite nspr nss popt lua rpm gptfdisk tar \
66
-    hawkey python3 python3-libs pcre glib tdnf python3-requests grub2 \
67
-    grub2-pc grub2-efi efivar efibootmgr dracut curl dosfstools ostree ostree-grub2 ostree-libs lvm2"
68
-
69 61
 TDNF_CMD="tdnf install -y --installroot $INITRD --rpmverbosity 10 -c ${WORKINGDIR}/tdnf.conf -q $PACKAGES"
70 62
 
71 63
 # run host's tdnf, if fails - try one from photon:3.0 docker image