diff options
author | Daniel Friesel <derf@derf.homelinux.org> | 2008-12-24 21:03:14 +0100 |
---|---|---|
committer | Daniel Friesel <derf@derf.homelinux.org> | 2008-12-24 21:03:14 +0100 |
commit | 27dabac18582c2a97af30090c63988ed09644011 (patch) | |
tree | eaefd9edc0c1f5d7083c4c01c4cf6230c39ce2b9 /bin/pkg | |
parent | fd88f05165883e7f055b665e09bdcac15da380b6 (diff) |
bin/pkg: Introduced global hooks
Diffstat (limited to 'bin/pkg')
-rwxr-xr-x | bin/pkg | 76 |
1 files changed, 38 insertions, 38 deletions
@@ -329,6 +329,38 @@ function exec_hook { } } +function global_hook { + cd $PDIR/$1 + case $2 in + post-add) + exec_hook $1 post-add + global_hook $1 post-update + ;; + pre-update) + ;; + post-update) + triggers+=$1 + check_prereqs $1 + if [[ -r Makefile ]] { + info "Running make\n" + make + } + checklinks $CL_OPTIONS + populate_collected $1 + update_provides $1 + fix_origin $1 + list_update_package $1 + ;; + pre-remove) + exec_hook $1 pre-remove + genocide_collected $1 + checklinks -r + list_remove_package $1 + update_provides $1 'remove' + ;; + esac +} + # Set the correct origin function fix_origin { cd $PDIR/$1 @@ -540,18 +572,7 @@ function pkg_add { cd $PDIR || return 255 vcs_add $1 || return 255 cd $1 || return 255 - check_prereqs $1 - if [[ -r $PDIR/$1/Makefile ]] { - info "Running make\n" - make - } - exec_hook $1 'post-add' - exec_hook $1 'post-update' - checklinks $CL_OPTIONS - populate_collected $1 - update_provides $1 - list_update_package $1 - fix_origin $1 + global_hook $1 post-add } function pkg_push { @@ -562,17 +583,9 @@ function pkg_push { if [[ $? = 0 ]] { clear_line info "Pushing $1\n" + global_hook $1 pre-update vcs_push - check_prereqs $1 - if [[ -r Makefile ]] { - info "Running make\n" - make - } - triggers+=$1 - checklinks $CL_OPTIONS - populate_collected $1 - update_provides $1 - fix_origin $1 + global_hook $1 post-update } } @@ -584,11 +597,7 @@ function pkg_remove { confirm_no "Package '$1' is $(real_priority $(cat priority)). Really remove?" || return } } - exec_hook $1 "pre-remove" - genocide_collected $1 - checklinks -r - list_remove_package $1 - update_provides $1 'remove' + global_hook $1 pre-remove rm -rf $PDIR/$1 info "Package removed.\n" } @@ -606,18 +615,9 @@ function pkg_upgrade { if list_incoming $1; then clear_line info "Updating $1 to $(list_remote_version $1)\n" + global_hook $1 pre-update vcs_upgrade - check_prereqs $1 - if [[ -r Makefile ]] { - info "Building binaries\n" - make - } - triggers+=$1 - checklinks $CL_OPTIONS - populate_collected $1 - update_provides $1 - list_update_package $1 - fix_origin $1 + global_hook $1 post-update fi } |