tech-pkg archive

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

Re: pkgsrc RC scripts



On Tue, 20 Oct 2009, Joerg Sonnenberger wrote:
> On Tue, Oct 20, 2009 at 07:10:35PM +1300, Steven Drake wrote:
> > 
> > This rases the question, do settings in mk.conf take presedence over
> > those in pkg_install.conf?
> > Should the infrastructure take its setting from pkg_install.conf?
> 
> I do not mind precendece in either way, but it should be cleanly
> documented.

I'd say that pkg_install.conf should take presedence, that way you should
get the same behavior with 'make install' as with 'pkg_add ....', use
mk.conf for setting the defaults.

Anyway based on that principal the "use-config-var.diff" patch modifies
the script templates to uses the config-var change in pkg_install-20091021
to decide what to do.  For backwards compatibility if config-var don't 
output anything the environment variables are then checked.  The patch
also changes the 'make help' documentation.  Whether extra documentation
needs to be added to pkg_install.conf(5) or not is up to you, I guess I
could do it if you think it's a good idea?

Because FONTS_VERBOSE & INFO_FILES_VERBOSE have a completely different
way of having there values determined I've included "verbose.diff" which
deprecates PKG_INSTALL_VERBOSE and allows them to be set individually with
the defaults being determined be PKG_DEVELOPER (includes doc change).  

As a passing thought do having variables in pkg_install.conf starting 
with PKG_ seem a bit redundant, and if so is it worth renaming them?

-- 
Steven
Index: pkgsrc/mk/pkginstall/bsd.pkginstall.mk
===================================================================
--- pkgsrc.orig/mk/pkginstall/bsd.pkginstall.mk 2009-10-30 13:15:47.000000000 
+1300
+++ pkgsrc/mk/pkginstall/bsd.pkginstall.mk      2009-10-30 13:19:57.000000000 
+1300
@@ -916,6 +916,9 @@
                ${TOUCH} ${TOUCH_ARGS} ${.TARGET};                      \
        fi
 
+#
+# INSTALL/DEINSTALL scripts behaviour:
+#
 # PKG_CREATE_USERGROUP indicates whether the INSTALL script should
 #      automatically add any needed users/groups to the system using
 #      useradd/groupadd.  It is either YES or NO and defaults to YES.
@@ -943,9 +946,14 @@
 #      databases in directories where fonts have been installed or
 #      removed.  It is either YES or NO and defaults to YES.
 #
-# These values merely set the defaults for INSTALL/DEINSTALL scripts, but
-# they may be overridden by resetting them in the environment.
+# Setting these variables in mk.conf merely sets the defaults for the
+# INSTALL/DEINSTALL scripts, and they may be overridden by setting any of
+# the variables in the pkg_install.conf file.
+# (With pkg_install version 20091022 and higher).
 #
+# Keywords: pkg_install.conf INSTALL DEINSTALL
+#
+
 PKG_CREATE_USERGROUP?= YES
 PKG_CONFIG?=           YES
 PKG_CONFIG_PERMS?=     NO
Index: pkgsrc/mk/pkginstall/dirs
===================================================================
--- pkgsrc.orig/mk/pkginstall/dirs      2009-10-30 13:15:47.000000000 +1300
+++ pkgsrc/mk/pkginstall/dirs   2009-10-30 13:27:10.000000000 +1300
@@ -57,6 +57,7 @@
 LS="@LS@"
 MKDIR="@MKDIR@"
 MV="@MV@"
+PKG_ADMIN="@PKG_ADMIN@"
 PWD_CMD="@PWD_CMD@"
 RM="@RM@"
 RMDIR="@RMDIR@"
@@ -77,7 +78,8 @@
 
 PKG_REFCOUNT_DIRS_DBDIR="${PKG_REFCOUNT_DBDIR}/dirs"
 
-case "${PKG_CONFIG:-@PKG_CONFIG@}" in
+config_var=`${PKG_ADMIN} config-var PKG_CONFIG`
+case "${config_var:-${PKG_CONFIG:-@PKG_CONFIG@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_CONFIG=yes
        ;;
@@ -85,7 +87,8 @@
        _PKG_CONFIG=no
        ;;
 esac
