Bläddra i källkod

Hue [py3] reset git state prior to docker build

Prakash Ranade 3 år sedan
förälder
incheckning
ddf0795208
3 ändrade filer med 18 tillägg och 16 borttagningar
  1. 12 16
      Makefile
  2. 1 0
      tools/container/build.sh
  3. 5 0
      tools/container/common.sh

+ 12 - 16
Makefile

@@ -128,24 +128,20 @@ endif
 ###################################
 # virtual-env
 ###################################
-virtual-env: $(BLD_DIR_ENV)/stamp
-$(BLD_DIR_ENV)/stamp:
-	@if [ "$(PYTHON_VER)" = "python2.7" ]; then \
-	  echo "--- Creating virtual environment at $(BLD_DIR_ENV)"; \
-	  $(SYS_PYTHON) $(VIRTUAL_BOOTSTRAP) \
-	    $(VIRTUALENV_OPTS) --system-site-packages $(BLD_DIR_ENV); \
-	  touch $@; \
-	  echo "--- $(BLD_DIR_ENV) ready"; \
-	else \
-	  echo "--- Creating virtual environment at $(BLD_DIR_ENV)"; \
-	  $(SYS_PYTHON) -m pip install --upgrade pip; \
-	  $(SYS_PIP) install virtualenv; \
-	  virtualenv $(BLD_DIR_ENV); \
-	  touch $@; \
-	  echo "--- $(BLD_DIR_ENV) ready"; \
-	fi
 
 .PHONY: virtual-env
+virtual-env: $(BLD_DIR_ENV)/stamp
+$(BLD_DIR_ENV)/stamp:
+	@echo "--- Creating virtual environment at $(BLD_DIR_ENV)"
+ifeq ($(PYTHON_VER),python2.7)
+	@$(SYS_PYTHON) $(VIRTUAL_BOOTSTRAP) $(VIRTUALENV_OPTS) --system-site-packages $(BLD_DIR_ENV)
+else ifeq ($(PYTHON_VER),python3.8)
+	@$(SYS_PYTHON) -m pip install --upgrade pip
+	@$(SYS_PIP) install virtualenv
+	@virtualenv $(BLD_DIR_ENV)
+endif
+	@echo "--- Virtual environment $(BLD_DIR_ENV) ready"
+	@touch $@
 
 ###################################
 # Build desktop

+ 1 - 0
tools/container/build.sh

@@ -157,6 +157,7 @@ rebuild_base_images() {
 }
 
 hue_containers_build() {
+  reset_git_state
   if [ $REBUILD_BASE -gt 0 ]; then
     rebuild_base_images
   fi

+ 5 - 0
tools/container/common.sh

@@ -7,6 +7,11 @@ REBUILD_BASE=1
 HUEUSER="hive"
 CONTAINER=$(uuidgen | cut -d"-" -f5)
 
+reset_git_state() {
+  cd $HUE_SRC
+  git clean -fdx
+}
+
 find_git_state() {
   cd $HUE_SRC
   export GBRANCH=$(git ls-remote  --get-url)"/commits/"$(git rev-parse --abbrev-ref HEAD)