xbps-src: improve run_func and always make a log in $wrksrc.
Also when or after the pkg is installed to destdir/stowned, and there was any error, always remove the files that were installed into destdir. With these changes there's no need to return any value in the do_foo() functions because they are caught automatically. Also any function is now logged into its own file to always log what happens.
This commit is contained in:
parent
4965921029
commit
08d47bc8b1
8 changed files with 158 additions and 151 deletions
|
@ -151,11 +151,8 @@ stow_pkg_real()
|
|||
# Register pkg in plist file.
|
||||
#
|
||||
$XBPS_PKGDB_CMD register $pkgname $lver "$short_desc" || return $?
|
||||
|
||||
run_func post_stow 2>/dev/null
|
||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
||||
msg_error "Package '$pkgname': post_stow phase failed!"
|
||||
fi
|
||||
run_func post_stow
|
||||
return 0
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -191,11 +188,7 @@ unstow_pkg_real()
|
|||
elif [ ! -w ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
||||
msg_error "$pkgname cannot be removed (permission denied)."
|
||||
elif [ -s ${XBPS_PKGMETADIR}/${pkgname}/flist ]; then
|
||||
run_func pre_remove 2>/dev/null
|
||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
||||
msg_error "Package '$pkgname': pre_remove stage failed!"
|
||||
fi
|
||||
|
||||
run_func pre_remove
|
||||
# Remove installed files.
|
||||
for f in $(cat ${XBPS_PKGMETADIR}/${pkgname}/flist); do
|
||||
if [ -f $XBPS_MASTERDIR/$f -o -h $XBPS_MASTERDIR/$f ]; then
|
||||
|
@ -216,11 +209,7 @@ unstow_pkg_real()
|
|||
done
|
||||
fi
|
||||
|
||||
run_func post_remove 2>/dev/null
|
||||
if [ $? -ne 0 -a $? -ne 255 ]; then
|
||||
msg_error "Package '$pkgname': post_remove phase failed!"
|
||||
fi
|
||||
|
||||
run_func post_remove
|
||||
# Remove metadata dir.
|
||||
rm -rf $XBPS_PKGMETADIR/$pkgname
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue