Browse code

updated the json file generation to be included as a part to installer

Harish Udaiya Kumar authored on 2015/08/14 08:58:27
Showing 3 changed files
... ...
@@ -29,9 +29,6 @@ else
29 29
 PHOTON_SOURCES ?= sources
30 30
 endif
31 31
 
32
-PHOTON_MINIMAL_DEPLIST := minimal-dep-list
33
-PHOTON_MICRO_DEPLIST := micro-dep-list
34
-PHOTON_FULL_DEPLIST := full-dep-list
35 32
 PREPARE_OUT_DATADIR := prepare-out-datadir
36 33
 
37 34
 ifdef PHOTON_PUBLISH_RPMS_PATH
... ...
@@ -54,7 +51,7 @@ all: iso minimal-iso docker-image ostree-host-iso live-iso cloud-image-all
54 54
 micro: micro-iso
55 55
 	@:
56 56
 
57
-micro-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MICRO) $(PHOTON_MICRO_DEPLIST)
57
+micro-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MICRO)
58 58
 	@echo "Building Photon Micro ISO..."
59 59
 	@cd $(PHOTON_INSTALLER_DIR) && \
60 60
         $(PHOTON_INSTALLER) -i $(PHOTON_STAGE)/photon-micro.iso \
... ...
@@ -62,18 +59,10 @@ micro-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MICRO) $(PHOTON_MICRO_DEPLIST
62 62
                 -l $(PHOTON_STAGE)/LOGS \
63 63
                 -r $(PHOTON_STAGE)/RPMS \
64 64
                 -p $(PHOTON_DATA_DIR)/build_install_options_micro.json \
65
+				-s $(PHOTON_SPECS_DIR) \
65 66
                 -f > \
66 67
                 $(PHOTON_LOGS_DIR)/installer.log 2>&1
67 68
 
68
-$(PHOTON_MICRO_DEPLIST): check $(PREPARE_OUT_DATADIR)
69
-	@echo "Generating the install time dependency list for micro installation"
70
-	@cd $(PHOTON_SPECDEPS_DIR) && \
71
-		$(PHOTON_SPECDEPS) \
72
-		-s $(PHOTON_SPECS_DIR) \
73
-		-t $(PHOTON_STAGE) \
74
-		--input-type=json --file packages_micro.json -d json -t $(PHOTON_STAGE) -a $(PHOTON_DATA_DIR)
75
-	@echo "generated the json file with all dependencies for micro installation"
76
-
77 69
 deptree-micro:
78 70
 	@cd $(PHOTON_SPECDEPS_DIR) && \
79 71
 		$(PHOTON_SPECDEPS) \
... ...
@@ -106,7 +95,7 @@ deptree-minimal:
106 106
 		-t $(PHOTON_STAGE) \
107 107
 		-i json -f packages_minimal.json -a $(PHOTON_DATA_DIR) 
108 108
 
109
-minimal-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL) $(PHOTON_MINIMAL_DEPLIST)
109
+minimal-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL)
110 110
 	@echo "Building Photon Minimal ISO..."
111 111
 	@cd $(PHOTON_INSTALLER_DIR) && \
112 112
         $(PHOTON_INSTALLER) -i $(PHOTON_STAGE)/photon-minimal.iso \
... ...
@@ -114,6 +103,7 @@ minimal-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL) $(PHOTON_MINIMAL_D
114 114
                 -l $(PHOTON_STAGE)/LOGS \
115 115
                 -r $(PHOTON_STAGE)/RPMS \
116 116
                 -p $(PHOTON_DATA_DIR)/build_install_options_minimal.json \
117
+				-s $(PHOTON_SPECS_DIR) \
117 118
                 -f > \
118 119
                 $(PHOTON_LOGS_DIR)/installer.log 2>&1
119 120
 
... ...
@@ -125,6 +115,7 @@ ostree-host-iso: check $(PHOTON_STAGE) ostree-repo
125 125
                 -l $(PHOTON_STAGE)/LOGS \
126 126
                 -r $(PHOTON_STAGE)/RPMS \
127 127
                 -p $(PHOTON_DATA_DIR)/build_install_options_ostreehost.json \
128
+				-s $(PHOTON_SPECS_DIR) \
128 129
                 -f > \
129 130
                 $(PHOTON_LOGS_DIR)/installer.log 2>&1
130 131
 
... ...
@@ -136,18 +127,10 @@ live-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL) minimal-iso
136 136
                 -l $(PHOTON_STAGE)/LOGS \
137 137
                 -r $(PHOTON_STAGE)/RPMS \
138 138
                 -p $(PHOTON_GENERATED_DATA_DIR)/build_install_options_livecd.json \
139
+				-s $(PHOTON_SPECS_DIR) \
139 140
                 -f > \
140 141
                 $(PHOTON_LOGS_DIR)/installer.log 2>&1                
141 142
 
142
-$(PHOTON_MINIMAL_DEPLIST): $(PREPARE_OUT_DATADIR)
143
-	@echo "Generating the install time dependency list for minimal installation"	
144
-	@cd $(PHOTON_SPECDEPS_DIR) && \
145
-		$(PHOTON_SPECDEPS) \
146
-		-s $(PHOTON_SPECS_DIR) \
147
-		-t $(PHOTON_STAGE) \
148
-		--input-type=json --file packages_minimal.json -d json -a $(PHOTON_DATA_DIR)
149
-	@echo "generated the json file with all dependencies for minimal installation"
150
-
151 143
 packages-minimal: check $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES)
