prepare_port: fix race condition in safety rule

The safe guard Git repository in $(CONTRIB_DIR) may only be initialized
once, regardless of the number of ports to be prepared.

Issue #3235
This commit is contained in:
Roman Iten
2019-03-18 14:33:49 +01:00
committed by Norman Feske
parent ed33cf08c7
commit 1caa2ff3cb
3 changed files with 18 additions and 16 deletions

View File

@@ -4,6 +4,9 @@
# \date 2014-05-27
#
# compound directory where all 3rd-party source codes are installed
CONTRIB_DIR ?= $(GENODE_DIR)/contrib
SHELL := bash
VERBOSE ?= @
ECHO := echo -e

View File

@@ -17,9 +17,6 @@ $(MAKECMDGOALS) default:
ARGUMENT := $(MAKECMDGOALS)
PORT_NAME := $(firstword $(ARGUMENT))
# compound directory where all 3rd-party source codes are installed
CONTRIB_DIR ?= $(GENODE_DIR)/contrib
# list of all repositories located at '<genode-dir>/repos/'
REPOSITORIES ?= $(shell find $(GENODE_DIR)/repos -follow -mindepth 1 -maxdepth 1 -type d)
@@ -45,18 +42,6 @@ _REL_HASH_FILE := $(notdir $(REP_DIR))/ports/$(notdir $(PORT))
# directory where to install the port
PORT_DIR := $(CONTRIB_DIR)/$(PORT_NAME)-$(HASH)
#
# Protect the GENODE_DIR Git repository by creating an
# empty Git repository in CONTRIB_DIR. This is to catch
# Git tools called by port recipes from falling through
# the parent directories of PORT_DIR and affecting other
# Git repositories.
#
$(PORT_DIR): $(CONTRIB_DIR)/.git
$(CONTRIB_DIR)/.git:
$(VERBOSE)mkdir -p $(CONTRIB_DIR)
$(VERBOSE)git init --quiet $(CONTRIB_DIR)
# path to hash file generated during installation
PORT_HASH_FILE := $(PORT_DIR)/$(PORT_NAME).hash