kiss: Simplfy pkg_find usage

This commit is contained in:
Dylan Araps 2020-03-22 16:32:05 +02:00
parent 3990e34dc0
commit 44c6050a39
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E
1 changed files with 5 additions and 9 deletions

14
kiss
View File

@ -195,8 +195,6 @@ pkg_sources() {
# having a source of the same name.
mkdir -p "$src_dir/$1" && cd "$src_dir/$1"
repo_dir=$(pkg_find "$1")
while read -r src dest || [ "$src" ]; do
# Comment.
if [ -z "${src##\#*}" ]; then :
@ -258,13 +256,13 @@ pkg_sources() {
}
# Local source.
elif [ -f "$repo_dir/$src" ]; then
elif [ -f "$(pkg_find "$1")/$src" ]; then
log "$1" "Found local file '$src'"
else
die "$1" "No local file '$src'"
fi
done < "$repo_dir/sources"
done < "$(pkg_find "$1")/sources"
}
pkg_extract() {
@ -272,8 +270,6 @@ pkg_extract() {
# any local repository files.
log "$1" "Extracting sources"
repo_dir=$(pkg_find "$1")
while read -r src dest || [ "$src" ]; do
mkdir -p "$mak_dir/$1/$dest" && cd "$mak_dir/$1/$dest"
@ -307,8 +303,8 @@ pkg_extract() {
*)
# Local file.
if [ -f "$repo_dir/$src" ]; then
cp -f "$repo_dir/$src" .
if [ -f "$(pkg_find "$1")/$src" ]; then
cp -f "$(pkg_find "$1")/$src" .
# Remote file.
elif [ -f "$src_dir/$1/${src##*/}" ]; then
@ -319,7 +315,7 @@ pkg_extract() {
fi
;;
esac
done < "$repo_dir/sources"
done < "$(pkg_find "$1")/sources"
}
pkg_depends() {