1N/A#!/bin/ksh -p
1N/A#
1N/A# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
1N/A# Use is subject to license terms.
1N/A#
1N/A#ident "%Z%%M% %I% %E% SMI"
1N/A#
1N/A# Some of the files in the perl distribution are uuencoded, or contain uuencoded
1N/A# data. Some of the sequences of uuencoded data look like SCCS keywords, i.e.
1N/A# "%<letter>%", so it is necessary to prevent the keywords from being expanded.
1N/A# The SCCS 'y' flag can be added to the SCCS files to prevent keyword expansion
1N/A# when the file is retrieved. However due to bugs in SCCS and wx we can't
1N/A# always be sure that these flags are propagated correctly. This script checks
1N/A# the files passed on its command-line to make sure they have not been subject
1N/A# to incorrect keyword expansion, which in the case of perl will not necessarily
1N/A# result in a build-time error, as the files are copied verbatim into the proto
1N/A# area.
1N/A#
1N/A
1N/A# Split out the directory and file components of each path on the command-line.
1N/Afor dirfile in $*; do
1N/A dir=${dirfile%/*}
1N/A file=${dirfile##*/}
1N/A sfile="SCCS/s.$file"
1N/A
1N/A # Create a new environment, so we pop back to the old directory.
1N/A (
1N/A # Check everything exists.
1N/A if [[ ! -d $dir ]]; then
1N/A printf 'Invalid directory: %s\n' $dir
1N/A exit 1
1N/A fi
1N/A cd $dir || exit 1
1N/A
1N/A # Source builds might not have the SCCS directory present.
1N/A if [[ ! -f $sfile ]]; then
1N/A continue;
1N/A fi
1N/A
1N/A #
1N/A # Compare the plaintext file with the version extracted from
1N/A # SCCS with keyword expansion prevented; fix everything up if
1N/A # the two don't match.
1N/A #
1N/A fetch='no'
1N/A if [[ ! -f $file ]]; then
1N/A fetch='yes'
1N/A elif [[ $(sccs get -kp $file 2>/dev/null | cksum) \
1N/A != $(cat $file | cksum) ]]; then
1N/A printf 'Warning: expanded SCCS keywords in %s fixed\n' \
1N/A $dirfile
1N/A fetch='yes'
1N/A fi
1N/A if [[ $fetch = 'yes' ]]; then
1N/A sccs admin -fy $file
1N/A sccs get $file 2>/dev/null
1N/A fi
1N/A )
1N/Adone