kiss: Make package version available to build scripts via $2

This commit is contained in:
Dylan Araps 2020-05-11 10:17:33 +03:00
parent 03c801fd66
commit df379e835f
No known key found for this signature in database
GPG Key ID: 46D62DD9F1DE636E

6
kiss
View File

@ -714,13 +714,17 @@ pkg_build() {
mkdir -p "$pkg_dir/$pkg/$pkg_db" "$mak_dir/$pkg" mkdir -p "$pkg_dir/$pkg/$pkg_db" "$mak_dir/$pkg"
cd "$mak_dir/$pkg" cd "$mak_dir/$pkg"
# Log the version so we can pass it to the package build file
# for the occasional use.
read -r build_version < "$repo_dir/version"
log "$pkg" "Starting build" log "$pkg" "Starting build"
run_hook pre-build "$pkg" "$pkg_dir/$pkg" run_hook pre-build "$pkg" "$pkg_dir/$pkg"
# Call the build script, log the output to the terminal # Call the build script, log the output to the terminal
# and to a file. There's no PIPEFAIL in POSIX shelll so # and to a file. There's no PIPEFAIL in POSIX shelll so
# we must resort to tricks like killing the script ourselves. # we must resort to tricks like killing the script ourselves.
{ "$repo_dir/build" "$pkg_dir/$pkg" 2>&1 || { { "$repo_dir/build" "$pkg_dir/$pkg" "$build_version" 2>&1 || {
log "$pkg" "Build failed" log "$pkg" "Build failed"
log "$pkg" "Log stored to $log_dir/$pkg-$time-$pid" log "$pkg" "Log stored to $log_dir/$pkg-$time-$pid"
run_hook build-fail "$pkg" "$pkg_dir/$pkg" run_hook build-fail "$pkg" "$pkg_dir/$pkg"