-case "${PKG_CONFIG_PERMS:-@PKG_CONFIG_PERMS@}" in
+config_var=`${PKG_ADMIN} config-var PKG_CONFIG_PERMS`
+case "${config_var:-${PKG_CONFIG_PERMS:-@PKG_CONFIG_PERMS@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_CONFIG_PERMS=yes
        ;;
Index: pkgsrc/mk/pkginstall/files
===================================================================
--- pkgsrc.orig/mk/pkginstall/files     2009-10-30 13:15:47.000000000 +1300
+++ pkgsrc/mk/pkginstall/files  2009-10-30 13:30:09.000000000 +1300
@@ -60,6 +60,7 @@
 LS="@LS@"
 MKDIR="@MKDIR@"
 MV="@MV@"
+PKG_ADMIN="@PKG_ADMIN@"
 PWD_CMD="@PWD_CMD@"
 RM="@RM@"
 RMDIR="@RMDIR@"
@@ -73,7 +74,8 @@
 
 : ${PKG_PREFIX=@PREFIX@}
 
-case "${PKG_CONFIG:-@PKG_CONFIG@}" in
+config_var=`${PKG_ADMIN} config-var PKG_CONFIG`
+case "${config_var:-${PKG_CONFIG:-@PKG_CONFIG@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_CONFIG=yes
        ;;
@@ -81,7 +83,8 @@
        _PKG_CONFIG=no
        ;;
 esac
-case "${PKG_CONFIG_PERMS:-@PKG_CONFIG_PERMS@}" in
+config_var=`${PKG_ADMIN} config-var PKG_CONFIG_PERMS`
+case "${config_var:-${PKG_CONFIG_PERMS:-@PKG_CONFIG_PERMS@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_CONFIG_PERMS=yes
        ;;
@@ -89,7 +92,8 @@
        _PKG_CONFIG_PERMS=no
        ;;
 esac
-case "${PKG_RCD_SCRIPTS:-@PKG_RCD_SCRIPTS@}" in
+config_var=`${PKG_ADMIN} config-var PKG_RCD_SCRIPTS`
+case "${config_var:-${PKG_RCD_SCRIPTS:-@PKG_RCD_SCRIPTS@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_RCD_SCRIPTS=yes
        ;;
Index: pkgsrc/mk/pkginstall/fonts
===================================================================
--- pkgsrc.orig/mk/pkginstall/fonts     2009-10-30 13:15:47.000000000 +1300
+++ pkgsrc/mk/pkginstall/fonts  2009-10-30 13:31:44.000000000 +1300
@@ -29,6 +29,7 @@
 FIND="@FIND@"
 GREP="@GREP@"
 MKFONTDIR="@MKFONTDIR@"
+PKG_ADMIN="@PKG_ADMIN@"
 PWD_CMD="@PWD_CMD@"
 RM="@RM@"
 SED="@SED@"
