mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-12-24 16:10:05 -07:00
kiss: add support for directories and absolute file paths as sources
This adds support for both absolute and relative directories in sources files. Relative file sources have always been supported, this just extends it to directories. Absolute paths to directories and files in sources is totally new. Directories will have their /contents/ copied to the initial build directory. The second field in the sources file can be used to set destination location. Checksums will not be validated for directories of any type. Absolute file paths do have their checksums validated. Notes: The package manager will check to see if the source is a directory or not. There is no need to have a trailing forward slash (though it might make sense to enforce this anyway, we'll see).
This commit is contained in:
parent
fecf4995f8
commit
99f61fc340
56
kiss
56
kiss
@ -221,9 +221,13 @@ pkg_sources() {
|
|||||||
die "$1" "Failed to download $src"
|
die "$1" "Failed to download $src"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Local source.
|
# Local source (relative).
|
||||||
elif [ -f "$repo_dir/$src" ]; then
|
elif [ -e "$repo_dir/$src" ]; then
|
||||||
log "$1" "Found local file '$src'"
|
log "$1" "Found local relative source '$src'"
|
||||||
|
|
||||||
|
# Local source (absolute).
|
||||||
|
elif [ -e "/$src" ]; then
|
||||||
|
log "$1" "Found local absolute source '$src'"
|
||||||
|
|
||||||
else
|
else
|
||||||
die "$1" "No local file '$src'"
|
die "$1" "No local file '$src'"
|
||||||
@ -319,10 +323,22 @@ pkg_extract() {
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
# Local file.
|
# Local directory (relative).
|
||||||
if [ -f "$repo_dir/$src" ]; then
|
if [ -d "$repo_dir/$src" ]; then
|
||||||
|
cp -Rf "$repo_dir/$src/." .
|
||||||
|
|
||||||
|
# Local directory (absolute).
|
||||||
|
elif [ -d "/$src" ]; then
|
||||||
|
cp -Rf "/$src/." .
|
||||||
|
|
||||||
|
# Local file (relative).
|
||||||
|
elif [ -f "$repo_dir/$src" ]; then
|
||||||
cp -f "$repo_dir/$src" .
|
cp -f "$repo_dir/$src" .
|
||||||
|
|
||||||
|
# Local file (absolute).
|
||||||
|
elif [ -f "/$src" ]; then
|
||||||
|
cp -f "/$src" .
|
||||||
|
|
||||||
# Remote file.
|
# Remote file.
|
||||||
elif [ -f "$src_dir/$1/${src##*/}" ]; then
|
elif [ -f "$src_dir/$1/${src##*/}" ]; then
|
||||||
cp -f "$src_dir/$1/${src##*/}" .
|
cp -f "$src_dir/$1/${src##*/}" .
|
||||||
@ -699,12 +715,30 @@ pkg_checksums() {
|
|||||||
[ -f "$repo_dir/sources" ] || return 0
|
[ -f "$repo_dir/sources" ] || return 0
|
||||||
|
|
||||||
while read -r src _ || [ "$src" ]; do
|
while read -r src _ || [ "$src" ]; do
|
||||||
case $src in
|
# Skip comments and blank lines.
|
||||||
\#*|"") ;;
|
if [ -z "${src##\#*}" ]; then
|
||||||
git+*) printf '%s\n' "$src" ;;
|
:
|
||||||
*://*) sh256 "$src_dir/$1/${src##*/}" ;;
|
|
||||||
*) sh256 "$repo_dir/$src" ;;
|
# Git source.
|
||||||
esac
|
elif [ -z "${src##git+*}" ]; then
|
||||||
|
printf '%s\n' "$src" # This should probably be ':'.
|
||||||
|
|
||||||
|
# Remote source.
|
||||||
|
elif [ -z "${src##*://*}" ]; then
|
||||||
|
sh256 "$src_dir/$1/${src##*/}"
|
||||||
|
|
||||||
|
# Skip directories.
|
||||||
|
elif [ -d "$repo_dir/$src" ] || [ -d "/$src" ]; then
|
||||||
|
:
|
||||||
|
|
||||||
|
# Local file (relative).
|
||||||
|
elif [ -f "$repo_dir/$src" ]; then
|
||||||
|
sh256 "$repo_dir/$src"
|
||||||
|
|
||||||
|
# Local file (absolute).
|
||||||
|
elif [ -f "/$src" ]; then
|
||||||
|
sh256 "/$src"
|
||||||
|
fi
|
||||||
done < "$repo_dir/sources" || die "$1" "Failed to generate checksums"
|
done < "$repo_dir/sources" || die "$1" "Failed to generate checksums"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user