diff --git a/.travis.yml b/.travis.yml index c75ae3dee0..1382cd798e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,57 +4,26 @@ language: cpp git: - depth: 1000 + depth: 2000 matrix: fast_finish: true include: - os: linux sudo: required - env: GCC_VER=5.4 services: - docker - os: osx sudo: true osx_image: xcode8 - env: CCACHE_CPP2=1 cache: ccache: true - pip: true - directories: - - $HOME/.pip/cache/ - - $HOME/Library/Caches/pip before_install: - - if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then - cd ${TRAVIS_BUILD_DIR} - && git fetch --unshallow && git fetch --all --tags - ; - elif [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" == "coverity" ]]; then - sudo apt-get install genromfs - && pip install empy - ; - elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then - test "${TRAVIS_BRANCH}" != 'coverity' || exit 0 - && sudo -H easy_install pip - && sudo -H pip install empy - && wget https://s3.amazonaws.com/px4-travis/toolchain/macos/ccache - && sudo mv ccache /usr/local/bin - && chmod +x /usr/local/bin/ccache - && mkdir -p ~/bin - && sudo ln -s /usr/local/bin/ccache ~/bin/c++ - && sudo ln -s /usr/local/bin/ccache ~/bin/cc - && sudo ln -s /usr/local/bin/ccache ~/bin/clang - && sudo ln -s /usr/local/bin/ccache ~/bin/clang++ - && sudo ln -s /usr/local/bin/ccache ~/bin/g++ - && sudo ln -s /usr/local/bin/ccache ~/bin/gcc - && export PATH=~/bin:$PATH - && wget https://s3.amazonaws.com/px4-travis/toolchain/macos/ninja - && sudo mv ninja /usr/local/bin - && chmod +x /usr/local/bin/ninja - ; - fi + - sudo -H easy_install pip + - sudo -H pip install empy + - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then sudo apt-get install genromfs; fi env: global: @@ -64,55 +33,21 @@ env: - secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA=" # AWS SECRET: $PX4_AWS_SECRET - secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk=" - - PX4_AWS_BUCKET=px4-travis script: - - ccache -M 1GB; ccache -z - if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then - ./Tools/docker_run.sh 'GIT_SUBMODULES_ARE_EVIL=1 make qgc_firmware'; + ./Tools/docker_run.sh 'make qgc_firmware'; elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then make tests; fi - - ccache -s after_success: - - if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then - make package_firmware && mkdir s3deploy-archive && cp Firmware.zip s3deploy-archive/ - && Tools/s3_deploy.py; - fi - - if [[ "${TRAVIS_OS_NAME}" = "linux" && "$GCC_VER" == "5.4" && "${TRAVIS_BRANCH}" != "coverity" ]]; then - export PX4_S3_DEPLOY=1; + - if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" != "coverity" ]]; then + ./Tools/docker_run.sh 'make s3put_firmware AWS_S3_BUCKET="px4-travis/archives/Firmware/${TRAVIS_BRANCH}/${TRAVIS_BUILD_ID}"' + && ./Tools/docker_run.sh 'make s3put_qgc_firmware AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}"'; fi deploy: -# deploy *.px4 to S3 px4-travis/Firmware/$TRAVIS_BRANCH - - provider: s3 - access_key_id: $PX4_AWS_KEY - secret_access_key: - secure: $PX4_AWS_SECRET - bucket: px4-travis - local_dir: s3deploy-branch - upload-dir: Firmware/$TRAVIS_BRANCH - acl: public_read - skip_cleanup: true - on: - all_branches: true - condition: $PX4_S3_DEPLOY = 1 - -# deploy Firmware.zip to S3 px4-travis/archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID - - provider: s3 - access_key_id: $PX4_AWS_KEY - secret_access_key: - secure: $PX4_AWS_SECRET - bucket: px4-travis - local_dir: s3deploy-archive - upload-dir: archives/Firmware/$TRAVIS_BRANCH/$TRAVIS_BUILD_ID - acl: public_read - skip_cleanup: true - on: - all_branches: true - condition: $PX4_S3_DEPLOY = 1 - # on tags deploy Firmware.zip to Github releases - provider: releases api_key: @@ -123,7 +58,7 @@ deploy: tags: true all_branches: true repo: PX4/Firmware - condition: $GCC_VER = 5.4 + condition: $TRAVIS_OS_NAME = linux addons: coverity_scan: diff --git a/CMakeLists.txt b/CMakeLists.txt index 79bd84a6fa..95c16d1bdd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,14 +168,26 @@ list(GET config_args 1 BOARD) list(GET config_args 2 LABEL) set(target_name "${OS}-${BOARD}-${LABEL}") -message(STATUS "${target_name}") - -# The Url for the elf file for crash logging +# version info from git +execute_process( + COMMAND Tools/tag_to_version.py --root ${PX4_SOURCE_DIR} + OUTPUT_VARIABLE version + WORKING_DIRECTORY ${PX4_SOURCE_DIR} + ) +execute_process( + COMMAND git describe --always --tags + OUTPUT_VARIABLE git_tag + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${PX4_SOURCE_DIR} + ) +message(STATUS "PX4 VERSION: ${git_tag}") +message(STATUS "CONFIG: ${target_name}") +# The URL for the elf file for crash logging if (DEFINED ENV{BUILD_URI}) - set (BUILD_URI $ENV{BUILD_URI}) + set(BUILD_URI $ENV{BUILD_URI}) else() - set (BUILD_URI "localhost") + set(BUILD_URI "localhost") endif() add_definitions(-DBUILD_URI=${BUILD_URI}) @@ -192,10 +204,12 @@ if(NOT CMAKE_INSTALL_PREFIX) set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install path prefix" FORCE) endif() endif() -message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +if (CMAKE_INSTALL_PREFIX) + message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +endif() list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/cmake") -message(STATUS "cmake module path: ${CMAKE_MODULE_PATH}") +message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}") set(config_module "configs/${CONFIG}") include(${config_module}) @@ -242,20 +256,7 @@ if (NOT ${CMAKE_VERSION} VERSION_LESS 3.1.0) cmake_policy(SET CMP0054 NEW) # don't dereference quoted variables endif() -# version info from git -execute_process( - COMMAND Tools/tag_to_version.py --root ${PX4_SOURCE_DIR} - OUTPUT_VARIABLE version - WORKING_DIRECTORY ${PX4_SOURCE_DIR} - ) -execute_process( - COMMAND git describe --always --tags - OUTPUT_VARIABLE git_tag - OUTPUT_STRIP_TRAILING_WHITESPACE - WORKING_DIRECTORY ${PX4_SOURCE_DIR} - ) set(package-contact "px4users@googlegroups.com") -message(STATUS "VERSION: ${version}") #============================================================================= # find programs and packages @@ -270,14 +271,12 @@ if (CATKIN_DEVEL_PREFIX) else() message(FATAL_ERROR "catkin not found") endif() -else() - #message(STATUS "catkin DISABLED") endif() find_package(PythonInterp REQUIRED) #============================================================================= -# cmake modules +# cmake testing # enable_testing() include(CTest) @@ -299,21 +298,39 @@ foreach(var ${required_variables}) endif() endforeach() +# print full c compiler version +execute_process(COMMAND ${CMAKE_C_COMPILER} --version + OUTPUT_VARIABLE c_compiler_version + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +STRING(REGEX MATCH "[^\n]*" c_compiler_version_short ${c_compiler_version}) +message(STATUS "C compiler: ${c_compiler_version_short}") + +# print full c++ compiler version +execute_process(COMMAND ${CMAKE_CXX_COMPILER} --version + OUTPUT_VARIABLE cxx_compiler_version + OUTPUT_STRIP_TRAILING_WHITESPACE + ) +STRING(REGEX MATCH "[^\n]*" cxx_compiler_version_short ${cxx_compiler_version}) +message(STATUS "C++ compiler: ${cxx_compiler_version_short}") + + #============================================================================= # git # -px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") -px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") -px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") -px4_add_git_submodule(TARGET git_gtest PATH "unittests/gtest") -px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan") -px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +px4_add_git_submodule(TARGET git_cmake_hexagon PATH "cmake/cmake_hexagon") px4_add_git_submodule(TARGET git_driverframework PATH "src/lib/DriverFramework") px4_add_git_submodule(TARGET git_ecl PATH "src/lib/ecl") -px4_add_git_submodule(TARGET git_jmavsim PATH "Tools/jMAVSim") px4_add_git_submodule(TARGET git_gazebo PATH "Tools/sitl_gazebo") +px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp") +px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") +px4_add_git_submodule(TARGET git_gtest PATH "unittests/gtest") +px4_add_git_submodule(TARGET git_jmavsim PATH "Tools/jMAVSim") px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix") -px4_add_git_submodule(TARGET git_cmake_hexagon PATH "cmake/cmake_hexagon") +px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0") +px4_add_git_submodule(TARGET git_mavlink2 PATH "mavlink/include/mavlink/v2.0") +px4_add_git_submodule(TARGET git_nuttx PATH "NuttX") +px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan") add_custom_target(submodule_clean WORKING_DIRECTORY ${PX4_SOURCE_DIR} diff --git a/Makefile b/Makefile index 02e08069c4..39c6dd1f3b 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ ############################################################################ # -# Copyright (c) 2015 - 2016 PX4 Development Team. All rights reserved. +# Copyright (c) 2015 - 2017 PX4 Development Team. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions @@ -116,8 +116,7 @@ define cmake-build +@$(eval BUILD_DIR = $(SRC_DIR)/build_$@$(BUILD_DIR_SUFFIX)) +@if [ $(PX4_CMAKE_GENERATOR) = "Ninja" ] && [ -e $(BUILD_DIR)/Makefile ]; then rm -rf $(BUILD_DIR); fi +@if [ ! -e $(BUILD_DIR)/CMakeCache.txt ]; then mkdir -p $(BUILD_DIR) && cd $(BUILD_DIR) && cmake $(2) -G"$(PX4_CMAKE_GENERATOR)" -DCONFIG=$(1) $(CMAKE_ARGS) || (rm -rf $(BUILD_DIR)); fi -+@echo "PX4 CONFIG: $(BUILD_DIR)" -+@$(PX4_MAKE) -C "$(BUILD_DIR)" $(PX4_MAKE_ARGS) $(ARGS) ++@(cd $(BUILD_DIR) && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS)) endef define colorecho @@ -151,56 +150,20 @@ posix: posix_sitl_default broadcast: posix_sitl_broadcast # Multi- config targets. - eagle_default: posix_eagle_default qurt_eagle_default eagle_legacy_default: posix_eagle_legacy qurt_eagle_legacy excelsior_default: posix_excelsior_default qurt_excelsior_default -# Deprecated config targets. - -ros_sitl_default: - @echo "This target is deprecated. Use make 'posix_sitl_default gazebo' instead." - -_sitl_deprecation: - @echo "Deprecated. Use 'make posix_sitl_default jmavsim' or" - @echo "'make posix_sitl_default gazebo' if Gazebo is preferred." - -run_sitl_quad: _sitl_deprecation -run_sitl_plane: _sitl_deprecation -run_sitl_ros: _sitl_deprecation # All targets with just dependencies but no recipe must either be marked as phony (or have the special @: as recipe). -.PHONY: all posix broadcast eagle_default eagle_legacy_default excelsior_default run_sitl_quad run_sitl_plane run_sitl_ros all_nuttx_targets +.PHONY: all posix broadcast eagle_default eagle_legacy_default excelsior_default all_nuttx_targets # Other targets # -------------------------------------------------------------------- -.PHONY: uavcan_firmware compiler_version check check_format format unittest tests qgc_firmware alt_firmware package_firmware clean submodulesclean distclean -.NOTPARALLEL: +.PHONY: qgc_firmware alt_firmware checks_bootloaders uavcan_firmware sizes check quick_check -# All targets with just dependencies but no recipe must either be marked as phony (or have the special @: as recipe). -.PHONY: checks_defaults checks_bootloaders checks_tests checks_uavcan checks_sitls checks_last quick_check tests extra_firmware - -uavcan_firmware: -ifeq ($(VECTORCONTROL),1) - $(call colorecho,"Downloading and building Vector control (FOC) firmware for the S2740VC and PX4ESC 1.6") - @(rm -rf vectorcontrol && git clone --quiet --depth 1 https://github.com/thiemar/vectorcontrol.git && cd vectorcontrol && BOARD=s2740vc_1_0 make --silent --no-print-directory && BOARD=px4esc_1_6 make --silent --no-print-directory && ../Tools/uavcan_copy.sh) -endif - -check_px4fmu-v4_default: uavcan_firmware - -check_px4fmu-v4_default_and_uavcan: check_px4fmu-v4_default - @echo VECTORCONTROL=$VECTORCONTROL -ifeq ($(VECTORCONTROL),1) - @echo "Cleaning up vectorcontrol firmware" - @rm -rf vectorcontrol - @rm -rf ROMFS/px4fmu_common/uavcan -endif - -sizes: - @-find build_* -name firmware_nuttx -type f | xargs size 2> /dev/null || : - -# QGroundControl flashable firmware (currently built by travis-ci) +# QGroundControl flashable NuttX firmware qgc_firmware: \ check_aerofc-v1_default \ check_crazyflie_default \ @@ -211,7 +174,9 @@ qgc_firmware: \ check_px4fmu-v3_default \ check_px4fmu-v4_default \ check_tap-v1_default \ + check_sizes +# Other NuttX firmware alt_firmware: \ check_auav-x21_default \ check_px4-stm32f4discovery_default \ @@ -221,8 +186,7 @@ alt_firmware: \ check_px4fmu-v5_default \ check_px4nucleoF767ZI-v1_default \ check_s2740vc-v1_default \ - -checks_defaults: qgc_firmware alt_firmware + check_sizes checks_bootloaders: \ check_esc35-v1_bootloader \ @@ -231,41 +195,68 @@ checks_bootloaders: \ check_px4flow-v2_bootloader \ check_s2740vc-v1_bootloader \ check_zubaxgnss-v1_bootloader \ + check_sizes -checks_uavcan: \ - check_px4fmu-v4_default_and_uavcan +uavcan_firmware: + $(call colorecho,"Downloading and building Vector control (FOC) firmware for the S2740VC and PX4ESC 1.6") + @rm -rf vectorcontrol + @git clone --quiet --depth 1 https://github.com/thiemar/vectorcontrol.git && cd vectorcontrol + @BOARD=s2740vc_1_0 make --silent --no-print-directory + @BOARD=px4esc_1_6 make --silent --no-print-directory && $(SRC_DIR)/Tools/uavcan_copy.sh) -checks_last: \ - tests \ - check_format \ -compiler_version: - -arm-none-eabi-gcc --version +sizes: + @-find build_* -name firmware_nuttx -type f | xargs size 2> /dev/null || : -# All default targets that don't require a special build environment (currently built on semaphore-ci) -check: compiler_version checks_defaults checks_bootloaders checks_tests checks_uavcan checks_last sizes +# All default targets that don't require a special build environment +check: check_posix_sitl_default qgc_firmware alt_firmware checks_bootloaders tests check_format # quick_check builds a single nuttx and posix target, runs testing, and checks the style -quick_check: compiler_version check_posix_sitl_default check_px4fmu-v3_default tests check_format sizes - -check_format: - $(call colorecho,"Checking formatting with astyle") - @./Tools/check_code_style_all.sh - @git diff --check - -format: - $(call colorecho,"Formatting with astyle") - @./Tools/check_code_style_all.sh --fix +quick_check: check_posix_sitl_default check_px4fmu-v3_default tests check_format check_%: @echo $(call colorecho,"Building" $(subst check_,,$@)) - @$(MAKE) --no-print-directory $(subst check_,,$@) package - @mkdir -p Packages - @cp build_$(subst check_,,$@)/*.zip Packages - @rm -rf build_$(subst check_,,$@) + @$(MAKE) --no-print-directory $(subst check_,,$@) @echo +# S3 upload helpers +# -------------------------------------------------------------------- +# s3cmd uses these ENV variables +# AWS_ACCESS_KEY_ID +# AWS_SECRET_ACCESS_KEY +# AWS_S3_BUCKET +.PHONY: s3put_firmware s3put_qgc_firmware + +Firmware.zip: + @rm -rf Firmware.zip + @zip --junk-paths Firmware.zip `find . -name nuttx-\*.px4` + +s3put_firmware: Firmware.zip + $(SRC_DIR)/Tools/s3put.sh Firmware.zip + +s3put_qgc_firmware: qgc_firmware + @$(SRC_DIR)/Tools/s3put.sh $(SRC_DIR)/build_px4fmu-v3_default/airframes.xml + @$(SRC_DIR)/Tools/s3put.sh $(SRC_DIR)/build_px4fmu-v3_default/parameters.xml + @find $(SRC_DIR)/build_* -name "*.px4" -exec $(SRC_DIR)/Tools/s3put.sh "{}" \; + +# Astyle +# -------------------------------------------------------------------- +.PHONY: check_format format + +check_format: + $(call colorecho,"Checking formatting with astyle") + @$(SRC_DIR)/Tools/check_code_style_all.sh + @git diff --check + +format: + $(call colorecho,"Formatting with astyle") + @$(SRC_DIR)/Tools/check_code_style_all.sh --fix + +# Testing +# -------------------------------------------------------------------- +.PHONY: unittest run_tests_posix tests tests_coverage + unittest: posix_sitl_default $(call cmake-build,unittest,$(SRC_DIR)/unittests) @(cd build_unittest && ctest -j2 --output-on-failure) @@ -285,6 +276,12 @@ tests_coverage: @genhtml --legend --show-details --function-coverage --quiet --output-directory coverage-html coverage.info @$(MAKE) --no-print-directory posix_sitl_default test_results_junit + + +# Clang analyzers +# -------------------------------------------------------------------- +.PHONY: scan-build clang-check clang-tidy + scan-build: @export CCACHE_DISABLE=1 @mkdir -p $(SRC_DIR)/build_posix_sitl_default_scan-build @@ -299,12 +296,13 @@ clang-tidy: @CC=clang CXX=clang++ $(MAKE) --no-print-directory posix_sitl_default @$(SRC_DIR)/Tools/clang-tool.sh -b build_posix_sitl_default -t clang-tidy -package_firmware: - @./Tools/package_firmware.py +# Cleanup +# -------------------------------------------------------------------- +.PHONY: clean submodulesclean distclean clean: - @rm -rf build_*/ - -@$(MAKE) -C NuttX/nuttx clean + @rm -rf $(SRC_DIR)/build_*/ + -@$(MAKE) --no-print-directory -C NuttX/nuttx clean submodulesclean: @git submodule sync --recursive @@ -314,13 +312,13 @@ submodulesclean: distclean: submodulesclean @git clean -ff -x -d -e ".project" -e ".cproject" -e ".idea" +# -------------------------------------------------------------------- + # All other targets are handled by PX4_MAKE. Add a rule here to avoid printing an error. %: $(if $(filter $(FIRST_ARG),$@), \ $(error "$@ cannot be the first argument. Use '$(MAKE) help|list_config_targets' to get a list of all possible [configuration] targets."),@#) -.PHONY: clean - CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~") #help: diff --git a/Tools/docker_run.sh b/Tools/docker_run.sh index 7a319ee379..298aade6ef 100755 --- a/Tools/docker_run.sh +++ b/Tools/docker_run.sh @@ -1,15 +1,28 @@ #! /bin/bash +if [ -z "$PX4_DOCKER_REPO" ]; then + PX4_DOCKER_REPO=px4io/px4-dev-nuttx:2017-01-14 +fi + PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) SRC_DIR=$PWD/../ CCACHE_DIR=${HOME}/.ccache mkdir -p ${CCACHE_DIR} +X11_TMP=/tmp/.X11-unix + docker run -it --rm -w ${SRC_DIR} \ - -v ${SRC_DIR}:${SRC_DIR}:rw \ - -v /tmp/.X11-unix:/tmp/.X11-unix:ro \ - -v ${CCACHE_DIR}:${CCACHE_DIR}:rw \ + -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \ + -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \ -e CCACHE_DIR=${CCACHE_DIR} \ + -e CI=${CI} \ + -e DISPLAY=$DISPLAY \ + -e GIT_SUBMODULES_ARE_EVIL=1 \ -e LOCAL_USER_ID=`id -u` \ - px4io/px4-dev-nuttx:2017-01-08 /bin/bash -c "$@" + -e TRAVIS_BRANCH=${TRAVIS_BRANCH} \ + -e TRAVIS_BUILD_ID=${TRAVIS_BUILD_ID} \ + -v ${CCACHE_DIR}:${CCACHE_DIR}:rw \ + -v ${SRC_DIR}:${SRC_DIR}:rw \ + -v ${X11_TMP}:${X11_TMP}:ro \ + ${PX4_DOCKER_REPO} /bin/bash -c "$@" diff --git a/Tools/s3_deploy.py b/Tools/s3_deploy.py deleted file mode 100755 index 351e830b95..0000000000 --- a/Tools/s3_deploy.py +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env python - -import glob -import zipfile -import os -import re -import shutil - -S3_DIR = 's3deploy-branch' -S3_ARCHIVE_DIR = 's3deploy-archive' - -if not os.path.isdir(S3_DIR): - os.mkdir(S3_DIR) - -if not os.path.isdir(S3_ARCHIVE_DIR): - os.mkdir(S3_ARCHIVE_DIR) - -shutil.copy("Firmware.zip", S3_ARCHIVE_DIR) - -def extract_file_only(filename, dest): - # extract firmware files without paths - f_src = archive.open(filename, 'r') - data = f_src.read() - with open(os.path.join(dest, - os.path.basename(filename)), 'w') as f_dst: - f_dst.write(data) - f_src.close() - -# get all zip files in Packages directory -for zip_filename in glob.glob("Packages/*.zip"): - - # open zipfile - with zipfile.ZipFile(zip_filename, 'r') as archive: - - # look for interesting names - for filename in archive.namelist(): - - # extract firmware files - if os.path.splitext(filename)[1] == '.px4': - extract_file_only(filename, S3_DIR) - - # copy px4fmu-v4_default xml files for qgroundcontrol - if re.match(filename, r'.*px4fmu-v4_default.*\.xml') is not None: - extract_file_only(filename, S3_DIR) diff --git a/Tools/s3put.sh b/Tools/s3put.sh new file mode 100755 index 0000000000..34a04fdf76 --- /dev/null +++ b/Tools/s3put.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +filename=${1} + +# Requires these ENV variables +# AWS_ACCESS_KEY_ID +# AWS_SECRET_ACCESS_KEY +# AWS_S3_BUCKET + +[ -z "$AWS_ACCESS_KEY_ID" ] && { echo "ERROR: Need to set AWS_ACCESS_KEY_ID"; exit 1; } +[ -z "$AWS_SECRET_ACCESS_KEY" ] && { echo "ERROR: Need to set AWS_SECRET_ACCESS_KEY"; exit 1; } +[ -z "$AWS_S3_BUCKET" ] && { echo "ERROR: Need to set AWS_S3_BUCKET"; exit 1; } + +if [ -f ${filename} ]; then + base_file_name=`basename $filename` + short_file_name=${base_file_name#nuttx-} + s3cmd --access_key=${AWS_ACCESS_KEY_ID} --secret_key=${AWS_SECRET_ACCESS_KEY} put ${filename} s3://${AWS_S3_BUCKET}/${short_file_name} +else + echo "ERROR: ${file} doesn't exist" + exit 1 +fi diff --git a/Tools/tag_to_version.py b/Tools/tag_to_version.py old mode 100644 new mode 100755 index fe597ac71d..d09c104901 --- a/Tools/tag_to_version.py +++ b/Tools/tag_to_version.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python + import subprocess import os import argparse diff --git a/cmake/nuttx/px4_impl_nuttx.cmake b/cmake/nuttx/px4_impl_nuttx.cmake index 8edaf25dea..f1fc0f9655 100644 --- a/cmake/nuttx/px4_impl_nuttx.cmake +++ b/cmake/nuttx/px4_impl_nuttx.cmake @@ -267,7 +267,7 @@ function(px4_nuttx_add_export) add_custom_target(nuttx_patch_${CONFIG}) foreach(patch ${nuttx_patches}) get_filename_component(patch_file_name ${patch} NAME) - message(STATUS "NuttX patch: nuttx-patches/${patch_file_name}") + message(STATUS "${CONFIG} NuttX patch: nuttx-patches/${patch_file_name}") string(REPLACE "/" "_" patch_name "nuttx_patch_${patch_file_name}-${CONFIG}") set(patch_stamp ${nuttx_src}/${patch_name}.stamp)