if a build-fail hook fails, kiss thinks the package built successfully
Closed this issue · 1 comments
aabacchus commented
- Does this issue occur in master?
Description
Create a dummy package which will fail to build
kiss-new badpkg 0
echo "false" >> badpkg/build
Create a build-fail hook which will fail
cat << EOF > hook.sh
#!/bin/sh -e
case "\$1" in build-fail) false ;; esac
EOF
Try building the unbuildable package:
$ cd badpkg && KISS_HOOK=../hook.sh kiss b
-> Building: explicit: testpkg
-> Checking for pre-built dependencies
-> testpkg Reading sources
-> testpkg Verifying sources
-> testpkg Building package (1/1)
-> testpkg Extracting sources
-> testpkg Starting build
-> testpkg Build failed
-> testpkg Log stored to /home/ben/.cache/kiss/logs/2021-08-16/testpkg-2021-08-16-20:46-1497987
ERROR build-fail hook failed: '/tmp/test.sh'
-> testpkg Successfully built package
-> testpkg Generating manifest
-> testpkg Stripping binaries and libraries
-> testpkg looking for dependencies (using readelf)
-> testpkg Generating etcsums
-> testpkg Creating tarball
-> testpkg Successfully created tarball
-> Install built packages? [testpkg]
-> Continue?: Press Enter to continue or Ctrl+C to abort
Using /usr/bin/ssu (to become root)
-> testpkg Checking if manifest valid
-> testpkg Checking if package installable
-> testpkg Checking for package conflicts
-> testpkg Installing package (testpkg@0-1.tar.gz)
-> testpkg Installed successfully
This occurs because when a hook fails, die
is called, which exit
s. I think exit
causes the shell to exit from the subshell environment it was invoked in.
The relevant section in pkg_build
is:
{
...
"$repo_dir/build" "$pkg_dir/$1" "$repo_ver" 2>&1 || {
log "$1" "Build failed"
log "$1" "Log stored to $log_dir/$1-$time-$KISS_PID"
# arg1: build-fail
# arg2: package name
# arg3: path to build directory
run_hook build-fail "$pkg" "$mak_dir/$1"
pkg_clean
kill 0
}
} | tee "$log_dir/$1-$time-$KISS_PID"
# continue building package
We exit the subshell, so kill 0
is never called and the build continues.
dylanaraps commented
Thanks!