mirror of
https://codeberg.org/kiss-community/kiss
synced 2024-09-28 12:22:39 -06:00
kiss: Support packages without sources files
This commit is contained in:
parent
df05ed582d
commit
3e004b193a
43
kiss
43
kiss
@ -175,11 +175,10 @@ pkg_lint() {
|
|||||||
read -r _ release 2>/dev/null < version || die "Version file not found"
|
read -r _ release 2>/dev/null < version || die "Version file not found"
|
||||||
|
|
||||||
[ "$release" ] || die "$1" "Release field not found in version file"
|
[ "$release" ] || die "$1" "Release field not found in version file"
|
||||||
[ -f sources ] || die "$1" "Sources file not found"
|
|
||||||
[ -x build ] || die "$1" "Build file not found or not executable"
|
[ -x build ] || die "$1" "Build file not found or not executable"
|
||||||
[ -s version ] || die "$1" "Version file not found or empty"
|
[ -s version ] || die "$1" "Version file not found or empty"
|
||||||
|
|
||||||
[ "$2" ] || [ -f checksums ] ||
|
[ ! -f sources ] || [ "$2" ] || [ -f checksums ] ||
|
||||||
die "$1" "Checksums are missing"
|
die "$1" "Checksums are missing"
|
||||||
|
|
||||||
case $PWD in "$KISS_ROOT/var/db/kiss/installed"*)
|
case $PWD in "$KISS_ROOT/var/db/kiss/installed"*)
|
||||||
@ -250,6 +249,11 @@ pkg_cache() {
|
|||||||
pkg_sources() {
|
pkg_sources() {
|
||||||
# Download any remote package sources. The existence of local
|
# Download any remote package sources. The existence of local
|
||||||
# files is also checked.
|
# files is also checked.
|
||||||
|
repo_dir=$(pkg_find "$1")
|
||||||
|
|
||||||
|
# Support packages without sources. Simply do nothing.
|
||||||
|
[ -f "$repo_dir/sources" ] || return 0
|
||||||
|
|
||||||
log "$1" "Downloading sources"
|
log "$1" "Downloading sources"
|
||||||
|
|
||||||
# Store each downloaded source in a directory named after the
|
# Store each downloaded source in a directory named after the
|
||||||
@ -324,12 +328,17 @@ pkg_sources() {
|
|||||||
else
|
else
|
||||||
die "$1" "No local file '$src'"
|
die "$1" "No local file '$src'"
|
||||||
fi
|
fi
|
||||||
done < "$(pkg_find "$1")/sources"
|
done < "$repo_dir/sources"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_extract() {
|
pkg_extract() {
|
||||||
# Extract all source archives to the build directory and copy over
|
# Extract all source archives to the build directory and copy over
|
||||||
# any local repository files.
|
# any local repository files.
|
||||||
|
repo_dir=$(pkg_find "$1")
|
||||||
|
|
||||||
|
# Support packages without sources. Simply do nothing.
|
||||||
|
[ -f "$repo_dir/sources" ] || return 0
|
||||||
|
|
||||||
log "$1" "Extracting sources"
|
log "$1" "Extracting sources"
|
||||||
|
|
||||||
while read -r src dest || [ "$src" ]; do
|
while read -r src dest || [ "$src" ]; do
|
||||||
@ -412,7 +421,7 @@ pkg_extract() {
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
done < "$(pkg_find "$1")/sources"
|
done < "$repo_dir/sources"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_depends() {
|
pkg_depends() {
|
||||||
@ -708,7 +717,8 @@ pkg_build() {
|
|||||||
|
|
||||||
# Install built packages to a directory under the package name
|
# Install built packages to a directory under the package name
|
||||||
# to avoid collisions with other packages.
|
# to avoid collisions with other packages.
|
||||||
mkdir -p "$pkg_dir/$pkg/$pkg_db" && cd "$mak_dir/$pkg"
|
mkdir -p "$pkg_dir/$pkg/$pkg_db" "$mak_dir/$pkg"
|
||||||
|
cd "$mak_dir/$pkg"
|
||||||
|
|
||||||
log "$pkg" "Starting build"
|
log "$pkg" "Starting build"
|
||||||
run_hook pre-build "$pkg" "$pkg_dir/$pkg"
|
run_hook pre-build "$pkg" "$pkg_dir/$pkg"
|
||||||
@ -785,6 +795,11 @@ pkg_build() {
|
|||||||
|
|
||||||
pkg_checksums() {
|
pkg_checksums() {
|
||||||
# Generate checksums for packages.
|
# Generate checksums for packages.
|
||||||
|
repo_dir=$(pkg_find "$1")
|
||||||
|
|
||||||
|
# Support packages without sources. Simply do nothing.
|
||||||
|
[ -f "$repo_dir/sources" ] || return 0
|
||||||
|
|
||||||
while read -r src _ || [ "$src" ]; do
|
while read -r src _ || [ "$src" ]; do
|
||||||
# Comment.
|
# Comment.
|
||||||
if [ -z "${src##\#*}" ]; then
|
if [ -z "${src##\#*}" ]; then
|
||||||
@ -812,21 +827,25 @@ pkg_checksums() {
|
|||||||
# of files is to 'cd' to the file's directory beforehand.
|
# of files is to 'cd' to the file's directory beforehand.
|
||||||
(cd "$src_path" && sh256 "${src##*/}") ||
|
(cd "$src_path" && sh256 "${src##*/}") ||
|
||||||
die "$1" "Failed to generate checksums"
|
die "$1" "Failed to generate checksums"
|
||||||
done < "$(pkg_find "$1")/sources"
|
done < "$repo_dir/sources"
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_verify() {
|
pkg_verify() {
|
||||||
# Verify all package checksums. This is achieved by generating
|
# Verify all package checksums. This is achieved by generating
|
||||||
# a new set of checksums and then comparing those with the old
|
# a new set of checksums and then comparing those with the old
|
||||||
# set.
|
# set.
|
||||||
for pkg do pkg_checksums "$pkg" | diff - "$(pkg_find "$pkg")/checksums" || {
|
for pkg do repo_dir=$(pkg_find "$pkg")
|
||||||
|
[ -f "$repo_dir/sources" ] || continue
|
||||||
|
|
||||||
|
pkg_checksums "$pkg" | diff - "$repo_dir/checksums" || {
|
||||||
log "$pkg" "Checksum mismatch"
|
log "$pkg" "Checksum mismatch"
|
||||||
|
|
||||||
# Instead of dying above, log it to the terminal. Also define a
|
# Instead of dying above, log it to the terminal. Also define a
|
||||||
# variable so we *can* die after all checksum files have been
|
# variable so we *can* die after all checksum files have been
|
||||||
# checked.
|
# checked.
|
||||||
mismatch="$mismatch$pkg "
|
mismatch="$mismatch$pkg "
|
||||||
} done
|
}
|
||||||
|
done
|
||||||
|
|
||||||
[ -z "$mismatch" ] || die "Checksum mismatch with: ${mismatch% }"
|
[ -z "$mismatch" ] || die "Checksum mismatch with: ${mismatch% }"
|
||||||
}
|
}
|
||||||
@ -1519,9 +1538,15 @@ args() {
|
|||||||
for pkg do pkg_lint "$pkg" c; done
|
for pkg do pkg_lint "$pkg" c; done
|
||||||
for pkg do pkg_sources "$pkg" c; done
|
for pkg do pkg_sources "$pkg" c; done
|
||||||
for pkg do
|
for pkg do
|
||||||
pkg_checksums "$pkg" | {
|
|
||||||
repo_dir=$(pkg_find "$pkg")
|
repo_dir=$(pkg_find "$pkg")
|
||||||
|
|
||||||
|
# Support packages without sources. Simply do nothing.
|
||||||
|
[ -f "$repo_dir/sources" ] || {
|
||||||
|
log "$pkg" "No sources file, skipping checksums"
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
pkg_checksums "$pkg" | {
|
||||||
if [ -w "$repo_dir" ]; then
|
if [ -w "$repo_dir" ]; then
|
||||||
tee "$repo_dir/checksums"
|
tee "$repo_dir/checksums"
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user