update: copy PKGBUILD into tracedir
This commit is contained in:
21
leaf
21
leaf
@@ -48,9 +48,17 @@ main() {
|
||||
prepare|build|install|force-install|remove|pack|dirct-install)
|
||||
leaf_check_permission
|
||||
for _item in "${@:2}"; do
|
||||
if [[ x"$1" == x"remove" ]]; then
|
||||
leaf_find_remove_pkgbuild "${_item}"
|
||||
else
|
||||
leaf_find_pkgbuild "${_item}"
|
||||
fi
|
||||
leaf_reset_state
|
||||
if [[ x"$1" == x"remove" ]]; then
|
||||
source "${TRACE_DIR}/${PKG_PREFIX}/${PKG_NAME}/PKGBUILD"
|
||||
else
|
||||
source "${PKGBUILD_DIR}/${PKG_PREFIX}/${PKG_NAME}".PKGBUILD
|
||||
fi
|
||||
leaf_parse_options
|
||||
srcdir="${BUILD_DIR}/${PKG_PREFIX}/${PKG_NAME}"
|
||||
pkgdir="${srcdir}"/__pkgdir__
|
||||
@@ -177,6 +185,18 @@ leaf_find_pkgbuild() {
|
||||
fi
|
||||
}
|
||||
|
||||
leaf_find_remove_pkgbuild() {
|
||||
local _location="$(find "${TRACE_DIR}" -type d -wholename "*$1*" -printf "%P\n")"
|
||||
if [ -z "${_location}" ]; then
|
||||
leaf_error "Package $1 does NOT exist"
|
||||
elif [[ $(echo "${_location}" | wc -l) == 1 ]]; then
|
||||
PKG_PREFIX="$(echo "${_location}" | awk -F'/' '{print $1}')"
|
||||
PKG_NAME="$(echo "${_location%.PKGBUILD}" | awk -F'/' '{print $2}')"
|
||||
else
|
||||
leaf_error "Ambiguous packages, the prefix or version of package must be specified"
|
||||
fi
|
||||
}
|
||||
|
||||
leaf_invoke_hooks() {
|
||||
local _hook _target _hook_dir
|
||||
local _trace_dir="${TRACE_DIR}/${PKG_PREFIX}/${PKG_NAME}"
|
||||
@@ -362,6 +382,7 @@ leaf_trace_package() {
|
||||
find . -type f | sort > "${_trace_dir}"/FILES
|
||||
find . -type l | sort > "${_trace_dir}"/LINKS
|
||||
sed -i "s/.//" "${_trace_dir}"/{DIRS,FILES,LINKS}
|
||||
install -vm644 "${PKGBUILD_DIR}/${PKG_PREFIX}/${PKG_NAME}.PKGBUILD" "${_trace_dir}/PKGBUILD"
|
||||
popd > /dev/null 2>&1
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user