diff --git a/.gitignore b/.gitignore index 533c8130..2d9f8e04 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ *.pyc *.DS_Store -/image \ No newline at end of file +/images \ No newline at end of file diff --git a/builder/image-build.sh b/builder/image-build.sh index ff6dc7a6..4f6f7f3d 100755 --- a/builder/image-build.sh +++ b/builder/image-build.sh @@ -21,8 +21,6 @@ export DEBIAN_FRONTEND=${DEBIAN_FRONTEND:='noninteractive'} export LANG=${LANG:='C.UTF-8'} export LC_ALL=${LC_ALL:='C.UTF-8'} -echo "BUILDER_DIR (pwd): $(pwd)" - BUILDER_DIR="$(pwd)" REPO_DIR="$(pwd)/repo" SCRIPTS_DIR="${REPO_DIR}/builder" @@ -32,7 +30,8 @@ IMAGES_DIR="${REPO_DIR}/images" [[ ! -d ${IMAGES_DIR} ]] && mkdir ${IMAGES_DIR} && echo_stamp "Directory ${IMAGES_DIR} was created successful" IMAGE_VERSION="${TRAVIS_TAG:=$(cd ${REPO_DIR}; git log --format=%h -1)}" -REPO_NAME=$(basename -s '.git' $(git remote --verbose | grep origin | grep fetch | cut -f2 | cut -d' ' -f1)) +REPO_URL="$(cd ${REPO_DIR}; git remote --verbose | grep origin | grep fetch | cut -f2 | cut -d' ' -f1)" +REPO_NAME="$(basename -s '.git' ${REPO_URL})" IMAGE_NAME="${REPO_NAME}_${IMAGE_VERSION}.img" IMAGE_PATH="${IMAGES_DIR}/${IMAGE_NAME}" @@ -83,7 +82,7 @@ get_image ${IMAGE_PATH} ${SOURCE_IMAGE} ./image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/init_rpi.sh' '/root/' ./image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/hardware_setup.sh' '/root/' -./image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-init.sh' ${CLEVER_VERSION} $(jq '.source_image' -r ${TARGET_CONFIG}) +./image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-init.sh' ${IMAGE_VERSION} ${SOURCE_IMAGE} ./image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-software.sh' ./image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-network.sh' @@ -96,6 +95,6 @@ get_image ${IMAGE_PATH} ${SOURCE_IMAGE} ./image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/kinetic-rosdep-clever.yaml' '/etc/ros/rosdep/' # ./image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/kinetic-ros-clever.rosinstall' '/home/pi/ros_catkin_ws/' -./image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-ros.sh' ${TARGET_REPO} ${TARGET_REF} False False ${NUMBER_THREADS} +./image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-ros.sh' ${REPO_URL} ${IMAGE_VERSION} False False ${NUMBER_THREADS} ./image-resize.sh ${IMAGE_PATH} diff --git a/builder/image-ros.sh b/builder/image-ros.sh index aec14f34..242788c0 100755 --- a/builder/image-ros.sh +++ b/builder/image-ros.sh @@ -1,12 +1,19 @@ #! /usr/bin/env bash # -# Script for image configure -# @urpylka Artem Smirnov +# Script for build the image. Used builder script of the target repo +# For build: docker run --privileged -it --rm -v /dev:/dev -v $(pwd):/builder/repo smirart/builder +# +# Copyright (C) 2018 Copter Express Technologies +# +# Author: Artem Smirnov +# +# Distributed under MIT License (available at https://opensource.org/licenses/MIT). +# The above copyright notice and this permission notice shall be included in all +# copies or substantial portions of the Software. # -# Exit immidiately on non-zero result -set -e +set -e # Exit immidiately on non-zero result REPO=$1 REF=$2 @@ -105,7 +112,7 @@ if [ "${INSTALL_ROS_PACK_SOURCES}" = "True" ]; then #/home/pi/ros_catkin_ws/src/mavros/mavros/scripts/install_geographiclib_datasets.sh echo_stamp "Building ros_catkin_ws packages" - cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -j$5 -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic + cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -j${NUMBER_THREADS} -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic #echo_stamp "#11 Building light packages on 2 threads" #cd /home/pi/ros_catkin_ws && ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release -j2 --install-space /opt/ros/kinetic --pkg actionlib actionlib_msgs angles async_web_server_cpp bond bond_core bondcpp bondpy camera_calibration_parsers camera_info_manager catkin class_loader cmake_modules cpp_common diagnostic_msgs diagnostic_updater dynamic_reconfigure eigen_conversions gencpp geneus genlisp genmsg gennodejs genpy geographic_msgs geometry_msgs geometry2 image_transport libmavconn mavlink mavros_msgs message_filters message_generation message_runtime mk nav_msgs nodelet orocos_kdl pluginlib python_orocos_kdl ros ros_comm rosapi rosauth rosbag rosbag_migration_rule rosbag_storage rosbash rosboost_cfg rosbridge_library rosbridge_server rosbridge_suite rosbuild rosclean rosconsole rosconsole_bridge roscpp roscpp_serialization roscpp_traits roscreate rosgraph rosgraph_msgs roslang roslaunch roslib roslint roslisp roslz4 rosmake rosmaster rosmsg rosnode rosout rospack rosparam rospy rospy_tutorials rosserial rosserial_client rosserial_msgs rosserial_python rosservice rostest rostime rostopic rosunit roswtf sensor_msgs smclib std_msgs std_srvs stereo_msgs tf tf2 tf2_bullet tf2_eigen tf2_geometry_msgs tf2_kdl tf2_msgs tf2_py tf2_ros tf2_sensor_msgs tf2_tools topic_tools trajectory_msgs urdf urdf_parser_plugin usb_cam uuid_msgs visualization_msgs xmlrpcpp diff --git a/builder_docker/Dockerfile b/builder_docker/Dockerfile index b6627386..0024e09a 100644 --- a/builder_docker/Dockerfile +++ b/builder_docker/Dockerfile @@ -14,4 +14,4 @@ COPY ./*.sh /builder/ COPY ./qemu-arm-resin /builder/qemu-arm-resin WORKDIR /builder -CMD ./image-build.sh +CMD ./repo/builder/image-build.sh