Skip to content

Commit

Permalink
Add two variables to control whether make package and make clean
Browse files Browse the repository at this point in the history
are run with elevated privileges. Remove MAKE_PACKAGE_AS_ROOT
for now, since it is not sure whether the functionality in the current
form will stay and developers should spend time on the destdir support
instead.
  • Loading branch information
joerg committed Oct 9, 2006
1 parent 1bd04c8 commit a85df88
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
12 changes: 9 additions & 3 deletions mk/bsd.pkg.clean.mk
@@ -1,4 +1,4 @@
# $NetBSD: bsd.pkg.clean.mk,v 1.8 2006/08/09 15:31:01 jlam Exp $
# $NetBSD: bsd.pkg.clean.mk,v 1.9 2006/10/09 11:44:06 joerg Exp $
#
# This Makefile fragment is included to bsd.pkg.mk and defines the
# relevant variables and targets for the "clean" phase.
Expand Down Expand Up @@ -50,7 +50,14 @@ post-clean:

.PHONY: do-clean
.if !target(do-clean)
do-clean:
. if !empty(_MAKE_CLEAN_AS_ROOT:M[Yy][Ee][Ss])
do-clean: su-target
. else
do-clean: su-do-clean
. endif
.endif

su-do-clean:
@${PHASE_MSG} "Cleaning for ${PKGNAME}"
${_PKG_SILENT}${_PKG_DEBUG} \
if ${TEST} -d ${WRKDIR:Q}; then \
Expand All @@ -65,7 +72,6 @@ do-clean:
${RMDIR} ${BUILD_DIR} 2>/dev/null || ${TRUE}; \
${RM} -f ${WRKDIR_BASENAME} 2>/dev/null || ${TRUE}
. endif
.endif

_CLEAN_TARGETS+= pre-clean
.if empty(CLEANDEPENDS:M[nN][oO])
Expand Down
7 changes: 6 additions & 1 deletion mk/bsd.prefs.mk
@@ -1,4 +1,4 @@
# $NetBSD: bsd.prefs.mk,v 1.238 2006/10/06 14:51:36 joerg Exp $
# $NetBSD: bsd.prefs.mk,v 1.239 2006/10/09 11:44:06 joerg Exp $
#
# Make file, included to get the site preferences, if any. Should
# only be included by package Makefiles before any .if defined()
Expand Down Expand Up @@ -326,6 +326,11 @@ PKG_FAIL_REASON+= "missing mk/platform/${OPSYS}.mk"

PKGDIRMODE?= 755

_MAKE_CLEAN_AS_ROOT?= no
# Whether to run the clean target as root.
_MAKE_PACKAGE_AS_ROOT?= yes
# Whether to run the package target as root.

PKG_INSTALLATION_TYPES?= overwrite
# This is a whitespace-separated list of installation types supported
# by the package.
Expand Down
16 changes: 1 addition & 15 deletions mk/package/bsd.package.mk
@@ -1,25 +1,11 @@
# $NetBSD: bsd.package.mk,v 1.8 2006/10/08 20:31:38 rillig Exp $
# $NetBSD: bsd.package.mk,v 1.9 2006/10/09 11:44:07 joerg Exp $
#
# This Makefile fragment is included by bsd.pkg.mk and provides all
# variables and targets related to binary packages.
#
# The following are the "public" targets provided by this module:
#
# package, repackage
#
# The following variables may be set by the package:
#
# MAKE_PACKAGE_AS_ROOT: YesNo
# When this variable is set to "no", the package is created by
# the user that also built the package. Since most packages don't
# need root privileges to create the package, the default value
# is "no". Packages that install unreadable files (for example
# with mode 4111) need to set this variable to "yes".
#
# Default value: "yes", but this will change to "no" after most
# packages that really need this option have been identified.

MAKE_PACKAGE_AS_ROOT?= yes

_COOKIE.package= ${WRKDIR}/.package_done

Expand Down
8 changes: 4 additions & 4 deletions mk/package/package.mk
@@ -1,4 +1,4 @@
# $NetBSD: package.mk,v 1.16 2006/10/08 20:31:38 rillig Exp $
# $NetBSD: package.mk,v 1.17 2006/10/09 11:44:07 joerg Exp $

######################################################################
### package (PUBLIC)
Expand Down Expand Up @@ -83,12 +83,12 @@ _PACKAGE_ALL_TARGETS+= package-warnings
_PACKAGE_ALL_TARGETS+= error-check

.PHONY: package-all su-package-all
.if !empty(MAKE_PACKAGE_AS_ROOT:M[Yy][Ee][Ss])
.if !empty(_MAKE_PACKAGE_AS_ROOT:M[Yy][Ee][Ss])
package-all: su-target
su-package-all: ${_PACKAGE_ALL_TARGETS}
.else
package-all: ${_PACKAGE_ALL_TARGETS}
package-all: su-package-all
.endif
su-package-all: ${_PACKAGE_ALL_TARGETS}

######################################################################
### package-check-installed (PRIVATE, override)
Expand Down

0 comments on commit a85df88

Please sign in to comment.