Browse Source

scripts: restore old build.sh and fixup release.sh generator

Leave build.sh as a local script, assume that CI will use the release.sh instead
Generator parser returned None at the end (...this is not rust...), also
fix args.* typos with a more declarative structure.
pull/2471/head
Maxim Prokhorov 2 years ago
parent
commit
75b51f1e80
2 changed files with 16 additions and 45 deletions
  1. +2
    -33
      code/build.sh
  2. +14
    -12
      code/scripts/generate_release_sh.py

+ 2
- 33
code/build.sh View File

@ -5,10 +5,7 @@ set -e
script_build_environments=true script_build_environments=true
script_build_webui=true script_build_webui=true
script_build_release=false
destination=../firmware destination=../firmware
release_args=""
# ALL env: sections from the .ini, even including those we don't want to build # ALL env: sections from the .ini, even including those we don't want to build
list_all_envs() { list_all_envs() {
@ -48,18 +45,6 @@ build_webui() {
node node_modules/gulp/bin/gulp.js || exit node node_modules/gulp/bin/gulp.js || exit
} }
build_release() {
echo "--------------------------------------------------------------"
echo "Building release images..."
set -x
python scripts/generate_release_sh.py $release_args > release.sh
bash release.sh
set +x
echo "--------------------------------------------------------------"
}
build_environments() { build_environments() {
echo "--------------------------------------------------------------" echo "--------------------------------------------------------------"
echo "Building environment images..." echo "Building environment images..."
@ -93,16 +78,13 @@ Options:
-f VALUE Filter build stage by name to skip it -f VALUE Filter build stage by name to skip it
Supported VALUEs are "environments" and "webui" Supported VALUEs are "environments" and "webui"
Can be specified multiple times. Can be specified multiple times.
-r Release mode. Instead of building specified environments,
build every available one with an external script (ref. scripts/generate_release_sh.py)
-a When in 'Release mode', append the string to the builder script arguments list
-l Print available environments -l Print available environments
-d VALUE Destination to move the .bin file after building the environment -d VALUE Destination to move the .bin file after building the environment
-h Display this message -h Display this message
EOF EOF
} }
while getopts "f:lra:pd:h" opt; do
while getopts "f:ld:h" opt; do
case $opt in case $opt in
f) f)
case "$OPTARG" in case "$OPTARG" in
@ -121,17 +103,6 @@ while getopts "f:lra:pd:h" opt; do
d) d)
destination=$OPTARG destination=$OPTARG
;; ;;
r)
script_build_environments=false
script_build_release=true
;;
a)
if ! $script_build_release ; then
echo Must be in release mode to append arguments
exit 1
fi
release_args="$release_args $OPTARG"
;;
h) h)
print_getopts_help print_getopts_help
exit exit
@ -148,8 +119,6 @@ if $script_build_webui ; then
build_webui build_webui
fi fi
if $script_build_release ; then
build_release
elif $script_build_environments ; then
if $script_build_environments ; then
build_environments $@ build_environments $@
fi fi

+ 14
- 12
code/scripts/generate_release_sh.py View File

@ -152,7 +152,7 @@ def parse_args():
version_parts.add_argument("--revision") version_parts.add_argument("--revision")
version_parts.add_argument("--suffix") version_parts.add_argument("--suffix")
parser.parse_args()
return parser.parse_args()
if __name__ == "__main__": if __name__ == "__main__":
@ -171,17 +171,19 @@ if __name__ == "__main__":
print("#!/bin/bash") print("#!/bin/bash")
print("set -e -x") print("set -e -x")
print('export ESPURNA_BUILD_DESTINATION="{}"'.format(args.destination))
print("export ESPURNA_BUILD_SINGLE_SOURCE={}".format(int(args.single_source)))
if args.full_version:
print('export ESPURNA_BUILD_FULL_VERSION="{}"'.format(args.full_version))
else:
if args.version:
print('export ESPURNA_BUILD_VERSION="{}"'.format(args.version))
if args.suffix:
print('export ESPURNA_BUILD_REVISION="{}"'.format(args.revision))
if args.suffix:
print('export ESPURNA_BUILD_VERSION_SUFFIX="{}"'.format(args.suffix))
variables = [
["ESPURNA_BUILD_DESTINATION", args.destination],
["ESPURNA_BUILD_SINGLE_SOURCE", int(args.single_source)],
["ESPURNA_BUILD_FULL_VERSION", args.full_version],
["ESPURNA_BUILD_VERSION", args.version],
["ESPURNA_BUILD_REVISION", args.revision],
["ESPURNA_BUILD_VERSION_SUFFIX", args.suffix]]
for var, value in variables:
if value or not value is None:
print("export {}=\"{}\"".format(var, value))
print('trap "ls -R ${ESPURNA_BUILD_DESTINATION}" EXIT') print('trap "ls -R ${ESPURNA_BUILD_DESTINATION}" EXIT')
print( print(
'echo "Selected thread #{} out of {}"'.format( 'echo "Selected thread #{} out of {}"'.format(


Loading…
Cancel
Save