summaryrefslogtreecommitdiff
path: root/mk
diff options
context:
space:
mode:
authorjoerg <joerg@pkgsrc.org>2008-04-03 14:07:51 +0000
committerjoerg <joerg@pkgsrc.org>2008-04-03 14:07:51 +0000
commitcaa9b2eebfa0d1aedfcdc490b2eadebd6200274f (patch)
tree68a4e35995a7f58f576b5e1e1b589becdf4ab2c0 /mk
parent597c8d129ddcbe0205bfdf4a5a01fa525d3bcbae (diff)
downloadpkgsrc-caa9b2eebfa0d1aedfcdc490b2eadebd6200274f.tar.gz
Move handling of pkg_install version into flavor. Add an explicit
phase pkg_install-depends before bootstrap-depends that just tries to install a new pkg_install if the current version is too old. Still keep it as bootstrap dependency for the bulk build code. For NetBSD, PKG_TOOLS_BIN has to be computed in shell code due to a make bug. OK: jlam@
Diffstat (limited to 'mk')
-rw-r--r--mk/bsd.pkg.mk22
-rw-r--r--mk/depends/depends.mk3
-rw-r--r--mk/fetch/fetch.mk3
-rw-r--r--mk/flavor/pkg/depends.mk20
-rw-r--r--mk/flavor/pkg/flavor-vars.mk11
-rw-r--r--mk/platform/NetBSD.mk10
6 files changed, 38 insertions, 31 deletions
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index e0a8d101839..1beff8002b0 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1940 2008/03/08 14:28:05 joerg Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1941 2008/04/03 14:07:51 joerg Exp $
#
# This file is in the public domain.
#
@@ -116,13 +116,6 @@ REAL_ROOT_GROUP?= ${ROOT_GROUP}
_INSTALL_UNSTRIPPED= # set (flag used by platform/*.mk)
.endif
-##### Non-overridable constants
-
-# Latest versions of tools required for correct pkgsrc operation.
-PKGTOOLS_REQD= 20070802
-# Versions of tools that are good enough to handle dependencies
-PKGTOOLS_BASE_REQD= 20051103
-
##### Transform USE_* into dependencies
.include "bsd.pkg.use.mk"
@@ -147,19 +140,6 @@ PKG_FAIL_REASON+= "PKG_INSTALLATION_TYPE must be \`\`pkgviews'' or \`\`overwrite
PKG_FAIL_REASON+= "This package doesn't support PKG_INSTALLATION_TYPE=${PKG_INSTALLATION_TYPE}."
.endif
-# Check that we are using up-to-date pkg_* tools with this file.
-.if !defined(NO_PKGTOOLS_REQD_CHECK)
-. if ${PKGTOOLS_VERSION} < ${PKGTOOLS_BASE_REQD}
-PKG_FAIL_REASON+='The package tools installed on this system are out of date.'
-PKG_FAIL_REASON+='The installed package tools are dated ${PKGTOOLS_VERSION:C|(....)(..)(..)|\1/\2/\3|} and you must'
-PKG_FAIL_REASON+='update them to at least ${PKGTOOLS_REQD:C|(....)(..)(..)|\1/\2/\3|} using the following command:'
-PKG_FAIL_REASON+=' '
-PKG_FAIL_REASON+=' (cd ${PKGSRCDIR}/pkgtools/pkg_install && ${MAKE} clean && ${MAKE} update)'
-. elif ${PKGTOOLS_VERSION} < ${PKGTOOLS_REQD}
-BOOTSTRAP_DEPENDS+= pkg_install>=${PKGTOOLS_REQD}:../../pkgtools/pkg_install
-. endif
-.endif # !NO_PKGTOOLS_REQD_CHECK
-
.if defined(ALL_TARGET)
PKG_FAIL_REASON+='ALL_TARGET is deprecated and must be replaced with BUILD_TARGET.'
.endif
diff --git a/mk/depends/depends.mk b/mk/depends/depends.mk
index 1c69e9729ef..c983fe0eceb 100644
--- a/mk/depends/depends.mk
+++ b/mk/depends/depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.14 2007/05/22 19:04:24 joerg Exp $
+# $NetBSD: depends.mk,v 1.15 2008/04/03 14:07:51 joerg Exp $
######################################################################
### depends (PUBLIC)
@@ -37,6 +37,7 @@ ${_COOKIE.depends}: real-depends
### real-depends is a helper target onto which one can hook all of the
### targets that do the actual dependency installation.
###
+_REAL_DEPENDS_TARGETS+= ${_PKG_INSTALL_DEPENDS:Dpkg_install-depends}
_REAL_DEPENDS_TARGETS+= bootstrap-depends
_REAL_DEPENDS_TARGETS+= depends-message
_REAL_DEPENDS_TARGETS+= pre-depends-hook
diff --git a/mk/fetch/fetch.mk b/mk/fetch/fetch.mk
index 6ff7ef4ed09..f6eed5f5472 100644
--- a/mk/fetch/fetch.mk
+++ b/mk/fetch/fetch.mk
@@ -1,4 +1,4 @@
-# $NetBSD: fetch.mk,v 1.32 2007/12/01 11:11:56 rillig Exp $
+# $NetBSD: fetch.mk,v 1.33 2008/04/03 14:07:51 joerg Exp $
_MASTER_SITE_BACKUP= ${MASTER_SITE_BACKUP:=${DIST_SUBDIR}${DIST_SUBDIR:D/}}
_MASTER_SITE_OVERRIDE= ${MASTER_SITE_OVERRIDE:=${DIST_SUBDIR}${DIST_SUBDIR:D/}}
@@ -93,6 +93,7 @@ SITES.${fetchfile:T:S/=/--/}?= ${PATCH_SITES}
### fetch is a public target to fetch all of the package distribution
### files.
###
+_FETCH_TARGETS+= ${_PKG_INSTALL_DEPENDS:Dpkg_install-depends}
_FETCH_TARGETS+= bootstrap-depends
_FETCH_TARGETS+= check-vulnerable
_FETCH_TARGETS+= pre-fetch
diff --git a/mk/flavor/pkg/depends.mk b/mk/flavor/pkg/depends.mk
index c4eeff00626..c02c7e5f76a 100644
--- a/mk/flavor/pkg/depends.mk
+++ b/mk/flavor/pkg/depends.mk
@@ -1,4 +1,4 @@
-# $NetBSD: depends.mk,v 1.41 2008/03/10 20:05:59 joerg Exp $
+# $NetBSD: depends.mk,v 1.42 2008/04/03 14:07:51 joerg Exp $
# This command prints out the dependency patterns for all full (run-time)
# dependencies of the package.
@@ -132,6 +132,24 @@ _flavor-install-dependencies: .PHONY ${_DEPENDS_FILE}
_flavor-post-install-dependencies: .PHONY ${_RDEPENDS_FILE}
######################################################################
+### pkg_install-depends (PUBLIC, pkgsrc/mk/depends/depends.mk)
+######################################################################
+### pkg_install-depends is a public target to install or update
+### pkg_install itself.
+###
+.PHONY: pkg_install-depends
+pkg_install-depends:
+ ${RUN}if [ `${PKG_INFO_CMD} -V 2>/dev/null || echo 20010302` -lt ${PKGTOOLS_REQD} ]; then \
+ ${PHASE_MSG} "Trying to handle out-dated pkg_install..."; \
+ cd ../../pkgtools/pkg_install && ${SETENV} ${PKGSRC_MAKE_ENV} \
+ _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" \
+ ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes clean && \
+ cd ../../pkgtools/pkg_install && ${SETENV} ${PKGSRC_MAKE_ENV} \
+ _PKGSRC_DEPS=", ${PKGNAME}${_PKGSRC_DEPS}" \
+ ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes ${DEPENDS_TARGET:Q}; \
+ fi
+
+######################################################################
### bootstrap-depends (PUBLIC, pkgsrc/mk/depends/depends.mk)
######################################################################
### bootstrap-depends is a public target to install any missing
diff --git a/mk/flavor/pkg/flavor-vars.mk b/mk/flavor/pkg/flavor-vars.mk
index 7443e0c17fe..ca6b063e660 100644
--- a/mk/flavor/pkg/flavor-vars.mk
+++ b/mk/flavor/pkg/flavor-vars.mk
@@ -1,4 +1,4 @@
-# $NetBSD: flavor-vars.mk,v 1.7 2008/03/10 20:05:59 joerg Exp $
+# $NetBSD: flavor-vars.mk,v 1.8 2008/04/03 14:07:51 joerg Exp $
#
# This Makefile fragment is included indirectly by bsd.prefs.mk and
# defines some variables which must be defined earlier than where
@@ -35,11 +35,20 @@ PKG_INFO_CMD?= ${PKG_TOOLS_BIN}/pkg_info
PKG_VIEW_CMD?= ${PKG_TOOLS_BIN}/pkg_view
LINKFARM_CMD?= ${PKG_TOOLS_BIN}/linkfarm
+# Latest versions of tools required for correct pkgsrc operation.
+PKGTOOLS_REQD= 20070813
+
.if !defined(PKGTOOLS_VERSION)
PKGTOOLS_VERSION!= ${PKG_INFO_CMD} -V 2>/dev/null || echo 20010302
MAKEFLAGS+= PKGTOOLS_VERSION=${PKGTOOLS_VERSION}
.endif
+# Check that we are using up-to-date pkg_* tools with this file.
+.if !defined(NO_PKGTOOLS_REQD_CHECK) && ${PKGTOOLS_VERSION} < ${PKGTOOLS_REQD}
+BOOTSTRAP_DEPENDS+= pkg_install>=${PKGTOOLS_REQD}:../../pkgtools/pkg_install
+_PKG_INSTALL_DEPENDS= yes
+.endif
+
# audit-packages logic for its location depends on a variety of factors
# including OS, pkg_install version and NetBSD version. The following
# should pick the correct version to run.
diff --git a/mk/platform/NetBSD.mk b/mk/platform/NetBSD.mk
index d264c9551dc..d4a6a814af5 100644
--- a/mk/platform/NetBSD.mk
+++ b/mk/platform/NetBSD.mk
@@ -1,4 +1,4 @@
-# $NetBSD: NetBSD.mk,v 1.29 2008/03/04 06:45:34 jlam Exp $
+# $NetBSD: NetBSD.mk,v 1.30 2008/04/03 14:07:51 joerg Exp $
#
# Variable definitions for the NetBSD operating system.
@@ -31,11 +31,9 @@ EXPORT_SYMBOLS_LDFLAGS?=-Wl,--export-dynamic
.endif
MOTIF_TYPE_DEFAULT?= openmotif # default 2.0 compatible libs type
NOLOGIN?= /sbin/nologin
-.if exists(${LOCALBASE}/sbin/pkg_info)
-PKG_TOOLS_BIN?= ${LOCALBASE}/sbin
-.else
-PKG_TOOLS_BIN?= /usr/sbin
-.endif
+# This must be lazy and using :? evaluation doesn't work due to a make bugs.
+PKG_TOOLS_BIN_cmd= if [ -x ${LOCALBASE}/sbin/pkg_info ]; then echo ${LOCALBASE}/sbin; else echo /usr/sbin; fi
+PKG_TOOLS_BIN?= ${PKG_TOOLS_BIN_cmd:sh}
ROOT_CMD?= ${SU} - root -c
ROOT_USER?= root
ROOT_GROUP?= wheel