forked from vmware/photon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
645 lines (564 loc) · 25.8 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
#
# Copyright VMware, Inc 2015
#
SRCROOT := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
MAKEROOT=$(SRCROOT)/support/make
# do not build these targets as '%'
$(MAKEROOT)/makedefs.mk: ;
Makefile: ;
include $(MAKEROOT)/makedefs.mk
export PATH := $(SRCROOT)/tools/bin:$(PATH)
export PHOTON_BUILD_NUM=$(PHOTON_BUILD_NUMBER)
export PHOTON_RELEASE_VER=$(PHOTON_RELEASE_VERSION)
ifdef PHOTON_CACHE_PATH
PHOTON_PACKAGES_MICRO := packages-cached
PHOTON_PACKAGES_MINIMAL := packages-cached
PHOTON_PACKAGES := packages-cached
else
PHOTON_PACKAGES_MICRO := packages-micro
PHOTON_PACKAGES_MINIMAL := packages-minimal
PHOTON_PACKAGES := packages
endif
ifdef PHOTON_SOURCES_PATH
PHOTON_SOURCES := sources-cached
else
PHOTON_SOURCES ?= sources
endif
MICRO_PACKAGE_LIST_FILE := build_install_options_micro.json
FULL_PACKAGE_LIST_FILE := build_install_options_all.json
ifdef PHOTON_PUBLISH_RPMS_PATH
PHOTON_PUBLISH_RPMS := publish-rpms-cached
else
PHOTON_PUBLISH_RPMS := publish-rpms
endif
ifdef PHOTON_PUBLISH_XRPMS_PATH
PHOTON_PUBLISH_XRPMS := publish-x-rpms-cached
else
PHOTON_PUBLISH_XRPMS := publish-x-rpms
endif
# Tri state RPMCHECK:
# 1) RPMCHECK is not specified: just build
# 2) RPMCHECK=enable: build and run %check section. do not stop on error. will generate report file.
# 3) RPMCHECK=enable_stop_on_error: build and run %check section. stop on first error.
#
# We use 2 parameters:
# -u: enable checking.
# -q: quit on error. if -q is not specified it will keep going
ifeq ($(RPMCHECK),enable)
PHOTON_RPMCHECK_FLAGS := -u
else ifeq ($(RPMCHECK),enable_stop_on_error)
PHOTON_RPMCHECK_FLAGS := -u -q
else
PHOTON_RPMCHECK_FLAGS :=
endif
# KAT build for FIPS certification
ifdef KAT_BUILD
PHOTON_KAT_BUILD_FLAGS := -F $(KAT_BUILD)
endif
ifeq ($(BUILDDEPS),true)
PUBLISH_BUILD_DEPENDENCIES := -bd True
else
PUBLISH_BUILD_DEPENDENCIES :=
endif
ifdef WEIGHTS
PACKAGE_WEIGHTS_PATH = -pw $(WEIGHTS)
else
PACKAGE_WEIGHTS_PATH =
endif
TOOLS_BIN := $(SRCROOT)/tools/bin
CONTAIN := $(TOOLS_BIN)/contain
ifeq ($(ARCH),x86_64)
VIXDISKUTIL := $(TOOLS_BIN)/vixdiskutil
IMGCONVERTER := $(TOOLS_BIN)/imgconverter
else
VIXDISKUTIL :=
IMGCONVERTER :=
endif
.PHONY : all iso clean photon-build-machine photon-vagrant-build photon-vagrant-local cloud-image \
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 \
clean-install clean-chroot build-updated-packages check generate-yaml-files
THREADS?=1
all: iso photon-docker-image k8s-docker-images live-iso cloud-image-all src-iso
micro: micro-iso
@:
micro-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES_MICRO)
@echo "Building Photon Micro ISO..."
@cd $(PHOTON_INSTALLER_DIR) && \
$(PHOTON_INSTALLER) \
-i $(PHOTON_STAGE)/photon-micro-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso \
-k $(PHOTON_STAGE)/photon-micro-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \
-w $(PHOTON_STAGE)/photon_iso \
-l $(PHOTON_STAGE)/LOGS \
-r $(PHOTON_STAGE)/RPMS \
-p $(PHOTON_GENERATED_DATA_DIR)/$(MICRO_PACKAGE_LIST_FILE) \
-c $(PHOTON_GENERATED_DATA_DIR)/$(MICRO_PACKAGE_LIST_FILE) \
-o $(PHOTON_STAGE)/common/data \
-d $(PHOTON_STAGE)/pkg_info.json \
-s $(PHOTON_DATA_DIR) \
-f > \
$(PHOTON_LOGS_DIR)/installer.log 2>&1
packages-micro: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) generate-dep-lists
@echo "Building all Micro RPMS..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
$(PHOTON_RPMCHECK_FLAGS) \
$(PUBLISH_BUILD_DEPENDENCIES) \
$(PACKAGE_WEIGHTS_PATH) \
-t ${THREADS}
live-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES_MINIMAL)
@echo "Building Photon Minimal LIVE ISO..."
@cd $(PHOTON_INSTALLER_DIR) && \
$(PHOTON_INSTALLER) \
-i $(PHOTON_STAGE)/photon-live-iso-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso \
-k $(PHOTON_STAGE)/photon-live-iso-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \
-w $(PHOTON_STAGE)/photon_iso \
-l $(PHOTON_STAGE)/LOGS \
-r $(PHOTON_STAGE)/RPMS \
-p $(PHOTON_GENERATED_DATA_DIR)/build_install_options_livecd.json \
-c $(PHOTON_GENERATED_DATA_DIR)/build_install_options_livecd.json \
-o $(PHOTON_STAGE)/common/data \
-d $(PHOTON_STAGE)/pkg_info.json \
-s $(PHOTON_DATA_DIR) \
-f > \
$(PHOTON_LOGS_DIR)/installer.log 2>&1
packages-minimal: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) generate-dep-lists
@echo "Building all RPMS..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
$(PHOTON_RPMCHECK_FLAGS) \
$(PUBLISH_BUILD_DEPENDENCIES) \
$(PACKAGE_WEIGHTS_PATH) \
-t ${THREADS}
iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES)
@echo "Building Photon Full ISO..."
@cd $(PHOTON_INSTALLER_DIR) && \
sudo $(PHOTON_INSTALLER) \
-i $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso \
-k $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).debug.iso \
-w $(PHOTON_STAGE)/photon_iso \
-l $(PHOTON_STAGE)/LOGS \
-r $(PHOTON_STAGE)/RPMS \
-x $(PHOTON_STAGE)/SRPMS \
-p $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \
-o $(PHOTON_STAGE)/common/data \
-d $(PHOTON_STAGE)/pkg_info.json \
-s $(PHOTON_DATA_DIR) \
-f > \
$(PHOTON_LOGS_DIR)/installer.log 2>&1
custom-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES)
@echo "Building Photon custom ISO..."
@cd $(PHOTON_INSTALLER_DIR) && \
sudo $(PHOTON_INSTALLER) \
-i $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER)-custom.iso \
-k $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER)-custom.debug.iso \
-w $(PHOTON_STAGE)/photon_iso \
-l $(PHOTON_STAGE)/LOGS \
-r $(PHOTON_STAGE)/RPMS \
-x $(PHOTON_STAGE)/SRPMS \
-p $(PHOTON_GENERATED_DATA_DIR)/build_install_options_custom.json \
-o $(PHOTON_STAGE)/common/data \
-d $(PHOTON_STAGE)/pkg_info.json \
-s $(PHOTON_DATA_DIR) \
-f > \
$(PHOTON_LOGS_DIR)/installer.log 2>&1
src-iso: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES)
@echo "Building Photon Full Source ISO..."
@cd $(PHOTON_INSTALLER_DIR) && \
sudo $(PHOTON_INSTALLER) \
-j $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).src.iso \
-w $(PHOTON_STAGE)/photon_iso \
-l $(PHOTON_STAGE)/LOGS \
-r $(PHOTON_STAGE)/RPMS \
-x $(PHOTON_STAGE)/SRPMS \
-p $(PHOTON_GENERATED_DATA_DIR)/$(FULL_PACKAGE_LIST_FILE) \
-o $(PHOTON_STAGE)/common/data \
-d $(PHOTON_STAGE)/pkg_info.json \
-s $(PHOTON_DATA_DIR) \
-f > \
$(PHOTON_LOGS_DIR)/sourceiso-installer.log 2>&1
pkgtree:
@cd $(PHOTON_SPECDEPS_DIR) && \
$(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i pkg -p $(pkg)
imgtree:
@cd $(PHOTON_SPECDEPS_DIR) && \
$(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i json -f $(PHOTON_DATA_DIR)/build_install_options_$(img).json
who-needs:
@cd $(PHOTON_SPECDEPS_DIR) && \
$(PHOTON_SPECDEPS) -s $(PHOTON_SPECS_DIR) -i who-needs -p $(pkg)
packages: check-docker-py check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
@echo "Building all RPMS..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-bt $(PHOTON_BUILD_TYPE) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-a $(PHOTON_SRPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-e $(PHOTON_PUBLISH_XRPMS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
-w $(PHOTON_STAGE)/pkg_info.json \
-g $(PHOTON_DATA_DIR)/pkg_build_options.json \
$(PHOTON_RPMCHECK_FLAGS) \
$(PHOTON_KAT_BUILD_FLAGS) \
$(PUBLISH_BUILD_DEPENDENCIES) \
$(PACKAGE_WEIGHTS_PATH) \
-t ${THREADS}
packages-docker: check-docker-py check-docker-service check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
@echo "Building all RPMS..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-bt $(PHOTON_BUILD_TYPE) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-a $(PHOTON_SRPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-e $(PHOTON_PUBLISH_XRPMS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
-w $(PHOTON_STAGE)/pkg_info.json \
-g $(PHOTON_DATA_DIR)/pkg_build_options.json \
$(PHOTON_RPMCHECK_FLAGS) \
$(PUBLISH_BUILD_DEPENDENCIES) \
$(PACKAGE_WEIGHTS_PATH) \
-t ${THREADS}
updated-packages: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
@echo "Building only updated RPMS..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_UPDATED_RPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-e $(PHOTON_PUBLISH_XRPMS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
-k $(PHOTON_INPUT_RPMS_DIR) \
$(PHOTON_KAT_BUILD_FLAGS) \
$(PHOTON_RPMCHECK_FLAGS) \
$(PUBLISH_BUILD_DEPENDENCIES) \
$(PACKAGE_WEIGHTS_PATH) \
-t ${THREADS}
tool-chain-stage1: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
@echo "Building all RPMS..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-a $(PHOTON_SRPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-t ${THREADS} \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
$(PHOTON_RPMCHECK_FLAGS) \
-m stage1
tool-chain-stage2: check-tools $(PHOTON_STAGE) $(PHOTON_PUBLISH_RPMS) $(PHOTON_SOURCES) $(CONTAIN) generate-dep-lists
@echo "Building all RPMS..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-a $(PHOTON_SRPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-t ${THREADS} \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
$(PHOTON_RPMCHECK_FLAGS) \
-m stage2
packages-cached:
@echo "Using cached RPMS..."
@$(RM) -f $(PHOTON_RPMS_DIR_NOARCH)/* && \
$(RM) -f $(PHOTON_RPMS_DIR_ARCH)/* && \
$(CP) -f $(PHOTON_CACHE_PATH)/RPMS/noarch/* $(PHOTON_RPMS_DIR_NOARCH)/ && \
$(CP) -f $(PHOTON_CACHE_PATH)/RPMS/$(ARCH)/* $(PHOTON_RPMS_DIR_ARCH)/
sources:
@$(MKDIR) -p $(PHOTON_SRCS_DIR)
sources-cached:
@echo "Using cached SOURCES..."
@ln -sf $(PHOTON_SOURCES_PATH) $(PHOTON_SRCS_DIR)
publish-rpms:
@echo "Pulling publish rpms from bintray..."
@cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \
$(PHOTON_PULL_PUBLISH_RPMS) $(PHOTON_PUBLISH_RPMS_DIR)
publish-x-rpms:
@echo "Pulling publish X rpms from bintray..."
@cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \
$(PHOTON_PULL_PUBLISH_X_RPMS) $(PHOTON_PUBLISH_XRPMS_DIR)
publish-rpms-cached:
@echo "Using cached publish rpms..."
@$(MKDIR) -p $(PHOTON_PUBLISH_RPMS_DIR)/{$(ARCH),noarch} && \
cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \
$(PHOTON_PULL_PUBLISH_RPMS) $(PHOTON_PUBLISH_RPMS_DIR) $(PHOTON_PUBLISH_RPMS_PATH)
publish-x-rpms-cached:
@echo "Using ..."
@$(MKDIR) -p $(PHOTON_PUBLISH_XRPMS_DIR)/{$(ARCH),noarch} && \
cd $(PHOTON_PULL_PUBLISH_RPMS_DIR) && \
$(PHOTON_PULL_PUBLISH_X_RPMS) $(PHOTON_PUBLISH_XRPMS_DIR) $(PHOTON_PUBLISH_XRPMS_PATH)
$(PHOTON_STAGE):
@echo "Creating staging folder..."
$(MKDIR) -p $(PHOTON_STAGE)
@echo "Creating chroot path..."
$(MKDIR) -p $(PHOTON_CHROOT_PATH)
@echo "Building RPMS folders..."
@test -d $(PHOTON_RPMS_DIR_NOARCH) || $(MKDIR) -p $(PHOTON_RPMS_DIR_NOARCH)
@test -d $(PHOTON_RPMS_DIR_ARCH) || $(MKDIR) -p $(PHOTON_RPMS_DIR_ARCH)
@echo "Building SRPMS folders..."
@test -d $(PHOTON_SRPMS_DIR) || $(MKDIR) -p $(PHOTON_SRPMS_DIR)
@echo "Building UPDATED_RPMS folders..."
@test -d $(PHOTON_UPDATED_RPMS_DIR_NOARCH) || $(MKDIR) -p $(PHOTON_UPDATED_RPMS_DIR_NOARCH)
@test -d $(PHOTON_UPDATED_RPMS_DIR_ARCH) || $(MKDIR) -p $(PHOTON_UPDATED_RPMS_DIR_ARCH)
@echo "Building SOURCES folder..."
@test -d $(PHOTON_SRCS_DIR) || $(MKDIR) -p $(PHOTON_SRCS_DIR)
@echo "Building LOGS folder..."
@test -d $(PHOTON_LOGS_DIR) || $(MKDIR) -p $(PHOTON_LOGS_DIR)
@echo "Creating COPYING file..."
install -m 444 $(SRCROOT)/COPYING $(PHOTON_STAGE)/COPYING
@echo "Creating open_source_license.txt file..."
install -m 444 $(SRCROOT)/installer/open_source_license.txt $(PHOTON_STAGE)/open_source_license.txt
@echo "Creating NOTICE file..."
install -m 444 $(SRCROOT)/NOTICE $(PHOTON_STAGE)/NOTICE
generate-dep-lists:
$(RMDIR) $(PHOTON_GENERATED_DATA_DIR)
$(MKDIR) -p $(PHOTON_GENERATED_DATA_DIR)
cd $(PHOTON_SPECDEPS_DIR) && \
$(PHOTON_SPECDEPS) \
-s $(PHOTON_SPECS_DIR) \
-t $(PHOTON_STAGE) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_GENERATED_DATA_DIR) \
--input-type=json \
--file "$$(ls $(PHOTON_DATA_DIR)/build_install_options*.json)" \
-d json \
-a $(PHOTON_DATA_DIR)
photon-docker-image:
$(PHOTON_REPO_TOOL) $(PHOTON_RPMS_DIR)
sudo docker build --no-cache --tag photon-build ./support/dockerfiles/photon
sudo docker run \
-it \
--rm \
--privileged \
--net=host \
-e PHOTON_BUILD_NUMBER=$(PHOTON_BUILD_NUMBER) \
-e PHOTON_RELEASE_VERSION=$(PHOTON_RELEASE_VERSION) \
-v `pwd`:/workspace \
photon-build \
./support/dockerfiles/photon/make-docker-image.sh tdnf
start-docker: check-docker
systemctl start docker
k8s-docker-images: start-docker photon-docker-image
mkdir -p $(PHOTON_STAGE)/docker_images && \
cd ./support/dockerfiles/k8s-docker-images && \
./build-k8s-base-image.sh $(PHOTON_RELEASE_VERSION) $(PHOTON_BUILD_NUMBER) $(PHOTON_STAGE) && \
./build-k8s-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
./build-k8s-dns-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
./build-k8s-dashboard-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
./build-flannel-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
./build-calico-docker-images.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
./build-k8s-heapster-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
./build-k8s-nginx-ingress.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE) && \
./build-wavefront-proxy-docker-image.sh $(PHOTON_DIST_TAG) $(PHOTON_RELEASE_VERSION) $(PHOTON_SPECS_DIR) $(PHOTON_STAGE)
install-photon-docker-image: photon-docker-image
sudo docker build -t photon:tdnf .
clean: clean-install clean-chroot
@echo "Deleting Photon ISO..."
@$(RM) -f $(PHOTON_STAGE)/photon-*.iso
@echo "Deleting stage dir..."
@$(RMDIR) $(PHOTON_STAGE)
@echo "Deleting chroot path..."
@$(RMDIR) $(PHOTON_CHROOT_PATH)
@echo "Deleting tools/bin..."
@$(RMDIR) $(TOOLS_BIN)
clean-install:
@echo "Cleaning installer working directory..."
@if [ -d $(PHOTON_STAGE)/photon_iso ]; then \
$(PHOTON_CHROOT_CLEANER) $(PHOTON_STAGE)/photon_iso; \
fi
clean-chroot:
@echo "Cleaning chroot path..."
@if [ -d $(PHOTON_CHROOT_PATH) ]; then \
$(PHOTON_CHROOT_CLEANER) $(PHOTON_CHROOT_PATH); \
fi
photon-build-machine: check-packer check-vagrant
@echo "Building photon-build-machine with Packer..."
@cd $(PHOTON_PACKER_TEMPLATES) && \
$(PACKER) build photon-build-machine.json
@echo "Adding box to Vagrant boxes..."
@$(VAGRANT) box add $(PHOTON_PACKER_TEMPLATES)/photon-build-machine.box --name photon-build-machine --force && \
$(RM) $(PHOTON_PACKER_TEMPLATES)/photon-build-machine.box
photon-vagrant-build: check-vagrant
@echo "Starting Photon build using Vagrant..."
@cd $(SRCROOT) && \
$(VAGRANT) up && \
$(VAGRANT) destroy -f
ifeq ($(VAGRANT_BUILD),all)
PACKER_ARGS=""
else
PACKER_ARGS="-only=$(VAGRANT_BUILD)"
endif
photon-vagrant-local: check-packer check-vagrant
@echo "Building a Photon Vagrant box with Packer..."
@if [ -e $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso ]; then \
cd $(PHOTON_PACKER_TEMPLATES) && \
$(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 && \
$(PACKER) build $(PACKER_ARGS) photon.json && \
$(SED) -i "" -e "s#\"iso_checksum_value\":.*#\"iso_checksum_value\": \"\",#" photon.json; \
echo "Moving boxes to $(PHOTON_STAGE)..." && \
$(MV) *.box $(PHOTON_STAGE); \
else \
echo "Unable to find $(PHOTON_STAGE)/photon-$(PHOTON_RELEASE_VERSION)-$(PHOTON_BUILD_NUMBER).iso ... aborting build"; \
fi
cloud-image: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES)
@echo "Building cloud image $(IMG_NAME)..."
@cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR)
$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) $(IMG_NAME) $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
cloud-image-all: check-kpartx $(PHOTON_STAGE) $(VIXDISKUTIL) $(IMGCONVERTER) $(PHOTON_PACKAGES)
@echo "Building cloud images - gce, ami, azure and ova..."
@cd $(PHOTON_CLOUD_IMAGE_BUILDER_DIR)
$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) gce $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ami $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) azure $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
$(PHOTON_CLOUD_IMAGE_BUILDER) $(PHOTON_CLOUD_IMAGE_BUILDER_DIR) ova_micro $(SRCROOT) $(PHOTON_GENERATED_DATA_DIR) $(PHOTON_STAGE) $(ADDITIONAL_RPMS_PATH)
check-tools: check-bison check-g++ check-gawk check-repo-tool check-texinfo check-sanity check-docker
check-docker:
@command -v docker >/dev/null 2>&1 || { echo "Package docker not installed. Aborting." >&2; exit 1; }
check-docker-service:
@docker ps >/dev/null 2>&1 || { echo "Docker service is not running. Aborting." >&2; exit 1; }
check-docker-py:
@python3 -c "import docker; assert docker.__version__ == '$(PHOTON_DOCKER_PY_VER)'" >/dev/null 2>&1 || { echo "Error: Python3 package docker-py3 2.3.0 not installed.\nPlease use: pip3 install docker==2.3.0" >&2; exit 1; }
check-bison:
@command -v bison >/dev/null 2>&1 || { echo "Package bison not installed. Aborting." >&2; exit 1; }
check-texinfo:
@command -v makeinfo >/dev/null 2>&1 || { echo "Package texinfo not installed. Aborting." >&2; exit 1; }
check-g++:
@command -v g++ >/dev/null 2>&1 || { echo "Package g++ not installed. Aborting." >&2; exit 1; }
check-gawk:
@command -v gawk >/dev/null 2>&1 || { echo "Package gawk not installed. Aborting." >&2; exit 1; }
check-repo-tool:
@command -v $(PHOTON_REPO_TOOL) >/dev/null 2>&1 || { echo "Package $(PHOTON_REPO_TOOL) not installed. Aborting." >&2; exit 1; }
check-kpartx:
@command -v kpartx >/dev/null 2>&1 || { echo "Package kpartx not installed. Aborting." >&2; exit 1; }
check-vagrant: check-packer
@command -v $(VAGRANT) >/dev/null 2>&1 || { echo "Vagrant not installed or wrong path, expecting $(VAGRANT). Aborting" >&2; exit 1; }
check-sanity:
$(SRCROOT)/support/sanity_check.sh
ifeq ($(VAGRANT_BUILD),vcloudair)
check-packer: check-packer-ovf-plugin
else ifeq ($(VAGRANT_BUILD),all)
check-packer: check-packer-ovf-plugin
else
check-packer:
endif
@command -v $(PACKER) >/dev/null 2>&1 || { echo "Packer not installed or wrong path, expecting $(PACKER). Aborting" >&2; exit 1; }
check-packer-ovf-plugin:
@[[ -e ~/.packer.d/plugins/packer-post-processor-vagrant-vmware-ovf ]] || { echo "Packer OVF post processor not installed. Aborting" >&2; exit 1; }
check: packages
ifeq ($(RPMCHECK),enable_stop_on_error)
$(eval rpmcheck_stop_on_error = -q)
endif
@echo "Testing all RPMS ..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) \
-bt $(PHOTON_BUILD_TYPE) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-a $(PHOTON_SRPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-b $(PHOTON_CHROOT_PATH) \
-l $(PHOTON_LOGS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-e $(PHOTON_PUBLISH_XRPMS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
-w $(PHOTON_DATA_DIR)/pkg_info.json \
-g $(PHOTON_DATA_DIR)/pkg_build_options.json \
-u \
$(rpmcheck_stop_on_error) \
-t ${THREADS}
%: check-tools $(PHOTON_PUBLISH_RPMS) $(PHOTON_PUBLISH_XRPMS) $(PHOTON_SOURCES) $(CONTAIN) $(eval PKG_NAME = $@)
$(eval PKG_NAME = $@)
@echo "Building package $(PKG_NAME) ..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_PACKAGE_BUILDER) -i $(PKG_NAME)\
-bt $(PHOTON_BUILD_TYPE) \
-b $(PHOTON_CHROOT_PATH) \
-s $(PHOTON_SPECS_DIR) \
-r $(PHOTON_RPMS_DIR) \
-a $(PHOTON_SRPMS_DIR) \
-x $(PHOTON_SRCS_DIR) \
-p $(PHOTON_PUBLISH_RPMS_DIR) \
-e $(PHOTON_PUBLISH_XRPMS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-d $(PHOTON_DIST_TAG) \
-n $(PHOTON_BUILD_NUMBER) \
-v $(PHOTON_RELEASE_VERSION) \
-g $(PHOTON_DATA_DIR)/pkg_build_options.json \
$(PHOTON_RPMCHECK_FLAGS) \
$(PHOTON_KAT_BUILD_FLAGS) \
-l $(PHOTON_LOGS_DIR)
generate-yaml-files: check-tools $(PHOTON_STAGE) $(PHOTON_PACKAGES)
@echo "Generating yaml files for packages ..."
@cd $(PHOTON_PKG_BUILDER_DIR) && \
$(PHOTON_GENERATE_OSS_FILES) -y \
-s $(PHOTON_SPECS_DIR) \
-a $(PHOTON_SRPMS_DIR) \
-l $(PHOTON_LOGS_DIR) \
-c $(PHOTON_PULLSOURCES_CONFIG) \
-f $(PHOTON_PKG_BLACKLIST_FILE)
$(TOOLS_BIN):
mkdir -p $(TOOLS_BIN)
$(CONTAIN): $(TOOLS_BIN)
gcc -O2 -std=gnu99 -Wall -Wextra $(SRCROOT)/tools/src/contain/*.c -o $@_unpriv
sudo install -o root -g root -m 4755 $@_unpriv $@
$(VIXDISKUTIL): $(TOOLS_BIN)
@cd $(SRCROOT)/tools/src/vixDiskUtil && \
make
$(IMGCONVERTER): $(TOOLS_BIN)
@cd $(SRCROOT)/tools/src/imgconverter && \
make