bfudrop.sh revision 52a52aeb5a7fdcd4b40e137fa7498612f87d95f3
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# ident "%Z%%M% %I% %E% SMI"
#
#
# Create a set of BFU archives for posting, then deliver them as a
# tarball, including binary license files.
#
# usage: bfudrop [-n] open-proto closed-bins build-id
# -n extract non-debug closed binaries.
# (open-proto and build-id are not modified.)
# open-proto absolute path to open-only proto area.
# closed-bins name of closed-bins tarball (bzipped, in $CODEMGR_WS)
# build-ID identifier for the archives, e.g.,
# "nightly-osol".
#
usage="bfudrop [-n] open-proto closed-bins build-ID"
function fail {
print -u2 "bfudrop: $@"
exit 1
}
#
# Directory that we assemble everything in. Includes these
# subdirectories:
# tmp scratch directory
# root_$MACH combined proto area
# archives-<build-ID> copy of archives plus license files
#
stagedir=$(mktemp -dt bfudropXXXXX)
scratchdir="$stagedir/tmp"
#
# Wrapper over cpio to filter out "NNN blocks" messages.
#
function cpio_filt {
integer cpio_stat
cpio_stat=$?
return $cpio_stat
}
#
# Generate README.BFU-ARCHIVES.$MACH from boilerplate and the contents
# of the bfu archives.
# usage: cd archivedir; mkreadme destdir
#
function mkreadme {
destdir="$1"
readme="$destdir/README.BFU-ARCHIVES.$MACH"
for f in *; do
#
# The cpio table of contents includes directories, and
# we just want files. So unpack the cpio file into a
# temp directory, do a find(1) to get the table of
# contents, and remove the temp directory.
#
case $f in
esac
fail "can't get contents for $f"
fi
#
# "find *" will miss dot files, but we don't expect
# any. "find ." would catch them, but we'd have to
# clean up the resulting list (remove the "./").
#
rm -rf "$scratchdir"
done
}
nondebug=n
while getopts n flag; do
n)
nondebug=y
;;
?)
exit 1
;;
esac
done
if [[ $# -ne 3 ]]; then
exit 1
fi
srcroot="$1"
closedtb="$2"
build="$3"
export CPIODIR="$cpioparent/$build"
export MACH
tarfile="$CODEMGR_WS/on-bfu-$build.$MACH.tar"
cd "$CODEMGR_WS"
#
# Copy the source proto area to a temp area and unpack the closed
# binaries on top. The source proto area is left alone so as not to
# break future incremental builds.
#
if [[ ! -d "$closed_root" ]]; then
fi
#
# Generate the actual archives.
#
#
# Bundle up the archives and license files.
#
# copy archives
# Insert binary license files.
cp -p "$SRC/tools/opensolaris/BINARYLICENSE.txt" "$stagedir/$subdir" || \
fail "can't add BINARYLICENSE.txt"
cp -p "$CODEMGR_WS/THIRDPARTYLICENSE.BFU-ARCHIVES" "$stagedir/$subdir" || \
fail "can't add THIRDPARTYLICENSE.BFU-ARCHIVES."
exit 0