nightly: use mail(1) instead of mailx(1)
[unleashed.git] / tools / env.sh
blob27811e25392c0c5b8f890fadb6e7ce29666b9b8d
2 # CDDL HEADER START
4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
19 # CDDL HEADER END
21 # Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
22 # Copyright 2015 Nexenta Systems, Inc. All rights reserved.
23 # Copyright 2012 Joshua M. Clulow <josh@sysmgr.org>
24 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
27 # Configuration variables for the runtime environment of the nightly
28 # build script and other tools for construction and packaging of
29 # releases.
30 # This example is suitable for building an illumos workspace, which
31 # will contain the resulting archives. It is based off the onnv
32 # release. It sets NIGHTLY_OPTIONS to make nightly do:
33 # DEBUG build instead of non-DEBUG (-D)
34 # runs 'make check' (-C)
35 # checks for new interfaces in libraries (-A)
36 # sends mail on completion (-m and the MAILTO variable)
37 # creates packages for PIT/RE (-p)
38 # checks for changes in ELF runpaths (-r)
40 # - This file is sourced by "bldenv.sh" and "nightly.sh" and should not
41 # be executed directly.
42 # - This script is only interpreted by ksh93 and explicitly allows the
43 # use of ksh93 language extensions.
45 export NIGHTLY_OPTIONS='-CAmpr'
47 # CODEMGR_WS - where is your workspace at
48 #export CODEMGR_WS="$HOME/ws/illumos-gate"
49 export CODEMGR_WS="`git rev-parse --show-toplevel`"
51 # Maximum number of dmake jobs. The recommended number is 2 + NCPUS,
52 # where NCPUS is the number of logical CPUs on your build system.
53 function maxjobs
55 nameref maxjobs=$1
56 integer ncpu
57 integer -r min_mem_per_job=512 # minimum amount of memory for a job
59 ncpu=$(builtin getconf ; getconf 'NPROCESSORS_ONLN')
60 (( maxjobs=ncpu + 2 ))
62 # Throttle number of parallel jobs launched by dmake to a value which
63 # gurantees that all jobs have enough memory. This was added to avoid
64 # excessive paging/swapping in cases of virtual machine installations
65 # which have lots of CPUs but not enough memory assigned to handle
66 # that many parallel jobs
67 if [[ $(/usr/sbin/prtconf 2>'/dev/null') == ~(E)Memory\ size:\ ([[:digit:]]+)\ Megabytes ]] ; then
68 integer max_jobs_per_memory # parallel jobs which fit into physical memory
69 integer physical_memory # physical memory installed
71 # The array ".sh.match" contains the contents of capturing
72 # brackets in the last regex, .sh.match[1] will contain
73 # the value matched by ([[:digit:]]+), i.e. the amount of
74 # memory installed
75 physical_memory="10#${.sh.match[1]}"
78 max_jobs_per_memory=round(physical_memory/min_mem_per_job) ,
79 maxjobs=fmax(2, fmin(maxjobs, max_jobs_per_memory))
83 return 0
86 maxjobs DMAKE_MAX_JOBS # "DMAKE_MAX_JOBS" passed as ksh(1) name reference
87 export DMAKE_MAX_JOBS
89 # Some scripts optionally send mail messages to MAILTO.
90 export MAILTO="$LOGNAME"
92 # The project (see project(4)) under which to run this build. If not
93 # specified, the build is simply run in a new task in the current project.
94 export BUILD_PROJECT=''
96 # You should not need to change the next three lines
97 export ATLOG="$CODEMGR_WS/log"
98 export LOGFILE="$ATLOG/nightly.log"
99 export MACH="$(uname -p)"
101 export ROOT="$CODEMGR_WS/proto/root_${MACH}"
102 export SRC="$CODEMGR_WS/usr/src"
105 # build environment variables, including version info for mcs, motd,
106 # motd, uname and boot messages. Mostly you shouldn't change this except
107 # when the release slips (nah) or you move an environment file to a new
108 # release
110 export VERSION="`git describe --long --all HEAD | cut -d/ -f2-`"
112 # Package creation variables. You probably shouldn't change these,
113 # either.
115 # PKGARCHIVE determines where the repository will be created.
117 # PKGPUBLISHER controls the publisher setting for the repository.
119 export PKGARCHIVE="${CODEMGR_WS}/packages/${MACH}/nightly"
120 export PKGPUBLISHER='unleashed'
122 # Package manifest format version.
123 export PKGFMT_OUTPUT='v1'
125 # we want make to do as much as it can, just in case there's more than
126 # one problem.
127 export MAKEFLAGS='k'
129 # Set this flag to 'n' to disable the use of 'checkpaths'. The default,
130 # if the 'N' option is not specified, is to run this test.
131 #CHECK_PATHS='y'
133 # POST_NIGHTLY can be any command to be run at the end of nightly. See
134 # nightly(1) for interactions between environment variables and this command.
135 #POST_NIGHTLY=