Skip to content

Commit

Permalink
formula-fetch: Allow local fs git URI
Browse files Browse the repository at this point in the history
Also fetch formulas from locations like:
FORMULA_SOURCES='file:///home/salt/formulas http://github.com/...'

To keep this change light, piggy-back on the fact that `hosting` is
empty for 'file://<absolute path to formulas dir>'.

Signed-off-by: Alexandru Avadanii <[email protected]>
  • Loading branch information
alexandruavadanii committed Sep 2, 2018
1 parent e3f6f40 commit 7dbb8d7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion formula-fetch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function fetchGitFormula() {
# Fallback to the master branch if the branch doesn't exist for this repository
branch=master
fi
if ! git clone "$origin" "$FORMULAS_BASE/$repo" -b "$branch"; then
if ! git clone --no-hardlinks "$origin" "$FORMULAS_BASE/$repo" -b "$branch"; then
echo -e "[E] Fetching formula from $origin failed."
return ${FAIL_ON_ERRORS:-0}
fi
Expand Down Expand Up @@ -208,6 +208,11 @@ function setupPyEnv() {
}
}

function listRepos_() {
# local filesystem lister ('hosting' is empty for abspaths, e.g. file:///home/...)
ls "$1" -1
}

function listRepos_github_com() {
#export python=$(pipenv --py || (setupPyEnv &>/dev/null; pipenv --py))
if [ -e Pipfile.lock ]; then python=$(pipenv --py); else python=python3; fi
Expand Down Expand Up @@ -241,6 +246,7 @@ function fetchAll() {
for source in $(echo ${FORMULA_SOURCES} | xargs -n1 --no-run-if-empty); do
hosting=$(echo ${source//\./_} | awk -F'/' '{print $3}')
orgname=$(echo ${source//\./_} | awk -F'/' '{print $4}')
[ -n "${hosting}" ] || orgname=$(echo ${source#*//})

# Get repos. To protect builds on master we likely fail on errors/none while getting repos from $source
set -o pipefail
Expand Down

0 comments on commit 7dbb8d7

Please sign in to comment.