@@ -47,7 +48,8 @@
 : ${PKGNAME=${PKG_METADATA_DIR##*/}}
 : ${PKG_PREFIX=@PREFIX@}
 
-case "${PKG_UPDATE_FONTS_DB:-@PKG_UPDATE_FONTS_DB@}" in
+config_var=`${PKG_ADMIN} config-var PKG_UPDATE_FONTS_DB`
+case "${config_var:-${PKG_UPDATE_FONTS_DB:-@PKG_UPDATE_FONTS_DB@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_UPDATE_FONTS_DB=yes
        ;;
@@ -56,7 +58,8 @@
        ;;
 esac
 
-case "${FONTS_VERBOSE:-@FONTS_VERBOSE@}" in
+config_var=`${PKG_ADMIN} config-var FONTS_VERBOSE`
+case "${config_var:-${FONTS_VERBOSE:-@FONTS_VERBOSE@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        echo="${ECHO}"
        ;;
Index: pkgsrc/mk/pkginstall/header
===================================================================
--- pkgsrc.orig/mk/pkginstall/header    2009-10-30 13:15:47.000000000 +1300
+++ pkgsrc/mk/pkginstall/header 2009-10-30 13:32:00.000000000 +1300
@@ -76,7 +76,8 @@
 
 PKG_INSTALLATION_TYPE="@PKG_INSTALLATION_TYPE@"
 
-case "${PKG_CONFIG:-@PKG_CONFIG@}" in
+config_var=`${PKG_ADMIN} config-var PKG_CONFIG`
+case "${config_var:-${PKG_CONFIG:-@PKG_CONFIG@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_CONFIG=yes
        ;;
Index: pkgsrc/mk/pkginstall/info-files
===================================================================
--- pkgsrc.orig/mk/pkginstall/info-files        2009-10-30 13:15:47.000000000 
+1300
+++ pkgsrc/mk/pkginstall/info-files     2009-10-30 13:32:20.000000000 +1300
@@ -33,6 +33,7 @@
 GREP="@GREP@"
 INSTALL_INFO="@INSTALL_INFO@"
 MKDIR="@MKDIR@"
+PKG_ADMIN="@PKG_ADMIN@"
 PWD_CMD="@PWD_CMD@"
 RM="@RM@"
 RMDIR="@RMDIR@"
@@ -48,7 +49,8 @@
 : ${PKGNAME=${PKG_METADATA_DIR##*/}}
 : ${PKG_PREFIX=@PREFIX@}
 
-case "${INFO_FILES_VERBOSE:-@INFO_FILES_VERBOSE@}" in
+config_var=`${PKG_ADMIN} config-var INFO_FILES_VERBOSE`
+case "${config_var:-${INFO_FILES_VERBOSE:-@INFO_FILES_VERBOSE@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        echo="${ECHO}"
        ;;
Index: pkgsrc/mk/pkginstall/shell
===================================================================
--- pkgsrc.orig/mk/pkginstall/shell     2009-10-30 13:15:47.000000000 +1300
+++ pkgsrc/mk/pkginstall/shell  2009-10-30 13:33:06.000000000 +1300
@@ -33,6 +33,7 @@
 CP="@CP@"
 ECHO="@ECHO@"
 GREP="@GREP@"
+PKG_ADMIN="@PKG_ADMIN@"
 PWD_CMD="@PWD_CMD@"
 RM="@RM@"
 SED="@SED@"
@@ -49,7 +50,8 @@
 : ${PKG_PREFIX=@PREFIX@}
 : ${PKGNAME=${PKG_METADATA_DIR##*/}}
 
-case "${PKG_REGISTER_SHELLS:-@PKG_REGISTER_SHELLS@}" in
+config_var=`${PKG_ADMIN} config-var PKG_REGISTER_SHELLS`
+case "${config_var:-${PKG_REGISTER_SHELLS:-@PKG_REGISTER_SHELLS@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_REGISTER_SHELLS=yes
        ;;
Index: pkgsrc/mk/pkginstall/usergroup
===================================================================
--- pkgsrc.orig/mk/pkginstall/usergroup 2009-10-30 13:15:47.000000000 +1300
+++ pkgsrc/mk/pkginstall/usergroup      2009-10-30 13:33:27.000000000 +1300
@@ -54,6 +54,7 @@
 LS="@LS@"
 MKDIR="@MKDIR@"
 MV="@MV@"
+PKG_ADMIN="@PKG_ADMIN@"
 PWD_CMD="@PWD_CMD@"
 RM="@RM@"
 RMDIR="@RMDIR@"
@@ -74,7 +75,8 @@
 PKG_REFCOUNT_USERS_DBDIR="${PKG_REFCOUNT_DBDIR}/users"
 PKG_REFCOUNT_GROUPS_DBDIR="${PKG_REFCOUNT_DBDIR}/groups"
 
-case "${PKG_CREATE_USERGROUP:-@PKG_CREATE_USERGROUP@}" in
+config_var=`${PKG_ADMIN} config-var PKG_CREATE_USERGROUP`
+case "${config_var:-${PKG_CREATE_USERGROUP:-@PKG_CREATE_USERGROUP@}}" in
 [Yy][Ee][Ss]|[Tt][Rr][Uu][Ee]|[Oo][Nn]|1)
        _PKG_CREATE_USERGROUP=yes
        ;;
Index: pkgsrc/mk/pkginstall/bsd.pkginstall.mk
===================================================================
--- pkgsrc.orig/mk/pkginstall/bsd.pkginstall.mk 2009-10-30 13:50:01.000000000 
+1300
+++ pkgsrc/mk/pkginstall/bsd.pkginstall.mk      2009-10-30 14:15:48.000000000 
+1300
@@ -5,27 +5,15 @@
 # framework, simply set the relevant variables to customize the install
 # scripts to the package.
 #
-# User-settable variables:
-#
-# PKGINSTALL_VERBOSE
-#      A list of scriptlets that will be verbose and output a message
-#      noting the actions taken.
-#
-#      * "all" is a special value that implies all of the other items
-#      * "fonts" for +FONTS
-#      * "info-files" for +INFO_FILES
-#
-#      Default value: "all" for PKG_DEVELOPERs, empty otherwise.
-#
 
 _VARGROUPS+=           pkginstall
 _USER_VARS.pkginstall= \
-       PKGINSTALL_VERBOSE \
        PKG_CREATE_USERGROUP \
        PKG_CONFIG PKG_CONFIG_PERMS \
        PKG_RCD_SCRIPTS \
        PKG_REGISTER_SHELLS \
-       PKG_UPDATE_FONTS_DB
+       PKG_UPDATE_FONTS_DB \
+       FONTS_VERBOSE INFO_FILES_VERBOSE
 _PKG_VARS.pkginstall= \
        DEINSTALL_TEMPLATES INSTALL_TEMPLATES \
        DEINSTALL_SRC INSTALL_SRC \
@@ -946,6 +934,14 @@ ${_INSTALL_FONTS_FILE}: ../../mk/pkginst
 #      databases in directories where fonts have been installed or
 #      removed.  It is either YES or NO and defaults to YES.
 #
+# FONTS_VERBOSE indicates whether the +FONTS scriptlet will output a message
+#      noting the actions taken if PKG_UPDATE_FONTS_DB is YES.  It is either
+#      YES or NO and defaults to YES for PKG_DEVELOPERs, otherwise NO.
+#
+# INFO_FILES_VERBOSE indicates whether the +INFO_FILES scriptlet will output
+#      a message noting the actions taken.  It is either YES or NO and
+#      defaults to  YES for PKG_DEVELOPERs, otherwise NO.
+#
 # Setting these variables in mk.conf merely sets the defaults for the
 # INSTALL/DEINSTALL scripts, and they may be overridden by setting any of
 # the variables in the pkg_install.conf file.
@@ -960,28 +956,16 @@ PKG_CONFIG_PERMS?=        NO
 PKG_RCD_SCRIPTS?=      NO
 PKG_REGISTER_SHELLS?=  YES
 PKG_UPDATE_FONTS_DB?=  YES
+FONTS_VERBOSE?=                ${PKG_DEVELOPER:DYES:UNO}
+INFO_FILES_VERBOSE?=   ${PKG_DEVELOPER:DYES:UNO}
 FILES_SUBST+=          PKG_CREATE_USERGROUP=${PKG_CREATE_USERGROUP:Q}
 FILES_SUBST+=          PKG_CONFIG=${PKG_CONFIG:Q}
 FILES_SUBST+=          PKG_CONFIG_PERMS=${PKG_CONFIG_PERMS:Q}
 FILES_SUBST+=          PKG_RCD_SCRIPTS=${PKG_RCD_SCRIPTS:Q}
 FILES_SUBST+=          PKG_REGISTER_SHELLS=${PKG_REGISTER_SHELLS:Q}
 FILES_SUBST+=          PKG_UPDATE_FONTS_DB=${PKG_UPDATE_FONTS_DB:Q}
-
-.if defined(PKG_DEVELOPER)
-PKGINSTALL_VERBOSE?=   all
-.else
-PKGINSTALL_VERBOSE?=   # empty
-.endif
-.if !empty(PKGINSTALL_VERBOSE:Mall) || !empty(PKGINSTALL_VERBOSE:Mfonts)
-FILES_SUBST+=          FONTS_VERBOSE=yes
-.else
-FILES_SUBST+=          FONTS_VERBOSE=no
-.endif
-.if !empty(PKGINSTALL_VERBOSE:Mall) || !empty(PKGINSTALL_VERBOSE:Minfo-files)
-FILES_SUBST+=          INFO_FILES_VERBOSE=yes
-.else
-FILES_SUBST+=          INFO_FILES_VERBOSE=no
-.endif
+FILES_SUBST+=          FONTS_VERBOSE=${FONTS_VERBOSE:Q}
+FILES_SUBST+=          INFO_FILES_VERBOSE=${INFO_FILES_VERBOSE:Q}
 
 # Substitute for various programs used in the DEINSTALL/INSTALL scripts and
 # in the rc.d scripts.


Home | Main Index | Thread Index | Old Index