mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-01-16 22:20:56 +00:00
In releases, turn off GEN_FILES in Makefile and CMakeLists.txt
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
dea4c7e09f
commit
473f6363f1
@ -1,6 +1,15 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Prepare .gitignore for a release.
|
print_usage()
|
||||||
|
{
|
||||||
|
cat <<EOF
|
||||||
|
Usage: $0 [OPTION]...
|
||||||
|
Prepare the source tree for a release.
|
||||||
|
|
||||||
|
Options:
|
||||||
|
-u Prepare for development (undo the release preparation)
|
||||||
|
EOF
|
||||||
|
}
|
||||||
|
|
||||||
# Copyright The Mbed TLS Contributors
|
# Copyright The Mbed TLS Contributors
|
||||||
# SPDX-License-Identifier: Apache-2.0
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
@ -19,42 +28,29 @@
|
|||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
|
|
||||||
print_usage()
|
if [ $# -ne 0 ] && [ "$1" = "--help" ]; then
|
||||||
{
|
|
||||||
echo "Usage: $0"
|
|
||||||
echo -e " -h|--help\t\tPrint this help."
|
|
||||||
echo -e " -i|--ignore\t\tAdd generated files to the gitignores."
|
|
||||||
echo -e " -u|--unignore\t\tRemove generated files from the gitignores."
|
|
||||||
}
|
|
||||||
|
|
||||||
if [[ $# -eq 0 ]]; then
|
|
||||||
print_usage
|
print_usage
|
||||||
exit 1
|
exit
|
||||||
elif [[ $# -ge 2 ]]; then
|
|
||||||
echo "Too many arguments!"
|
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
case "$1" in
|
unrelease= # if non-empty, we're in undo-release mode
|
||||||
-i | --ignore)
|
while getopts u OPTLET; do
|
||||||
IGNORE=true
|
case $OPTLET in
|
||||||
;;
|
u) unrelease=1;;
|
||||||
-u | --uignore)
|
\?)
|
||||||
IGNORE=false
|
echo 1>&2 "$0: unknown option: -$OPTLET"
|
||||||
;;
|
echo 1>&2 "Try '$0 --help' for more information."
|
||||||
-h | --help | "")
|
exit 3;;
|
||||||
print_usage
|
esac
|
||||||
exit 1
|
done
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "Unknown argument: $1"
|
|
||||||
echo "run '$0 --help' for options"
|
#### .gitignore processing ####
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
|
|
||||||
GITIGNORES=$(find . -name ".gitignore")
|
GITIGNORES=$(find . -name ".gitignore")
|
||||||
for GITIGNORE in $GITIGNORES; do
|
for GITIGNORE in $GITIGNORES; do
|
||||||
if $IGNORE; then
|
if [ -n "$unrelease" ]; then
|
||||||
sed -i '/###START_COMMENTED_GENERATED_FILES###/,/###END_COMMENTED_GENERATED_FILES###/s/^# //' $GITIGNORE
|
sed -i '/###START_COMMENTED_GENERATED_FILES###/,/###END_COMMENTED_GENERATED_FILES###/s/^# //' $GITIGNORE
|
||||||
sed -i 's/###START_COMMENTED_GENERATED_FILES###/###START_GENERATED_FILES###/' $GITIGNORE
|
sed -i 's/###START_COMMENTED_GENERATED_FILES###/###START_GENERATED_FILES###/' $GITIGNORE
|
||||||
sed -i 's/###END_COMMENTED_GENERATED_FILES###/###END_GENERATED_FILES###/' $GITIGNORE
|
sed -i 's/###END_COMMENTED_GENERATED_FILES###/###END_GENERATED_FILES###/' $GITIGNORE
|
||||||
@ -64,3 +60,23 @@ for GITIGNORE in $GITIGNORES; do
|
|||||||
sed -i 's/###END_GENERATED_FILES###/###END_COMMENTED_GENERATED_FILES###/' $GITIGNORE
|
sed -i 's/###END_GENERATED_FILES###/###END_COMMENTED_GENERATED_FILES###/' $GITIGNORE
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#### Build scripts ####
|
||||||
|
|
||||||
|
# GEN_FILES defaults on (non-empty) in development, off (empty) in releases
|
||||||
|
if [ -n "$unrelease" ]; then
|
||||||
|
r=' yes'
|
||||||
|
else
|
||||||
|
r=''
|
||||||
|
fi
|
||||||
|
sed -i 's/^\(GEN_FILES[ ?:]*=\)\([^#]*\)/\1'"$r/" Makefile */Makefile
|
||||||
|
|
||||||
|
# GEN_FILES defaults on in development, off in releases
|
||||||
|
if [ -n "$unrelease" ]; then
|
||||||
|
r='ON'
|
||||||
|
else
|
||||||
|
r='OFF'
|
||||||
|
fi
|
||||||
|
sed -i 's/^\( *option *( *GEN_FILES *"[^"]*" *\)\([A-Za-z0-9][A-Za-z0-9]*\)/\1'"$r/" CMakeLists.txt
|
||||||
|
Loading…
Reference in New Issue
Block a user