pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/mk



Module Name:    pkgsrc
Committed By:   jlam
Date:           Thu Aug 10 05:41:53 UTC 2017

Modified Files:
        pkgsrc/mk/pkgformat/pkg/templates: deinstall header install
        pkgsrc/mk/pkgtasks: bsd.pkgtasks.mk

Log Message:
mk/pkgtasks: Failures in POST- stages of the scripts are non-fatal.

The return values of the postinstall and postremove meta-tasks are
ignored unless the user-settable variable ${PKG_FATAL_ERRORS} is
"yes".  ${PKG_FATAL_ERRORS} defaults to "no" to preserve the
existing behavior of install scripts by mk/pkginstall.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 pkgsrc/mk/pkgformat/pkg/templates/deinstall \
    pkgsrc/mk/pkgformat/pkg/templates/install
cvs rdiff -u -r1.5 -r1.6 pkgsrc/mk/pkgformat/pkg/templates/header
cvs rdiff -u -r1.5 -r1.6 pkgsrc/mk/pkgtasks/bsd.pkgtasks.mk

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/mk/pkgformat/pkg/templates/deinstall
diff -u pkgsrc/mk/pkgformat/pkg/templates/deinstall:1.1 pkgsrc/mk/pkgformat/pkg/templates/deinstall:1.2
--- pkgsrc/mk/pkgformat/pkg/templates/deinstall:1.1     Thu Jun  1 02:09:43 2017
+++ pkgsrc/mk/pkgformat/pkg/templates/deinstall Thu Aug 10 05:41:52 2017
@@ -27,7 +27,7 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
-# $NetBSD: deinstall,v 1.1 2017/06/01 02:09:43 jlam Exp $
+# $NetBSD: deinstall,v 1.2 2017/08/10 05:41:52 jlam Exp $
 
 case ${STAGE} in
 DEINSTALL)
@@ -36,19 +36,29 @@ DEINSTALL)
        # Use the data in the shell comments appended at the end of
        # the script.
        #
+       # Failures during the "DEINSTALL" stage are fatal since the
+       # package files likely can't be removed properly if that
+       # happens.
+       #
        task_preremove "${SELF}" || exit $?
        ;;
 
 POST-DEINSTALL)
        task_load postremove
+       task_load truthy
 
        # Use the data in the shell comments appended at the end of
        # the script.
        #
        # Failures during the POST-DEINSTALL stage are non-fatal, so
-       # ignore the return value of the "postremove" task.
+       # ignore the return value of the "postremove" task unless
+       # ${PKG_FATAL_ERRORS} is truthy.
        #
-       task_postremove "${SELF}"
+       if task_is_truthy "${PKG_FATAL_ERRORS}"; then
+               task_postremove "${SELF}" || exit $?
+       else
+               task_postremove "${SELF}"
+       fi
        ;;
 esac
 
Index: pkgsrc/mk/pkgformat/pkg/templates/install
diff -u pkgsrc/mk/pkgformat/pkg/templates/install:1.1 pkgsrc/mk/pkgformat/pkg/templates/install:1.2
--- pkgsrc/mk/pkgformat/pkg/templates/install:1.1       Thu Jun  1 02:09:43 2017
+++ pkgsrc/mk/pkgformat/pkg/templates/install   Thu Aug 10 05:41:52 2017
@@ -27,7 +27,7 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
-# $NetBSD: install,v 1.1 2017/06/01 02:09:43 jlam Exp $
+# $NetBSD: install,v 1.2 2017/08/10 05:41:52 jlam Exp $
 
 case ${STAGE} in
 PRE-INSTALL)
@@ -36,16 +36,29 @@ PRE-INSTALL)
        # Use the data in the shell comments appended at the end of
        # the script.
        #
+       # Failures during the "PRE-INSTALL" stage are fatal since the
+       # package files likely can't be installed properly if that
+       # happens.
+       #
        task_preinstall "${SELF}" || exit $?
        ;;
 
 POST-INSTALL)
        task_load postinstall
+       task_load truthy
 
        # Use the data in the shell comments appended at the end of
        # the script.
        #
-       task_postinstall "${SELF}" || exit $?
+       # Failures during the POST-INSTALL stage are non-fatal, so
+       # ignore the return value of the "postinstall" task unless
+       # ${PKG_FATAL_ERRORS} is truthy.
+       #
+       if task_is_truthy "${PKG_FATAL_ERRORS}"; then
+               task_postinstall "${SELF}" || exit $?
+       else
+               task_postinstall "${SELF}"
+       fi
        ;;
 esac
 

