Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src Move some tests from validatemakeparams() to sanitycheck(), ...
details: https://anonhg.NetBSD.org/src/rev/2f4822ceda25
branches: trunk
changeset: 783054:2f4822ceda25
user: apb <apb%NetBSD.org@localhost>
date: Sun Dec 02 19:19:36 2012 +0000
description:
Move some tests from validatemakeparams() to sanitycheck(), so the
related error messages can be printed before build.sh builds
a new version of make.
Also make some sanity tests unconditional, instead of conditional on
${do_build} || ${do_distribution} || ${do_release} || ${do_install}.
diffstat:
build.sh | 69 ++++++++++++++++++++++++++++++---------------------------------
1 files changed, 33 insertions(+), 36 deletions(-)
diffs (113 lines):
diff -r e5d6795e7f0b -r 2f4822ceda25 build.sh
--- a/build.sh Sun Dec 02 18:40:43 2012 +0000
+++ b/build.sh Sun Dec 02 19:19:36 2012 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/env sh
-# $NetBSD: build.sh,v 1.259 2012/11/15 23:51:53 joerg Exp $
+# $NetBSD: build.sh,v 1.260 2012/12/02 19:19:36 apb Exp $
#
# Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
# All rights reserved.
@@ -1253,6 +1253,24 @@
#
sanitycheck()
{
+ # Non-root should always use either the -U or -E flag.
+ #
+ if ! ${do_expertmode} && \
+ [ "$id_u" -ne 0 ] && \
+ [ "${MKUNPRIVED}" = "no" ] ; then
+ bomb "-U or -E must be set for build as an unprivileged user."
+ fi
+
+ # Install as non-root is a bad idea.
+ #
+ if ${do_install} && [ "$id_u" -ne 0 ] ; then
+ if ${do_expertmode}; then
+ warning "Will install as an unprivileged user."
+ else
+ bomb "-E must be set for install as an unprivileged user."
+ fi
+ fi
+
# If the PATH contains any non-absolute components (including,
# but not limited to, "." or ""), then complain. As an exception,
# allow "" or "." as the last component of the PATH. This is fatal
@@ -1580,45 +1598,26 @@
removedirs="${TOOLDIR}"
if [ -z "${DESTDIR}" ] || [ "${DESTDIR}" = "/" ]; then
- if ${do_build} || ${do_distribution} || ${do_release}; then
- if ! ${do_build} || \
- [ "${uname_s}" != "NetBSD" ] || \
- [ "${uname_m}" != "${MACHINE}" ]; then
- bomb "DESTDIR must != / for cross builds, or ${progname} 'distribution' or 'release'."
- fi
- if ! ${do_expertmode}; then
- bomb "DESTDIR must != / for non -E (expert) builds"
- fi
- statusmsg "WARNING: Building to /, in expert mode."
- statusmsg " This may cause your system to break! Reasons include:"
- statusmsg " - your kernel is not up to date"
- statusmsg " - the libraries or toolchain have changed"
- statusmsg " YOU HAVE BEEN WARNED!"
+ if ${do_distribution} || ${do_release} || \
+ [ "${uname_s}" != "NetBSD" ] || \
+ [ "${uname_m}" != "${MACHINE}" ]; then
+ bomb "DESTDIR must != / for cross builds, or ${progname} 'distribution' or 'release'."
fi
+ if ! ${do_expertmode}; then
+ bomb "DESTDIR must != / for non -E (expert) builds"
+ fi
+ statusmsg "WARNING: Building to /, in expert mode."
+ statusmsg " This may cause your system to break! Reasons include:"
+ statusmsg " - your kernel is not up to date"
+ statusmsg " - the libraries or toolchain have changed"
+ statusmsg " YOU HAVE BEEN WARNED!"
else
removedirs="${removedirs} ${DESTDIR}"
fi
- if ${do_build} || ${do_distribution} || ${do_release}; then
- if ! ${do_expertmode} && \
- [ "$id_u" -ne 0 ] && \
- [ "${MKUNPRIVED}" = "no" ] ; then
- bomb "-U or -E must be set for build as an unprivileged user."
- fi
- fi
if ${do_releasekernel} && [ -z "${RELEASEDIR}" ]; then
bomb "Must set RELEASEDIR with \`releasekernel=...'"
fi
- # Install as non-root is a bad idea.
- #
- if ${do_install} && [ "$id_u" -ne 0 ] ; then
- if ${do_expertmode}; then
- warning "Will install as an unprivileged user."
- else
- bomb "-E must be set for install as an unprivileged user."
- fi
- fi
-
# If a previous build.sh run used -U (and therefore created a
# METALOG file), then most subsequent build.sh runs must also
# use -U. If DESTDIR is about to be removed, then don't perform
@@ -1629,9 +1628,7 @@
# DESTDIR is about to be removed
;;
*)
- if ( ${do_build} || ${do_distribution} || ${do_release} || \
- ${do_install} ) && \
- [ -e "${DESTDIR}/METALOG" ] && \
+ if [ -e "${DESTDIR}/METALOG" ] && \
[ "${MKUNPRIVED}" = "no" ] ; then
if $do_expertmode; then
warning "A previous build.sh run specified -U."
@@ -1718,7 +1715,7 @@
eval cat <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
-# Generated from: \$NetBSD: build.sh,v 1.259 2012/11/15 23:51:53 joerg Exp $
+# Generated from: \$NetBSD: build.sh,v 1.260 2012/12/02 19:19:36 apb Exp $
# with these arguments: ${_args}
#
Home |
Main Index |
Thread Index |
Old Index