forked from Archive/PX4-Autopilot
Moved deployment logic to python scripts.
This commit is contained in:
parent
50159cabbe
commit
a0fff97fd2
|
@ -20,8 +20,9 @@
|
||||||
Archives/*
|
Archives/*
|
||||||
Build/*
|
Build/*
|
||||||
Testing/
|
Testing/
|
||||||
Binaries/*
|
Packages/*
|
||||||
Meta/*
|
s3deploy-branch/
|
||||||
|
s3deploy-archive/
|
||||||
build/*
|
build/*
|
||||||
build_*/
|
build_*/
|
||||||
core
|
core
|
||||||
|
|
|
@ -78,9 +78,7 @@ script:
|
||||||
after_success:
|
after_success:
|
||||||
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||||
make package_firmware && mkdir s3deploy-archive && cp Firmware.zip s3deploy-archive/
|
make package_firmware && mkdir s3deploy-archive && cp Firmware.zip s3deploy-archive/
|
||||||
&& cp Binaries/* .
|
&& Tools/s3_deploy.py;
|
||||||
&& find . -maxdepth 1 -mindepth 1 -type f -name 'nuttx-*-default.px4' | sed 's/.\/nuttx-//' | sed 's/-default.px4//' | xargs -I{} mv nuttx-{}-default.px4 {}_default.px4
|
|
||||||
&& mkdir s3deploy-branch && mv *_default.px4 Meta/px4fmu-v4_default/parameters.xml Meta/px4fmu-v4_default/airframes.xml s3deploy-branch/;
|
|
||||||
fi
|
fi
|
||||||
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "$GCC_VER" == "5.4" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
- if [[ "${TRAVIS_OS_NAME}" = "linux" && "$GCC_VER" == "5.4" && "${TRAVIS_BRANCH}" != "coverity" ]]; then
|
||||||
export PX4_S3_DEPLOY=1;
|
export PX4_S3_DEPLOY=1;
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -300,7 +300,7 @@ clang-tidy:
|
||||||
@$(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:
|
package_firmware:
|
||||||
@zip --junk-paths Firmware.zip `find Binaries/. -name \*.px4`
|
@./Tools/package_firmware.py
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@rm -rf build_*/
|
@rm -rf build_*/
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import glob
|
||||||
|
import zipfile
|
||||||
|
import os
|
||||||
|
|
||||||
|
FIRMWARE_FILE = 'Firmware.zip'
|
||||||
|
|
||||||
|
|
||||||
|
def extract_file_only(filename, dest):
|
||||||
|
"""
|
||||||
|
Extract a file without keeping directories.
|
||||||
|
"""
|
||||||
|
# extract firmware files without paths
|
||||||
|
f_src = archive.open(filename, 'r')
|
||||||
|
data = f_src.read()
|
||||||
|
dst_name = os.path.join(dest, os.path.basename(filename))
|
||||||
|
with open(dst_name, 'w') as f_dst:
|
||||||
|
f_dst.write(data)
|
||||||
|
f_src.close()
|
||||||
|
|
||||||
|
# open destination archive
|
||||||
|
with zipfile.ZipFile(FIRMWARE_FILE, 'w') as dest_archive:
|
||||||
|
|
||||||
|
# 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 src_filename in archive.namelist():
|
||||||
|
|
||||||
|
# extract firmware files
|
||||||
|
if os.path.splitext(src_filename)[1] == '.px4':
|
||||||
|
base_name = os.path.basename(src_filename)
|
||||||
|
dest_archive.writestr(base_name, archive.read(src_filename))
|
|
@ -0,0 +1,44 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
import glob
|
||||||
|
import zipfile
|
||||||
|
import os
|
||||||
|
import re
|
||||||
|
import shutil
|
||||||
|
|
||||||
|
S3_DIR = 's3deploy-branch'
|
||||||
|
S3_ARCHIVE_DIR = 's3deploy-branch'
|
||||||
|
|
||||||
|
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.copyfile(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)
|
Loading…
Reference in New Issue