Index: pkgsrc/mk/pkgformat/pkg/templates/header
diff -u pkgsrc/mk/pkgformat/pkg/templates/header:1.5 pkgsrc/mk/pkgformat/pkg/templates/header:1.6
--- pkgsrc/mk/pkgformat/pkg/templates/header:1.5        Thu Aug 10 05:41:07 2017
+++ pkgsrc/mk/pkgformat/pkg/templates/header    Thu Aug 10 05:41:52 2017
@@ -29,7 +29,7 @@
 # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 # POSSIBILITY OF SUCH DAMAGE.
 #
-# $NetBSD: header,v 1.5 2017/08/10 05:41:07 jlam Exp $
+# $NetBSD: header,v 1.6 2017/08/10 05:41:52 jlam Exp $
 
 # Package task loader.
 : ${TASK_MODULE_DIR:=@LOCALBASE@/share/pkgtasks-1}
@@ -163,5 +163,6 @@ CURDIR=$( ${PWD_CMD} )
 : ${PKG_INIT_SCRIPTS:=@PKG_INIT_SCRIPTS@}
 : ${PKG_REGISTER_SHELLS:=@PKG_REGISTER_SHELLS@}
 : ${PKG_UPDATE_FONTS_DB:=@PKG_UPDATE_FONTS_DB@}
+: ${PKG_FATAL_ERRORS:=@PKG_FATAL_ERRORS@}
 
 ### END: pkgsrc/mk/pkgformat/pkg/templates/header

Index: pkgsrc/mk/pkgtasks/bsd.pkgtasks.mk
diff -u pkgsrc/mk/pkgtasks/bsd.pkgtasks.mk:1.5 pkgsrc/mk/pkgtasks/bsd.pkgtasks.mk:1.6
--- pkgsrc/mk/pkgtasks/bsd.pkgtasks.mk:1.5      Thu Aug 10 05:41:07 2017
+++ pkgsrc/mk/pkgtasks/bsd.pkgtasks.mk  Thu Aug 10 05:41:53 2017
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkgtasks.mk,v 1.5 2017/08/10 05:41:07 jlam Exp $
+# $NetBSD: bsd.pkgtasks.mk,v 1.6 2017/08/10 05:41:53 jlam Exp $
 #
 # Copyright (c) 2017 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -52,6 +52,13 @@ _VARGROUPS+= pkgtasks
 #      Possible: yes, no (case-insensitive)
 #      Default: yes
 #
+# PKG_FATAL_ERRORS
+#      User-settable variable for whether the return value of the
+#      {pre,post}{install,remove} meta-tasks is used or not.
+#
+#      Possible: yes, no (case-insensitive)
+#      Default: no
+#
 # PKG_INIT_SCRIPTS
 #      User-settable variable for whether to copy init scripts into
 #      the appropriate places for the init system to locate them,
@@ -81,12 +88,14 @@ _USER_VARS.pkgtasks+=       PKG_CONFIG PKG_CON
 PKG_CONFIG?=           yes
 PKG_CONFIG_PERMS?=     no
 PKG_CREATE_USERGROUP?= yes
+PKG_FATAL_ERRORS?=     no
 PKG_INIT_SCRIPTS?=     ${PKG_RCD_SCRIPTS:Uno}  # deprecated
 PKG_REGISTER_SHELLS?=  yes
 PKG_UPDATE_FONTS_DB?=  yes
 FILES_SUBST+=          PKG_CONFIG=${PKG_CONFIG:tl:Q}
 FILES_SUBST+=          PKG_CONFIG_PERMS=${PKG_CONFIG_PERMS:tl:Q}
 FILES_SUBST+=          PKG_CREATE_USERGROUP=${PKG_CREATE_USERGROUP:tl:Q}
+FILES_SUBST+=          PKG_FATAL_ERRORS=${PKG_FATAL_ERRORS:tl:Q}
 FILES_SUBST+=          PKG_INIT_SCRIPTS=${PKG_INIT_SCRIPTS:tl:Q}
 FILES_SUBST+=          PKG_REGISTER_SHELLS=${PKG_REGISTER_SHELLS:tl:Q}
 FILES_SUBST+=          PKG_UPDATE_FONTS_DB=${PKG_UPDATE_FONTS_DB:tl:Q}



Home | Main Index | Thread Index | Old Index