CryptoPkg/OpensslLib: Fix CRLF breakage in process_files.sh

This got broken in committing, due to a catalogue of broken practices.

Firstly, we should *pull* git submissions, never recommit them. You
preserve the correct history then, and don't risk rebasing to result in
a history which *never* worked in the form that gets preserved.

That would have kept the authorship attrbution correct too.

Secondly, we shouldn't be storing CRLF line endings in the objects that
git stores in its database. It is designed to store simple LF line endings,
and then check that out as appropriate for the system (resulting in CRLF
in the working tree for Windows users, as they expect). That would avoid
this problem, and all the other problems we have with patches being
exchanged.

Make it executable too, which also got lost in the commit mess.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
This commit is contained in:
David Woodhouse 2016-03-05 16:44:33 +00:00
parent f949616754
commit 9353c60cea

194
CryptoPkg/Library/OpensslLib/process_files.sh Normal file → Executable file
View File

@ -1,97 +1,97 @@
#!/bin/sh #!/bin/sh
# #
# This script runs the OpenSSL Configure script, then processes the # This script runs the OpenSSL Configure script, then processes the
# resulting file list into our local OpensslLib.inf and also takes # resulting file list into our local OpensslLib.inf and also takes
# a copy of opensslconf.h. # a copy of opensslconf.h.
# #
# This only needs to be done once by a developer when updating to a # This only needs to be done once by a developer when updating to a
# new version of OpenSSL (or changing options, etc.). Normal users # new version of OpenSSL (or changing options, etc.). Normal users
# do not need to do this, since the results are stored in the EDK2 # do not need to do this, since the results are stored in the EDK2
# git repository for them. # git repository for them.
OPENSSL_PATH=$(sed -n '/DEFINE OPENSSL_PATH/{s/.* \(openssl-[0-9.]*[a-z]*\)[[:space:]]*/\1/ p}' OpensslLib.inf) OPENSSL_PATH=$(sed -n '/DEFINE OPENSSL_PATH/{s/.* \(openssl-[0-9.]*[a-z]*\)[[:space:]]*/\1/ p}' OpensslLib.inf)
if ! cd "${OPENSSL_PATH}" ; then if ! cd "${OPENSSL_PATH}" ; then
echo "Cannot change to OpenSSL directory \"${OPENSSL_PATH}\"" echo "Cannot change to OpenSSL directory \"${OPENSSL_PATH}\""
exit 1 exit 1
fi fi
./Configure UEFI \ ./Configure UEFI \
no-asm \ no-asm \
no-bf \ no-bf \
no-camellia \ no-camellia \
no-capieng \ no-capieng \
no-cast \ no-cast \
no-cms \ no-cms \
no-deprecated \ no-deprecated \
no-dgram \ no-dgram \
no-dsa \ no-dsa \
no-dynamic-engine \ no-dynamic-engine \
no-ec \ no-ec \
no-ecdh \ no-ecdh \
no-ecdsa \ no-ecdsa \
no-engine \ no-engine \
no-engines \ no-engines \
no-err \ no-err \
no-filenames \ no-filenames \
no-fp-api \ no-fp-api \
no-hw \ no-hw \
no-idea \ no-idea \
no-jpake \ no-jpake \
no-krb5 \ no-krb5 \
no-locking \ no-locking \
no-mdc2 \ no-mdc2 \
no-posix-io \ no-posix-io \
no-pqueue \ no-pqueue \
no-rc2 \ no-rc2 \
no-rcs \ no-rcs \
no-rfc3779 \ no-rfc3779 \
no-ripemd \ no-ripemd \
no-scrypt \ no-scrypt \
no-sct \ no-sct \
no-seed \ no-seed \
no-sha0 \ no-sha0 \
no-sock \ no-sock \
no-srp \ no-srp \
no-ssl \ no-ssl \
no-stdio \ no-stdio \
no-threads \ no-threads \
no-ts \ no-ts \
no-ui \ no-ui \
no-whirlpool \ no-whirlpool \
|| exit 1 || exit 1
make files make files
cd - cd -
function filelist () function filelist ()
{ {
echo '1,/# Autogenerated files list starts here/p' echo '1,/# Autogenerated files list starts here/p'
echo '/# Autogenerated files list ends here/,$p' echo '/# Autogenerated files list ends here/,$p'
echo '/# Autogenerated files list starts here/a\' echo '/# Autogenerated files list starts here/a\'
while read LINE; do while read LINE; do
case "$LINE" in case "$LINE" in
RELATIVE_DIRECTORY=*) RELATIVE_DIRECTORY=*)
eval "$LINE" eval "$LINE"
;; ;;
LIBSRC=*) LIBSRC=*)
LIBSRC=$(echo "$LINE" | sed s/^LIBSRC=//) LIBSRC=$(echo "$LINE" | sed s/^LIBSRC=//)
if [ "$RELATIVE_DIRECTORY" != "ssl" ]; then if [ "$RELATIVE_DIRECTORY" != "ssl" ]; then
for FILE in $LIBSRC; do for FILE in $LIBSRC; do
if [ "$FILE" != "b_print.c" ]; then if [ "$FILE" != "b_print.c" ]; then
echo -e ' $(OPENSSL_PATH)/'$RELATIVE_DIRECTORY/$FILE\\r\\ echo -e ' $(OPENSSL_PATH)/'$RELATIVE_DIRECTORY/$FILE\\r\\
fi fi
done done
fi fi
;; ;;
esac esac
done done
echo -e \\r echo -e \\r
} }
filelist < "${OPENSSL_PATH}/MINFO" | sed -n -f - -i OpensslLib.inf filelist < "${OPENSSL_PATH}/MINFO" | sed -n -f - -i OpensslLib.inf
# We can tell Windows users to put this back manually if they can't run # We can tell Windows users to put this back manually if they can't run
# Configure. # Configure.
cp "${OPENSSL_PATH}/crypto/opensslconf.h" . cp "${OPENSSL_PATH}/crypto/opensslconf.h" .