Makefile cleanup and travis-ci s3 deploy (#6329)

- pulls more of the travis-ci s3 deploy into the repo so we can potentially migrate to another CI system
 - fixed the sizes output and added verbose compiler version to cmake (#6322)
 - fixed filenames for firmware uploaded to s3 (was broken by the changes yesterday)
 - fixed some broken git version display in cmake
 - Makefile organization
 - simplified .travis.yml
 - added a print to know which config the nuttx patch was being applied to
 - docker_run.sh now respects PX4_DOCKER_REPO for setting the docker image, but defaults to the good production nuttx image
This commit is contained in:
Daniel Agar 2017-01-14 09:38:28 -05:00 committed by GitHub
parent c235b44a90
commit 8caf6c54fa
8 changed files with 169 additions and 227 deletions

View File

@ -4,57 +4,26 @@
language: cpp language: cpp
git: git:
depth: 1000 depth: 2000
matrix: matrix:
fast_finish: true fast_finish: true
include: include:
- os: linux - os: linux
sudo: required sudo: required
env: GCC_VER=5.4
services: services:
- docker - docker
- os: osx - os: osx
sudo: true sudo: true
osx_image: xcode8 osx_image: xcode8
env: CCACHE_CPP2=1
cache: cache:
ccache: true ccache: true
pip: true
directories:
- $HOME/.pip/cache/
- $HOME/Library/Caches/pip
before_install: before_install:
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then - sudo -H easy_install pip
cd ${TRAVIS_BUILD_DIR} - sudo -H pip install empy
&& git fetch --unshallow && git fetch --all --tags - if [ "${TRAVIS_OS_NAME}" = "linux" ]; then sudo apt-get install genromfs; fi
;
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
env: env:
global: global:
@ -64,55 +33,21 @@ env:
- secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA=" - secure: "XknnZHWBbpHbN4f3fuAVwUztdLIu8ej4keC3aQSDofo3uw8AFEzojfsQsN9u77ShWSIV4iYJWh9C9ALkCx7TocJ+xYjiboo10YhM9lH/8u+EXjYWG6GHS8ua0wkir+cViSxoLNaMtmcb/rPTicJecAGANxLsIHyBAgTL3fkbLSA="
# AWS SECRET: $PX4_AWS_SECRET # AWS SECRET: $PX4_AWS_SECRET
- secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk=" - secure: "h6oajlW68dWIr+wZhO58Dv6e68dZHrBLVA6lPXZmheFQBW6Xam1HuLGA0LOW6cL9TnrAsOZ8g4goB58eMQnMEijFZKi3mhRwZhd/Xjq/ZGJOWBUrLoQHZUw2dQk5ja5vmUlKEoQnFZjDuMjx8KfX5ZMNy8A3yssWZtJYHD8c+bk="
- PX4_AWS_BUCKET=px4-travis
script: script:
- ccache -M 1GB; ccache -z
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then - 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 elif [ "${TRAVIS_OS_NAME}" = "osx" ]; then
make tests; make tests;
fi fi
- ccache -s
after_success: after_success:
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then - if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_PULL_REQUEST}" == "false" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
make package_firmware && mkdir s3deploy-archive && cp Firmware.zip s3deploy-archive/ ./Tools/docker_run.sh 'make s3put_firmware AWS_S3_BUCKET="px4-travis/archives/Firmware/${TRAVIS_BRANCH}/${TRAVIS_BUILD_ID}"'
&& Tools/s3_deploy.py; && ./Tools/docker_run.sh 'make s3put_qgc_firmware AWS_S3_BUCKET="px4-travis/Firmware/${TRAVIS_BRANCH}"';
fi
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "$GCC_VER" == "5.4" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
export PX4_S3_DEPLOY=1;
fi fi
deploy: 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 # on tags deploy Firmware.zip to Github releases
- provider: releases - provider: releases
api_key: api_key:
@ -123,7 +58,7 @@ deploy:
tags: true tags: true
all_branches: true all_branches: true
repo: PX4/Firmware repo: PX4/Firmware
condition: $GCC_VER = 5.4 condition: $TRAVIS_OS_NAME = linux
addons: addons:
coverity_scan: coverity_scan:

View File

@ -168,14 +168,26 @@ list(GET config_args 1 BOARD)
list(GET config_args 2 LABEL) list(GET config_args 2 LABEL)
set(target_name "${OS}-${BOARD}-${LABEL}") set(target_name "${OS}-${BOARD}-${LABEL}")
message(STATUS "${target_name}") # version info from git
execute_process(
# The Url for the elf file for crash logging 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}) if (DEFINED ENV{BUILD_URI})
set (BUILD_URI $ENV{BUILD_URI}) set(BUILD_URI $ENV{BUILD_URI})
else() else()
set (BUILD_URI "localhost") set(BUILD_URI "localhost")
endif() endif()
add_definitions(-DBUILD_URI=${BUILD_URI}) 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) set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install path prefix" FORCE)
endif() endif()
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") 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}") set(config_module "configs/${CONFIG}")
include(${config_module}) 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 cmake_policy(SET CMP0054 NEW) # don't dereference quoted variables
endif() 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") set(package-contact "px4users@googlegroups.com")
message(STATUS "VERSION: ${version}")
#============================================================================= #=============================================================================
# find programs and packages # find programs and packages
@ -270,14 +271,12 @@ if (CATKIN_DEVEL_PREFIX)
else() else()
message(FATAL_ERROR "catkin not found") message(FATAL_ERROR "catkin not found")
endif() endif()
else()
#message(STATUS "catkin DISABLED")
endif() endif()
find_package(PythonInterp REQUIRED) find_package(PythonInterp REQUIRED)
#============================================================================= #=============================================================================
# cmake modules # cmake testing
# #
enable_testing() enable_testing()
include(CTest) include(CTest)
@ -299,21 +298,39 @@ foreach(var ${required_variables})
endif() endif()
endforeach() 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 # git
# #
px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg") px4_add_git_submodule(TARGET git_cmake_hexagon PATH "cmake/cmake_hexagon")
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_driverframework PATH "src/lib/DriverFramework") 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_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_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_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 add_custom_target(submodule_clean
WORKING_DIRECTORY ${PX4_SOURCE_DIR} WORKING_DIRECTORY ${PX4_SOURCE_DIR}

144
Makefile
View File

@ -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 # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions # modification, are permitted provided that the following conditions
@ -116,8 +116,7 @@ define cmake-build
+@$(eval BUILD_DIR = $(SRC_DIR)/build_$@$(BUILD_DIR_SUFFIX)) +@$(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 [ $(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 +@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)" +@(cd $(BUILD_DIR) && $(PX4_MAKE) $(PX4_MAKE_ARGS) $(ARGS))
+@$(PX4_MAKE) -C "$(BUILD_DIR)" $(PX4_MAKE_ARGS) $(ARGS)
endef endef
define colorecho define colorecho
@ -151,56 +150,20 @@ posix: posix_sitl_default
broadcast: posix_sitl_broadcast broadcast: posix_sitl_broadcast
# Multi- config targets. # Multi- config targets.
eagle_default: posix_eagle_default qurt_eagle_default eagle_default: posix_eagle_default qurt_eagle_default
eagle_legacy_default: posix_eagle_legacy qurt_eagle_legacy eagle_legacy_default: posix_eagle_legacy qurt_eagle_legacy
excelsior_default: posix_excelsior_default qurt_excelsior_default 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). # 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 # Other targets
# -------------------------------------------------------------------- # --------------------------------------------------------------------
.PHONY: uavcan_firmware compiler_version check check_format format unittest tests qgc_firmware alt_firmware package_firmware clean submodulesclean distclean .PHONY: qgc_firmware alt_firmware checks_bootloaders uavcan_firmware sizes check quick_check
.NOTPARALLEL:
# All targets with just dependencies but no recipe must either be marked as phony (or have the special @: as recipe). # QGroundControl flashable NuttX firmware
.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)
qgc_firmware: \ qgc_firmware: \
check_aerofc-v1_default \ check_aerofc-v1_default \
check_crazyflie_default \ check_crazyflie_default \
@ -211,7 +174,9 @@ qgc_firmware: \
check_px4fmu-v3_default \ check_px4fmu-v3_default \
check_px4fmu-v4_default \ check_px4fmu-v4_default \
check_tap-v1_default \ check_tap-v1_default \
check_sizes
# Other NuttX firmware
alt_firmware: \ alt_firmware: \
check_auav-x21_default \ check_auav-x21_default \
check_px4-stm32f4discovery_default \ check_px4-stm32f4discovery_default \
@ -221,8 +186,7 @@ alt_firmware: \
check_px4fmu-v5_default \ check_px4fmu-v5_default \
check_px4nucleoF767ZI-v1_default \ check_px4nucleoF767ZI-v1_default \
check_s2740vc-v1_default \ check_s2740vc-v1_default \
check_sizes
checks_defaults: qgc_firmware alt_firmware
checks_bootloaders: \ checks_bootloaders: \
check_esc35-v1_bootloader \ check_esc35-v1_bootloader \
@ -231,41 +195,68 @@ checks_bootloaders: \
check_px4flow-v2_bootloader \ check_px4flow-v2_bootloader \
check_s2740vc-v1_bootloader \ check_s2740vc-v1_bootloader \
check_zubaxgnss-v1_bootloader \ check_zubaxgnss-v1_bootloader \
check_sizes
checks_uavcan: \ uavcan_firmware:
check_px4fmu-v4_default_and_uavcan $(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: sizes:
-arm-none-eabi-gcc --version @-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) # All default targets that don't require a special build environment
check: compiler_version checks_defaults checks_bootloaders checks_tests checks_uavcan checks_last sizes 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 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 quick_check: check_posix_sitl_default check_px4fmu-v3_default tests check_format
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
check_%: check_%:
@echo @echo
$(call colorecho,"Building" $(subst check_,,$@)) $(call colorecho,"Building" $(subst check_,,$@))
@$(MAKE) --no-print-directory $(subst check_,,$@) package @$(MAKE) --no-print-directory $(subst check_,,$@)
@mkdir -p Packages
@cp build_$(subst check_,,$@)/*.zip Packages
@rm -rf build_$(subst check_,,$@)
@echo @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 unittest: posix_sitl_default
$(call cmake-build,unittest,$(SRC_DIR)/unittests) $(call cmake-build,unittest,$(SRC_DIR)/unittests)
@(cd build_unittest && ctest -j2 --output-on-failure) @(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 @genhtml --legend --show-details --function-coverage --quiet --output-directory coverage-html coverage.info
@$(MAKE) --no-print-directory posix_sitl_default test_results_junit @$(MAKE) --no-print-directory posix_sitl_default test_results_junit
# Clang analyzers
# --------------------------------------------------------------------
.PHONY: scan-build clang-check clang-tidy
scan-build: scan-build:
@export CCACHE_DISABLE=1 @export CCACHE_DISABLE=1
@mkdir -p $(SRC_DIR)/build_posix_sitl_default_scan-build @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 @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 @$(SRC_DIR)/Tools/clang-tool.sh -b build_posix_sitl_default -t clang-tidy
package_firmware: # Cleanup
@./Tools/package_firmware.py # --------------------------------------------------------------------
.PHONY: clean submodulesclean distclean
clean: clean:
@rm -rf build_*/ @rm -rf $(SRC_DIR)/build_*/
-@$(MAKE) -C NuttX/nuttx clean -@$(MAKE) --no-print-directory -C NuttX/nuttx clean
submodulesclean: submodulesclean:
@git submodule sync --recursive @git submodule sync --recursive
@ -314,13 +312,13 @@ submodulesclean:
distclean: submodulesclean distclean: submodulesclean
@git clean -ff -x -d -e ".project" -e ".cproject" -e ".idea" @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. # All other targets are handled by PX4_MAKE. Add a rule here to avoid printing an error.
%: %:
$(if $(filter $(FIRST_ARG),$@), \ $(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."),@#) $(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~\..*~~") CONFIGS:=$(shell ls cmake/configs | sed -e "s~.*/~~" | sed -e "s~\..*~~")
#help: #help:

View File

@ -1,15 +1,28 @@
#! /bin/bash #! /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 ) PWD=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
SRC_DIR=$PWD/../ SRC_DIR=$PWD/../
CCACHE_DIR=${HOME}/.ccache CCACHE_DIR=${HOME}/.ccache
mkdir -p ${CCACHE_DIR} mkdir -p ${CCACHE_DIR}
X11_TMP=/tmp/.X11-unix
docker run -it --rm -w ${SRC_DIR} \ docker run -it --rm -w ${SRC_DIR} \
-v ${SRC_DIR}:${SRC_DIR}:rw \ -e AWS_ACCESS_KEY_ID=${AWS_ACCESS_KEY_ID} \
-v /tmp/.X11-unix:/tmp/.X11-unix:ro \ -e AWS_SECRET_ACCESS_KEY=${AWS_SECRET_ACCESS_KEY} \
-v ${CCACHE_DIR}:${CCACHE_DIR}:rw \
-e CCACHE_DIR=${CCACHE_DIR} \ -e CCACHE_DIR=${CCACHE_DIR} \
-e CI=${CI} \
-e DISPLAY=$DISPLAY \
-e GIT_SUBMODULES_ARE_EVIL=1 \
-e LOCAL_USER_ID=`id -u` \ -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 "$@"

View File

@ -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)

21
Tools/s3put.sh Executable file
View File

@ -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

2
Tools/tag_to_version.py Normal file → Executable file
View File

@ -1,3 +1,5 @@
#!/usr/bin/env python
import subprocess import subprocess
import os import os
import argparse import argparse

View File

@ -267,7 +267,7 @@ function(px4_nuttx_add_export)
add_custom_target(nuttx_patch_${CONFIG}) add_custom_target(nuttx_patch_${CONFIG})
foreach(patch ${nuttx_patches}) foreach(patch ${nuttx_patches})
get_filename_component(patch_file_name ${patch} NAME) 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}") string(REPLACE "/" "_" patch_name "nuttx_patch_${patch_file_name}-${CONFIG}")
set(patch_stamp ${nuttx_src}/${patch_name}.stamp) set(patch_stamp ${nuttx_src}/${patch_name}.stamp)