493N/A#! /bin/ksh93
0N/A#
1130N/A# Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
0N/A#
0N/A# Permission is hereby granted, free of charge, to any person obtaining a
919N/A# copy of this software and associated documentation files (the "Software"),
919N/A# to deal in the Software without restriction, including without limitation
919N/A# the rights to use, copy, modify, merge, publish, distribute, sublicense,
919N/A# and/or sell copies of the Software, and to permit persons to whom the
919N/A# Software is furnished to do so, subject to the following conditions:
0N/A#
919N/A# The above copyright notice and this permission notice (including the next
919N/A# paragraph) shall be included in all copies or substantial portions of the
919N/A# Software.
0N/A#
919N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
919N/A# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
919N/A# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
919N/A# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
919N/A# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
919N/A# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
919N/A# DEALINGS IN THE SOFTWARE.
0N/A#
0N/A#
0N/A# Create and fill a package staging area for X
0N/A#
0N/A# This script should be run from the base of the build tree.
0N/A#
970N/A# Arguments:
970N/A# -v Enable verbose mode
970N/A# -p <publisher> Set publisher name in built repo to <publisher>
0N/A#
0N/A
0N/A# Make sure that we aren't affected by the personal environment of
0N/A# whoever is running this script
970N/APATH=/usr/bin:/usr/ccs/bin:/opt/onbld/bin:${PATH}
493N/ASHELL=/bin/ksh93
970N/Aexport PATH
0N/A
1003N/Aprogname="$0"
1003N/Afunction fatal_error
1003N/A{
1003N/A print -u2 "${progname}: ERROR: $*"
1003N/A exit 1
1003N/A}
1003N/A
970N/A# Path to directory in build tree containing build tools
970N/ABUILD_TOOLS="$(pwd)/open-src/util/build-tools/"
0N/A
970N/AVERBOSE_FLAGS="" # verbosity flags passed to make
970N/APUBLISHER_FLAGS="" # publisher flags passed to make
731N/A
970N/Aset -- $(getopt p:v $*)
970N/Aif [ $? != 0 ] ; then
970N/A print -u2 USAGE: $0 [-v]
970N/A exit 2
561N/Afi
493N/A
970N/Afor i in $* ; do
970N/A case $i in
970N/A -p) PUBLISHER_FLAGS="PKGPUBLISHER=$2"; shift 2;;
970N/A -v) VERBOSE_FLAGS="-v"; shift;;
970N/A esac
0N/Adone
0N/A
0N/A
970N/A[ -d log ] || mkdir log
970N/ALOG="$(pwd)/log/make-pkgs"
970N/ACHECK_LOG="$(pwd)/log/check-pkgs"
0N/A
1219N/A# Get build version from hg by searching for most recent tag matching s11u*
1219N/ABUILD_TAG="$(hg parent --template '{latesttag}\n' | \
1219N/A perl -l -n -e 'if ($_ =~ m/^s11u\d+_\d+/) {print $_}')"
0N/A
1219N/Aif [[ -z "${BUILD_TAG}" ]] ; then
1219N/A fatal_error "BUILD_TAG could not be found from hg parent"
29N/Afi
0N/A
1219N/Aprint "Building packages for X Consolidation, build ${BUILD_TAG}"
970N/A
970N/AMACH="$(uname -p)"
970N/A
970N/A# Remove old packages
970N/A/bin/rm -rf "proto/pkg_${MACH}"
970N/A
970N/AXMAKE="${BUILD_TOOLS}/xmake ${VERBOSE_FLAGS} -k"
970N/A
970N/Acd pkg
970N/A${XMAKE} clean > "${LOG}" 2>&1
1219N/A${XMAKE} install "${PUBLISHER_FLAGS}" > "${LOG}" 2>&1
970N/Aprint "Result log is in ${LOG}"
970N/A
1130N/Aprint "Checking built packages"
1219N/A${XMAKE} check > "${CHECK_LOG}" 2>&1
1130N/Aprint "Package check log is in ${CHECK_LOG}"
1130N/A
970N/A"${BUILD_TOOLS}/find-build-errors" -s "${LOG}"
970N/A
493N/Aexit 0