Skip to content

Commit

Permalink
[make] Introducing build option SOURCE_FOLDER (#1155)
Browse files Browse the repository at this point in the history
When KEEP_SLAVE_ON=yes and SOURCE_FOLDER is defined, the path pointed
by SOURCE_FOLDER will be mounted in the build slave docker at /var/src.

This option allows user to mount an extra path into the build slave
when the slave is left running. Usually when user need to build extra
stuff in SOURCE_FOLDER.
  • Loading branch information
yxieca authored Nov 16, 2017
1 parent a99b5e9 commit d376506
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# * USERNAME: Desired username -- default at rules/config
# * PASSWORD: Desired password -- default at rules/config
# * KEEP_SLAVE_ON: Keeps slave container up after building-process concludes.
# * SOURCE_FOLDER: host path to be mount as /var/src, only effective when KEEP_SLAVE_ON=yes
#
###############################################################################

Expand Down Expand Up @@ -72,7 +73,11 @@ SONIC_BUILD_INSTRUCTION := make \
{ echo Image $(SLAVE_IMAGE):$(SLAVE_TAG) not found. Building... ; \
$(DOCKER_BUILD) ; }
ifeq "$(KEEP_SLAVE_ON)" "yes"
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
ifdef SOURCE_FOLDER
@$(DOCKER_RUN) -v $(SOURCE_FOLDER):/var/src $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
else
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) bash -c "$(SONIC_BUILD_INSTRUCTION) $@; /bin/bash"
endif
else
@$(DOCKER_RUN) $(SLAVE_IMAGE):$(SLAVE_TAG) $(SONIC_BUILD_INSTRUCTION) $@
endif
Expand Down

0 comments on commit d376506

Please sign in to comment.