make_release_packages revision 731
792N/A#! /bin/ksh93
792N/A#
792N/A# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
792N/A# Use is subject to license terms.
792N/A#
792N/A# Permission is hereby granted, free of charge, to any person obtaining a
792N/A# copy of this software and associated documentation files (the
792N/A# "Software"), to deal in the Software without restriction, including
792N/A# without limitation the rights to use, copy, modify, merge, publish,
792N/A# distribute, and/or sell copies of the Software, and to permit persons
792N/A# to whom the Software is furnished to do so, provided that the above
792N/A# copyright notice(s) and this permission notice appear in all copies of
792N/A# the Software and that both the above copyright notice(s) and this
792N/A# permission notice appear in supporting documentation.
792N/A#
792N/A# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
792N/A# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
792N/A# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
792N/A# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
792N/A# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
792N/A# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
792N/A# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
792N/A# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
792N/A# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
792N/A#
792N/A# Except as contained in this notice, the name of a copyright holder
792N/A# shall not be used in advertising or otherwise to promote the sale, use
792N/A# or other dealings in this Software without prior written authorization
792N/A# of the copyright holder.
792N/A#
792N/A# @(#)make_release_packages 1.74 09/06/18
792N/A#
792N/A# Create and fill a package staging area for X
792N/A#
792N/A# This script should be run from the base of the build tree.
792N/A# It takes no parameters.
792N/A#
792N/A# Example:
792N/A# cd /export/home/hammer1/WORKSPACES_S493_ALPHA2.1
792N/A# ./make_release_packages
792N/A#
792N/A# To build a subset of packages
792N/A# ./make_release_packages packages
792N/A# or
792N/A# env PACKAGE_LIST="packages" ./make_release_packages
792N/A#
792N/A
792N/A# Make sure that we aren't affected by the personal environment of
792N/A# whoever is running this script
792N/APATH=/usr/bin:/usr/ccs/bin
792N/ASHELL=/bin/ksh93
792N/Aexport LC_NUMERIC=C
792N/A
792N/AMACH="$(uname -p)"
792N/ADATE="$(date +0.%Y.%m.%d)"
792N/A
792N/A# List of official (deliverable) X-window packages for all platforms
792N/AXW_PACKAGE_LIST="SUNWfontconfig SUNWfontconfig-docs SUNWfontconfig-root
792N/A SUNWttf-google-droid
792N/A SUNWpciaccess SUNWpixman SUNWfreetype2 SUNWvncviewer SUNWxcursor-themes
792N/A SUNWxorg-client-docs SUNWxorg-client-programs
792N/A SUNWxorg-clientlibs SUNWxorg-compatlinks
792N/A SUNWxorg-graphics-ddx SUNWxorg-headers
792N/A SUNWxorg-server SUNWxorg-tsol-module
792N/A SUNWxscreensaver-hacks SUNWxscreensaver-hacks-gl
792N/A SUNWxvnc SUNWxwacx SUNWxwcft SUNWxwdem SUNWxwdxm
792N/A SUNWxwfnt SUNWxwfs SUNWxwfsw SUNWxwice SUNWxwinc
792N/A SUNWxwman SUNWxwmod SUNWxwoft SUNWxwopt SUNWxwplr
792N/A SUNWxwplt SUNWxwpmn SUNWxwrtl SUNWxwslb SUNWxwsvr
792N/A SUNWxwxft"
792N/A
792N/AXSUN_PACKAGE_LIST="SUNWxsun-headers SUNWxsun-server SUNWxwts"
792N/A
792N/A# Some packages are only built for certain platforms currently
792N/Acase "${MACH}" in
792N/A sparc)
792N/A XW_PACKAGE_LIST="$XW_PACKAGE_LIST $XSUN_PACKAGE_LIST SUNWxwpsr"
792N/A ;;
792N/A i386)
792N/A XW_PACKAGE_LIST="$XW_PACKAGE_LIST SUNWxorg-mesa"
792N/A ;;
792N/Aesac
792N/A
792N/A# Localization template packages for delivery to translation teams
792N/Aif [[ "$BUILD_L10N" != "no" ]]; then
792N/A XW_L10N_PACKAGES="SUNW0xacx SUNW0xman SUNW0xpmn
792N/A SUNW0xwplt SUNW0xwopt SUNW0xwsvr"
792N/Aelse
792N/A XW_L10N_PACKAGES=" "
792N/Afi
792N/A
792N/A# FSW* packages are built for the OpenSolaris (Project Indiana) deliveries
792N/AFSW_PACKAGE_LIST="
792N/A FSWxorg-fonts-core
792N/A FSWxorg-fonts-cyrillic
792N/A FSWxorg-fonts-daewoo
792N/A FSWxorg-fonts-ethiopic
792N/A FSWxorg-fonts-iso8859-2
792N/A FSWxorg-fonts-iso8859-3
792N/A FSWxorg-fonts-iso8859-4
792N/A FSWxorg-fonts-iso8859-9
792N/A FSWxorg-fonts-iso8859-10
792N/A FSWxorg-fonts-iso8859-13
792N/A FSWxorg-fonts-iso8859-14
792N/A FSWxorg-fonts-iso8859-16
792N/A FSWxorg-fonts-jiskan
792N/A FSWxorg-fonts-syriac
792N/A FSWxorg-fonts-vera
792N/A"
792N/A
792N/Aif [[ "$BUILD_FSW" != "no" ]]; then
792N/A EXTRA_PACKAGES+="${FSW_PACKAGE_LIST}"
792N/Afi
792N/A
792N/A# To build a subset of packages:
792N/A# make_release_packages packages
792N/A# or
792N/A# env PACKAGE_LIST="packages" make_release_packages
792N/A#
792N/Aif (( $# > 0 )) ; then
792N/A PACKAGE_LIST="$*"
792N/Aelse
792N/A : ${PACKAGE_LIST:="$XW_PACKAGE_LIST $EXTRA_PACKAGES $XW_L10N_PACKAGES"}
792N/Afi
792N/A
792N/A### Functions for use later
792N/Afunction print_and_run
792N/A{
792N/A print "$@"
792N/A "$@"
792N/A}
792N/A
792N/Aprogname="$0"
792N/A
792N/Afunction fatal_error
{
print -u2 "${progname}: ERROR: $*"
exit 1
}
function process_includes
{
nawk \
"/^include / {
system(\"cat $1/\" \$2)
next
}
{ print }" $2
}
# Which platform name do we use for 64-bit?
case "${MACH}" in
sparc) PLAT_64="sparcv9" ;;
i386) PLAT_64="amd64" ;;
*) fatal_error "Unknown architecture - not SPARC nor i386." ;;
esac
: ${PACKAGE_DIR:="$(pwd)/proto-packages"}
SOURCE_DIR="$(pwd)"
PKG_SOURCE_DIR=${SOURCE_DIR}/packages
cd ${PKG_SOURCE_DIR}
# Get build version from pkgversion
if [[ -f pkgversion ]] ; then
source ./pkgversion
else
fatal_error "${PKG_SOURCE_DIR}/pkgversion not found. Cannot continue."
fi
if [[ -z "${VERSION}" ]] ; then
fatal_error "VERSION not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
fi
if [[ -z "${BUILD}" ]] ; then
fatal_error "BUILD not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
fi
DECIMAL_BUILD=$(( ${BUILD} / 100.0 ))
print "Building packages for X11 version ${VERSION} build ${DECIMAL_BUILD}"
if [[ "${MACH}" = "sparc" ]]; then
PROTODIR=${SOURCE_DIR}/proto-sun4-svr4
else
PROTODIR=${SOURCE_DIR}/proto-${MACH}-svr4
fi
# Next, create the staging area.
#
print 'Removing old proto-packages and recreating'
/bin/rm -rf ${PACKAGE_DIR}
/bin/mkdir ${PACKAGE_DIR} ${PACKAGE_DIR}/logs
# Now copy the package description info
print 'Copying package descriptions'
/bin/cp copyright depend i.* r.* ${PACKAGE_DIR} >/dev/null 2>&1
for package in ${PACKAGE_LIST} common_files ; do
if [[ ! -d ${package} ]] ; then
print "packages/${package} not found ; skipping"
continue
fi
cd ${package}
/bin/mkdir ${PACKAGE_DIR}/${package}
/bin/cp p* d* lib* i.* r.* M* ${PACKAGE_DIR}/${package} >/dev/null 2>&1
# We keep the master copyright in the top-level copyright file
# Packages that need additional copyright have copyright.add files
# that we then merge here
cp ../copyright ${PACKAGE_DIR}/${package}/copyright
for F in copyright.add copyright.add.${MACH} ; do
if [[ -f $F ]] ; then
chmod +w ${PACKAGE_DIR}/${package}/copyright
process_includes "${PROTODIR}/licenses" $F \
>> ${PACKAGE_DIR}/${package}/copyright
fi
done
cd ..
done
# Now move into the package staging area and build the packages.
cd ${PACKAGE_DIR}
for D in etc usr var lib licenses kernel ; do
/bin/rm -f $D
/bin/ln -s ${PROTODIR}/$D $D
done
for D in openwin ; do
/bin/rm -f $D
/bin/ln -s ${PROTODIR}/usr/$D $D
done
LOGfile=logs/package_build
print -- '---Building packages'
# Variables to pass to pkgmk for use in prototype files
# They must start with lowercase letters to be resolved at pkgmk time
PKGMK_VARS="plat_64=${PLAT_64} plat=${MACH}"
for package in ${PACKAGE_LIST} ; do
print "******** Making the ${package} package ********"
if [[ ! -d ${package} ]] ; then
print "${PACKAGE_DIR}/${package} was not found ; skipping"
continue
fi
cd ${package}
date
sed -e '/ARCH/s/ISA/'${MACH}'/' -e 's/SUNW_PRODVERS=.*$/SUNW_PRODVERS='${VERSION}/ -e 's/VERSION=.*$/VERSION='${VERSION}.${BUILD},REV=${DATE}/ pkginfo.tmpl > pkginfo
if [[ -f Makefile ]] ; then
print_and_run /usr/ccs/bin/make SOURCEDIR=${PKG_SOURCE_DIR} all
else
for pf in preinstall preremove postinstall postremove ; do
# If filename.tmpl exists, but filename does not,
# build filename from the .tmpl
if [[ -f "${pf}.tmpl" && ! -f "${pf}" ]] ; then
SOURCEDIR=${PKG_SOURCE_DIR} \
nawk -f ${PKG_SOURCE_DIR}/awk_procedure \
${pf}.tmpl > ${pf}
fi
done
fi
for df in depend depend_${MACH} ; do
# If filename.tmpl exists, but filename does not,
# build filename from the .tmpl
if [[ -f "${df}.tmpl" && ! -f "${df}" ]] ; then
process_includes "${PKG_SOURCE_DIR}/${package}" ${df}.tmpl > ${df}
fi
done
if [[ -f prototype ]] ; then
# Simple package with the same prototype on all platforms
PROTOTYPE="prototype"
else
# Package with some platform-specific settings in prototype
if [[ ! -f prototype_${MACH} ]]; then
ln -s prototype_com prototype_${MACH}
fi
PROTOTYPE="prototype_${MACH}"
fi
print_and_run /usr/bin/pkgmk -d ${PACKAGE_DIR}/${package} -f ${PROTOTYPE} -o ${PKGMK_VARS}
print "******** Done Making the ${package} package ********"
cd ..
done >$LOGfile 2>&1
print result log is in ${PACKAGE_DIR}/$LOGfile
print -n "Packages built: "
grep -c "Packaging complete" ${PACKAGE_DIR}/$LOGfile
print -n "Packages failed: "
grep -c "Packaging was not successful" ${PACKAGE_DIR}/$LOGfile
# Create an installdir with symlinks to built packages
cd ${PACKAGE_DIR}
mkdir installdir
cd installdir
for package in ${PACKAGE_LIST} ; do
if [[ -d ../${package}/${package} ]] ; then
ln -s ../${package}/${package} .
fi
done
if [[ -f ${PKG_SOURCE_DIR}/upgrade-X ]] ; then
cp -p ${PKG_SOURCE_DIR}/upgrade-X .
chmod a+x upgrade-X
fi
exit 0