152 144
 	@echo "Building all RPMS..."
153 145
 	@cd $(PHOTON_PKG_BUILDER_DIR) && \
... ...
@@ -163,7 +146,7 @@ packages-minimal: check $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES)
163 163
 		-d $(PHOTON_DIST_TAG) \
164 164
                 -t ${THREADS}
165 165
 
166
-iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES) ostree-repo $(PHOTON_FULL_DEPLIST)
166
+iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES) ostree-repo
167 167
 	@echo "Building Photon FUll ISO..."
168 168
 	@cd $(PHOTON_INSTALLER_DIR) && \
169 169
         sudo $(PHOTON_INSTALLER) -i $(PHOTON_STAGE)/photon.iso \
... ...
@@ -171,18 +154,10 @@ iso: check $(PHOTON_STAGE) $(PHOTON_PACKAGES) ostree-repo $(PHOTON_FULL_DEPLIST)
171 171
                 -l $(PHOTON_STAGE)/LOGS \
172 172
                 -r $(PHOTON_STAGE)/RPMS \
173 173
                 -p $(PHOTON_DATA_DIR)/build_install_options_all.json \
174
+				-s $(PHOTON_SPECS_DIR) \
174 175
                 -f > \
175 176
                 $(PHOTON_LOGS_DIR)/installer.log 2>&1
176 177
 
177
-$(PHOTON_FULL_DEPLIST): $(PHOTON_MINIMAL_DEPLIST) 
178
-	@echo "Generating the install time dependency list for full installation"
179
-	@cd $(PHOTON_SPECDEPS_DIR) && \
180
-		$(PHOTON_SPECDEPS) \
181
-		-s $(PHOTON_SPECS_DIR) \
182
-		-t $(PHOTON_STAGE) \
183
-		--input-type=json --file packages_full.json -d json -a $(PHOTON_DATA_DIR)
184
-	@echo "generated the json file with all dependencies for full installation"
185
-
186 178
 deptree-full:
187 179
 	@cd $(PHOTON_SPECDEPS_DIR) && \
188 180
 		$(PHOTON_SPECDEPS) \
... ...
@@ -275,7 +250,7 @@ prepare-out-datadir:
275 275
 	$(MKDIR) -p $(PHOTON_GENERATED_DATA_DIR)
276 276
 	$(CP) $(PHOTON_DATA_DIR)/*.json $(PHOTON_GENERATED_DATA_DIR)
277 277
 
278
-$(PHOTON_STAGE):
278
+$(PHOTON_STAGE): $(PREPARE_OUT_DATADIR)
279 279
 	@echo "Creating staging folder..."
280 280
 	$(MKDIR) -p $(PHOTON_STAGE)
281 281
 	@echo "Creating chroot path..."
... ...
@@ -11,6 +11,9 @@ import random
11 11
 import string
12 12
 import subprocess
13 13
 import sys
14
+sys.path.append('../support/SpecDeps/')
15
+from SpecData import SerializableSpecObject
16
+from SpecData import SerializedSpecObjects
14 17
 import os
15 18
 from jsonwrapper import JsonWrapper
16 19
 from packageselector import PackageSelector
... ...
@@ -128,6 +131,7 @@ if __name__ == '__main__':
128 128
     parser.add_option("-f", "--force", action="store_true", dest="force", default=False)
129 129
     parser.add_option("-p", "--package-list-file", dest="package_list_file", default="../common/data/build_install_options_all.json")
130 130
     parser.add_option("-m", "--stage-path", dest="stage_path", default="../stage")
131
+    parser.add_option("-s", "--spec-path", dest="spec_path", default="../SPECS")
131 132
 
132 133
     (options,  args) = parser.parse_args()
133 134
     if options.iso_path:
... ...
@@ -177,6 +181,12 @@ if __name__ == '__main__':
177 177
     options_sorted = option_list_json.items()
178 178
     base_path = os.path.dirname(options.package_list_file)
179 179
 
180
+    # Generate the package dependencies based on package_list_file
181
+    specDependencyGenerator = SerializedSpecObjects(base_path, options.stage_path)
182
+    for install_option in options_sorted:
183
+        if install_option[1]["visible"] == True:
184
+		    specDependencyGenerator.readSpecsAndConvertToSerializableObjects(options.spec_path, "json", install_option[1]["file"], "json")
185
+
180 186
     packages = []
181 187
     additional_files_to_copy_from_stage_to_iso = []
182 188
     if config['iso_system'] == True:
... ...
@@ -63,6 +63,7 @@ fi
63 63
 PASSWORD=`date | md5sum | cut -f 1 -d ' '`
64 64
 sed -i "s/PASSWORD/$PASSWORD/" $VMDK_CONFIG_SAFE_FILE
65 65
 cat $VMDK_CONFIG_SAFE_FILE
66
+cp $SRC_ROOT/support/SpecDeps/*.py $INSTALLER_PATH/installer
66 67
 ./photonInstaller.py -p build_install_options_$IMG_NAME.json -r $PHOTON_STAGE_PATH/RPMS -v $INSTALLER_PATH/photon-${IMG_NAME} -o $GENERATED_DATA_PATH -f $VMDK_CONFIG_SAFE_FILE
67 68
 rm $VMDK_CONFIG_SAFE_FILE
68 69