Add magic support for direct operation on files

Things that work now: (in any combinations)
- `./build.sh debian`
- `./build.sh debian:sid`
- `./build.sh ../library/debian`
- `./build.sh ../library/debian:sid`
This commit is contained in:
Tianon Gravi 2014-09-22 09:41:08 -06:00
parent 143ac14d2a
commit 4b6f49153d
1 changed files with 15 additions and 4 deletions

View File

@ -106,18 +106,29 @@ mkdir -p "$latestLogDir"
# gather all the `repo:tag` combos to build
for repoTag in "${repos[@]}"; do
echo "$repoTag" >> "$logDir/repos.txt"
repo="${repoTag%%:*}"
tag="${repoTag#*:}"
[ "$repo" != "$tag" ] || tag=
if [ -f "$repo" ]; then
repoFile="$repo"
repo="$(basename "$repoFile")"
repoTag="${repo}${tag:+:$tag}"
else
repoFile="$library/$repo"
fi
repoFile="$(readlink -f "$repoFile")"
echo "$repoTag ($repoFile)" >> "$logDir/repos.txt"
if [ "${repoGitRepo[$repoTag]}" ]; then
queue+=( "$repoTag" )
continue
fi
repo="${repoTag%:*}"
# parse the repo library file
IFS=$'\n'
repoTagLines=( $(cat "$library/$repo" | grep -vE '^#|^\s*$') )
repoTagLines=( $(cat "$repoFile" | grep -vE '^#|^\s*$') )
unset IFS
tags=()