pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/mk/pkgtasks Add "pkgtasks" framework to generate data ...
details: https://anonhg.NetBSD.org/pkgsrc/rev/8441f8d7e5ec
branches: trunk
changeset: 363091:8441f8d7e5ec
user: jlam <jlam%pkgsrc.org@localhost>
date: Thu Jun 01 02:06:04 2017 +0000
description:
Add "pkgtasks" framework to generate data files used by pkgtasks.
A full dependency on the "pkgtasks" package will be added if a
non-empty data file is generated by the framework.
This framework is not yet hooked into bsd.pkg.mk, pending some
other changes.
diffstat:
mk/pkgtasks/bsd.pkgtasks.mk | 190 ++++++++++++++++++++++
mk/pkgtasks/directories.mk | 164 +++++++++++++++++++
mk/pkgtasks/files.mk | 235 +++++++++++++++++++++++++++
mk/pkgtasks/fonts.mk | 108 ++++++++++++
mk/pkgtasks/info_files.mk | 79 +++++++++
mk/pkgtasks/ocaml_findlib.mk | 84 +++++++++
mk/pkgtasks/permissions.mk | 112 +++++++++++++
mk/pkgtasks/shells.mk | 72 ++++++++
mk/pkgtasks/shlibs.mk | 60 ++++++
mk/pkgtasks/tests/Kyuafile | 61 +++++++
mk/pkgtasks/tests/create_usergroup_test | 169 +++++++++++++++++++
mk/pkgtasks/tests/directories_test | 111 ++++++++++++
mk/pkgtasks/tests/files_test | 168 +++++++++++++++++++
mk/pkgtasks/tests/fonts_test | 116 +++++++++++++
mk/pkgtasks/tests/groups_test | 113 +++++++++++++
mk/pkgtasks/tests/info_files_test | 109 ++++++++++++
mk/pkgtasks/tests/ocaml_findlib_test | 104 ++++++++++++
mk/pkgtasks/tests/permissions_test | 110 ++++++++++++
mk/pkgtasks/tests/pkgtasks_test | 139 ++++++++++++++++
mk/pkgtasks/tests/shells_test | 104 ++++++++++++
mk/pkgtasks/tests/shlibs_test | 100 +++++++++++
mk/pkgtasks/tests/test.mk | 69 ++++++++
mk/pkgtasks/tests/users_test | 113 +++++++++++++
mk/pkgtasks/usergroup.mk | 275 ++++++++++++++++++++++++++++++++
mk/pkgtasks/usergroup.sh | 83 +++++++++
25 files changed, 3048 insertions(+), 0 deletions(-)
diffs (truncated from 3148 to 300 lines):
diff -r dc7c8454bdfa -r 8441f8d7e5ec mk/pkgtasks/bsd.pkgtasks.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/pkgtasks/bsd.pkgtasks.mk Thu Jun 01 02:06:04 2017 +0000
@@ -0,0 +1,190 @@
+# $NetBSD: bsd.pkgtasks.mk,v 1.1 2017/06/01 02:06:04 jlam Exp $
+#
+# Copyright (c) 2017 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+_VARGROUPS+= pkgtasks
+
+# PKG_CONFIG
+# User-settable variable for whether the directory- and
+# file-handling should be performed automatically, or if the
+# user should be warned instead.
+#
+# Possible: yes, no (case-insensitive)
+# Default: yes
+#
+# PKG_CONFIG_PERMS
+# User-settable variable for whether to set permissions and
+# ownership on files and directories, or if the user should be
+# warned instead.
+#
+# Possible: yes, no (case-insensitive)
+# Default: yes
+#
+# PKG_CREATE_USERGROUP
+# User-settable variable for whether groups and users should be
+# added automatically, or if the user should be warned instead.
+#
+# Possible: yes, no (case-insensitive)
+# Default: yes
+#
+# PKG_INIT_SCRIPTS
+# User-settable variable for whether to copy init scripts into
+# the appropriate places for the init system to locate them,
+# e.g., copy rc.d scripts to ${RCD_SCRIPTS_DIR}, or if the user
+# should be warned instead.
+#
+# Possible: yes, no (case-insensitive)
+# Default: yes
+#
+# PKG_REGISTER_SHELLS
+# User-settable variable for whether to register shells in the
+# login shell database (/etc/shells) automatically, or if the
+# user should be warned instead.
+#
+# Possible: yes, no (case-insensitive)
+# Default: yes
+#
+# PKG_UPDATE_FONTS_DB
+# User-settable variable for whether to update the databases in
+# fonts directories automatically, or if the user should be
+# warned instead.
+#
+# Possible: yes, no (case-insensitive)
+# Default: yes
+#
+_USER_VARS.pkgtasks+= PKG_CONFIG PKG_CONFIG_PERMS PKG_INIT_SCRIPTS
+PKG_CONFIG?= yes
+PKG_CONFIG_PERMS?= no
+PKG_CREATE_USERGROUP?= yes
+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_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}
+
+# FILES_SUBST
+# Package-settable varibable that lists "variable=value" pairs
+# that is turned into a sed(1) script for substituting
+# "@variable@" with "value".
+#
+# FILES_SUBST_SED
+# System variable set by this file that is list of
+# "variable=value" pairs in ${FILES_SUBST} turned into a sed(1)
+# script for substituting "@variable@" with "value".
+#
+_PKG_VARS.pkgtasks+= FILES_SUBST
+_SYS_VARS.pkgtasks+= FILES_SUBST_SED
+FILES_SUBST_SED= ${FILES_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/}
+
+# PKG_REFCOUNT_DBDIR
+# The location of the reference-count database directory used
+# by installed packages.
+#
+# Possible: any valid directory path
+# Default: ${PKG_DBDIR}.refcount
+#
+PKG_REFCOUNT_DBDIR?= ${PKG_DBDIR}.refcount
+FILES_SUBST+= PKG_PREFIX=${PREFIX:Q}
+FILES_SUBST+= PKG_REFCOUNT_DBDIR=${PKG_REFCOUNT_DBDIR:Q}
+
+# Directory to hold the built objects.
+_PKGTASKS_DIR= ${WRKDIR}/.pkgtasks
+
+# List of generated task data files.
+_PKGTASKS_DATAFILES= # empty
+
+# USE_PKGTASKS
+# Public variable set by this file that indicates whether
+# package tasks are needed.
+#
+# Possible: yes, no
+#
+_SYS_VARS.pkgtasks= USE_PKGTASKS
+USE_PKGTASKS= no
+
+.include "${PKGSRCDIR}/mk/pkgtasks/directories.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/files.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/fonts.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/info_files.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/ocaml_findlib.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/permissions.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/shells.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/shlibs.mk"
+.include "${PKGSRCDIR}/mk/pkgtasks/usergroup.mk"
+
+# Add a dependency on pkgtasks if package tasks are needed.
+.if "${USE_PKGTASKS:tl}" == "yes"
+DEPENDS+= pkgtasks-1>=1.9:../../pkgtools/pkgtasks
+.endif
+TASK_MODULE_DIR?= ${LOCALBASE}/share/pkgtasks-1
+
+# PKGTASKS_DATAFILE
+# The formatted data file for use by pkgtools/pkgtasks.
+#
+_SYS_VARS.pkgtasks= PKGTASKS_DATAFILE
+PKGTASKS_DATAFILE= ${_PKGTASKS_DIR}/pkgtasks-datafile
+
+${PKGTASKS_DATAFILE}: ${_PKGTASKS_DATAFILES}
+ ${RUN}${MKDIR} ${.TARGET:H:Q}
+ ${RUN}${CAT} ${.ALLSRC} > ${.TARGET:Q}.tmp
+ ${RUN}${MV} ${.TARGET:Q}.tmp ${.TARGET:Q}
+
+.PHONY: pkgtasks
+pkgtasks: ${PKGTASKS_DATAFILE}
+
+# Variables for programs used by pkgtasks.
+FILES_SUBST+= AWK=${AWK:Q}
+FILES_SUBST+= CAT=${CAT:Q}
+FILES_SUBST+= CHMOD=${CHMOD:Q}
+FILES_SUBST+= CHOWN=${CHOWN:Q}
+FILES_SUBST+= CP=${CP:Q}
+FILES_SUBST+= DATE=${DATE:Q}
+FILES_SUBST+= FIND=${FIND:Q}
+FILES_SUBST+= ID=${ID:Q}
+FILES_SUBST+= LDCONFIG=${LDCONFIG:Q}
+FILES_SUBST+= LN=${LN:Q}
+FILES_SUBST+= LS=${LS:Q}
+FILES_SUBST+= MKDIR=${MKDIR:Q}
+FILES_SUBST+= MKTEMP=${MKTEMP:Q}
+FILES_SUBST+= MV=${MV:Q}
+FILES_SUBST+= PRINTF=${PRINTF:Q}
+FILES_SUBST+= RM=${RM:Q}
+FILES_SUBST+= RMDIR=${RMDIR:Q}
+FILES_SUBST+= SED=${SED:Q}
+FILES_SUBST+= SORT=${SORT:Q}
+FILES_SUBST+= UNAME=${UNAME:Q}
+
+# Variables for addgroup/adduser programs used by pkgtasks.
+FILES_SUBST+= GROUPADD=${GROUPADD:Q}
+FILES_SUBST+= PW=${PW:Q} # DragonFly, FreeBSD
+FILES_SUBST+= PWD_MKDB=${PWD_MKDB:Q} # MirBSD
+FILES_SUBST+= USERADD=${USERADD:Q}
diff -r dc7c8454bdfa -r 8441f8d7e5ec mk/pkgtasks/directories.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mk/pkgtasks/directories.mk Thu Jun 01 02:06:04 2017 +0000
@@ -0,0 +1,164 @@
+# $NetBSD: directories.mk,v 1.1 2017/06/01 02:06:04 jlam Exp $
+#
+# Copyright (c) 2017 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# This code is derived from software contributed to The NetBSD Foundation
+# by Johnny C. Lam.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Generate the data file for the directories package task.
+
+# MAKE_DIRS
+# OWN_DIRS
+# REQD_DIRS
+# List of directories that should be created and destroyed when
+# the package is installed and removed.
+#
+# OWN_DIRS is for directories owned by the package and the user
+# is prompted to remove the directory if it isn't empty. The
+# directories are created or removed only if PKG_CONFIG is "yes".
+#
+# MAKE_DIRS is for directories used by the package and the user
+# is never prompted to remove non-empty directories. The
+# directories are created or removed only if PKG_CONFIG is "yes".
+#
+# REQD_DIRS is for directories used by the package that must
+# always be created (PKG_CONFIG is ignored), and the user is
+# never prompted to remove non-empty directories. All
+# directories listed in REQD_DIRS should be under ${PREFIX}.
+# The use-case for REQD_DIRS is very specialized, and most
+# packages should be using either OWN_DIRS or MAKE_DIRS instead.
+#
+# If the directory pathname is a relative path, then it is taken
+# to be relative to ${PREFIX}.
+#
+# MAKE_DIRS_PERMS
+# OWN_DIRS_PERMS
+# REQD_DIRS_PERMS
+# List of sublists representing directories with ownership and
+# explicit modes that should be created and destroyed when the
+# package is installed and removed. The sublists are of the
+# form:
+#
+# <directory> <owner> <group> <mode>
+#
+# These variables have the same usage as the similarly-named
+# variables that don't end in "_PERMS".
+#
+_PKG_VARS.pkgtasks+= MAKE_DIRS MAKE_DIRS_PERMS \
+ OWN_DIRS OWN_DIRS_PERMS \
+ REQD_DIRS REQD_DIRS_PERMS
+MAKE_DIRS?= # empty
+MAKE_DIRS_PERMS?= # empty
+OWN_DIRS?= # empty
+OWN_DIRS_PERMS?= # empty
+REQD_DIRS?= # empty
+REQD_DIRS_PERMS?= # empty
+
+# Trigger pkgtasks dependency if needed.
+_PKGTASKS_DATAVARS.directories= \
+ MAKE_DIRS MAKE_DIRS_PERMS \
+ OWN_DIRS OWN_DIRS_PERMS \
+ REQD_DIRS REQD_DIRS_PERMS
+.for _var_ in ${_PKGTASKS_DATAVARS.directories}
+. if !empty(${_var_})
+USE_PKGTASKS= yes
+. endif
+.endfor
+
+# Strip leading "${PREFIX}/" from the directory pathnames.
+_MAKE_DIRS= ${MAKE_DIRS:S|^${PREFIX}/||g}
+_MAKE_DIRS_PERMS= ${MAKE_DIRS_PERMS:S|^${PREFIX}/||g}
+_OWN_DIRS= ${OWN_DIRS:S|^${PREFIX}/||g}
+_OWN_DIRS_PERMS= ${OWN_DIRS_PERMS:S|^${PREFIX}/||g}
+_REQD_DIRS= ${REQD_DIRS:S|^${PREFIX}/||g}
+_REQD_DIRS_PERMS= ${REQD_DIRS_PERMS:S|^${PREFIX}/||g}
+
+# Assert that the variables have the right number of words and
+# that no directory is listed in more than one variable.
+#
+_ALL_DIRS.directories= # empty
+.for _var_ in MAKE_DIRS OWN_DIRS REQD_DIRS
Home |
Main Index |
Thread Index |
Old Index