pkgsrc-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: pkgsrc/pkgtools
Module Name: pkgsrc
Committed By: jmmv
Date: Fri Feb 17 21:27:38 UTC 2017
Modified Files:
pkgsrc/pkgtools: Makefile
Added Files:
pkgsrc/pkgtools/pkg_comp-cron: DESCR INSTALL MESSAGE Makefile PLIST
pkgsrc/pkgtools/pkg_comp-cron/files: files.new list.txt pkg_comp.conf
Log Message:
Initial addition of pkgtools/pkg_comp-cron, version 1.0:
This package sets up periodic builds of binary packages using the
pkgtools/pkg_comp utility given minimal configuration. All that is
needed from the user is to determine which packages to build
automatically.
If you are on NetBSD, see also sysutils/sysbuild-user, which is the
perfect companion to this package to periodically build the base system.
To generate a diff of this commit:
cvs rdiff -u -r1.116 -r1.117 pkgsrc/pkgtools/Makefile
cvs rdiff -u -r0 -r1.1 pkgsrc/pkgtools/pkg_comp-cron/DESCR \
pkgsrc/pkgtools/pkg_comp-cron/INSTALL \
pkgsrc/pkgtools/pkg_comp-cron/MESSAGE \
pkgsrc/pkgtools/pkg_comp-cron/Makefile \
pkgsrc/pkgtools/pkg_comp-cron/PLIST
cvs rdiff -u -r0 -r1.1 pkgsrc/pkgtools/pkg_comp-cron/files/files.new \
pkgsrc/pkgtools/pkg_comp-cron/files/list.txt \
pkgsrc/pkgtools/pkg_comp-cron/files/pkg_comp.conf
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: pkgsrc/pkgtools/Makefile
diff -u pkgsrc/pkgtools/Makefile:1.116 pkgsrc/pkgtools/Makefile:1.117
--- pkgsrc/pkgtools/Makefile:1.116 Fri Feb 17 21:25:46 2017
+++ pkgsrc/pkgtools/Makefile Fri Feb 17 21:27:38 2017
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.116 2017/02/17 21:25:46 jmmv Exp $
+# $NetBSD: Makefile,v 1.117 2017/02/17 21:27:38 jmmv Exp $
#
COMMENT= Tools for use in the packages collection
@@ -35,6 +35,7 @@ SUBDIR+= pkg
SUBDIR+= pkg_alternatives
SUBDIR+= pkg_chk
SUBDIR+= pkg_comp
+SUBDIR+= pkg_comp-cron
SUBDIR+= pkg_comp1
SUBDIR+= pkg_distinst
SUBDIR+= pkg_filecheck
Added files:
Index: pkgsrc/pkgtools/pkg_comp-cron/DESCR
diff -u /dev/null pkgsrc/pkgtools/pkg_comp-cron/DESCR:1.1
--- /dev/null Fri Feb 17 21:27:38 2017
+++ pkgsrc/pkgtools/pkg_comp-cron/DESCR Fri Feb 17 21:27:38 2017
@@ -0,0 +1,7 @@
+This package sets up periodic builds of binary packages using the
+pkgtools/pkg_comp utility given minimal configuration. All that is
+needed from the user is to determine which packages to build
+automatically.
+
+If you are on NetBSD, see also sysutils/sysbuild-user, which is the
+perfect companion to this package to periodically build the base system.
Index: pkgsrc/pkgtools/pkg_comp-cron/INSTALL
diff -u /dev/null pkgsrc/pkgtools/pkg_comp-cron/INSTALL:1.1
--- /dev/null Fri Feb 17 21:27:38 2017
+++ pkgsrc/pkgtools/pkg_comp-cron/INSTALL Fri Feb 17 21:27:38 2017
@@ -0,0 +1,81 @@
+#! /bin/sh
+
+BUILDBASE="@BUILDBASE@"
+EGDIR="@EGDIR@"
+PKG_COMP_HOME="@PKG_COMP_HOME@"
+PKG_COMP_USER="@PKG_COMP_USER@"
+PKG_COMP_EGDIR="@PKG_COMP_EGDIR@"
+SANDBOXCTL_EGDIR="@SANDBOXCTL_EGDIR@"
+
+# Regexp to match our crontab entry.
+CRONTAB_RE="${PREFIX}/sbin/pkg_comp4cron .*${BUILDBASE}/pkg_comp.conf"
+
+# Dumps the pkg_comp user's crontab to a temporary file and outputs
+# the path to the file. If the crontab does not exist, populates
+# the output with some basic contents.
+get_crontab() {
+ local tempfile="$(mktemp "${TMPDIR:-/tmp}/pkg_comp.XXXXXX")"
+ if ! crontab -u "${PKG_COMP_USER}" -l >>"${tempfile}"; then
+ cat >>"${tempfile}" <<EOF
+PATH=${PREFIX}/bin:${PREFIX}/sbin:/usr/bin:/usr/sbin:/bin:/sbin
+SHELL=/bin/sh
+
+# Cheatsheet: minute hour day-of-month month day-of-week(0,7=Sun)
+EOF
+ fi
+ echo "${tempfile}"
+}
+
+# Adds an entry to for pkg_comp to the crontab if not yet present.
+install_crontab() {
+ local tempfile; tempfile="$(get_crontab)" || return
+ if ! grep "${CRONTAB_RE}" "${tempfile}" >/dev/null; then
+ echo "@daily ${PREFIX}/sbin/pkg_comp4cron -l \"${BUILDBASE}/log\"" \
+ "-- -c \"${BUILDBASE}/pkg_comp.conf\" auto" \
+ >>"${tempfile}"
+ crontab -u "${PKG_COMP_USER}" - <"${tempfile}"
+ echo "pkg_comp daily entry added to ${PKG_COMP_USER}'s crontab"
+ fi
+ rm -f "${tempfile}"
+}
+
+# Removes the previously-configured crontab entry by this package.
+uninstall_crontab() {
+ local tempfile; tempfile="$(get_crontab)" || return
+ if grep "${CRONTAB_RE}" "${tempfile}" >/dev/null; then
+ local tempfile2="$(mktemp "${TMPDIR:-/tmp}/pkg_comp.XXXXXX")"
+ grep -v "${CRONTAB_RE}" "${tempfile}" >>"${tempfile2}"
+ if [ -s "${tempfile2}" ]; then
+ crontab -u "${PKG_COMP_USER}" "${tempfile2}"
+ else
+ crontab -u "${PKG_COMP_USER}" -r
+ fi
+ echo "pkg_comp daily entry removed from ${PKG_COMP_USER}'s crontab"
+ rm -f "${tempfile2}"
+ fi
+ rm -f "${tempfile}"
+}
+
+case "${STAGE}" in
+ POST-INSTALL)
+ if [ ! -e "${PKG_COMP_HOME}/sandbox.conf" ]; then
+ echo "${PKGNAME}: Installing sample sandbox.conf file"
+ ${MKDIR} -p "${PKG_COMP_HOME}"
+ sed "s,^SANDBOX_ROOT=.*$,SANDBOX_ROOT=${PKG_COMP_HOME}/sandbox," \
+ "${SANDBOXCTL_EGDIR}/default.conf" \
+ >"${PKG_COMP_HOME}/sandbox.conf"
+ fi
+
+ if [ ! -e "${PKG_COMP_HOME}/extra.mk.conf" ]; then
+ echo "${PKGNAME}: Installing sample extra.mk.conf file"
+ ${MKDIR} -p "${PKG_COMP_HOME}"
+ cp "${PKG_COMP_EGDIR}/extra.mk.conf" "${PKG_COMP_HOME}/"
+ fi
+
+ install_crontab
+ ;;
+
+ DEINSTALL)
+ uninstall_crontab
+ ;;
+esac
Index: pkgsrc/pkgtools/pkg_comp-cron/MESSAGE
diff -u /dev/null pkgsrc/pkgtools/pkg_comp-cron/MESSAGE:1.1
--- /dev/null Fri Feb 17 21:27:38 2017
+++ pkgsrc/pkgtools/pkg_comp-cron/MESSAGE Fri Feb 17 21:27:38 2017
@@ -0,0 +1,27 @@
+===========================================================================
+$NetBSD: MESSAGE,v 1.1 2017/02/17 21:27:38 jmmv Exp $
+
+The system has been configured to perform daily rebuilds of packages for
+the current platform. Please take the time to review the following files:
+
+ ${PKG_COMP_HOME}/extra.mk.conf
+ ${PKG_COMP_HOME}/list.txt
+ ${PKG_COMP_HOME}/pkg_comp.conf
+ ${PKG_COMP_HOME}/sandbox.conf
+
+At the very minimum, you will have to modify the list.txt file to specify
+the set of packages you want to build.
+
+Make sure to review that the changes to the ${PKG_COMP_USER}'s crontab(5)
+are correct and that the chosen schedule suits your needs.
+
+Built binary packages can be used by setting:
+
+ PKG_PATH=file://${PKG_COMP_HOME}/packages/All
+
+Lastly, remember that you can trigger manual pkg_comp operations by doing:
+
+ su - ${PKG_COMP_USER} ${PREFIX}/sbin/pkg_comp \
+ -c ${PKG_COMP_HOME}/pkg_comp.conf <arguments>
+
+===========================================================================
Index: pkgsrc/pkgtools/pkg_comp-cron/Makefile
diff -u /dev/null pkgsrc/pkgtools/pkg_comp-cron/Makefile:1.1
--- /dev/null Fri Feb 17 21:27:38 2017
+++ pkgsrc/pkgtools/pkg_comp-cron/Makefile Fri Feb 17 21:27:38 2017
@@ -0,0 +1,78 @@
+# $NetBSD: Makefile,v 1.1 2017/02/17 21:27:38 jmmv Exp $
+
+DISTNAME= pkg_comp-cron-1.0
+CATEGORIES= pkgtools
+MASTER_SITES= # empty
+DISTFILES= # empty
+
+MAINTAINER= jmmv%NetBSD.org@localhost
+COMMENT= Configures periodic pkgsrc binary package builds
+LICENSE= modified-bsd
+
+DEPENDS= pkg_comp>=2.0:../../pkgtools/pkg_comp
+
+BUILD_DEFS= VARBASE
+DEINSTALL_TEMPLATES= INSTALL
+NO_CHECKSUM= yes
+NO_CONFIGURE= yes
+WRKSRC= ${WRKDIR}
+
+PKG_COMP_USER?= ${REAL_ROOT_USER}
+PKG_COMP_GROUP?= ${REAL_ROOT_GROUP}
+PKG_COMP_HOME?= ${VARBASE}/pkg_comp
+
+EGDIR= ${PREFIX}/share/examples/pkg_comp-cron
+OWN_DIRS_PERMS= ${PKG_COMP_HOME} ${PKG_COMP_USER} ${PKG_COMP_GROUP} 755
+CONF_FILES= ${EGDIR}/list.txt ${PKG_COMP_HOME}/list.txt
+CONF_FILES+= ${EGDIR}/pkg_comp.conf ${PKG_COMP_HOME}/pkg_comp.conf
+
+BUILD_SUBST+= -e 's,@BUILDBASE@,${PKG_COMP_HOME},g'
+BUILD_SUBST+= -e 's,@EGDIR@,${EGDIR},g'
+BUILD_SUBST+= -e 's,@PKG_COMP_EGDIR@,${PREFIX}/share/examples/pkg_comp,g'
+BUILD_SUBST+= -e 's,@PREFIX@,${PREFIX},g'
+FILES_SUBST+= BUILDBASE=${PKG_COMP_HOME}
+FILES_SUBST+= EGDIR=${EGDIR}
+FILES_SUBST+= PKG_COMP_HOME=${PKG_COMP_HOME}
+FILES_SUBST+= PKG_COMP_USER=${PKG_COMP_USER}
+FILES_SUBST+= PKG_COMP_EGDIR=${PREFIX}/share/examples/pkg_comp
+FILES_SUBST+= SANDBOXCTL_EGDIR=${PREFIX}/share/examples/sandboxctl
+MESSAGE_SUBST+= EGDIR=${EGDIR}
+MESSAGE_SUBST+= PKG_COMP_HOME=${PKG_COMP_HOME}
+MESSAGE_SUBST+= PKG_COMP_USER=${PKG_COMP_USER}
+
+.include "../../mk/bsd.prefs.mk"
+
+# Configure the default pkg_comp.conf on a platform basis, providing
+# reasonable defaults. The user has to review the installed file anyway
+# so it is not strictly necessary to make these "perfect" -- but good
+# defaults will help in getting started.
+.if ${OPSYS} == "Darwin"
+# Xcode ships with git only, not cvs, so default to git to simplify the
+# bootstrapping process.
+BUILD_SUBST+= -e 's,@FETCH_VCS@,git,g'
+# Since macOS Sierra (11.12), /usr is a protected tree to which apps
+# cannot write even as root. Default to somewhere else; because pkg_comp
+# requires privileges to run, /opt/pkg is a reasonable location.
+BUILD_SUBST+= -e 's,@LOCALBASE@,/opt/pkg,g'
+BUILD_SUBST+= -e 's,@SYSCONFDIR@,/opt/pkg/etc,g'
+BUILD_SUBST+= -e 's,@VARBASE@,/opt/pkg/var,g'
+.else
+BUILD_SUBST+= -e 's,@FETCH_VCS@,cvs,g'
+BUILD_SUBST+= -e 's,@LOCALBASE@,/usr/pkg,g'
+BUILD_SUBST+= -e 's,@SYSCONFDIR@,/etc,g'
+BUILD_SUBST+= -e 's,@VARBASE@,/var,g'
+.endif
+
+INSTALLATION_DIRS= share/examples/pkg_comp-cron
+
+do-build:
+.for file in list.txt pkg_comp.conf
+ ${SED} ${BUILD_SUBST} <${FILESDIR}/${file} >${WRKSRC}/${file}
+.endfor
+
+do-install:
+.for file in list.txt pkg_comp.conf
+ ${INSTALL_DATA} ${WRKSRC}/${file} ${DESTDIR}${EGDIR}/
+.endfor
+
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/pkgtools/pkg_comp-cron/PLIST
diff -u /dev/null pkgsrc/pkgtools/pkg_comp-cron/PLIST:1.1
--- /dev/null Fri Feb 17 21:27:38 2017
+++ pkgsrc/pkgtools/pkg_comp-cron/PLIST Fri Feb 17 21:27:38 2017
@@ -0,0 +1,3 @@
+@comment $NetBSD: PLIST,v 1.1 2017/02/17 21:27:38 jmmv Exp $
+share/examples/pkg_comp-cron/list.txt
+share/examples/pkg_comp-cron/pkg_comp.conf
Index: pkgsrc/pkgtools/pkg_comp-cron/files/files.new
Binary files are different
Index: pkgsrc/pkgtools/pkg_comp-cron/files/list.txt
diff -u /dev/null pkgsrc/pkgtools/pkg_comp-cron/files/list.txt:1.1
--- /dev/null Fri Feb 17 21:27:38 2017
+++ pkgsrc/pkgtools/pkg_comp-cron/files/list.txt Fri Feb 17 21:27:38 2017
@@ -0,0 +1,11 @@
+# Packages to build automatically during the periodic runs.
+#
+# List one package per line, using bare names or the category/name syntax.
+
+#shells/dash
+#tmux
+
+# Don't forget to list pkg_comp-cron itself if you are building packages
+# for this same machine! Otherwise, rebootstrapping your system
+# configuration will require additional manual steps.
+#pkg_comp-cron
Index: pkgsrc/pkgtools/pkg_comp-cron/files/pkg_comp.conf
diff -u /dev/null pkgsrc/pkgtools/pkg_comp-cron/files/pkg_comp.conf:1.1
--- /dev/null Fri Feb 17 21:27:38 2017
+++ pkgsrc/pkgtools/pkg_comp-cron/files/pkg_comp.conf Fri Feb 17 21:27:38 2017
@@ -0,0 +1,29 @@
+# $NetBSD: pkg_comp.conf,v 1.1 2017/02/17 21:27:38 jmmv Exp $
+
+# pkg_comp.conf(5) configuration file for unattended pkgsrc builds.
+
+# Remote VCS configuration.
+FETCH_VCS=@FETCH_VCS@
+#CVS_ROOT=:ext:anoncvs%anoncvs.NetBSD.org@localhost:/cvsroot
+#CVS_TAG=pkgsrc-2017Q1
+#GIT_URL=https://github.com/jsonn/pkgsrc.git
+#GIT_BRANCH=trunk
+
+# Host file layout.
+PKGSRCDIR="@BUILDBASE@/pkgsrc"
+DISTDIR="@BUILDBASE@/distfiles"
+PACKAGES="@BUILDBASE@/packages"
+PBULK_PACKAGES="@BUILDBASE@/pbulk-packages"
+EXTRA_MKCONF="@BUILDBASE@/extra.mk.conf"
+SANDBOX_CONFFILE="@BUILDBASE@/sandbox.conf"
+
+# Target file layout.
+LOCALBASE="@LOCALBASE@"
+PKG_DBDIR="${LOCALBASE}/libdata/pkgdb"
+SYSCONFDIR="@SYSCONFDIR@"
+VARBASE="@VARBASE@"
+
+# List of packages to build during automatic execution. We source these
+# from a separate file for simplicity, as maintaining a long list of
+# package names in a shell variable can be cumbersome.
+AUTO_PACKAGES="$(grep -v '^#' '@BUILDBASE@/list.txt')"
Home |
Main Index |
Thread Index |
Old Index