make_release_packages revision 561
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#! /bin/ksh93
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Permission is hereby granted, free of charge, to any person obtaining a
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# copy of this software and associated documentation files (the
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# "Software"), to deal in the Software without restriction, including
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# without limitation the rights to use, copy, modify, merge, publish,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# distribute, and/or sell copies of the Software, and to permit persons
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# to whom the Software is furnished to do so, provided that the above
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# copyright notice(s) and this permission notice appear in all copies of
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# the Software and that both the above copyright notice(s) and this
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# permission notice appear in supporting documentation.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Except as contained in this notice, the name of a copyright holder
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# shall not be used in advertising or otherwise to promote the sale, use
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# or other dealings in this Software without prior written authorization
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# of the copyright holder.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# @(#)make_release_packages 1.62 08/10/06
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Create and fill a package staging area for X
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# This script should be run from the base of the build tree.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# It takes no parameters.
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Example:
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# cd /export/home/hammer1/WORKSPACES_S493_ALPHA2.1
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# ./make_release_packages
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# To build a subset of packages
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# ./make_release_packages packages
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# or
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# env PACKAGE_LIST="packages" ./make_release_packages
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync#
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Make sure that we aren't affected by the personal environment of
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# whoever is running this script
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncPATH=/usr/bin:/usr/ccs/bin
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncSHELL=/bin/ksh93
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncexport LC_NUMERIC=C
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncMACH="$(uname -p)"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncDATE="$(date +0.%Y.%m.%d)"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# List of official (deliverable) X-window packages for all platforms
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncXW_PACKAGE_LIST="SUNWfontconfig SUNWfontconfig-docs SUNWfontconfig-root
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWfreetype2 SUNWvncviewer SUNWxcursor-themes
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxorg-cfg SUNWxorg-client-docs SUNWxorg-client-programs
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxorg-clientlibs SUNWxorg-compatlinks SUNWxorg-devel-docs
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxorg-doc SUNWxorg-graphics-ddx SUNWxorg-headers
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxorg-server SUNWxorg-tsol-module SUNWxprint-server
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxscreensaver-hacks SUNWxscreensaver-hacks-gl SUNWxsun-server
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxvnc SUNWxwacx SUNWxwcft SUNWxwdem SUNWxwdim SUNWxwdxm
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxwfnt SUNWxwfs SUNWxwfsw SUNWxwhl SUNWxwice SUNWxwinc
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxwman SUNWxwmod SUNWxwoft SUNWxwopt SUNWxwpft SUNWxwplr
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxwplt SUNWxwpmn SUNWxwrtl SUNWxwslb SUNWxwsrv SUNWxwsvr
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNWxwts SUNWxwxft"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Some packages are only built for certain platforms currently
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsynccase "${MACH}" in
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync sparc)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XW_PACKAGE_LIST="$XW_PACKAGE_LIST SUNWxwpsr"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ;;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync i386)
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XW_PACKAGE_LIST="$XW_PACKAGE_LIST SUNWxorg-mesa"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync ;;
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncesac
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# Localization template packages for delivery to translation teams
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncif [[ "$BUILD_L10N" != "no" ]]; then
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XW_L10N_PACKAGES="SUNW0xacx SUNW0xman SUNW0xpmn
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync SUNW0xwplt SUNW0xwopt SUNW0xwsvr"
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncelse
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync XW_L10N_PACKAGES=" "
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncfi
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync# FSW* packages are built for the OpenSolaris (Project Indiana) deliveries
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsyncFSW_PACKAGE_LIST="
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FSWxorg-fonts-core
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FSWxorg-fonts-cyrillic
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FSWxorg-fonts-daewoo
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FSWxorg-fonts-ethiopic
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FSWxorg-fonts-iso8859-2
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FSWxorg-fonts-iso8859-3
b8e299dddd091ae24e0c08c45d91b8f937bd14d2vboxsync FSWxorg-fonts-iso8859-4
FSWxorg-fonts-iso8859-9
FSWxorg-fonts-iso8859-10
FSWxorg-fonts-iso8859-13
FSWxorg-fonts-iso8859-14
FSWxorg-fonts-iso8859-16
FSWxorg-fonts-jiskan
FSWxorg-fonts-syriac
FSWxorg-fonts-vera
"
if [[ "$BUILD_FSW" != "no" ]]; then
EXTRA_PACKAGES+="${FSW_PACKAGE_LIST}"
fi
# To build a subset of packages:
# make_release_packages packages
# or
# env PACKAGE_LIST="packages" make_release_packages
#
if (( $# > 0 )) ; then
PACKAGE_LIST="$*"
else
: ${PACKAGE_LIST:="$XW_PACKAGE_LIST $EXTRA_PACKAGES $XW_L10N_PACKAGES"}
fi
### Functions for use later
function print_and_run
{
print "$@"
"$@"
}
progname="$0"
function fatal_error
{
print -u2 "${progname}: ERROR: $*"
exit 1
}
# 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
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
PROTODIR=${PROTODIR} nawk \
'BEGIN { PROTODIR = ENVIRON [ "PROTODIR" ]; }
/^include / {
system("cat " PROTODIR "/licenses/" $2)
next
}
{ print }' \
$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 ; do
/bin/rm -f $D
/bin/ln -s ${PROTODIR}/$D $D
done
for D in openwin dt sfw bin ; 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
cd ${package}
date
print "******** Making the ${package} package ********"
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
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