- Add log levels for package builder
- Remove unwanted logs from Makefile targets
- Remove unused Makefile targets
Change-Id: I4cb4c812ac15a5617d4df6245ac2a891e7a93c16
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/5895
Reviewed-by: Alexey Makhalov <amakhalov@vmware.com>
Tested-by: Sharath George
... | ... |
@@ -16,11 +16,9 @@ export PHOTON_BUILD_NUM=$(PHOTON_BUILD_NUMBER) |
16 | 16 |
export PHOTON_RELEASE_VER=$(PHOTON_RELEASE_VERSION) |
17 | 17 |
|
18 | 18 |
ifdef PHOTON_CACHE_PATH |
19 |
-PHOTON_PACKAGES_MICRO := packages-cached |
|
20 | 19 |
PHOTON_PACKAGES_MINIMAL := packages-cached |
21 | 20 |
PHOTON_PACKAGES := packages-cached |
22 | 21 |
else |
23 |
-PHOTON_PACKAGES_MICRO := packages-micro |
|
24 | 22 |
PHOTON_PACKAGES_MINIMAL := packages-minimal |
25 | 23 |
PHOTON_PACKAGES := packages |
26 | 24 |
endif |
... | ... |
@@ -31,7 +29,6 @@ else |
31 | 31 |
PHOTON_SOURCES ?= sources |
32 | 32 |
endif |
33 | 33 |
|
34 |
-MICRO_PACKAGE_LIST_FILE := build_install_options_micro.json |
|
35 | 34 |
FULL_PACKAGE_LIST_FILE := build_install_options_all.json |
36 | 35 |
|
37 | 36 |
ifdef PHOTON_PUBLISH_RPMS_PATH |
... | ... |
@@ -90,72 +87,33 @@ VIXDISKUTIL := |
90 | 90 |
IMGCONVERTER := |
91 | 91 |
endif |
92 | 92 |
|
93 |
-.PHONY : all iso clean photon-build-machine photon-vagrant-build photon-vagrant-local cloud-image \ |
|
94 |
-check-tools check-docker check-bison check-g++ check-gawk check-repo-tool check-kpartx check-vagrant check-packer check-packer-ovf-plugin check-sanity \ |
|
95 |
-clean-install clean-chroot build-updated-packages check generate-yaml-files |
|
96 |
- |
|
97 |
-THREADS?=1 |
|
93 |
+$(TOOLS_BIN): |
|
94 |
+ mkdir -p $(TOOLS_BIN) |
|
98 | 95 |
|
99 |
-all: iso photon-docker-image k8s-docker-images live-iso cloud-image-all src-iso |
|
96 |
+$(CONTAIN): $(TOOLS_BIN) |
|
97 |
+ gcc -O2 -std=gnu99 -Wall -Wextra $(SRCROOT)/tools/src/contain/*.c -o $@_unpriv |
|
98 |
+ sudo install -o root -g root -m 4755 $@_unpriv $@ |
|
100 | 99 |
|
101 |
-micro: micro-iso |
|
102 |
- @: |
|
100 |
+$(VIXDISKUTIL): $(TOOLS_BIN) |
|
101 |
+ @cd $(SRCROOT)/tools/src/vixDiskUtil && \ |
|
102 |
+ make |
|
103 | 103 |
|
104 |
-micro-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES_MICRO) |
|
105 |
- @echo "Building Photon Micro ISO..." |
|
106 |
- @cd $(PHOTON_INSTALLER_DIR) && \ |
|
107 |
- $(PHOTON_INSTALLER) \ |
|
108 |
- -i $(PHOTON_STAGE)/photon-micro-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso \ |
|
109 |
- -k $(PHOTON_STAGE)/photon-micro-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \ |
|
110 |
- -w $(PHOTON_STAGE)/photon_iso \ |
|
111 |
- -l $(PHOTON_STAGE)/LOGS \ |
|
112 |
- -r $(PHOTON_STAGE)/RPMS \ |
|
113 |
- -p $(PHOTON_GENERATED_DATA_DIR)/$(MICRO_PACKAGE_LIST_FILE) \ |
|
114 |
- -c $(PHOTON_GENERATED_DATA_DIR)/$(MICRO_PACKAGE_LIST_FILE) \ |
|
115 |
- -o $(PHOTON_STAGE)/common/data \ |
|
116 |
- -d $(PHOTON_STAGE)/pkg_info.json \ |
|
117 |
- -s $(PHOTON_DATA_DIR) \ |
|
118 |
- -f > \ |
|
119 |
- $(PHOTON_LOGS_DIR)/installer.log 2>&1 |
|
104 |
+$(IMGCONVERTER): $(TOOLS_BIN) |
|
105 |
+ @cd $(SRCROOT)/tools/src/imgconverter && \ |
|
106 |
+ make |
|
120 | 107 |
|
121 |
-packages-micro: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) generate-dep-lists |
|
122 |
- @echo "Building all Micro RPMS..." |
|
123 |
- @cd $(PHOTON_PKG_BUILDER_DIR) && \ |
|
124 |
- $(PHOTON_PACKAGE_BUILDER) \ |
|
125 |
- -s $(PHOTON_SPECS_DIR) \ |
|
126 |
- -r $(PHOTON_RPMS_DIR) \ |
|
127 |
- -x $(PHOTON_SRCS_DIR) \ |
|
128 |
- -b $(PHOTON_CHROOT_PATH) \ |
|
129 |
- -l $(PHOTON_LOGS_DIR) \ |
|
130 |
- -p $(PHOTON_PUBLISH_RPMS_DIR) \ |
|
131 |
- -c $(PHOTON_PULLSOURCES_CONFIG) \ |
|
132 |
- -d $(PHOTON_DIST_TAG) \ |
|
133 |
- -n $(PHOTON_BUILD_NUMBER) \ |
|
134 |
- -v $(PHOTON_RELEASE_VERSION) \ |
|
135 |
- $(PHOTON_RPMCHECK_FLAGS) \ |
|
136 |
- $(PUBLISH_BUILD_DEPENDENCIES) \ |
|
137 |
- $(PACKAGE_WEIGHTS_PATH) \ |
|
138 |
- -t ${THREADS} |
|
108 |
+.PHONY : all iso clean cloud-image \ |
|
109 |
+check-tools check-docker check-bison check-g++ check-gawk check-repo-tool check-kpartx check-sanity \ |
|
110 |
+clean-install clean-chroot build-updated-packages check generate-yaml-files |
|
139 | 111 |
|
140 |
-live-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL) |
|
141 |
- @echo "Building Photon Minimal LIVE ISO..." |
|
142 |
- @cd $(PHOTON_INSTALLER_DIR) && \ |
|
143 |
- $(PHOTON_INSTALLER) \ |
|
144 |
- -i $(PHOTON_STAGE)/photon-live-iso-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso \ |
|
145 |
- -k $(PHOTON_STAGE)/photon-live-iso-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \ |
|
146 |
- -w $(PHOTON_STAGE)/photon_iso \ |
|
147 |
- -l $(PHOTON_STAGE)/LOGS \ |
|
148 |
- -r $(PHOTON_STAGE)/RPMS \ |
|
149 |
- -p $(PHOTON_GENERATED_DATA_DIR)/build_install_options_livecd.json \ |
|
150 |
- -c $(PHOTON_GENERATED_DATA_DIR)/build_install_options_livecd.json \ |
|
151 |
- -o $(PHOTON_STAGE)/common/data \ |
|
152 |
- -d $(PHOTON_STAGE)/pkg_info.json \ |
|
153 |
- -s $(PHOTON_DATA_DIR) \ |
|
154 |
- -f > \ |
|
155 |
- $(PHOTON_LOGS_DIR)/installer.log 2>&1 |
|
112 |
+THREADS?=1 |
|
113 |
+LOGLEVEL?=info |
|
156 | 114 |
|
115 |
+# Build targets for rpm build |
|
116 |
+#------------------------------------------------------------------------------- |
|
157 | 117 |
packages-minimal: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) generate-dep-lists |
158 |
- @echo "Building all RPMS..." |
|
118 |
+ @echo "Building all minimal RPMS..." |
|
119 |
+ @echo "" |
|
159 | 120 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
160 | 121 |
$(PHOTON_PACKAGE_BUILDER) \ |
161 | 122 |
-s $(PHOTON_SPECS_DIR) \ |
... | ... |
@@ -163,6 +121,7 @@ packages-minimal: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SO |
163 | 163 |
-x $(PHOTON_SRCS_DIR) \ |
164 | 164 |
-b $(PHOTON_CHROOT_PATH) \ |
165 | 165 |
-l $(PHOTON_LOGS_DIR) \ |
166 |
+ -y $(LOGLEVEL) \ |
|
166 | 167 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
167 | 168 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
168 | 169 |
-d $(PHOTON_DIST_TAG) \ |
... | ... |
@@ -173,91 +132,9 @@ packages-minimal: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SO |
173 | 173 |
$(PACKAGE_WEIGHTS_PATH) \ |
174 | 174 |
-t ${THREADS} |
175 | 175 |
|
176 |
-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
|
177 |
- @echo "Building Photon Full ISO..." |
|
178 |
- @cd $(PHOTON_INSTALLER_DIR) && \ |
|
179 |
- sudo $(PHOTON_INSTALLER) \ |
|
180 |
- -i $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso \ |
|
181 |
- -k $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \ |
|
182 |
- -w $(PHOTON_STAGE)/photon_iso \ |
|
183 |
- -l $(PHOTON_STAGE)/LOGS \ |
|
184 |
- -r $(PHOTON_STAGE)/RPMS \ |
|
185 |
- -x $(PHOTON_STAGE)/SRPMS \ |
|
186 |
- -p $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
187 |
- -o $(PHOTON_STAGE)/common/data \ |
|
188 |
- -d $(PHOTON_STAGE)/pkg_info.json \ |
|
189 |
- -s $(PHOTON_DATA_DIR) \ |
|
190 |
- -f > \ |
|
191 |
- $(PHOTON_LOGS_DIR)/installer.log 2>&1 |
|
192 |
- |
|
193 |
-custom-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
|
194 |
- @echo "Building Photon custom ISO..." |
|
195 |
- @cd $(PHOTON_INSTALLER_DIR) && \ |
|
196 |
- sudo $(PHOTON_INSTALLER) \ |
|
197 |
- -i $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER)-custom.iso \ |
|
198 |
- -k $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER)-custom.debug.iso \ |
|
199 |
- -w $(PHOTON_STAGE)/photon_iso \ |
|
200 |
- -l $(PHOTON_STAGE)/LOGS \ |
|
201 |
- -r $(PHOTON_STAGE)/RPMS \ |
|
202 |
- -x $(PHOTON_STAGE)/SRPMS \ |
|
203 |
- -p $(PHOTON_GENERATED_DATA_DIR)/build_install_options_custom.json \ |
|
204 |
- -o $(PHOTON_STAGE)/common/data \ |
|
205 |
- -d $(PHOTON_STAGE)/pkg_info.json \ |
|
206 |
- -s $(PHOTON_DATA_DIR) \ |
|
207 |
- -f > \ |
|
208 |
- $(PHOTON_LOGS_DIR)/installer.log 2>&1 |
|
209 |
- |
|
210 |
-src-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
|
211 |
- @echo "Building Photon Full Source ISO..." |
|
212 |
- @cd $(PHOTON_INSTALLER_DIR) && \ |
|
213 |
- sudo $(PHOTON_INSTALLER) \ |
|
214 |
- -j $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).src.iso \ |
|
215 |
- -w $(PHOTON_STAGE)/photon_iso \ |
|
216 |
- -l $(PHOTON_STAGE)/LOGS \ |
|
217 |
- -r $(PHOTON_STAGE)/RPMS \ |
|
218 |
- -x $(PHOTON_STAGE)/SRPMS \ |
|
219 |
- -p $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
220 |
- -o $(PHOTON_STAGE)/common/data \ |
|
221 |
- -d $(PHOTON_STAGE)/pkg_info.json \ |
|
222 |
- -s $(PHOTON_DATA_DIR) \ |
|
223 |
- -f > \ |
|
224 |
- $(PHOTON_LOGS_DIR)/sourceiso-installer.log 2>&1 |
|
225 |
- |
|
226 |
-pkgtree: |
|
227 |
- @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
228 |
- $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i pkg -p $(pkg) |
|
229 |
- |
|
230 |
-imgtree: |
|
231 |
- @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
232 |
- $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i json -f $(PHOTON_DATA_DIR)/build_install_options_$(img).json |
|
233 |
- |
|
234 |
-who-needs: |
|
235 |
- @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
236 |
- $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i who-needs -p $(pkg) |
|
237 |
- |
|
238 |
-print-upward-deps: |
|
239 |
- @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
240 |
- $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i print-upward-deps -p $(pkg) |
|
241 |
- |
|
242 |
-# Input args: BASE_COMMIT= (optional) |
|
243 |
-# |
|
244 |
-# This target removes staged RPMS that can be affected by change(s) and should |
|
245 |
-# be rebuilt as part of incremental build support |
|
246 |
-# For every spec file touched - remove all upward dependent packages (rpms) |
|
247 |
-# If support folder was touched - do full build |
|
248 |
-# |
|
249 |
-# The analyzed changes are: |
|
250 |
-# - commits from BASE_COMMIT to HEAD (if BASE_COMMIT= parameter is specified) |
|
251 |
-# - local changes (if no commits specified) |
|
252 |
-clean-stage-for-incremental-build: |
|
253 |
- @test -n "$$(git diff --name-only $(BASE_COMMIT) @ | grep SPECS)" && $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i remove-upward-deps -p $$(echo `git diff --name-only $(BASE_COMMIT) @ | grep .spec | xargs -n1 basename 2>/dev/null` | tr ' ' :) ||: |
|
254 |
- @test -n "$$(git diff --name-only $(BASE_COMMIT) @ | grep support)" && $(RM) -rf $(PHOTON_RPMS_DIR) ||: |
|
255 |
- |
|
256 |
-check-spec-files: |
|
257 |
- @./tools/scripts/check_spec_files.sh $(BASE_COMMIT) |
|
258 |
- |
|
259 | 176 |
packages: check-docker-py check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) check-spec-files generate-dep-lists |
260 | 177 |
@echo "Building all RPMS..." |
178 |
+ @echo "" |
|
261 | 179 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
262 | 180 |
$(PHOTON_PACKAGE_BUILDER) \ |
263 | 181 |
-bt $(PHOTON_BUILD_TYPE) \ |
... | ... |
@@ -267,6 +144,7 @@ packages: check-docker-py check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $( |
267 | 267 |
-x $(PHOTON_SRCS_DIR) \ |
268 | 268 |
-b $(PHOTON_CHROOT_PATH) \ |
269 | 269 |
-l $(PHOTON_LOGS_DIR) \ |
270 |
+ -y $(LOGLEVEL) \ |
|
270 | 271 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
271 | 272 |
-e $(PHOTON_PUBLISH_XRPMS_DIR) \ |
272 | 273 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
... | ... |
@@ -283,6 +161,7 @@ packages: check-docker-py check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $( |
283 | 283 |
|
284 | 284 |
packages-docker: check-docker-py check-docker-service check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
285 | 285 |
@echo "Building all RPMS..." |
286 |
+ @echo "" |
|
286 | 287 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
287 | 288 |
$(PHOTON_PACKAGE_BUILDER) \ |
288 | 289 |
-bt $(PHOTON_BUILD_TYPE) \ |
... | ... |
@@ -292,6 +171,7 @@ packages-docker: check-docker-py check-docker-service check-tools $(PHOTON_STAGE |
292 | 292 |
-x $(PHOTON_SRCS_DIR) \ |
293 | 293 |
-b $(PHOTON_CHROOT_PATH) \ |
294 | 294 |
-l $(PHOTON_LOGS_DIR) \ |
295 |
+ -y $(LOGLEVEL) \ |
|
295 | 296 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
296 | 297 |
-e $(PHOTON_PUBLISH_XRPMS_DIR) \ |
297 | 298 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
... | ... |
@@ -307,6 +187,7 @@ packages-docker: check-docker-py check-docker-service check-tools $(PHOTON_STAGE |
307 | 307 |
|
308 | 308 |
updated-packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
309 | 309 |
@echo "Building only updated RPMS..." |
310 |
+ @echo "" |
|
310 | 311 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
311 | 312 |
$(PHOTON_PACKAGE_BUILDER) \ |
312 | 313 |
-s $(PHOTON_SPECS_DIR) \ |
... | ... |
@@ -314,6 +195,7 @@ updated-packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_P |
314 | 314 |
-x $(PHOTON_SRCS_DIR) \ |
315 | 315 |
-b $(PHOTON_CHROOT_PATH) \ |
316 | 316 |
-l $(PHOTON_LOGS_DIR) \ |
317 |
+ -y $(LOGLEVEL) \ |
|
317 | 318 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
318 | 319 |
-e $(PHOTON_PUBLISH_XRPMS_DIR) \ |
319 | 320 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
... | ... |
@@ -329,6 +211,7 @@ updated-packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_P |
329 | 329 |
|
330 | 330 |
tool-chain-stage1: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
331 | 331 |
@echo "Building all RPMS..." |
332 |
+ @echo "" |
|
332 | 333 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
333 | 334 |
$(PHOTON_PACKAGE_BUILDER) \ |
334 | 335 |
-s $(PHOTON_SPECS_DIR) \ |
... | ... |
@@ -337,6 +220,7 @@ tool-chain-stage1: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_S |
337 | 337 |
-x $(PHOTON_SRCS_DIR) \ |
338 | 338 |
-b $(PHOTON_CHROOT_PATH) \ |
339 | 339 |
-l $(PHOTON_LOGS_DIR) \ |
340 |
+ -y $(LOGLEVEL) \ |
|
340 | 341 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
341 | 342 |
-t ${THREADS} \ |
342 | 343 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
... | ... |
@@ -348,6 +232,7 @@ tool-chain-stage1: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_S |
348 | 348 |
|
349 | 349 |
tool-chain-stage2: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists |
350 | 350 |
@echo "Building all RPMS..." |
351 |
+ @echo "" |
|
351 | 352 |
@cd $(PHOTON_PKG_BUILDER_DIR) && \ |
352 | 353 |
$(PHOTON_PACKAGE_BUILDER) \ |
353 | 354 |
-s $(PHOTON_SPECS_DIR) \ |
... | ... |
@@ -356,6 +241,7 @@ tool-chain-stage2: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_S |
356 | 356 |
-x $(PHOTON_SRCS_DIR) \ |
357 | 357 |
-b $(PHOTON_CHROOT_PATH) \ |
358 | 358 |
-l $(PHOTON_LOGS_DIR) \ |
359 |
+ -y $(LOGLEVEL) \ |
|
359 | 360 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
360 | 361 |
-t ${THREADS} \ |
361 | 362 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
... | ... |
@@ -365,7 +251,119 @@ tool-chain-stage2: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_S |
365 | 365 |
$(PHOTON_RPMCHECK_FLAGS) \ |
366 | 366 |
-m stage2 |
367 | 367 |
|
368 |
+%: check-tools $(PHOTON_PUBLISH_RPMS) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_SOURCES) $(CONTAIN) check-spec-files $(eval PKG_NAME = $@) |
|
369 |
+ $(eval PKG_NAME = $@) |
|
370 |
+ @echo "" |
|
371 |
+ @echo "Building package $(PKG_NAME) ..." |
|
372 |
+ @echo "" |
|
373 |
+ @cd $(PHOTON_PKG_BUILDER_DIR) && \ |
|
374 |
+ $(PHOTON_PACKAGE_BUILDER) -i $(PKG_NAME)\ |
|
375 |
+ -bt $(PHOTON_BUILD_TYPE) \ |
|
376 |
+ -b $(PHOTON_CHROOT_PATH) \ |
|
377 |
+ -s $(PHOTON_SPECS_DIR) \ |
|
378 |
+ -r $(PHOTON_RPMS_DIR) \ |
|
379 |
+ -a $(PHOTON_SRPMS_DIR) \ |
|
380 |
+ -x $(PHOTON_SRCS_DIR) \ |
|
381 |
+ -p $(PHOTON_PUBLISH_RPMS_DIR) \ |
|
382 |
+ -e $(PHOTON_PUBLISH_XRPMS_DIR) \ |
|
383 |
+ -c $(PHOTON_PULLSOURCES_CONFIG) \ |
|
384 |
+ -y $(LOGLEVEL) \ |
|
385 |
+ -d $(PHOTON_DIST_TAG) \ |
|
386 |
+ -n $(PHOTON_BUILD_NUMBER) \ |
|
387 |
+ -v $(PHOTON_RELEASE_VERSION) \ |
|
388 |
+ -g $(PHOTON_DATA_DIR)/pkg_build_options.json \ |
|
389 |
+ $(PHOTON_RPMCHECK_FLAGS) \ |
|
390 |
+ $(PHOTON_KAT_BUILD_FLAGS) \ |
|
391 |
+ -l $(PHOTON_LOGS_DIR) \ |
|
392 |
+ -t ${THREADS} |
|
393 |
+#------------------------------------------------------------------------------- |
|
394 |
+ |
|
395 |
+# The targets listed under "all" are the installer built artifacts |
|
396 |
+#=============================================================================== |
|
397 |
+all: iso photon-docker-image k8s-docker-images cloud-image-all src-iso |
|
398 |
+ |
|
399 |
+iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
|
400 |
+ @echo "Building Photon Full ISO..." |
|
401 |
+ @cd $(PHOTON_INSTALLER_DIR) && \ |
|
402 |
+ sudo $(PHOTON_INSTALLER) \ |
|
403 |
+ -i $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso \ |
|
404 |
+ -k $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \ |
|
405 |
+ -w $(PHOTON_STAGE)/photon_iso \ |
|
406 |
+ -l $(PHOTON_STAGE)/LOGS \ |
|
407 |
+ -y $(LOGLEVEL) \ |
|
408 |
+ -r $(PHOTON_STAGE)/RPMS \ |
|
409 |
+ -x $(PHOTON_STAGE)/SRPMS \ |
|
410 |
+ -p $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
411 |
+ -o $(PHOTON_STAGE)/common/data \ |
|
412 |
+ -d $(PHOTON_STAGE)/pkg_info.json \ |
|
413 |
+ -s $(PHOTON_DATA_DIR) \ |
|
414 |
+ -f > \ |
|
415 |
+ $(PHOTON_LOGS_DIR)/installer.log 2>&1 |
|
416 |
+ |
|
417 |
+src-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
|
418 |
+ @echo "Building Photon Full Source ISO..." |
|
419 |
+ @cd $(PHOTON_INSTALLER_DIR) && \ |
|
420 |
+ sudo $(PHOTON_INSTALLER) \ |
|
421 |
+ -j $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).src.iso \ |
|
422 |
+ -w $(PHOTON_STAGE)/photon_iso \ |
|
423 |
+ -l $(PHOTON_STAGE)/LOGS \ |
|
424 |
+ -y $(LOGLEVEL) \ |
|
425 |
+ -r $(PHOTON_STAGE)/RPMS \ |
|
426 |
+ -x $(PHOTON_STAGE)/SRPMS \ |
|
427 |
+ -p $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \ |
|
428 |
+ -o $(PHOTON_STAGE)/common/data \ |
|
429 |
+ -d $(PHOTON_STAGE)/pkg_info.json \ |
|
430 |
+ -s $(PHOTON_DATA_DIR) \ |
|
431 |
+ -f > \ |
|
432 |
+ $(PHOTON_LOGS_DIR)/sourceiso-installer.log 2>&1 |
|
433 |
+ |
|
434 |
+cloud-image: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES) |
|
435 |
+ @echo "Building cloud image $(IMG_NAME)..." |
|
436 |
+ @cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) |
|
437 |
+ $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) $(IMG_NAME) $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
438 |
+ |
|
368 | 439 |
|
440 |
+cloud-image-all: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES) |
|
441 |
+ @echo "Building cloud images - gce, ami, azure and ova..." |
|
442 |
+ @cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) |
|
443 |
+ $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) gce $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
444 |
+ $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ami $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
445 |
+ $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) azure $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
446 |
+ $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
447 |
+ $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova_micro $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
448 |
+ |
|
449 |
+photon-docker-image: |
|
450 |
+ $(PHOTON_REPO_TOOL) $(PHOTON_RPMS_DIR) |
|
451 |
+ sudo docker build --no-cache --tag photon-build ./support/dockerfiles/photon |
|
452 |
+ sudo docker run \ |
|
453 |
+ -it \ |
|
454 |
+ --rm \ |
|
455 |
+ --privileged \ |
|
456 |
+ --net=host \ |
|
457 |
+ -e PHOTON_BUILD_NUMBER=$(PHOTON_BUILD_NUMBER) \ |
|
458 |
+ -e PHOTON_RELEASE_VERSION=$(PHOTON_RELEASE_VERSION) \ |
|
459 |
+ -v `pwd`:/workspace \ |
|
460 |
+ photon-build \ |
|
461 |
+ ./support/dockerfiles/photon/make-docker-image.sh tdnf |
|
462 |
+ |
|
463 |
+k8s-docker-images: start-docker photon-docker-image |
|
464 |
+ mkdir -p $(PHOTON_STAGE)/docker_images && \ |
|
465 |
+ cd ./support/dockerfiles/k8s-docker-images && \ |
|
466 |
+ ./build-k8s-base-image.sh $(PHOTON_RELEASE_VERSION) $(PHOTON_BUILD_NUMBER) $(PHOTON_STAGE) && \ |
|
467 |
+ ./build-k8s-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
468 |
+ ./build-k8s-metrics-server-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
469 |
+ ./build-k8s-coredns-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
470 |
+ ./build-k8s-dns-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
471 |
+ ./build-k8s-dashboard-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
472 |
+ ./build-flannel-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
473 |
+ ./build-calico-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
474 |
+ ./build-k8s-heapster-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
475 |
+ ./build-k8s-nginx-ingress.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
476 |
+ ./build-wavefront-proxy-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) |
|
477 |
+#=============================================================================== |
|
478 |
+ |
|
479 |
+# Set up Build environment |
|
480 |
+#_______________________________________________________________________________ |
|
369 | 481 |
packages-cached: |
370 | 482 |
@echo "Using cached RPMS..." |
371 | 483 |
@$(RM) -f $(PHOTON_RPMS_DIR_NOARCH)/* && \ |
... | ... |
@@ -381,12 +379,12 @@ sources-cached: |
381 | 381 |
@ln -sf $(PHOTON_SOURCES_PATH) $(PHOTON_SRCS_DIR) |
382 | 382 |
|
383 | 383 |
publish-rpms: |
384 |
- @echo "Pulling publish rpms from bintray..." |
|
384 |
+ @echo "Pulling toolchain rpms from bintray..." |
|
385 | 385 |
@cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \ |
386 | 386 |
$(PHOTON_PULL_PUBLISH_RPMS) $(PHOTON_PUBLISH_RPMS_DIR) |
387 | 387 |
|
388 | 388 |
publish-x-rpms: |
389 |
- @echo "Pulling publish X rpms from bintray..." |
|
389 |
+ @echo "Pulling X toolchain rpms from bintray..." |
|
390 | 390 |
@cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \ |
391 | 391 |
$(PHOTON_PULL_PUBLISH_X_RPMS) $(PHOTON_PUBLISH_XRPMS_DIR) |
392 | 392 |
|
... | ... |
@@ -425,57 +423,10 @@ $(PHOTON_STAGE): |
425 | 425 |
install -m 444 $(SRCROOT)/installer/open_source_license.txt $(PHOTON_STAGE)/open_source_license.txt |
426 | 426 |
@echo "Creating NOTICE file..." |
427 | 427 |
install -m 444 $(SRCROOT)/NOTICE $(PHOTON_STAGE)/NOTICE |
428 |
+#_______________________________________________________________________________ |
|
428 | 429 |
|
429 |
- |
|
430 |
-generate-dep-lists: |
|
431 |
- $(RMDIR) $(PHOTON_GENERATED_DATA_DIR) |
|
432 |
- $(MKDIR) -p $(PHOTON_GENERATED_DATA_DIR) |
|
433 |
- cd $(PHOTON_SPECDEPS_DIR) && \ |
|
434 |
- $(PHOTON_SPECDEPS) \ |
|
435 |
- -s $(PHOTON_SPECS_DIR) \ |
|
436 |
- -t $(PHOTON_STAGE) \ |
|
437 |
- -l $(PHOTON_LOGS_DIR) \ |
|
438 |
- -p $(PHOTON_GENERATED_DATA_DIR) \ |
|
439 |
- --input-type=json \ |
|
440 |
- --file "$$(ls $(PHOTON_DATA_DIR)/build_install_options*.json)" \ |
|
441 |
- -d json \ |
|
442 |
- -a $(PHOTON_DATA_DIR) |
|
443 |
- |
|
444 |
-photon-docker-image: |
|
445 |
- $(PHOTON_REPO_TOOL) $(PHOTON_RPMS_DIR) |
|
446 |
- sudo docker build --no-cache --tag photon-build ./support/dockerfiles/photon |
|
447 |
- sudo docker run \ |
|
448 |
- -it \ |
|
449 |
- --rm \ |
|
450 |
- --privileged \ |
|
451 |
- --net=host \ |
|
452 |
- -e PHOTON_BUILD_NUMBER=$(PHOTON_BUILD_NUMBER) \ |
|
453 |
- -e PHOTON_RELEASE_VERSION=$(PHOTON_RELEASE_VERSION) \ |
|
454 |
- -v `pwd`:/workspace \ |
|
455 |
- photon-build \ |
|
456 |
- ./support/dockerfiles/photon/make-docker-image.sh tdnf |
|
457 |
- |
|
458 |
-start-docker: check-docker |
|
459 |
- systemctl start docker |
|
460 |
- |
|
461 |
-k8s-docker-images: start-docker photon-docker-image |
|
462 |
- mkdir -p $(PHOTON_STAGE)/docker_images && \ |
|
463 |
- cd ./support/dockerfiles/k8s-docker-images && \ |
|
464 |
- ./build-k8s-base-image.sh $(PHOTON_RELEASE_VERSION) $(PHOTON_BUILD_NUMBER) $(PHOTON_STAGE) && \ |
|
465 |
- ./build-k8s-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
466 |
- ./build-k8s-metrics-server-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
467 |
- ./build-k8s-coredns-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
468 |
- ./build-k8s-dns-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
469 |
- ./build-k8s-dashboard-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
470 |
- ./build-flannel-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
471 |
- ./build-calico-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
472 |
- ./build-k8s-heapster-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
473 |
- ./build-k8s-nginx-ingress.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \ |
|
474 |
- ./build-wavefront-proxy-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) |
|
475 |
- |
|
476 |
-install-photon-docker-image: photon-docker-image |
|
477 |
- sudo docker build -t photon:tdnf . |
|
478 |
- |
|
430 |
+# Clean build environment |
|
431 |
+#================================================================== |
|
479 | 432 |
clean: clean-install clean-chroot |
480 | 433 |
@echo "Deleting Photon ISO..." |
481 | 434 |
@$(RM) -f $(PHOTON_STAGE)/photon-*.iso |
... | ... |
@@ -498,55 +449,10 @@ clean-chroot: |
498 | 498 |
$(PHOTON_CHROOT_CLEANER) $(PHOTON_CHROOT_PATH); \ |
499 | 499 |
fi |
500 | 500 |
|
501 |
-photon-build-machine: check-packer check-vagrant |
|
502 |
- @echo "Building photon-build-machine with Packer..." |
|
503 |
- @cd $(PHOTON_PACKER_TEMPLATES) && \ |
|
504 |
- $(PACKER) build photon-build-machine.json |
|
505 |
- @echo "Adding box to Vagrant boxes..." |
|
506 |
- @$(VAGRANT) box add $(PHOTON_PACKER_TEMPLATES)/photon-build-machine.box --name photon-build-machine --force && \ |
|
507 |
- $(RM) $(PHOTON_PACKER_TEMPLATES)/photon-build-machine.box |
|
508 |
- |
|
509 |
-photon-vagrant-build: check-vagrant |
|
510 |
- @echo "Starting Photon build using Vagrant..." |
|
511 |
- @cd $(SRCROOT) && \ |
|
512 |
- $(VAGRANT) up && \ |
|
513 |
- $(VAGRANT) destroy -f |
|
514 |
- |
|
515 |
-ifeq ($(VAGRANT_BUILD),all) |
|
516 |
-PACKER_ARGS="" |
|
517 |
-else |
|
518 |
-PACKER_ARGS="-only=$(VAGRANT_BUILD)" |
|
519 |
-endif |
|
520 |
- |
|
521 |
-photon-vagrant-local: check-packer check-vagrant |
|
522 |
- @echo "Building a Photon Vagrant box with Packer..." |
|
523 |
- @if [ -e $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso ]; then \ |
|
524 |
- cd $(PHOTON_PACKER_TEMPLATES) && \ |
|
525 |
- $(SED) -i "" -e "s#\"iso_checksum_value\":.*#\"iso_checksum_value\": \"$$($(SHASUM) ../../stage/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso | cut -f 1 -d ' ')\",#" photon.json && \ |
|
526 |
- $(PACKER) build $(PACKER_ARGS) photon.json && \ |
|
527 |
- $(SED) -i "" -e "s#\"iso_checksum_value\":.*#\"iso_checksum_value\": \"\",#" photon.json; \ |
|
528 |
- echo "Moving boxes to $(PHOTON_STAGE)..." && \ |
|
529 |
- $(MV) *.box $(PHOTON_STAGE); \ |
|
530 |
- else \ |
|
531 |
- echo "Unable to find $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso ... aborting build"; \ |
|
532 |
- fi |
|
533 |
- |
|
534 |
-cloud-image: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES) |
|
535 |
- @echo "Building cloud image $(IMG_NAME)..." |
|
536 |
- @cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) |
|
537 |
- $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) $(IMG_NAME) $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
538 |
- |
|
539 |
- |
|
540 |
-cloud-image-all: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES) |
|
541 |
- @echo "Building cloud images - gce, ami, azure and ova..." |
|
542 |
- @cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) |
|
543 |
- $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) gce $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
544 |
- $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ami $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
545 |
- $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) azure $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
546 |
- $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
547 |
- $(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova_micro $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH) |
|
548 |
- |
|
501 |
+#================================================================== |
|
549 | 502 |
|
503 |
+# Targets to check for tools support in build environment |
|
504 |
+#__________________________________________________________________________________ |
|
550 | 505 |
check-tools: check-bison check-g++ check-gawk check-repo-tool check-texinfo check-sanity check-docker |
551 | 506 |
|
552 | 507 |
check-docker: |
... | ... |
@@ -576,23 +482,16 @@ check-repo-tool: |
576 | 576 |
check-kpartx: |
577 | 577 |
@command -v kpartx >/dev/null 2>&1 || { echo "Package kpartx not installed. Aborting." >&2; exit 1; } |
578 | 578 |
|
579 |
-check-vagrant: check-packer |
|
580 |
- @command -v $(VAGRANT) >/dev/null 2>&1 || { echo "Vagrant not installed or wrong path, expecting $(VAGRANT). Aborting" >&2; exit 1; } |
|
581 |
- |
|
582 | 579 |
check-sanity: |
583 |
- $(SRCROOT)/support/sanity_check.sh |
|
580 |
+ @$(SRCROOT)/support/sanity_check.sh |
|
581 |
+ @echo "" |
|
584 | 582 |
|
585 |
-ifeq ($(VAGRANT_BUILD),vcloudair) |
|
586 |
-check-packer: check-packer-ovf-plugin |
|
587 |
-else ifeq ($(VAGRANT_BUILD),all) |
|
588 |
-check-packer: check-packer-ovf-plugin |
|
589 |
-else |
|
590 |
-check-packer: |
|
591 |
-endif |
|
592 |
- @command -v $(PACKER) >/dev/null 2>&1 || { echo "Packer not installed or wrong path, expecting $(PACKER). Aborting" >&2; exit 1; } |
|
583 |
+start-docker: check-docker |
|
584 |
+ systemctl start docker |
|
593 | 585 |
|
594 |
-check-packer-ovf-plugin: |
|
595 |
- @[[ -e ~/.packer.d/plugins/packer-post-processor-vagrant-vmware-ovf ]] || { echo "Packer OVF post processor not installed. Aborting" >&2; exit 1; } |
|
586 |
+install-photon-docker-image: photon-docker-image |
|
587 |
+ sudo docker build -t photon:tdnf . |
|
588 |
+#__________________________________________________________________________________ |
|
596 | 589 |
|
597 | 590 |
check: packages |
598 | 591 |
ifeq ($(RPMCHECK),enable_stop_on_error) |
... | ... |
@@ -608,6 +507,7 @@ check: packages |
608 | 608 |
-x $(PHOTON_SRCS_DIR) \ |
609 | 609 |
-b $(PHOTON_CHROOT_PATH) \ |
610 | 610 |
-l $(PHOTON_LOGS_DIR) \ |
611 |
+ -y $(LOGLEVEL) \ |
|
611 | 612 |
-p $(PHOTON_PUBLISH_RPMS_DIR) \ |
612 | 613 |
-e $(PHOTON_PUBLISH_XRPMS_DIR) \ |
613 | 614 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
... | ... |
@@ -620,28 +520,45 @@ check: packages |
620 | 620 |
$(rpmcheck_stop_on_error) \ |
621 | 621 |
-t ${THREADS} |
622 | 622 |
|
623 |
-%: check-tools $(PHOTON_PUBLISH_RPMS) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_SOURCES) $(CONTAIN) check-spec-files $(eval PKG_NAME = $@) |
|
624 |
- $(eval PKG_NAME = $@) |
|
625 |
- @echo "Building package $(PKG_NAME) ..." |
|
626 |
- @cd $(PHOTON_PKG_BUILDER_DIR) && \ |
|
627 |
- $(PHOTON_PACKAGE_BUILDER) -i $(PKG_NAME)\ |
|
628 |
- -bt $(PHOTON_BUILD_TYPE) \ |
|
629 |
- -b $(PHOTON_CHROOT_PATH) \ |
|
630 |
- -s $(PHOTON_SPECS_DIR) \ |
|
631 |
- -r $(PHOTON_RPMS_DIR) \ |
|
632 |
- -a $(PHOTON_SRPMS_DIR) \ |
|
633 |
- -x $(PHOTON_SRCS_DIR) \ |
|
634 |
- -p $(PHOTON_PUBLISH_RPMS_DIR) \ |
|
635 |
- -e $(PHOTON_PUBLISH_XRPMS_DIR) \ |
|
636 |
- -c $(PHOTON_PULLSOURCES_CONFIG) \ |
|
637 |
- -d $(PHOTON_DIST_TAG) \ |
|
638 |
- -n $(PHOTON_BUILD_NUMBER) \ |
|
639 |
- -v $(PHOTON_RELEASE_VERSION) \ |
|
640 |
- -g $(PHOTON_DATA_DIR)/pkg_build_options.json \ |
|
641 |
- $(PHOTON_RPMCHECK_FLAGS) \ |
|
642 |
- $(PHOTON_KAT_BUILD_FLAGS) \ |
|
643 |
- -l $(PHOTON_LOGS_DIR) \ |
|
644 |
- -t ${THREADS} |
|
623 |
+# Spec file checker and utilities |
|
624 |
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
625 |
+check-spec-files: |
|
626 |
+ @echo "" |
|
627 |
+ @./tools/scripts/check_spec_files.sh $(BASE_COMMIT) |
|
628 |
+ |
|
629 |
+generate-dep-lists: |
|
630 |
+ @echo "" |
|
631 |
+ @$(RMDIR) $(PHOTON_GENERATED_DATA_DIR) |
|
632 |
+ @$(MKDIR) -p $(PHOTON_GENERATED_DATA_DIR) |
|
633 |
+ @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
634 |
+ $(PHOTON_SPECDEPS) \ |
|
635 |
+ -s $(PHOTON_SPECS_DIR) \ |
|
636 |
+ -t $(PHOTON_STAGE) \ |
|
637 |
+ -l $(PHOTON_LOGS_DIR) \ |
|
638 |
+ -y $(LOGLEVEL) \ |
|
639 |
+ -p $(PHOTON_GENERATED_DATA_DIR) \ |
|
640 |
+ --input-type=json \ |
|
641 |
+ --file "$$(ls $(PHOTON_DATA_DIR)/build_install_options*.json)" \ |
|
642 |
+ -d json \ |
|
643 |
+ -a $(PHOTON_DATA_DIR) |
|
644 |
+ @echo "" |
|
645 |
+pkgtree: |
|
646 |
+ @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
647 |
+ $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -y $(LOGLEVEL) -i pkg -p $(pkg) |
|
648 |
+ |
|
649 |
+imgtree: |
|
650 |
+ @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
651 |
+ $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -y $(LOGLEVEL) -i json -f $(PHOTON_DATA_DIR)/build_install_options_$(img).json |
|
652 |
+ |
|
653 |
+who-needs: |
|
654 |
+ @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
655 |
+ $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -y $(LOGLEVEL) -i who-needs -p $(pkg) |
|
656 |
+ |
|
657 |
+print-upward-deps: |
|
658 |
+ @cd $(PHOTON_SPECDEPS_DIR) && \ |
|
659 |
+ $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i print-upward-deps -p $(pkg) |
|
660 |
+ |
|
661 |
+#+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |
|
645 | 662 |
|
646 | 663 |
generate-yaml-files: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
647 | 664 |
@echo "Generating yaml files for packages ..." |
... | ... |
@@ -650,20 +567,21 @@ generate-yaml-files: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES) |
650 | 650 |
-s $(PHOTON_SPECS_DIR) \ |
651 | 651 |
-a $(PHOTON_SRPMS_DIR) \ |
652 | 652 |
-l $(PHOTON_LOGS_DIR) \ |
653 |
+ -z $(LOGLEVEL) \ |
|
653 | 654 |
-c $(PHOTON_PULLSOURCES_CONFIG) \ |
654 | 655 |
-f $(PHOTON_PKG_BLACKLIST_FILE) |
655 | 656 |
|
656 |
-$(TOOLS_BIN): |
|
657 |
- mkdir -p $(TOOLS_BIN) |
|
658 |
- |
|
659 |
-$(CONTAIN): $(TOOLS_BIN) |
|
660 |
- gcc -O2 -std=gnu99 -Wall -Wextra $(SRCROOT)/tools/src/contain/*.c -o $@_unpriv |
|
661 |
- sudo install -o root -g root -m 4755 $@_unpriv $@ |
|
662 |
- |
|
663 |
-$(VIXDISKUTIL): $(TOOLS_BIN) |
|
664 |
- @cd $(SRCROOT)/tools/src/vixDiskUtil && \ |
|
665 |
- make |
|
657 |
+# Input args: BASE_COMMIT= (optional) |
|
658 |
+# |
|
659 |
+# This target removes staged RPMS that can be affected by change(s) and should |
|
660 |
+# be rebuilt as part of incremental build support |
|
661 |
+# For every spec file touched - remove all upward dependent packages (rpms) |
|
662 |
+# If support folder was touched - do full build |
|
663 |
+# |
|
664 |
+# The analyzed changes are: |
|
665 |
+# - commits from BASE_COMMIT to HEAD (if BASE_COMMIT= parameter is specified) |
|
666 |
+# - local changes (if no commits specified) |
|
667 |
+clean-stage-for-incremental-build: |
|
668 |
+ @test -n "$$(git diff --name-only $(BASE_COMMIT) @ | grep SPECS)" && $(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i remove-upward-deps -p $$(echo `git diff --name-only $(BASE_COMMIT) @ | grep .spec | xargs -n1 basename 2>/dev/null` | tr ' ' :) ||: |
|
669 |
+ @test -n "$$(git diff --name-only $(BASE_COMMIT) @ | grep support)" && $(RM) -rf $(PHOTON_RPMS_DIR) ||: |
|
666 | 670 |
|
667 |
-$(IMGCONVERTER): $(TOOLS_BIN) |
|
668 |
- @cd $(SRCROOT)/tools/src/imgconverter && \ |
|
669 |
- make |
... | ... |
@@ -97,7 +97,6 @@ |
97 | 97 |
"asciidoc", |
98 | 98 |
"mkinitcpio", |
99 | 99 |
"glibmm", |
100 |
- "deltarpm", |
|
101 | 100 |
"cdrkit", |
102 | 101 |
"libgsystem", |
103 | 102 |
"libsepol", |
... | ... |
@@ -120,7 +119,6 @@ |
120 | 120 |
"lzo-minilzo", |
121 | 121 |
"swig", |
122 | 122 |
"pycurl3", |
123 |
- "python3-yum-metadata-parser", |
|
124 | 123 |
"strace", |
125 | 124 |
"python3-cracklib", |
126 | 125 |
"haveged", |
... | ... |
@@ -29,11 +29,12 @@ class Installer(object): |
29 | 29 |
unmount_disk_command = "./mk-unmount-disk.sh" |
30 | 30 |
|
31 | 31 |
def __init__(self, install_config, maxy=0, maxx=0, iso_installer=False, |
32 |
- rpm_path="../stage/RPMS", log_path="../stage/LOGS"): |
|
32 |
+ rpm_path="../stage/RPMS", log_path="../stage/LOGS", log_level="info"): |
|
33 | 33 |
self.install_config = install_config |
34 | 34 |
self.install_config['iso_installer'] = iso_installer |
35 | 35 |
self.rpm_path = rpm_path |
36 | 36 |
self.log_path = log_path |
37 |
+ self.log_level = log_level |
|
37 | 38 |
|
38 | 39 |
if 'working_directory' in self.install_config: |
39 | 40 |
self.working_directory = self.install_config['working_directory'] |
... | ... |
@@ -8,7 +8,7 @@ from installer import Installer |
8 | 8 |
class InstallerContainer(object): |
9 | 9 |
def __init__(self, install_config, maxy=0, maxx=0, |
10 | 10 |
iso_installer=False, rpm_path="../stage/RPMS", |
11 |
- log_path="../stage/LOGS"): |
|
11 |
+ log_path="../stage/LOGS", log_level="info"): |
|
12 | 12 |
|
13 | 13 |
self.install_config = install_config |
14 | 14 |
self.maxy = maxy |
... | ... |
@@ -16,10 +16,11 @@ class InstallerContainer(object): |
16 | 16 |
self.iso_installer = iso_installer |
17 | 17 |
self.rpm_path = rpm_path |
18 | 18 |
self.log_path = log_path |
19 |
+ self.log_level = log_level |
|
19 | 20 |
|
20 | 21 |
def install(self, params): |
21 | 22 |
installer = None |
22 | 23 |
installer = Installer(self.install_config, self.maxy, self.maxx, |
23 |
- self.iso_installer, self.rpm_path, self.log_path) |
|
24 |
+ self.iso_installer, self.rpm_path, self.log_path, self.log_level) |
|
24 | 25 |
|
25 | 26 |
return installer.install(params) |
... | ... |
@@ -189,6 +189,7 @@ if __name__ == '__main__': |
189 | 189 |
default="/mnt/photon-root") |
190 | 190 |
parser.add_argument("-l", "--log-path", dest="log_path", |
191 | 191 |
default="../stage/LOGS") |
192 |
+ parser.add_argument("-y", "--log-level", dest="log_level") |
|
192 | 193 |
parser.add_argument("-r", "--rpm-path", dest="rpm_path", default="../stage/RPMS") |
193 | 194 |
parser.add_argument("-x", "--srpm-path", dest="srpm_path", default="../stage/SRPMS") |
194 | 195 |
parser.add_argument("-o", "--output-data-path", dest="output_data_path", |
... | ... |
@@ -287,7 +288,7 @@ if __name__ == '__main__': |
287 | 287 |
|
288 | 288 |
# Run the installer |
289 | 289 |
package_installer = Installer(config, rpm_path=options.rpm_path, |
290 |
- log_path=options.log_path) |
|
290 |
+ log_path=options.log_path, log_level=options.log_level) |
|
291 | 291 |
package_installer.install(None) |
292 | 292 |
|
293 | 293 |
# Making the iso if needed |
... | ... |
@@ -11,9 +11,6 @@ TAR=/bin/tar |
11 | 11 |
RPMBUILD=/usr/bin/rpmbuild |
12 | 12 |
SED=/usr/bin/sed |
13 | 13 |
SHASUM=/usr/bin/shasum |
14 |
-PACKER=/usr/local/bin/packer |
|
15 |
-VAGRANT=/usr/bin/vagrant |
|
16 |
-VAGRANT_BUILD=vagrant |
|
17 | 14 |
ARCH?=$(shell uname -m) |
18 | 15 |
|
19 | 16 |
SRCROOT := $(realpath $(SRCROOT)) |
... | ... |
@@ -57,7 +54,6 @@ PHOTON_RPMS_DIR_NOARCH=$(PHOTON_RPMS_DIR)/noarch |
57 | 57 |
PHOTON_RPMS_DIR_ARCH=$(PHOTON_RPMS_DIR)/$(ARCH) |
58 | 58 |
PHOTON_UPDATED_RPMS_DIR_NOARCH?=$(PHOTON_UPDATED_RPMS_DIR)/noarch |
59 | 59 |
PHOTON_UPDATED_RPMS_DIR_ARCH?=$(PHOTON_UPDATED_RPMS_DIR)/$(ARCH) |
60 |
-PHOTON_PACKER_TEMPLATES=$(SRCROOT)/support/packer-templates |
|
61 | 60 |
|
62 | 61 |
PHOTON_CHROOT_PATH:=$(PHOTON_STAGE)/photonroot |
63 | 62 |
PHOTON_FS_ROOT=/usr/src/photon |
... | ... |
@@ -13,7 +13,7 @@ class ChrootUtils(object): |
13 | 13 |
logPath = constants.logPath |
14 | 14 |
self.logName = logName |
15 | 15 |
self.logPath = logPath |
16 |
- self.logger = Logger.getLogger(logName, logPath) |
|
16 |
+ self.logger = Logger.getLogger(logName, logPath, constants.logLevel) |
|
17 | 17 |
|
18 | 18 |
def createChroot(self, chrootName): |
19 | 19 |
chrootID = constants.buildRootPath + "/" + chrootName |
... | ... |
@@ -23,6 +23,8 @@ def main(): |
23 | 23 |
default="../../stage/SRPMS") |
24 | 24 |
parser.add_argument("-j", "--output-dir", dest="outputDirPath", |
25 | 25 |
default="../../stage/") |
26 |
+ parser.add_argument("-z", "--log-level", dest="logLevel", |
|
27 |
+ default="info") |
|
26 | 28 |
parser.add_argument("-c", "--pullsources-config", dest="pullsourcesConfig", |
27 | 29 |
default="pullsources.conf") |
28 | 30 |
parser.add_argument("-f", "--pkg-blacklist-file", dest="pkgBlacklistFile", |
... | ... |
@@ -39,7 +41,8 @@ def main(): |
39 | 39 |
try: |
40 | 40 |
if not os.path.isdir(options.logPath): |
41 | 41 |
cmdUtils.runCommandInShell("mkdir -p " + options.logPath) |
42 |
- logger = Logger.getLogger(options.logPath + "/generateYamlFiles") |
|
42 |
+ logger = Logger.getLogger(options.logPath + "/generateYamlFiles", |
|
43 |
+ options.logPath, options.logLevel) |
|
43 | 44 |
|
44 | 45 |
if options.generateYamlFiles: |
45 | 46 |
if (options.pkgBlacklistFile is not None and |
... | ... |
@@ -73,6 +76,7 @@ def main(): |
73 | 73 |
constants.setSpecPath(options.specPath) |
74 | 74 |
constants.setSourceRpmPath(options.sourceRpmPath) |
75 | 75 |
constants.setLogPath(options.logPath) |
76 |
+ constants.setLogLevel(options.logLevel) |
|
76 | 77 |
constants.setPullSourcesConfig(options.pullsourcesConfig) |
77 | 78 |
constants.initialize() |
78 | 79 |
|
... | ... |
@@ -175,7 +179,7 @@ def buildSourcesList(yamlDir, blackListPkgs, logger, singleFile=True): |
175 | 175 |
|
176 | 176 |
if singleFile: |
177 | 177 |
yamlFile.close() |
178 |
- logger.info("Generated source yaml files for all packages") |
|
178 |
+ logger.debug("Generated source yaml files for all packages") |
|
179 | 179 |
|
180 | 180 |
|
181 | 181 |
def buildSRPMList(srpmPath, yamlDir, blackListPkgs, logger, singleFile=True): |
... | ... |
@@ -226,7 +230,7 @@ def buildSRPMList(srpmPath, yamlDir, blackListPkgs, logger, singleFile=True): |
226 | 226 |
|
227 | 227 |
if singleFile: |
228 | 228 |
yamlFile.close() |
229 |
- logger.info("Generated SRPM yaml files for all packages") |
|
229 |
+ logger.debug("Generated SRPM yaml files for all packages") |
|
230 | 230 |
|
231 | 231 |
|
232 | 232 |
if __name__ == "__main__": |
... | ... |
@@ -3,31 +3,41 @@ import logging |
3 | 3 |
|
4 | 4 |
class Logger(object): |
5 | 5 |
@staticmethod |
6 |
- def getLogger(mymodule, logpath=None, resetFile=False): |
|
6 |
+ def string_to_loglevel(loglevel): |
|
7 |
+ logLevelMap = { |
|
8 |
+ "error": logging.ERROR, |
|
9 |
+ "warning": logging.WARNING, |
|
10 |
+ "info": logging.INFO, |
|
11 |
+ "debug": logging.DEBUG, |
|
12 |
+ } |
|
13 |
+ return logLevelMap.get(loglevel, logging.INFO) |
|
14 |
+ |
|
15 |
+ @staticmethod |
|
16 |
+ def getLogger(mymodule, logpath=None, loglevel="info"): |
|
7 | 17 |
logfile = mymodule + ".log" |
8 | 18 |
if logpath is not None: |
9 | 19 |
if not os.path.isdir(logpath): |
10 | 20 |
os.makedirs(logpath) |
11 | 21 |
logfile = logpath + "/" + logfile |
12 |
- if resetFile: |
|
13 |
- open(logfile, 'w').close() |
|
14 | 22 |
logger = logging.getLogger(mymodule) |
15 | 23 |
if not logger.handlers: |
16 | 24 |
#creating file handler |
17 | 25 |
fhandler = logging.FileHandler(logfile) |
18 | 26 |
# create console handler |
19 | 27 |
ch = logging.StreamHandler() |
20 |
- formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') |
|
28 |
+ fhformatter = logging.Formatter('%(asctime)s - %(name)s - %(message)s') |
|
29 |
+ chformatter = logging.Formatter('%(message)s') |
|
21 | 30 |
# add formatter to handler |
22 |
- fhandler.setFormatter(formatter) |
|
23 |
- ch.setFormatter(formatter) |
|
24 |
- |
|
31 |
+ fhandler.setFormatter(fhformatter) |
|
32 |
+ #fhandler.setLevel(logging.DEBUG) |
|
33 |
+ ch.setFormatter(chformatter) |
|
34 |
+ #ch.setLevel(Logger.string_to_loglevel(loglevel)) |
|
35 |
+ logger.setLevel(Logger.string_to_loglevel(loglevel)) |
|
25 | 36 |
logger.addHandler(ch) |
26 | 37 |
logger.addHandler(fhandler) |
27 |
- logger.setLevel(logging.DEBUG) |
|
28 |
- logger.info("-" * 75) |
|
29 |
- logger.info("Starting Log") |
|
30 |
- logger.info("-" * 75) |
|
38 |
+ logger.debug("-" * 75) |
|
39 |
+ logger.debug("Starting Log") |
|
40 |
+ logger.debug("-" * 75) |
|
31 | 41 |
return logger |
32 | 42 |
|
33 | 43 |
if __name__ == "__main__": |
... | ... |
@@ -19,7 +19,7 @@ class PackageBuildDataGenerator(object): |
19 | 19 |
logName = "PackageBuildDataGenerator" |
20 | 20 |
if logPath is None: |
21 | 21 |
logPath = constants.logPath |
22 |
- self.logger = Logger.getLogger(logName, logPath) |
|
22 |
+ self.logger = Logger.getLogger(logName, logPath, constants.logLevel) |
|
23 | 23 |
self.__mapCyclesToPackageList = {} |
24 | 24 |
self.__mapPackageToCycle = {} |
25 | 25 |
self.__buildDependencyGraph = {} |
... | ... |
@@ -110,16 +110,16 @@ class PackageBuildDataGenerator(object): |
110 | 110 |
|
111 | 111 |
# Remove duplicate entries in sorted list in intervals |
112 | 112 |
if (len(sortedList) - prevSortListLen) > 100: |
113 |
- self.logger.info("Removing duplicates in sortedList") |
|
113 |
+ self.logger.debug("Removing duplicates in sortedList") |
|
114 | 114 |
sortedList = removeDuplicateEntries(sortedList) |
115 | 115 |
else: |
116 | 116 |
prevSortListLen = len(sortedList) |
117 | 117 |
|
118 |
- self.logger.info("Removing duplicates in sorted list") |
|
118 |
+ self.logger.debug("Removing duplicates in sorted list") |
|
119 | 119 |
sortedList = removeDuplicateEntries(sortedList) |
120 | 120 |
|
121 |
- self.logger.info("Sorted list: ") |
|
122 |
- self.logger.info(sortedList) |
|
121 |
+ self.logger.debug("Sorted list: ") |
|
122 |
+ self.logger.debug(sortedList) |
|
123 | 123 |
self.__sortedPackageList = sortedList |
124 | 124 |
|
125 | 125 |
def _constructBuildAndRunTimeDependencyGraph(self, basePackage): |
... | ... |
@@ -129,7 +129,7 @@ class PackageBuildDataGenerator(object): |
129 | 129 |
addBuildTimeGraph = False |
130 | 130 |
if basePackage in self.__runTimeDependencyGraph: |
131 | 131 |
addRunTimeGraph = False |
132 |
- |
|
132 |
+ |
|
133 | 133 |
nextPackagesToConstructGraph = set() |
134 | 134 |
if addBuildTimeGraph: |
135 | 135 |
dependentRpmPackages = SPECS.getData().getBuildRequiresForPkg(basePackage) |
... | ... |
@@ -152,7 +152,7 @@ class PackageBuildDataGenerator(object): |
152 | 152 |
self._constructBuildAndRunTimeDependencyGraph(pkg) |
153 | 153 |
|
154 | 154 |
def _readDependencyGraphAndCyclesForGivenPackages(self, basePackages): |
155 |
- self.logger.info("Reading dependency graph to check for cycles") |
|
155 |
+ self.logger.debug("Reading dependency graph to check for cycles") |
|
156 | 156 |
|
157 | 157 |
for pkg in basePackages: |
158 | 158 |
self._constructBuildAndRunTimeDependencyGraph(pkg) |
... | ... |
@@ -235,7 +235,7 @@ class PackageBuildDataGenerator(object): |
235 | 235 |
return sortedPackageList, circularDependencyGraph |
236 | 236 |
|
237 | 237 |
def _constructDependencyMap(self, cyclicDependencyGraph): |
238 |
- self.logger.info("Constructing dependency map from circular dependency graph.....") |
|
238 |
+ self.logger.debug("Constructing dependency map from circular dependency graph.....") |
|
239 | 239 |
constructDependencyMap = {} |
240 | 240 |
for node in cyclicDependencyGraph.keys(): |
241 | 241 |
tmpDepNodeList = set() |
... | ... |
@@ -253,19 +253,19 @@ class PackageBuildDataGenerator(object): |
253 | 253 |
tmpDepNodeList.add(depNode) |
254 | 254 |
depNodeList.remove(node) |
255 | 255 |
constructDependencyMap[node] = depNodeList |
256 |
- self.logger.info("Dependency Map:") |
|
257 |
- self.logger.info(constructDependencyMap) |
|
256 |
+ self.logger.debug("Dependency Map:") |
|
257 |
+ self.logger.debug(constructDependencyMap) |
|
258 | 258 |
return constructDependencyMap |
259 | 259 |
|
260 | 260 |
def _findCircularDependencies(self, cyclicDependencyGraph): |
261 |
- self.logger.info("Looking for circular dependencies") |
|
261 |
+ self.logger.debug("Looking for circular dependencies") |
|
262 | 262 |
if not cyclicDependencyGraph: |
263 | 263 |
return |
264 | 264 |
#step1: construct dependency map from dependency graph |
265 | 265 |
constructDependencyMap = self._constructDependencyMap(cyclicDependencyGraph) |
266 | 266 |
|
267 | 267 |
#step2: find cycles in dependency map |
268 |
- self.logger.info("Finding and adding cycles using constructed dependency map......") |
|
268 |
+ self.logger.debug("Finding and adding cycles using constructed dependency map......") |
|
269 | 269 |
cycleCount = 0 |
270 | 270 |
for node in cyclicDependencyGraph.keys(): |
271 | 271 |
listDepPkg = constructDependencyMap[node] |
... | ... |
@@ -283,12 +283,12 @@ class PackageBuildDataGenerator(object): |
283 | 283 |
for x in cycPkgs: |
284 | 284 |
self.__mapPackageToCycle[x] = cycleName |
285 | 285 |
self.__mapCyclesToPackageList[cycleName] = cycPkgs |
286 |
- self.logger.info("New circular dependency found:") |
|
287 |
- self.logger.info(cycleName + " " + ",".join(cycPkgs)) |
|
286 |
+ self.logger.debug("New circular dependency found:") |
|
287 |
+ self.logger.debug(cycleName + " " + ",".join(cycPkgs)) |
|
288 | 288 |
cycleCount += 1 |
289 | 289 |
|
290 | 290 |
if cycleCount > 0: |
291 |
- self.logger.info("Found " + str(cycleCount) + " cycles.") |
|
292 |
- self.logger.info("Successfully added all detected circular dependencies to list.") |
|
291 |
+ self.logger.debug("Found " + str(cycleCount) + " cycles.") |
|
292 |
+ self.logger.debug("Successfully added all detected circular dependencies to list.") |
|
293 | 293 |
else: |
294 |
- self.logger.info("No circular dependencies found.") |
|
294 |
+ self.logger.debug("No circular dependencies found.") |
... | ... |
@@ -52,7 +52,7 @@ class PackageBuilderBase(object): |
52 | 52 |
if not os.path.isdir(self.logPath): |
53 | 53 |
cmdUtils = CommandUtils() |
54 | 54 |
cmdUtils.runCommandInShell("mkdir -p " + self.logPath) |
55 |
- self.logger = Logger.getLogger(self.logName, self.logPath) |
|
55 |
+ self.logger = Logger.getLogger(self.logName, self.logPath, constants.logLevel) |
|
56 | 56 |
|
57 | 57 |
def _findPackageNameAndVersionFromRPMFile(self, rpmfile): |
58 | 58 |
rpmfile = os.path.basename(rpmfile) |
... | ... |
@@ -137,7 +137,7 @@ class PackageBuilderBase(object): |
137 | 137 |
|
138 | 138 |
def _findDependentPackagesAndInstalledRPM(self, instanceID): |
139 | 139 |
listInstalledPackages, listInstalledRPMs = self._findInstalledPackages(instanceID) |
140 |
- self.logger.info(listInstalledPackages) |
|
140 |
+ self.logger.debug(listInstalledPackages) |
|
141 | 141 |
listDependentPackages = self._findBuildTimeRequiredPackages() |
142 | 142 |
listTestPackages=[] |
143 | 143 |
if constants.rpmCheck and self.package in constants.testForceRPMS: |
... | ... |
@@ -203,7 +203,7 @@ class PackageBuilderContainer(PackageBuilderBase): |
203 | 203 |
pass |
204 | 204 |
|
205 | 205 |
try: |
206 |
- self.logger.info("BuildContainer-prepareBuildContainer: " + |
|
206 |
+ self.logger.debug("BuildContainer-prepareBuildContainer: " + |
|
207 | 207 |
"Starting build container: " + containerName) |
208 | 208 |
#TODO: Is init=True equivalent of --sig-proxy? |
209 | 209 |
privilegedDocker = False |
... | ... |
@@ -257,9 +257,9 @@ class PackageBuilderContainer(PackageBuilderBase): |
257 | 257 |
|
258 | 258 |
pkgUtils = PackageUtils(self.logName, self.logPath) |
259 | 259 |
if listDependentPackages: |
260 |
- self.logger.info("BuildContainer-buildPackage: " + |
|
260 |
+ self.logger.debug("BuildContainer-buildPackage: " + |
|
261 | 261 |
"Installing dependent packages..") |
262 |
- self.logger.info(listDependentPackages) |
|
262 |
+ self.logger.debug(listDependentPackages) |
|
263 | 263 |
for pkg in listDependentPackages: |
264 | 264 |
packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg) |
265 | 265 |
self._installPackage(pkgUtils, packageName, packageVersion, containerID, destLogPath,listInstalledPackages, listInstalledRPMs) |
... | ... |
@@ -274,9 +274,9 @@ class PackageBuilderContainer(PackageBuilderBase): |
274 | 274 |
if flag == False: |
275 | 275 |
self._installPackage(pkgUtils, packageName,packageVersion, containerID, destLogPath,listInstalledPackages, listInstalledRPMs) |
276 | 276 |
pkgUtils.installRPMSInAOneShotInContainer(containerID, destLogPath) |
277 |
- self.logger.info("Finished installing the build time dependent packages....") |
|
277 |
+ self.logger.debug("Finished installing the build time dependent packages....") |
|
278 | 278 |
|
279 |
- self.logger.info("BuildContainer-buildPackage: Start building the package: " + |
|
279 |
+ self.logger.debug("BuildContainer-buildPackage: Start building the package: " + |
|
280 | 280 |
self.package) |
281 | 281 |
pkgUtils.adjustGCCSpecsInContainer(self.package, self.version, containerID, destLogPath) |
282 | 282 |
pkgUtils.buildRPMSForGivenPackageInContainer( |
... | ... |
@@ -284,7 +284,7 @@ class PackageBuilderContainer(PackageBuilderBase): |
284 | 284 |
self.version, |
285 | 285 |
containerID, |
286 | 286 |
destLogPath) |
287 |
- self.logger.info("BuildContainer-buildPackage: Successfully built the package: " + |
|
287 |
+ self.logger.debug("BuildContainer-buildPackage: Successfully built the package: " + |
|
288 | 288 |
self.package) |
289 | 289 |
except Exception as e: |
290 | 290 |
self.logger.error("Failed while building package:" + self.package) |
... | ... |
@@ -337,7 +337,7 @@ class PackageBuilderChroot(PackageBuilderBase): |
337 | 337 |
pkgUtils = PackageUtils(self.logName, self.logPath) |
338 | 338 |
|
339 | 339 |
if listDependentPackages: |
340 |
- self.logger.info("Installing the build time dependent packages......") |
|
340 |
+ self.logger.debug("Installing the build time dependent packages......") |
|
341 | 341 |
for pkg in listDependentPackages: |
342 | 342 |
packageName, packageVersion = StringUtils.splitPackageNameAndVersion(pkg) |
343 | 343 |
self._installPackage(pkgUtils, packageName, packageVersion, chrootID, self.logPath,listInstalledPackages, listInstalledRPMs) |
... | ... |
@@ -352,19 +352,19 @@ class PackageBuilderChroot(PackageBuilderBase): |
352 | 352 |
if flag == False: |
353 | 353 |
self._installPackage(pkgUtils, packageName,packageVersion, chrootID, self.logPath,listInstalledPackages, listInstalledRPMs) |
354 | 354 |
pkgUtils.installRPMSInAOneShot(chrootID, self.logPath) |
355 |
- self.logger.info("Finished installing the build time dependent packages....") |
|
355 |
+ self.logger.debug("Finished installing the build time dependent packages....") |
|
356 | 356 |
|
357 | 357 |
pkgUtils.adjustGCCSpecs(self.package, self.version, chrootID, self.logPath) |
358 | 358 |
pkgUtils.buildRPMSForGivenPackage(self.package, self.version, chrootID, |
359 | 359 |
self.logPath) |
360 |
- self.logger.info("Successfully built the package:" + self.package) |
|
360 |
+ self.logger.debug("Successfully built the package:" + self.package) |
|
361 | 361 |
except Exception as e: |
362 | 362 |
self.logger.error("Failed while building package:" + self.package) |
363 | 363 |
self.logger.debug("Chroot with ID: " + chrootID + |
364 | 364 |
" not deleted for debugging.") |
365 | 365 |
logFileName = os.path.join(self.logPath, self.package + ".log") |
366 | 366 |
fileLog = os.popen('tail -n 100 ' + logFileName).read() |
367 |
- self.logger.debug(fileLog) |
|
367 |
+ self.logger.info(fileLog) |
|
368 | 368 |
raise e |
369 | 369 |
if chrootID is not None: |
370 | 370 |
chrUtils.destroyChroot(chrootID) |
... | ... |
@@ -15,7 +15,7 @@ class PackageInfo(object): |
15 | 15 |
logPath = constants.logPath |
16 | 16 |
self.logName = logName |
17 | 17 |
self.logPath = logPath |
18 |
- self.logger = Logger.getLogger(logName, logPath) |
|
18 |
+ self.logger = Logger.getLogger(logName, logPath, constants.logLevel) |
|
19 | 19 |
self.pkgList = {} |
20 | 20 |
|
21 | 21 |
def loadPackagesData(self): |
... | ... |
@@ -50,7 +50,7 @@ class PackageInfo(object): |
50 | 50 |
self.logger.error("Missing rpm file for package:" + rpmPkg) |
51 | 51 |
|
52 | 52 |
def writePkgListToFile(self, fileName): |
53 |
- self.logger.info("Writing package list to the json file") |
|
53 |
+ self.logger.debug("Writing package list to the json file") |
|
54 | 54 |
cmdUtils = CommandUtils() |
55 | 55 |
dirPath = os.path.basename(fileName) |
56 | 56 |
if not os.path.isdir(dirPath): |
... | ... |
@@ -23,7 +23,8 @@ class PackageManager(object): |
23 | 23 |
logPath = constants.logPath |
24 | 24 |
self.logName = logName |
25 | 25 |
self.logPath = logPath |
26 |
- self.logger = Logger.getLogger(logName, logPath) |
|
26 |
+ self.logLevel = constants.logLevel |
|
27 |
+ self.logger = Logger.getLogger(logName, logPath, constants.logLevel) |
|
27 | 28 |
self.mapCyclesToPackageList = {} |
28 | 29 |
self.mapPackageToCycle = {} |
29 | 30 |
self.sortedPackageList = [] |
... | ... |
@@ -67,6 +68,8 @@ class PackageManager(object): |
67 | 67 |
else: |
68 | 68 |
self.buildToolChainPackages(buildThreads) |
69 | 69 |
self._buildGivenPackages(listPackages, buildThreads) |
70 |
+ self.logger.info("Package build has been completed") |
|
71 |
+ self.logger.info("") |
|
70 | 72 |
|
71 | 73 |
def _readPackageBuildData(self, listPackages): |
72 | 74 |
try: |
... | ... |
@@ -99,8 +102,8 @@ class PackageManager(object): |
99 | 99 |
if packageIsAlreadyBuilt: |
100 | 100 |
listAvailablePackages.add(package+"-"+version) |
101 | 101 |
|
102 |
- self.logger.info("List of Already built packages") |
|
103 |
- self.logger.info(listAvailablePackages) |
|
102 |
+ self.logger.debug("List of Already built packages") |
|
103 |
+ self.logger.debug(listAvailablePackages) |
|
104 | 104 |
return listAvailablePackages |
105 | 105 |
|
106 | 106 |
def _calculateParams(self, listPackages): |
... | ... |
@@ -147,7 +150,7 @@ class PackageManager(object): |
147 | 147 |
ThreadPool.pkgBuildType = self.pkgBuildType |
148 | 148 |
|
149 | 149 |
def _initializeScheduler(self, statusEvent): |
150 |
- Scheduler.setLog(self.logName, self.logPath) |
|
150 |
+ Scheduler.setLog(self.logName, self.logPath, self.logLevel) |
|
151 | 151 |
Scheduler.setParams(self.sortedPackageList, set(self.listOfPackagesAlreadyBuilt)) |
152 | 152 |
Scheduler.setEvent(statusEvent) |
153 | 153 |
Scheduler.stopScheduling = False |
... | ... |
@@ -158,13 +161,16 @@ class PackageManager(object): |
158 | 158 |
for pkg in listPackages: |
159 | 159 |
for version in SPECS.getData().getVersions(pkg): |
160 | 160 |
listPackageNamesAndVersions.append(pkg+"-"+version) |
161 |
- |
|
161 |
+ alreadyBuiltRPMS = self._readAlreadyAvailablePackages() |
|
162 |
+ if alreadyBuiltRPMS: |
|
163 |
+ self.logger.debug("List of already available packages:") |
|
164 |
+ self.logger.debug(alreadyBuiltRPMS) |
|
165 |
+ |
|
162 | 166 |
if constants.rpmCheck: |
163 | 167 |
listMakeCheckPackages=set() |
164 | 168 |
for pkg in listPackages: |
165 | 169 |
version = SPECS.getData().getHighestVersion(pkg) |
166 | 170 |
listMakeCheckPackages.add(pkg+"-"+version) |
167 |
- alreadyBuiltRPMS = self._readAlreadyAvailablePackages() |
|
168 | 171 |
listPackageNamesAndVersions = (list(set(listPackageNamesAndVersions)|(listMakeCheckPackages-alreadyBuiltRPMS))) |
169 | 172 |
|
170 | 173 |
returnVal = self._calculateParams(listPackageNamesAndVersions) |
... | ... |
@@ -183,7 +189,7 @@ class PackageManager(object): |
183 | 183 |
|
184 | 184 |
statusEvent.wait() |
185 | 185 |
Scheduler.stopScheduling = True |
186 |
- self.logger.info("Waiting for all remaining worker threads") |
|
186 |
+ self.logger.debug("Waiting for all remaining worker threads") |
|
187 | 187 |
ThreadPool.join_all() |
188 | 188 |
|
189 | 189 |
setFailFlag = False |
... | ... |
@@ -201,15 +207,13 @@ class PackageManager(object): |
201 | 201 |
|
202 | 202 |
if not setFailFlag: |
203 | 203 |
if allPackagesBuilt: |
204 |
- self.logger.info("All packages built successfully") |
|
204 |
+ self.logger.debug("All packages built successfully") |
|
205 | 205 |
else: |
206 | 206 |
self.logger.error("Build stopped unexpectedly.Unknown error.") |
207 | 207 |
raise Exception("Unknown error") |
208 | 208 |
|
209 |
- self.logger.info("Terminated") |
|
210 |
- |
|
211 | 209 |
def _createBuildContainer(self): |
212 |
- self.logger.info("Generating photon build container..") |
|
210 |
+ self.logger.debug("Generating photon build container..") |
|
213 | 211 |
try: |
214 | 212 |
#TODO image name constants.buildContainerImageName |
215 | 213 |
self.dockerClient.images.remove("photon_build_container:latest", force=True) |
... | ... |
@@ -233,7 +237,7 @@ class PackageManager(object): |
233 | 233 |
self.logger.debug("Deleting chroot: " + chrootID) |
234 | 234 |
chrUtils.destroyChroot(chrootID) |
235 | 235 |
raise e |
236 |
- self.logger.info("VDBG-PU-createBuildContainer: chrootID: " + chrootID) |
|
236 |
+ self.logger.debug("createBuildContainer: chrootID: " + chrootID) |
|
237 | 237 |
|
238 | 238 |
# Create photon build container using toolchain chroot |
239 | 239 |
#TODO: Coalesce logging |
... | ... |
@@ -254,4 +258,4 @@ class PackageManager(object): |
254 | 254 |
cmd = "rm -f ./tcroot.tar.gz" |
255 | 255 |
cmdUtils.runCommandInShell(cmd, self.logPath + "/toolchain-chroot4.log") |
256 | 256 |
chrUtils.destroyChroot(chrootID) |
257 |
- self.logger.info("Photon build container successfully created.") |
|
257 |
+ self.logger.debug("Photon build container successfully created.") |
... | ... |
@@ -20,7 +20,7 @@ class PackageUtils(object): |
20 | 20 |
logPath = constants.logPath |
21 | 21 |
self.logName = logName |
22 | 22 |
self.logPath = logPath |
23 |
- self.logger = Logger.getLogger(logName, logPath) |
|
23 |
+ self.logger = Logger.getLogger(logName, logPath, constants.logLevel) |
|
24 | 24 |
self.runInChrootCommand = ("./run-in-chroot.sh " + constants.sourcePath + |
25 | 25 |
" " + constants.rpmPath) |
26 | 26 |
self.rpmBinary = "rpm" |
... | ... |
@@ -43,8 +43,6 @@ class PackageUtils(object): |
43 | 43 |
self.noDepsRPMFilesToReInstallInAOneShot = "" |
44 | 44 |
|
45 | 45 |
def installRPM(self, package,version, chrootID, noDeps=False, destLogPath=None): |
46 |
-# self.logger.info("Installing rpm for package:"+package) |
|
47 |
-# self.logger.debug("No deps:"+str(noDeps)) |
|
48 | 46 |
|
49 | 47 |
rpmfile = self.findRPMFileForGivenPackage(package,version) |
50 | 48 |
if rpmfile is None: |
... | ... |
@@ -65,7 +63,7 @@ class PackageUtils(object): |
65 | 65 |
rpmInstallcmd = self.rpmBinary + " " + self.installRPMPackageOptions |
66 | 66 |
cmdUtils = CommandUtils() |
67 | 67 |
if self.noDepsRPMFilesToInstallInAOneShot != "": |
68 |
- self.logger.info("Installing nodeps rpms: " + |
|
68 |
+ self.logger.debug("Installing nodeps rpms: " + |
|
69 | 69 |
self.noDepsPackagesToInstallInAOneShot) |
70 | 70 |
logFile = destLogPath + "/install_rpms_nodeps.log" |
71 | 71 |
cmd = (rpmInstallcmd+" "+self.nodepsRPMPackageOptions + " " + |
... | ... |
@@ -76,7 +74,7 @@ class PackageUtils(object): |
76 | 76 |
self.logger.error("Unable to install rpms") |
77 | 77 |
raise Exception("RPM installation failed") |
78 | 78 |
if self.rpmFilesToInstallInAOneShot != "": |
79 |
- self.logger.info("Installing rpms: " + self.packagesToInstallInAOneShot) |
|
79 |
+ self.logger.debug("Installing rpms: " + self.packagesToInstallInAOneShot) |
|
80 | 80 |
logFile = destLogPath+"/install_rpms.log" |
81 | 81 |
cmd = rpmInstallcmd+" "+self.rpmFilesToInstallInAOneShot |
82 | 82 |
returnVal = cmdUtils.runCommandInShell(cmd, logFile, chrootCmd) |
... | ... |
@@ -86,7 +84,7 @@ class PackageUtils(object): |
86 | 86 |
raise Exception("RPM installation failed") |
87 | 87 |
|
88 | 88 |
def buildRPMSForGivenPackage(self, package, version, chrootID, destLogPath=None): |
89 |
- self.logger.info("Building rpm's for package:" + package) |
|
89 |
+ self.logger.info("Building package : " + package) |
|
90 | 90 |
|
91 | 91 |
listSourcesFiles = SPECS.getData().getSources(package, version) |
92 | 92 |
listPatchFiles = SPECS.getData().getPatches(package, version) |
... | ... |
@@ -119,7 +117,11 @@ class PackageUtils(object): |
119 | 119 |
listRPMFiles, listSRPMFiles = self._buildRPM(chrootSpecPath + specName, |
120 | 120 |
chrootLogsFilePath, chrootCmd, |
121 | 121 |
package, macros) |
122 |
- self.logger.info("Successfully built rpm:" + package) |
|
122 |
+ logmsg = package + " build done - RPMs : [ " |
|
123 |
+ for f in listRPMFiles: |
|
124 |
+ logmsg += (os.path.basename(f) + " ") |
|
125 |
+ logmsg += "]\n" |
|
126 |
+ self.logger.info(logmsg) |
|
123 | 127 |
except Exception as e: |
124 | 128 |
self.logger.error("Failed while building rpm:" + package) |
125 | 129 |
raise e |
... | ... |
@@ -136,7 +138,7 @@ class PackageUtils(object): |
136 | 136 |
shutil.copyfile(chrootLogsFilePath, testLogFile) |
137 | 137 |
else: |
138 | 138 |
shutil.copy2(chrootLogsFilePath, destLogPath) |
139 |
- self.logger.info("RPM build is successful") |
|
139 |
+ self.logger.debug("RPM build is successful") |
|
140 | 140 |
|
141 | 141 |
for rpmFile in listRPMFiles: |
142 | 142 |
self._copyRPM(chrootID + "/" + rpmFile, constants.rpmPath) |
... | ... |
@@ -225,7 +227,7 @@ class PackageUtils(object): |
225 | 225 |
self.forceRpmPackageOptions) |
226 | 226 |
|
227 | 227 |
if self.noDepsRPMFilesToInstallInAOneShot != "": |
228 |
- self.logger.info("PackageUtils-installRPMSInAOneShotInContainer: " + |
|
228 |
+ self.logger.debug("PackageUtils-installRPMSInAOneShotInContainer: " + |
|
229 | 229 |
"Installing nodeps rpms: " + |
230 | 230 |
self.noDepsPackagesToInstallInAOneShot) |
231 | 231 |
logFile = destLogPath + "/install_rpms_nodeps.log" |
... | ... |
@@ -258,7 +260,7 @@ class PackageUtils(object): |
258 | 258 |
logfile.write(installLog.decode()) |
259 | 259 |
|
260 | 260 |
if self.rpmFilesToInstallInAOneShot != "": |
261 |
- self.logger.info("PackageUtils-installRPMSInAOneShotInContainer: Installing rpms: " + |
|
261 |
+ self.logger.debug("PackageUtils-installRPMSInAOneShotInContainer: Installing rpms: " + |
|
262 | 262 |
self.packagesToInstallInAOneShot) |
263 | 263 |
logFile = destLogPath + "/install_rpms.log" |
264 | 264 |
cmd = rpmInstallcmd + " " + self.rpmFilesToInstallInAOneShot |
... | ... |
@@ -315,7 +317,7 @@ class PackageUtils(object): |
315 | 315 |
raise Exception("Failed while adjusting gcc specs") |
316 | 316 |
|
317 | 317 |
def buildRPMSForGivenPackageInContainer(self, package, version, containerID, destLogPath=None): |
318 |
- self.logger.info("Building rpm's for package " + package + " in container " + |
|
318 |
+ self.logger.debug("Building rpms for package " + package + " in container " + |
|
319 | 319 |
containerID.short_id) |
320 | 320 |
|
321 | 321 |
listSourcesFiles = SPECS.getData().getSources(package, version) |
... | ... |
@@ -363,7 +365,8 @@ class PackageUtils(object): |
363 | 363 |
package, |
364 | 364 |
version, |
365 | 365 |
macros) |
366 |
- self.logger.info("Successfully built rpm:" + package) |
|
366 |
+ logmsg = "Successfully built " + package + " - RPMs : [" + "".join(os.path.basename(listRPMFiles)) + "]" |
|
367 |
+ self.logger.info(logmsg) |
|
367 | 368 |
except Exception as e: |
368 | 369 |
self.logger.error("Failed while building rpm: " + package) |
369 | 370 |
raise e |
... | ... |
@@ -378,7 +381,7 @@ class PackageUtils(object): |
378 | 378 |
returnVal = CommandUtils().runCommandInShell(cmd, logFile) |
379 | 379 |
testLogFile = destLogPath + "/" + package + "-test.log" |
380 | 380 |
shutil.copyfile(rpmLog, testLogFile) |
381 |
- self.logger.info("RPM build is successful") |
|
381 |
+ self.logger.debug("RPM build is successful") |
|
382 | 382 |
|
383 | 383 |
# Verify RPM and SRPM files exist as success criteria |
384 | 384 |
for rpmFile in listRPMFiles: |
... | ... |
@@ -460,7 +463,7 @@ class PackageUtils(object): |
460 | 460 |
def _copySourcesTobuildroot(self, listSourceFiles, package, version, destDir): |
461 | 461 |
for source in listSourceFiles: |
462 | 462 |
sourcePath = self._verifyShaAndGetSourcePath(source, package, version) |
463 |
- self.logger.info("Copying... Source path :" + source + |
|
463 |
+ self.logger.debug("Copying... Source path :" + source + |
|
464 | 464 |
" Source filename: " + sourcePath[0]) |
465 | 465 |
shutil.copy2(sourcePath[0], destDir) |
466 | 466 |
|
... | ... |
@@ -469,7 +472,7 @@ class PackageUtils(object): |
469 | 469 |
for additionalFile in listAdditionalFiles: |
470 | 470 |
source = additionalFile["src"] |
471 | 471 |
destDir = chrootID + additionalFile["dst"] |
472 |
- self.logger.info("Copying additional Source build files :" + source) |
|
472 |
+ self.logger.debug("Copying additional Source build files :" + source) |
|
473 | 473 |
if os.path.exists(source): |
474 | 474 |
if os.path.isfile(source): |
475 | 475 |
shutil.copy(source, destDir) |
... | ... |
@@ -495,18 +498,18 @@ class PackageUtils(object): |
495 | 495 |
rpmBuildcmd = self.rpmbuildBinary + " " + self.rpmbuildBuildallOption |
496 | 496 |
|
497 | 497 |
if constants.rpmCheck and package in constants.testForceRPMS: |
498 |
- self.logger.info("#" * (68 + 2 * len(package))) |
|
498 |
+ self.logger.debug("#" * (68 + 2 * len(package))) |
|
499 | 499 |
if not SPECS.getData().isCheckAvailable(package): |
500 |
- self.logger.info("####### " + package + |
|
500 |
+ self.logger.debug("####### " + package + |
|
501 | 501 |
" MakeCheck is not available. Skipping MakeCheck TEST for " + |
502 | 502 |
package + " #######") |
503 | 503 |
rpmBuildcmd = self.rpmbuildBinary + " --clean" |
504 | 504 |
else: |
505 |
- self.logger.info("####### " + package + |
|
505 |
+ self.logger.debug("####### " + package + |
|
506 | 506 |
" MakeCheck is available. Running MakeCheck TEST for " + |
507 | 507 |
package + " #######") |
508 | 508 |
rpmBuildcmd = self.rpmbuildBinary + " " + self.rpmbuildCheckOption |
509 |
- self.logger.info("#" * (68 + 2 * len(package))) |
|
509 |
+ self.logger.debug("#" * (68 + 2 * len(package))) |
|
510 | 510 |
else: |
511 | 511 |
rpmBuildcmd += " " + self.rpmbuildNocheckOption |
512 | 512 |
|
... | ... |
@@ -515,16 +518,16 @@ class PackageUtils(object): |
515 | 515 |
rpmBuildcmd += " " + specFile |
516 | 516 |
|
517 | 517 |
cmdUtils = CommandUtils() |
518 |
- self.logger.info("Building rpm....") |
|
519 |
- self.logger.info(rpmBuildcmd) |
|
518 |
+ self.logger.debug("Building rpm....") |
|
519 |
+ self.logger.debug(rpmBuildcmd) |
|
520 | 520 |
returnVal = cmdUtils.runCommandInShell(rpmBuildcmd, logFile, chrootCmd) |
521 | 521 |
if constants.rpmCheck and package in constants.testForceRPMS: |
522 | 522 |
if not SPECS.getData().isCheckAvailable(package): |
523 |
- constants.testLogger.info(package + " : N/A") |
|
523 |
+ constants.testLogger.debug(package + " : N/A") |
|
524 | 524 |
elif returnVal: |
525 |
- constants.testLogger.info(package + " : PASS") |
|
525 |
+ constants.testLogger.debug(package + " : PASS") |
|
526 | 526 |
else: |
527 |
- constants.testLogger.error(package + " : FAIL") |
|
527 |
+ constants.testLogger.debug(package + " : FAIL") |
|
528 | 528 |
|
529 | 529 |
if constants.rpmCheck: |
530 | 530 |
if not returnVal and constants.rpmCheckStopOnError: |
... | ... |
@@ -558,7 +561,7 @@ class PackageUtils(object): |
558 | 558 |
cmdUtils = CommandUtils() |
559 | 559 |
for source in listSourceFiles: |
560 | 560 |
sourcePath = self._verifyShaAndGetSourcePath(source, package, version) |
561 |
- self.logger.info("Copying source file: " + sourcePath[0]) |
|
561 |
+ self.logger.debug("Copying source file: " + sourcePath[0]) |
|
562 | 562 |
copyCmd = "docker cp " + sourcePath[0] + " " + containerID.short_id + ":" + destDir |
563 | 563 |
cmdUtils.runCommandInShell(copyCmd) |
564 | 564 |
|
... | ... |
@@ -576,10 +579,10 @@ class PackageUtils(object): |
576 | 576 |
if os.path.exists(source): |
577 | 577 |
copyCmd = "docker cp " + source |
578 | 578 |
if os.path.isfile(source): |
579 |
- self.logger.info("Copying additional source file: " + source) |
|
579 |
+ self.logger.debug("Copying additional source file: " + source) |
|
580 | 580 |
copyCmd += " " + destPath |
581 | 581 |
else: |
582 |
- self.logger.info("Copying additional source file tree: " + source) |
|
582 |
+ self.logger.debug("Copying additional source file tree: " + source) |
|
583 | 583 |
copyCmd += "/. " + destPath |
584 | 584 |
#TODO: cmd error code |
585 | 585 |
cmdUtils.runCommandInShell(copyCmd) |
... | ... |
@@ -606,18 +609,18 @@ class PackageUtils(object): |
606 | 606 |
rpmBuildCmd = self.rpmbuildBinary + " " + self.rpmbuildBuildallOption |
607 | 607 |
|
608 | 608 |
if constants.rpmCheck and package in constants.testForceRPMS: |
609 |
- self.logger.info("#" * (68 + 2 * len(package))) |
|
609 |
+ self.logger.debug("#" * (68 + 2 * len(package))) |
|
610 | 610 |
if not SPECS.getData().isCheckAvailable(package, version): |
611 |
- self.logger.info("####### " + package + |
|
611 |
+ self.logger.debug("####### " + package + |
|
612 | 612 |
" MakeCheck is not available. Skipping MakeCheck TEST for " + |
613 | 613 |
package + " #######") |
614 | 614 |
rpmBuildCmd = self.rpmbuildBinary + " --clean" |
615 | 615 |
else: |
616 |
- self.logger.info("####### " + package + |
|
616 |
+ self.logger.debug("####### " + package + |
|
617 | 617 |
" MakeCheck is available. Running MakeCheck TEST for " + |
618 | 618 |
package + " #######") |
619 | 619 |
rpmBuildCmd = self.rpmbuildBinary + " " + self.rpmbuildCheckOption |
620 |
- self.logger.info("#" * (68 + 2 * len(package))) |
|
620 |
+ self.logger.debug("#" * (68 + 2 * len(package))) |
|
621 | 621 |
else: |
622 | 622 |
rpmBuildCmd += " "+self.rpmbuildNocheckOption |
623 | 623 |
|
... | ... |
@@ -628,7 +631,7 @@ class PackageUtils(object): |
628 | 628 |
rpmBuildCmd = "docker exec -t " + str(containerID.short_id) + " " + rpmBuildCmd |
629 | 629 |
|
630 | 630 |
cmdUtils = CommandUtils() |
631 |
- self.logger.info("Building rpm for package: " + package) |
|
631 |
+ self.logger.debug("Building rpm for package: " + package) |
|
632 | 632 |
#TODO: Show running log of rpmbuildcmd |
633 | 633 |
#TODO: Get exit status of rpmBuildCmd |
634 | 634 |
#containerID.exec_run(rpmBuildCmd) |
... | ... |
@@ -67,7 +67,7 @@ class pullSources: |
67 | 67 |
#form url: https://dl.bintray.com/vmware/photon_sources/1.0/<filename>. |
68 | 68 |
url = '%s/%s' % (self._config['baseurl'], filename) |
69 | 69 |
|
70 |
- self.logger.info("Downloading: " + url) |
|
70 |
+ self.logger.debug("Downloading: " + url) |
|
71 | 71 |
|
72 | 72 |
# We need to provide atomicity for file downloads. That is, |
73 | 73 |
# the file should be visible in its canonical location only |
... | ... |
@@ -28,8 +28,8 @@ class Scheduler(object): |
28 | 28 |
Scheduler.event = event |
29 | 29 |
|
30 | 30 |
@staticmethod |
31 |
- def setLog(logName, logPath): |
|
32 |
- Scheduler.logger = Logger.getLogger(logName, logPath) |
|
31 |
+ def setLog(logName, logPath, logLevel): |
|
32 |
+ Scheduler.logger = Logger.getLogger(logName, logPath, logLevel) |
|
33 | 33 |
|
34 | 34 |
@staticmethod |
35 | 35 |
def setParams(sortedList, listOfAlreadyBuiltPackages): |
... | ... |
@@ -182,12 +182,12 @@ class Scheduler(object): |
182 | 182 |
@staticmethod |
183 | 183 |
def _setPriorities(): |
184 | 184 |
if constants.packageWeightsPath is None: |
185 |
- Scheduler.logger.info("Priority Scheduler disabled") |
|
185 |
+ Scheduler.logger.debug("Priority Scheduler disabled") |
|
186 | 186 |
if constants.publishBuildDependencies: |
187 |
- Scheduler.logger.info("Publishing Build dependencies") |
|
187 |
+ Scheduler.logger.debug("Publishing Build dependencies") |
|
188 | 188 |
Scheduler._makeGraph() |
189 | 189 |
else: |
190 |
- Scheduler.logger.info("Priority Scheduler enabled") |
|
190 |
+ Scheduler.logger.debug("Priority Scheduler enabled") |
|
191 | 191 |
Scheduler._parseWeights() |
192 | 192 |
|
193 | 193 |
Scheduler._makeGraph() |
... | ... |
@@ -201,8 +201,8 @@ class Scheduler(object): |
201 | 201 |
Scheduler.priorityMap[child_pkg] |
202 | 202 |
+ (Scheduler.dependencyGraph[package][child_pkg] |
203 | 203 |
* (Scheduler._getWeight(package)))) |
204 |
- Scheduler.logger.info("set Priorities: Priority of all packages") |
|
205 |
- Scheduler.logger.info(Scheduler.priorityMap) |
|
204 |
+ Scheduler.logger.debug("set Priorities: Priority of all packages") |
|
205 |
+ Scheduler.logger.debug(Scheduler.priorityMap) |
|
206 | 206 |
|
207 | 207 |
|
208 | 208 |
@staticmethod |
... | ... |
@@ -233,4 +233,4 @@ class Scheduler(object): |
233 | 233 |
break |
234 | 234 |
if canBuild: |
235 | 235 |
Scheduler.listOfPackagesNextToBuild.put((-Scheduler._getPriority(pkg), pkg)) |
236 |
-# Scheduler.logger.info("Adding " + pkg + " to the schedule list") |
|
236 |
+ Scheduler.logger.debug("Adding " + pkg + " to the schedule list") |
... | ... |
@@ -40,7 +40,7 @@ class SpecObjectsUtils(object): |
40 | 40 |
self.mapSpecObjects = {} |
41 | 41 |
self.mapPackageToSpec = {} |
42 | 42 |
self.mapSpecFileNameToSpecObj = {} |
43 |
- self.logger = Logger.getLogger("Serializable Spec objects", logPath) |
|
43 |
+ self.logger = Logger.getLogger("Serializable Spec objects", logPath, constants.logLevel) |
|
44 | 44 |
|
45 | 45 |
def readSpecsAndConvertToSerializableObjects(self, specFilesPath): |
46 | 46 |
listSpecFiles = [] |
... | ... |
@@ -252,7 +252,7 @@ class SpecObjectsUtils(object): |
252 | 252 |
specName = self.mapPackageToSpec[package] |
253 | 253 |
if specName in self.mapSpecObjects: |
254 | 254 |
return specName |
255 |
- self.logger.error("Could not able to find " + package + " package from specs") |
|
255 |
+ self.logger.error("Could not find " + package + " package from specs") |
|
256 | 256 |
raise Exception("Invalid package:" + package) |
257 | 257 |
|
258 | 258 |
def isRPMPackage(self, package): |
... | ... |
@@ -290,23 +290,23 @@ class SpecObjectsUtils(object): |
290 | 290 |
listSpecs = self.mapSpecObjects.keys() |
291 | 291 |
for spec in listSpecs: |
292 | 292 |
for specObj in self.mapSpecObjects[spec]: |
293 |
- self.logger.info("-----------Spec:"+specObj.name+"--------------") |
|
294 |
- self.logger.info("Version:"+specObj.version) |
|
295 |
- self.logger.info("Release:"+specObj.release) |
|
296 |
- self.logger.info("SpecFile:"+specObj.specFile) |
|
297 |
- self.logger.info("Source Files") |
|
298 |
- self.logger.info(specObj.listSources) |
|
299 |
- self.logger.info("Patch Files") |
|
300 |
- self.logger.info(specObj.listPatches) |
|
301 |
- self.logger.info("List RPM packages") |
|
302 |
- self.logger.info(specObj.listPackages) |
|
303 |
- self.logger.info("Build require packages") |
|
304 |
- self.logger.info(self.getPkgNamesFromObj(specObj.buildRequirePackages)) |
|
305 |
- self.logger.info("install require packages") |
|
306 |
- self.logger.info(self.getPkgNamesFromObj(specObj.installRequiresAllPackages)) |
|
307 |
- self.logger.info(specObj.installRequiresPackages) |
|
308 |
- self.logger.info("security_hardening: " + specObj.securityHardening) |
|
309 |
- self.logger.info("------------------------------------------------") |
|
293 |
+ self.logger.debug("-----------Spec:"+specObj.name+"--------------") |
|
294 |
+ self.logger.debug("Version:"+specObj.version) |
|
295 |
+ self.logger.debug("Release:"+specObj.release) |
|
296 |
+ self.logger.debug("SpecFile:"+specObj.specFile) |
|
297 |
+ self.logger.debug("Source Files") |
|
298 |
+ self.logger.debug(specObj.listSources) |
|
299 |
+ self.logger.debug("Patch Files") |
|
300 |
+ self.logger.debug(specObj.listPatches) |
|
301 |
+ self.logger.debug("List RPM packages") |
|
302 |
+ self.logger.debug(specObj.listPackages) |
|
303 |
+ self.logger.debug("Build require packages") |
|
304 |
+ self.logger.debug(self.getPkgNamesFromObj(specObj.buildRequirePackages)) |
|
305 |
+ self.logger.debug("install require packages") |
|
306 |
+ self.logger.debug(self.getPkgNamesFromObj(specObj.installRequiresAllPackages)) |
|
307 |
+ self.logger.debug(specObj.installRequiresPackages) |
|
308 |
+ self.logger.debug("security_hardening: " + specObj.securityHardening) |
|
309 |
+ self.logger.debug("------------------------------------------------") |
|
310 | 310 |
|
311 | 311 |
|
312 | 312 |
class SPECS(object): |
... | ... |
@@ -376,14 +376,17 @@ class SPECS(object): |
376 | 376 |
|
377 | 377 |
class SpecDependencyGenerator(object): |
378 | 378 |
|
379 |
+ def __init__(self, logPath, logLevel): |
|
380 |
+ self.logger = Logger.getLogger("Serializable Spec objects", logPath, logLevel) |
|
381 |
+ |
|
379 | 382 |
def findTotalRequires(self, mapDependencies, depQue, parent): |
380 | 383 |
while not depQue.empty(): |
381 | 384 |
specPkg = depQue.get() |
382 | 385 |
try: |
383 | 386 |
listRequiredPackages = SPECS.getData().getRequiresForPkg(specPkg) |
384 | 387 |
except Exception as e: |
385 |
- print("Caught Exception:"+str(e)) |
|
386 |
- print(specPkg + " is missing") |
|
388 |
+ self.logger.info("Caught Exception:"+str(e)) |
|
389 |
+ self.logger.info(specPkg + " is missing") |
|
387 | 390 |
raise e |
388 | 391 |
|
389 | 392 |
for depPkg in listRequiredPackages: |
... | ... |
@@ -424,7 +427,7 @@ class SpecDependencyGenerator(object): |
424 | 424 |
def printTree(self, children, curParent, depth): |
425 | 425 |
if curParent in children: |
426 | 426 |
for child in children[curParent]: |
427 |
- print ("\t" * depth + child) |
|
427 |
+ self.logger.info("\t" * depth + child) |
|
428 | 428 |
self.printTree(children, child, depth + 1) |
429 | 429 |
|
430 | 430 |
def getAllPackageNames(self, jsonFilePath): |
... | ... |
@@ -455,7 +458,7 @@ class SpecDependencyGenerator(object): |
455 | 455 |
depQue.put(pkg) |
456 | 456 |
self.findTotalRequires(mapDependencies, depQue, parent) |
457 | 457 |
else: |
458 |
- print("Could not find spec for "+pkg) |
|
458 |
+ self.logger.info("Could not find spec for " + package) |
|
459 | 459 |
|
460 | 460 |
def displayDependencies(self, displayOption, inputType, inputValue, allDeps, parent): |
461 | 461 |
children = {} |
... | ... |
@@ -467,22 +470,22 @@ class SpecDependencyGenerator(object): |
467 | 467 |
for k, v in parent.iteritems(): |
468 | 468 |
children.setdefault(v, []).append(k) |
469 | 469 |
if inputType == "json": |
470 |
- print("Dependency Mappings for {}".format(inputValue) + " :") |
|
471 |
- print("-" * 52 + " {}".format(children)) |
|
472 |
- print("-" * 52) |
|
470 |
+ self.logger.info("Dependency Mappings for {}".format(inputValue) + " :") |
|
471 |
+ self.logger.info("-" * 52 + " {}".format(children)) |
|
472 |
+ self.logger.info("-" * 52) |
|
473 | 473 |
if "" in children: |
474 | 474 |
for child in children[""]: |
475 |
- print(child) |
|
475 |
+ self.logger.info(child) |
|
476 | 476 |
self.printTree(children, child, 1) |
477 |
- print("*" * 18 + " {} ".format(len(sortedList)) + |
|
477 |
+ self.logger.info("*" * 18 + " {} ".format(len(sortedList)) + |
|
478 | 478 |
"packages in total " + "*" * 18) |
479 | 479 |
else: |
480 | 480 |
if inputType == "pkg" and len(children) > 0: |
481 |
- print ("cyclic dependency detected, mappings: \n", children) |
|
481 |
+ self.logger.info("cyclic dependency detected, mappings: \n", children) |
|
482 | 482 |
|
483 | 483 |
# To display a flat list of all packages |
484 | 484 |
elif displayOption == "list": |
485 |
- print (sortedList) |
|
485 |
+ self.logger.info(sortedList) |
|
486 | 486 |
|
487 | 487 |
# To generate a new JSON file based on given input json file |
488 | 488 |
elif displayOption == "json" and inputType == "json": |
... | ... |
@@ -524,8 +527,8 @@ class SpecDependencyGenerator(object): |
524 | 524 |
pkg=inputValue+"-"+SPECS.getData().getHighestVersion(inputValue) |
525 | 525 |
for version in SPECS.getData().getVersions(depPackage): |
526 | 526 |
depPkg = depPackage+"-"+version |
527 |
- print (depPkg) |
|
527 |
+ self.logger.info(depPkg) |
|
528 | 528 |
if pkg in SPECS.getData().getRequiresForPkg(depPkg): |
529 | 529 |
whoNeedsList.append(depPkg) |
530 |
- print (whoNeedsList) |
|
530 |
+ self.logger.info(whoNeedsList) |
|
531 | 531 |
return whoNeedsList |
... | ... |
@@ -13,6 +13,7 @@ from jsonwrapper import JsonWrapper |
13 | 13 |
from constants import constants |
14 | 14 |
from CommandUtils import CommandUtils |
15 | 15 |
from StringUtils import StringUtils |
16 |
+from Logger import Logger |
|
16 | 17 |
|
17 | 18 |
DEFAULT_INPUT_TYPE = "pkg" |
18 | 19 |
DEFAULT_DISPLAY_OPTION = "tree" |
... | ... |
@@ -29,6 +30,7 @@ def main(): |
29 | 29 |
parser.add_argument("-d", "--disp", dest="display_option", default=DEFAULT_DISPLAY_OPTION) |
30 | 30 |
parser.add_argument("-s", "--spec-dir", dest="spec_dir", default=SPEC_FILE_DIR) |
31 | 31 |
parser.add_argument("-l", "--log-dir", dest="log_dir", default=LOG_FILE_DIR) |
32 |
+ parser.add_argument("-y", "--log-level", dest="log_level", default="info") |
|
32 | 33 |
parser.add_argument("-t", "--stage-dir", dest="stage_dir", default="../../stage") |
33 | 34 |
parser.add_argument("-a", "--input-data-dir", dest="input_data_dir", default="../../common/data/") |
34 | 35 |
parser.add_argument("-o", "--output-dir", dest="output_dir", default="../../stage/common/data") |
... | ... |
@@ -36,9 +38,11 @@ def main(): |
36 | 36 |
|
37 | 37 |
constants.setSpecPath(options.spec_dir) |
38 | 38 |
constants.setLogPath(options.log_dir) |
39 |
+ constants.setLogLevel(options.log_level) |
|
39 | 40 |
constants.initialize() |
40 | 41 |
|
41 | 42 |
cmdUtils = CommandUtils() |
43 |
+ logger = Logger.getLogger("SpecDeps", options.log_dir, options.log_level) |
|
42 | 44 |
|
43 | 45 |
if not os.path.isdir(options.output_dir): |
44 | 46 |
cmdUtils.runCommandInShell2("mkdir -p "+options.output_dir) |
... | ... |
@@ -46,11 +50,11 @@ def main(): |
46 | 46 |
if not options.input_data_dir.endswith('/'): |
47 | 47 |
options.input_data_dir += '/' |
48 | 48 |
try: |
49 |
- specDeps = SpecDependencyGenerator() |
|
49 |
+ specDeps = SpecDependencyGenerator(options.log_dir, options.log_level) |
|
50 | 50 |
|
51 | 51 |
if options.input_type == "remove-upward-deps": |
52 | 52 |
whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option) |
53 |
- print ("Removing upward dependencies: " + str(whoNeedsList)) |
|
53 |
+ logger.info("Removing upward dependencies: " + str(whoNeedsList)) |
|
54 | 54 |
for pkg in whoNeedsList: |
55 | 55 |
package, version = StringUtils.splitPackageNameAndVersion(pkg) |
56 | 56 |
release = SPECS.getData().getRelease(package, version) |
... | ... |
@@ -60,7 +64,7 @@ def main(): |
60 | 60 |
cmdUtils.runCommandInShell2("rm -f "+rpmFile) |
61 | 61 |
elif options.input_type == "print-upward-deps": |
62 | 62 |
whoNeedsList = specDeps.process("get-upward-deps", options.pkg, options.display_option) |
63 |
- print ("Upward dependencies: " + str(whoNeedsList)) |
|
63 |
+ logger.info("Upward dependencies: " + str(whoNeedsList)) |
|
64 | 64 |
# To display/print package dependencies on console |
65 | 65 |
elif (options.input_type == "pkg" or |
66 | 66 |
options.input_type == "who-needs"): |
... | ... |
@@ -69,6 +73,7 @@ def main(): |
69 | 69 |
elif options.input_type == "json": |
70 | 70 |
list_json_files = options.json_file.split("\n") |
71 | 71 |
# Generate the expanded package dependencies json file based on package_list_file |
72 |
+ logger.info("Generating the install time dependency list for all json files") |
|
72 | 73 |
for json_file in list_json_files: |
73 | 74 |
shutil.copy2(json_file, options.output_dir) |
74 | 75 |
json_wrapper_option_list = JsonWrapper(json_file) |
... | ... |
@@ -81,7 +86,6 @@ def main(): |
81 | 81 |
continue |
82 | 82 |
if options.display_option == "json": |
83 | 83 |
output_file = os.path.join(options.output_dir, install_option[1]["file"]) |
84 |
- print ("Generating the install time dependency list for " + json_file) |
|
85 | 84 |
specDeps.process(options.input_type, input_value, options.display_option, output_file) |
86 | 85 |
except Exception as e: |
87 | 86 |
traceback.print_exc() |
... | ... |
@@ -19,7 +19,7 @@ class ToolChainUtils(object): |
19 | 19 |
logPath = constants.logPath |
20 | 20 |
self.logName = logName |
21 | 21 |
self.logPath = logPath |
22 |
- self.logger = Logger.getLogger(logName, logPath) |
|
22 |
+ self.logger = Logger.getLogger(logName, logPath, constants.logLevel) |
|
23 | 23 |
self.adjustToolChainScript = "adjust-tool-chain.sh" |
24 | 24 |
self.localegenScript = "./locale-gen.sh" |
25 | 25 |
self.localegenConfig = "./locale-gen.conf" |
... | ... |
@@ -31,7 +31,7 @@ class ToolChainUtils(object): |
31 | 31 |
self.rpmCommand = "fakeroot-ng rpm" |
32 | 32 |
|
33 | 33 |
def prepareBuildRoot(self, chrootID): |
34 |
- self.logger.info("Preparing build environment") |
|
34 |
+ self.logger.debug("Preparing build environment") |
|
35 | 35 |
cmdUtils = CommandUtils() |
36 | 36 |
cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/dev") |
37 | 37 |
cmdUtils.runCommandInShell("mkdir -p " + chrootID + "/etc") |
... | ... |
@@ -56,7 +56,7 @@ class ToolChainUtils(object): |
56 | 56 |
self.logger.error("Prepare build root script failed.Unable to prepare chroot.") |
57 | 57 |
raise Exception("Prepare build root script failed") |
58 | 58 |
|
59 |
- self.logger.info("Successfully prepared chroot:" + chrootID) |
|
59 |
+ self.logger.debug("Successfully prepared chroot:" + chrootID) |
|
60 | 60 |
|
61 | 61 |
def findRPMFileInGivenLocation(self, package, rpmdirPath): |
62 | 62 |
cmdUtils = CommandUtils() |
... | ... |
@@ -78,17 +78,29 @@ class ToolChainUtils(object): |
78 | 78 |
return None |
79 | 79 |
|
80 | 80 |
def buildCoreToolChainPackages(self): |
81 |
- self.logger.info("Building core toolchain packages.....") |
|
81 |
+ self.logger.info("Step 1 : Building the core toolchain packages.....") |
|
82 |
+ self.logger.info("") |
|
82 | 83 |
chrootID = None |
83 | 84 |
pkgCount = 0 |
84 | 85 |
try: |
85 | 86 |
pkgUtils = PackageUtils(self.logName, self.logPath) |
87 |
+ coreToolChainYetToBuild = [] |
|
86 | 88 |
for package in constants.listCoreToolChainPackages: |
87 | 89 |
version = SPECS.getData().getHighestVersion(package) |
88 | 90 |
rpmPkg = pkgUtils.findRPMFileForGivenPackage(package, version) |
89 | 91 |
if rpmPkg is not None: |
90 | 92 |
continue |
91 |
- self.logger.info("Building core toolchain package: " + package) |
|
93 |
+ else: |
|
94 |
+ coreToolChainYetToBuild.append(package) |
|
95 |
+ if coreToolChainYetToBuild: |
|
96 |
+ self.logger.info("The following core toolchain packages need to be built :") |
|
97 |
+ self.logger.info(coreToolChainYetToBuild) |
|
98 |
+ else: |
|
99 |
+ self.logger.info("Core toolchain packages are already available") |
|
100 |
+ |
|
101 |
+ for package in coreToolChainYetToBuild: |
|
102 |
+ version = SPECS.getData().getHighestVersion(package) |
|
103 |
+ self.logger.debug("Building core toolchain package : " + package) |
|
92 | 104 |
chrUtils = ChrootUtils(self.logName, self.logPath) |
93 | 105 |
chrootName = "build-"+package |
94 | 106 |
destLogPath = constants.logPath + "/build-" + package |
... | ... |
@@ -105,7 +117,8 @@ class ToolChainUtils(object): |
105 | 105 |
pkgCount += 1 |
106 | 106 |
chrUtils.destroyChroot(chrootID) |
107 | 107 |
chrootID = None |
108 |
- self.logger.info("Successfully built toolchain") |
|
108 |
+ self.logger.debug("Successfully built toolchain") |
|
109 |
+ self.logger.info("-" * 45 + "\n") |
|
109 | 110 |
if chrootID is not None: |
110 | 111 |
chrUtils.destroyChroot(chrootID) |
111 | 112 |
except Exception as e: |
... | ... |
@@ -125,7 +138,7 @@ class ToolChainUtils(object): |
125 | 125 |
logPath = self.logPath |
126 | 126 |
cmdUtils = CommandUtils() |
127 | 127 |
self.prepareBuildRoot(chrootID) |
128 |
- self.logger.info("Installing Tool Chain RPMS.......") |
|
128 |
+ self.logger.debug("Installing Tool Chain RPMS.......") |
|
129 | 129 |
rpmFiles = "" |
130 | 130 |
packages = "" |
131 | 131 |
listBuildRequiresPackages = self.getListDependentPackages(packageName, packageVersion) |
... | ... |
@@ -151,7 +164,7 @@ class ToolChainUtils(object): |
151 | 151 |
rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo) |
152 | 152 |
if rpmFile is None: |
153 | 153 |
if package in constants.listOfRPMsProvidedAfterBuild: |
154 |
- self.logger.info("No old version of " + package + |
|
154 |
+ self.logger.debug("No old version of " + package + |
|
155 | 155 |
" exists, skip until the new version is built") |
156 | 156 |
continue |
157 | 157 |
self.logger.error("Unable to find rpm " + package + |
... | ... |
@@ -168,24 +181,21 @@ class ToolChainUtils(object): |
168 | 168 |
self.logger.debug("Command Executed:" + cmd) |
169 | 169 |
self.logger.error("Installing tool chain failed") |
170 | 170 |
raise Exception("RPM installation failed") |
171 |
- self.logger.info("Successfully installed default Tool Chain RPMS in Chroot:" + chrootID) |
|
172 |
- print("Building Package: ".format(packageName)) |
|
173 |
- print(constants.perPackageToolChain) |
|
171 |
+ self.logger.debug("Successfully installed default Tool Chain RPMS in Chroot:" + chrootID) |
|
174 | 172 |
if packageName in constants.perPackageToolChain: |
175 |
- print(constants.perPackageToolChain[packageName]) |
|
173 |
+ self.logger.debug(constants.perPackageToolChain[packageName]) |
|
176 | 174 |
self.installCustomToolChainRPMS(chrootID, |
177 | 175 |
constants.perPackageToolChain[packageName].get(platform.machine(), []), |
178 | 176 |
packageName) |
179 | 177 |
|
180 | 178 |
def installCustomToolChainRPMS(self, chrootID, listOfToolChainPkgs, packageName): |
181 |
- self.logger.info("Installing package specific tool chain RPMs for " + packageName + |
|
179 |
+ self.logger.debug("Installing package specific tool chain RPMs for " + packageName + |
|
182 | 180 |
".......") |
183 | 181 |
rpmFiles = "" |
184 | 182 |
packages = "" |
185 | 183 |
cmdUtils = CommandUtils() |
186 | 184 |
for package in listOfToolChainPkgs: |
187 | 185 |
pkgUtils = PackageUtils(self.logName, self.logPath) |
188 |
- print("DEBUG:" + package) |
|
189 | 186 |
if re.match("openjre*", packageName) is not None or re.match("openjdk*", packageName): |
190 | 187 |
# x86_64 has openjdk/jre as a published rpms but aarch64 has openjdk8/jre8 |
191 | 188 |
# Remove this condition after publishxrpms for x86_^4 got updated |
... | ... |
@@ -211,10 +221,10 @@ class ToolChainUtils(object): |
211 | 211 |
self.logger.debug("Command Executed:" + cmd) |
212 | 212 |
self.logger.error("Installing tool chain failed") |
213 | 213 |
raise Exception("RPM installation failed") |
214 |
- self.logger.info("Successfully installed all Tool Chain X RPMS") |
|
214 |
+ self.logger.debug("Successfully installed all Tool Chain X RPMS") |
|
215 | 215 |
|
216 | 216 |
def installToolChainRPMSinContainer(self, containerID): |
217 |
- self.logger.info("Installing tool-chain RPMS in container: " + containerID.short_id) |
|
217 |
+ self.logger.debug("Installing tool-chain RPMS in container: " + containerID.short_id) |
|
218 | 218 |
rpmFiles = "" |
219 | 219 |
packages = "" |
220 | 220 |
pkgUtils = PackageUtils(self.logName, self.logPath) |
... | ... |
@@ -228,7 +238,7 @@ class ToolChainUtils(object): |
228 | 228 |
rpmFile = self.findRPMFileInGivenLocation(package, constants.prevPublishRPMRepo) |
229 | 229 |
if rpmFile is None: |
230 | 230 |
if package in constants.listOfRPMsProvidedAfterBuild: |
231 |
- self.logger.info("No old version of " + package + |
|
231 |
+ self.logger.debug("No old version of " + package + |
|
232 | 232 |
" exists, skip until the new version is built") |
233 | 233 |
continue |
234 | 234 |
self.logger.error("Unable to find rpm " + package + |
... | ... |
@@ -246,18 +256,18 @@ class ToolChainUtils(object): |
246 | 246 |
self.logger.debug("Installing tool-chain rpms: " + packages) |
247 | 247 |
|
248 | 248 |
cmd = "/usr/bin/bash -l -c '/usr/bin/rpm -Uvh --force --nodeps " + rpmFiles + "'" |
249 |
- self.logger.info("VDBG-TCU-installToolChainRPMSinContainer: Installing rpms cmd: " + cmd) |
|
249 |
+ self.logger.debug("installToolChainRPMSinContainer: Installing rpms cmd: " + cmd) |
|
250 | 250 |
tcInstallLog = containerID.exec_run(cmd) |
251 | 251 |
# TODO: Find a way to collect exit status of the command that was run. |
252 | 252 |
if not tcInstallLog: |
253 | 253 |
self.logger.error("Installing tool chain in container failed") |
254 | 254 |
raise Exception("RPM installation in container failed") |
255 |
- self.logger.info(tcInstallLog) |
|
256 |
- self.logger.info("Successfully installed default tool-chain RPMS in container: " + |
|
255 |
+ self.logger.debug(tcInstallLog) |
|
256 |
+ self.logger.debug("Successfully installed default tool-chain RPMS in container: " + |
|
257 | 257 |
containerID.short_id) |
258 | 258 |
|
259 | 259 |
def installCustomToolChainRPMSinContainer(self, containerID, listOfToolChainPkgs, packageName): |
260 |
- self.logger.info("Installing package specific tool chain RPMs for " + packageName) |
|
260 |
+ self.logger.debug("Installing package specific tool chain RPMs for " + packageName) |
|
261 | 261 |
rpmFiles = "" |
262 | 262 |
packages = "" |
263 | 263 |
for package in listOfToolChainPkgs: |
... | ... |
@@ -287,6 +297,6 @@ class ToolChainUtils(object): |
287 | 287 |
if not tcInstallLog: |
288 | 288 |
self.logger.error("Installing tool chain in container failed") |
289 | 289 |
raise Exception("RPM installation in container failed") |
290 |
- self.logger.info(tcInstallLog) |
|
291 |
- self.logger.info("Successfully installed all tool-chain XRPMS in container: " + |
|
290 |
+ self.logger.debug(tcInstallLog) |
|
291 |
+ self.logger.debug("Successfully installed all tool-chain XRPMS in container: " + |
|
292 | 292 |
containerID.short_id) |
... | ... |
@@ -18,7 +18,7 @@ class WorkerThread(threading.Thread): |
18 | 18 |
def run(self): |
19 | 19 |
buildThreadFailed = False |
20 | 20 |
ThreadPool.ThreadPool.makeWorkerThreadActive(self.name) |
21 |
- self.logger.info("Thread " + self.name + " is starting now") |
|
21 |
+ self.logger.debug("Thread " + self.name + " is starting now") |
|
22 | 22 |
while True: |
23 | 23 |
pkg = Scheduler.Scheduler.getNextPackageToBuild() |
24 | 24 |
if pkg is None: |
... | ... |
@@ -35,10 +35,10 @@ class WorkerThread(threading.Thread): |
35 | 35 |
self.logger.exception(e) |
36 | 36 |
buildThreadFailed = True |
37 | 37 |
Scheduler.Scheduler.notifyPackageBuildFailed(pkg) |
38 |
- self.logger.info("Thread " + self.name + " stopped building package:" + pkg) |
|
38 |
+ self.logger.debug("Thread " + self.name + " stopped building package:" + pkg) |
|
39 | 39 |
self.statusEvent.set() |
40 | 40 |
break |
41 | 41 |
Scheduler.Scheduler.notifyPackageBuildCompleted(pkg) |
42 | 42 |
|
43 | 43 |
ThreadPool.ThreadPool.makeWorkerThreadInActive(self.name) |
44 |
- self.logger.info("Thread " + self.name + " is going to rest") |
|
44 |
+ self.logger.debug("Thread " + self.name + " is going to rest") |
... | ... |
@@ -30,6 +30,7 @@ def main(): |
30 | 30 |
parser.add_argument("-e", "--publish-XRPMS-path", dest="publishXRPMSPath", |
31 | 31 |
default="../../stage/PUBLISHXRPMS") |
32 | 32 |
parser.add_argument("-l", "--log-path", dest="logPath", default="../../stage/LOGS") |
33 |
+ parser.add_argument("-y", "--log-level", dest="logLevel", default="error") |
|
33 | 34 |
parser.add_argument("-z", "--top-dir-path", dest="topDirPath", default="/usr/src/photon") |
34 | 35 |
parser.add_argument("-b", "--build-root-path", dest="buildRootPath", default="/mnt") |
35 | 36 |
parser.add_argument("-t", "--threads", dest="buildThreads", |
... | ... |
@@ -62,7 +63,7 @@ def main(): |
62 | 62 |
if not os.path.isdir(options.logPath): |
63 | 63 |
cmdUtils.runCommandInShell("mkdir -p " + options.logPath) |
64 | 64 |
|
65 |
- logger = Logger.getLogger(options.logPath + "/Main") |
|
65 |
+ logger = Logger.getLogger("Main", options.logPath, options.logLevel) |
|
66 | 66 |
errorFlag = False |
67 | 67 |
package = None |
68 | 68 |
pkgInfoJsonFile = options.pkgInfoFile |
... | ... |
@@ -126,16 +127,17 @@ def main(): |
126 | 126 |
if not os.path.isdir(options.buildRootPath): |
127 | 127 |
cmdUtils.runCommandInShell("mkdir -p " + options.buildRootPath) |
128 | 128 |
|
129 |
- logger.info("Source Path :"+options.sourcePath) |
|
130 |
- logger.info("Spec Path :" + options.specPath) |
|
131 |
- logger.info("Rpm Path :" + options.rpmPath) |
|
132 |
- logger.info("Log Path :" + options.logPath) |
|
133 |
- logger.info("Top Dir Path :" + options.topDirPath) |
|
134 |
- logger.info("Publish RPMS Path :" + options.publishRPMSPath) |
|
135 |
- logger.info("Publish X RPMS Path :" + options.publishXRPMSPath) |
|
129 |
+ logger.debug("Source Path :"+options.sourcePath) |
|
130 |
+ logger.debug("Spec Path :" + options.specPath) |
|
131 |
+ logger.debug("Rpm Path :" + options.rpmPath) |
|
132 |
+ logger.debug("Log Path :" + options.logPath) |
|
133 |
+ logger.debug("Log Level :" + options.logLevel) |
|
134 |
+ logger.debug("Top Dir Path :" + options.topDirPath) |
|
135 |
+ logger.debug("Publish RPMS Path :" + options.publishRPMSPath) |
|
136 |
+ logger.debug("Publish X RPMS Path :" + options.publishXRPMSPath) |
|
136 | 137 |
|
137 | 138 |
if options.installPackage: |
138 |
- logger.info("Package to build:" + package) |
|
139 |
+ logger.debug("Package to build:" + package) |
|
139 | 140 |
|
140 | 141 |
get_packages_with_build_options(options.pkgBuildOptionFile) |
141 | 142 |
|
... | ... |
@@ -147,6 +149,7 @@ def main(): |
147 | 147 |
constants.setSourceRpmPath(options.sourceRpmPath) |
148 | 148 |
constants.setTopDirPath(options.topDirPath) |
149 | 149 |
constants.setLogPath(options.logPath) |
150 |
+ constants.setLogLevel(options.logLevel) |
|
150 | 151 |
constants.setDist(options.dist) |
151 | 152 |
constants.setBuildNumber(options.buildNumber) |
152 | 153 |
constants.setReleaseVersion(options.releaseVersion) |
... | ... |
@@ -195,15 +198,16 @@ def buildAPackage(package, buildThreads, pkgBuildType): |
195 | 195 |
def buildPackagesForAllSpecs(logger, buildThreads, pkgInfoJsonFile, pkgBuildType): |
196 | 196 |
listPackages = SPECS.getData().getListPackages() |
197 | 197 |
|
198 |
- logger.info("List of packages to build:") |
|
199 |
- logger.info(listPackages) |
|
198 |
+ logger.debug("List of all packages :") |
|
199 |
+ logger.debug(listPackages) |
|
200 |
+ logger.info("") |
|
200 | 201 |
if constants.rpmCheck: |
201 | 202 |
constants.setTestForceRPMS(copy.copy(listPackages)) |
202 | 203 |
pkgManager = PackageManager(pkgBuildType=pkgBuildType) |
203 | 204 |
pkgManager.buildPackages(listPackages, buildThreads, pkgBuildType) |
204 | 205 |
|
205 | 206 |
# Generating package info file which is required by installer |
206 |
- logger.info("Writing Package info to the file:" + pkgInfoJsonFile) |
|
207 |
+ logger.debug("Writing Package info to the file:" + pkgInfoJsonFile) |
|
207 | 208 |
pkgInfo = PackageInfo() |
208 | 209 |
pkgInfo.loadPackagesData() |
209 | 210 |
pkgInfo.writePkgListToFile(pkgInfoJsonFile) |
... | ... |
@@ -5,6 +5,7 @@ class constants(object): |
5 | 5 |
sourcePath = "" |
6 | 6 |
rpmPath = "" |
7 | 7 |
logPath = "" |
8 |
+ logLevel = "info" |
|
8 | 9 |
topDirPath = "" |
9 | 10 |
buildRootPath = "/mnt" |
10 | 11 |
prevPublishRPMRepo = "" |
... | ... |
@@ -514,6 +515,10 @@ class constants(object): |
514 | 514 |
constants.topDirPath = topDirPath |
515 | 515 |
|
516 | 516 |
@staticmethod |
517 |
+ def setLogLevel(logLevel): |
|
518 |
+ constants.logLevel = logLevel |
|
519 |
+ |
|
520 |
+ @staticmethod |
|
517 | 521 |
def setLogPath(logPath): |
518 | 522 |
constants.logPath = logPath |
519 | 523 |
|
... | ... |
@@ -572,7 +577,8 @@ class constants(object): |
572 | 572 |
@staticmethod |
573 | 573 |
def initialize(): |
574 | 574 |
if constants.rpmCheck: |
575 |
- constants.testLogger = Logger.getLogger("MakeCheckTest", constants.logPath) |
|
575 |
+ constants.testLogger = Logger.getLogger("MakeCheckTest", |
|
576 |
+ constants.logPath, constants.logLevel) |
|
576 | 577 |
constants.addMacro("with_check", "1") |
577 | 578 |
else: |
578 | 579 |
constants.addMacro("with_check", "0") |
... | ... |
@@ -20,5 +20,5 @@ if [ $# -eq 2 ]; then |
20 | 20 |
PUBLISHCACHE=$2 |
21 | 21 |
while read FILE; do cp -r $PUBLISHCACHE/$FILE $PUBLISHRPMSPATHDIR/$FILE; done < $INPUTFILE |
22 | 22 |
else |
23 |
- cat $INPUTFILE | awk '{print "https://bintray.com/artifact/download/vmware/photon_publish_x_rpms/"$1}' | xargs -n 1 -P 10 wget --user-agent Mozilla/4.0 -c -nv -nc -r -nH --cut-dirs=4 -P ${PUBLISHRPMSPATHDIR} |
|
23 |
+ cat $INPUTFILE | awk '{print "https://bintray.com/artifact/download/vmware/photon_publish_x_rpms/"$1}' | xargs -n 1 -P 10 wget --user-agent Mozilla/4.0 -c -nv -nc -r -nH --quiet --cut-dirs=4 -P ${PUBLISHRPMSPATHDIR} |
|
24 | 24 |
fi |
... | ... |
@@ -20,5 +20,5 @@ if [ $# -eq 2 ]; then |
20 | 20 |
PUBLISHCACHE=$2 |
21 | 21 |
while read FILE; do cp -r $PUBLISHCACHE/$FILE $PUBLISHRPMSPATHDIR/$FILE; done < $INPUTFILE |
22 | 22 |
else |
23 |
- cat $INPUTFILE | awk '{print "https://bintray.com/artifact/download/vmware/photon_publish_rpms/"$1}' | xargs -n 1 -P 10 wget --user-agent Mozilla/4.0 -c -nv -nc -r -nH --cut-dirs=4 -P ${PUBLISHRPMSPATHDIR} |
|
23 |
+ cat $INPUTFILE | awk '{print "https://bintray.com/artifact/download/vmware/photon_publish_rpms/"$1}' | xargs -n 1 -P 10 wget --user-agent Mozilla/4.0 -c -nv -nc -r -nH --quiet --cut-dirs=4 -P ${PUBLISHRPMSPATHDIR} |
|
24 | 24 |
fi |
... | ... |
@@ -1,22 +1,19 @@ |
1 | 1 |
#!/bin/bash |
2 |
- |
|
3 | 2 |
SCRIPTS_DIR="$(dirname ${0})" |
4 | 3 |
|
5 | 4 |
# Sanify check for all json files. |
6 | 5 |
echo "Sanity check for all json files..." |
7 | 6 |
while read f; do |
8 |
- echo "Checking:${f}" |
|
9 | 7 |
if ! json_pp -t null < "${f}" >& /dev/null; then |
10 | 8 |
echo "Please check:${f} for syntax errors" |
11 | 9 |
exit 1 |
12 | 10 |
fi |
13 |
-done < <(find "${SCRIPTS_DIR}/../" -name "*.json" -type f -not -path "*stage*") |
|
11 |
+done < <(find "${SCRIPTS_DIR}/../" \( -name '*stage*' \) -prune -o -name "*.json" -type f | grep -v "/stage") |
|
14 | 12 |
|
15 | 13 |
echo "Checking all python code is compilable..." |
16 | 14 |
while read f; do |
17 |
- echo "Checking:${f}" |
|
18 | 15 |
if ! python3 -m py_compile "${f}"; then |
19 | 16 |
echo "Please check:${f} for complitation errors" |
20 | 17 |
exit 1 |
21 | 18 |
fi |
22 |
-done < <(find "${SCRIPTS_DIR}/../" -name "*.py" -type f -not -path "*stage*") |
|
19 |
+done < <(find "${SCRIPTS_DIR}/../" \( -name '*stage*' \) -prune -o -name "*.py" -type f | grep -v "/stage") |