Skip to content

Commit

Permalink
packets_creation: add the icub packet creation via gh action
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicogene committed Jan 7, 2021
1 parent 12d4458 commit 5c016e1
Show file tree
Hide file tree
Showing 5 changed files with 303 additions and 122 deletions.
6 changes: 3 additions & 3 deletions .ci/create_icub-common_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -185,10 +185,10 @@ fini()
rm "$_CONTROL_FILE"
fi

export ICUB_PACKAGE_NAME="icub-common_${ICUB_PACKAGE_VERSION}-${ICUB_DEBIAN_REVISION_NUMBER}~${PLATFORM_RELEASE}_${PLATFORM_HARDWARE}.deb"
echo $ICUB_PACKAGE_NAME > ICUB_PACKAGE_NAME.txt
export ICUB_COMMON_PACKAGE_NAME="icub-common_${ICUB_PACKAGE_VERSION}-${ICUB_DEBIAN_REVISION_NUMBER}~${PLATFORM_RELEASE}_${PLATFORM_HARDWARE}.deb"
echo $ICUB_COMMON_PACKAGE_NAME > ICUB_COMMON_PACKAGE_NAME.txt
ls
log "${COL_OK}${ICUB_PACKAGE_NAME} CREATED"
log "${COL_OK}${ICUB_COMMON_PACKAGE_NAME} CREATED"
}

check_and_install_deps()
Expand Down
214 changes: 175 additions & 39 deletions .ci/create_icub-main_deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ VARS_FILE="${SCRIPT_PATH}/packages_vars.sh"
_WHO_AM_I=$(whoami)
_EQUIVS_BIN=$(which equivs-build || true)
_LSB_BIN=$(which lsb_release || true)
_PLATFORM_KEY=""
__PLATFORM_RELEASE=""
_PLATFORM_HARDWARE=""
_CONTROL_FILE=""
ICUB_SCRIPT_DIR=$(pwd)


# #####################################################

print_defs ()
Expand All @@ -52,7 +55,7 @@ print_defs ()
echo " _WHO_AM_I is $_WHO_AM_I"
echo " _EQUIVS_BIN is $_EQUIVS_BIN"
echo " _LSB_BIN is $_LSB_BIN"
echo " _PLATFORM_KEY is $_PLATFORM_KEY"
echo " __PLATFORM_RELEASE is $__PLATFORM_RELEASE"
echo " _PLATFORM_HARDWARE is $_PLATFORM_HARDWARE"
echo " _CONTROL_FILE is $_CONTROL_FILE "
}
Expand Down Expand Up @@ -161,9 +164,9 @@ init()
;;
esac

_CONTROL_FILE="icub-common.${_PLATFORM_RELEASE}-${PLATFORM_HARDWARE}.control"
_CONTROL_FILE="icub.${_PLATFORM_RELEASE}-${PLATFORM_HARDWARE}.control"

if [ "$PACKAGE_VERSION" == "" ]; then
if [ "$ICUB_PACKAGE_VERSION" == "" ]; then
exit_err "Package version string is empty"
fi

Expand All @@ -179,31 +182,34 @@ init()
exit_err "Distro $_PLATFORM_HARDWARE is not supported, we support only $SUPPORTED_TARGET_LIST"
fi

if [ "$_WHO_AM_I" != "root" ]; then
sudo apt-get update
else
apt-get update
fi

log "$0 ${COL_OK}STARTED"
}

fini()
{
if [ -f "$_CONTROL_FILE" ]; then
rm "$_CONTROL_FILE"
fi

log "$0 ${COL_OK}ENDED"
echo $ICUB_MAIN_PACKAGE_NAME > ${ICUB_SCRIPT_DIR}/ICUB_MAIN_PACKAGE_NAME.txt
mv $ICUB_MAIN_PACKAGE_NAME ${ICUB_SCRIPT_DIR}
ls
log "${COL_OK}${ICUB_MAIN_PACKAGE_NAME} CREATED"
}

check_and_install_deps()
{
export DEBIAN_FRONTEND=noninteractive

if [ "$_WHO_AM_I" != "root" ]; then
sudo apt-get update
else
apt-get update
export _SUDO=sudo
fi
if [ "$_LSB_BIN" == "" ]; then
if [ "$_WHO_AM_I" != "root" ]; then
log "installing lsb_release, so we may need your password"
sudo apt-get install -y lsb-release
$_SUDO apt-get install -y lsb-release
else
log "installing lsb_release"
apt-get install -y lsb-release
Expand All @@ -213,7 +219,7 @@ check_and_install_deps()
if [ "$_EQUIVS_BIN" == "" ]; then
if [ "$_WHO_AM_I" != "root" ]; then
log "installing equivs, so we may need your password"
sudo apt-get install -y equivs
$_SUDO apt-get install -y equivs
else
log "installing equivs"
apt-get install -y equivs
Expand All @@ -222,45 +228,175 @@ check_and_install_deps()
fi
}

create_control_file()

create_deb()
{
_ICUB_COMMON_DEPENDENCIES=""
for dep in $ICUB_DEPS_COMMON ; do
if [ "$_ICUB_COMMON_DEPENDENCIES" == "" ]; then
_ICUB_COMMON_DEPENDENCIES="$dep"
else
_ICUB_COMMON_DEPENDENCIES="${_ICUB_COMMON_DEPENDENCIES}, $dep"
fi
done
_PLAT_DEPS_TAG="ICUB_DEPS_${_PLATFORM_RELEASE}"
for pdep in ${!_PLAT_DEPS_TAG} ; do
if [ "$_ICUB_COMMON_DEPENDENCIES" == "" ]; then
_ICUB_COMMON_DEPENDENCIES="$pdep"
else
_ICUB_COMMON_DEPENDENCIES="${_ICUB_COMMON_DEPENDENCIES}, $pdep"
fi
done
echo "Package: icub-common
Version: ${PACKAGE_VERSION}-${ICUB_DEBIAN_REVISION_NUMBER}~${_PLATFORM_RELEASE}
# Generate dpkg DEBIAN folder
mkdir -p ${D_ICUB_INSTALL_DIR}/DEBIAN
# Generate 'conffiles' file
touch ${D_ICUB_INSTALL_DIR}/DEBIAN/conffiles

# Generate dpkg DEBIAN/control file
touch ${D_ICUB_INSTALL_DIR}/DEBIAN/control
mkdir -p ${D_ICUB_INSTALL_DIR}/usr/share/doc/icub
cp ${D_ICUB_ROOT}/COPYING ${D_ICUB_INSTALL_DIR}/usr/share/doc/icub/copyright
cp ${D_ICUB_ROOT}/AUTHORS ${D_ICUB_INSTALL_DIR}/usr/share/doc/icub/AUTHORS
touch ${D_ICUB_INSTALL_DIR}/DEBIAN/md5sums

_CONTROL_FILE=${D_ICUB_INSTALL_DIR}/DEBIAN/control

SIZE=$(du -s $D_ICUB_INSTALL_DIR/)
SIZE=$(echo $SIZE | awk '{ split($0, array, "/" ); print array[1] }')
echo "Size: $SIZE"
echo "Package: icub
Version: ${ICUB_PACKAGE_VERSION}-${ICUB_DEBIAN_REVISION_NUMBER}~${_PLATFORM_RELEASE}
Section: contrib/science
Priority: optional
Architecture: $_PLATFORM_HARDWARE
Depends: $_ICUB_COMMON_DEPENDENCIES, cmake (>=${CMAKE_MIN_REQ_VER})
Depends: icub-common (= ${ICUB_PACKAGE_VERSION}~${_PLATFORM_RELEASE}), yarp (>= ${YARP_REQUIRED_VERSION})
Installed-Size: $SIZE
Homepage: http://www.icub.org
Maintainer: ${ICUB_PACKAGE_MAINTAINER}
Description: List of dependencies for iCub software (metapackage)
This metapackage lists all the dependencies needed to install the icub platform software or to download the source code and compile it directly onto your machine." | tee $_CONTROL_FILE
Description: Software platform for iCub humanoid robot with simulator.
The iCub is the humanoid robot developed as part of the European project
RobotCub and subsequently adopted by more than 20 laboratories worldwide.
It has 53 motors that move the head, arms & hands, waist, and legs. It can
see and hear, it has the sense of proprioception and movement.
.
This package provides the standard iCub software platform and apps to
interact with the real iCub robot, or with the included simulator." | tee $_CONTROL_FILE

# Build package
export ICUB_MAIN_PACKAGE_NAME="iCub${ICUB_PACKAGE_VERSION}-${ICUB_DEBIAN_REVISION_NUMBER}~${_PLATFORM_RELEASE}.deb"
echo $ICUB_MAIN_PACKAGE_NAME
cd ${D_ICUB_INSTALL_DIR} && dpkg -b ${D_ICUB_INSTALL_DIR} $ICUB_MAIN_PACKAGE_NAME
if [ "$?" != "0" ]; then
echo "Error: unable to build the package"
exit 1
fi

}

create_deb()
install_deps()
{
$_EQUIVS_BIN $_CONTROL_FILE
###------------------- Handle cmake ----------------------###
echo "Installing CMAKE in the environment"

if [ "$_PLATFORM_RELEASE" == "bionic" ]; then
wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | $_SUDO apt-key add -
$_SUDO apt-add-repository 'deb https://apt.kitware.com/ubuntu/ bionic main'
DEBIAN_FRONTEND=noninteractive; $_SUDO apt-get install $APT_OPTIONS cmake
else
DEBIAN_FRONTEND=noninteractive; $_SUDO apt-get install $APT_OPTIONS cmake
fi

if [ "$?" != "0" ]; then
echo "Error: unable to install cmake"
exit 1
fi

###------------------- Handle YCM ----------------------###
echo "Installing YCM package"
YCM_URL_TAG="YCM_PACKAGE_URL_${_PLATFORM_RELEASE}"
wget ${!YCM_URL_TAG} -O /tmp/ycm.deb
DEBIAN_FRONTEND=noninteractive; $_SUDO dpkg --ignore-depends=libjs-sphinxdoc -i /tmp/ycm.deb; $_SUDO apt-get install $APT_OPTIONS -f

if [ "$?" != "0" ]; then
echo "Error: unable to install ycm"
exit 1
fi

###----------- Handle iCub deps from icub-common -------###
echo "Installing icub-common dependencies in the environment"
DEP_TAG="ICUB_DEPS_${_PLATFORM_RELEASE}"
_DEPENDENCIES="$ICUB_DEPS_COMMON ${!DEP_TAG}"
DEBIAN_FRONTEND=noninteractive; $_SUDO apt-get install $APT_OPTIONS $_DEPENDENCIES

if [ "$?" != "0" ]; then
echo "Error: unable to install dependencies"
exit 1
fi

###------------------- Handle IpOpt --------------------###
## It seems already handeled by $_SUDO apt install coinor-libipopt-dev

###------------------- Handle YARP --------------------###
echo "Installing YARP package"
YARP_URL_TAG="YARP_PACKAGE_URL_${_PLATFORM_RELEASE}"
wget ${!YARP_URL_TAG} -O /tmp/yarp.deb
DEBIAN_FRONTEND=noninteractive; $_SUDO dpkg -i /tmp/yarp.deb

if [ "$?" != "0" ]; then
echo "Error: unable to install yarp"
exit 1
fi
}

build_icub() {

#echo "Cloning icub sources from ${ICUB_REPO_URL}"
#git clone $ICUB_REPO_URL
#if [ "$?" != "0" ]; then
# echo "Error: unable to clone icub repositoy from ${ICUB_REPO_URL}"
# exit 1
#fi
cd ${ICUB_SCRIPT_DIR}
export D_ICUB_ROOT=$(pwd)
git checkout v$ICUB_PACKAGE_VERSION
if [ "$?" != "0" ]; then
echo "Error: unable to checkout to v$ICUB_PACKAGE_VERSION"
exit 1
fi

mkdir build && cd build

CMAKE_OPTIONS_TAG="CMAKE_OPTIONS_${PLATFORM_KEY}"
_SPECIAL_DIST_CMAKE_OPTIONS="${!CMAKE_OPTIONS_TAG}"
export D_ICUB_INSTALL_DIR=$(pwd)/install
cmake $ICUB_CMAKE_OPTIONS -DCMAKE_INSTALL_PREFIX=$D_ICUB_INSTALL_DIR/usr ..

make -j && make install
if [ "$?" != "0" ]; then
echo "Error: unable to checkout to build and/or install icub-main"
exit 1
fi
}

fix_relocatable_files(){
ICUB_INI_PATH="$D_ICUB_INSTALL_DIR/usr/share/yarp/config/path.d"
ICUB_INI_FILE="iCub.ini"

echo "Fixing iCub.ini in path.d"
# this fixes missing iCub.ini file
if [ ! -e "${ICUB_INI_PATH}/${ICUB_INI_FILE}" ]
then
mkdir -p $ICUB_INI_PATH
ls $ICUB_INI_PATH
touch ${ICUB_INI_PATH}/${ICUB_INI_FILE}
echo ###### This file is automatically generated by CMake. >> ${ICUB_INI_PATH}/${ICUB_INI_FILE}
echo [search iCub] >> ${ICUB_INI_PATH}/${ICUB_INI_FILE}
echo path "/usr/share/iCub">> ${ICUB_INI_PATH}/${ICUB_INI_FILE}
fi
echo "Fix path inside cmake files"
_cmake_files=$(find ${D_ICUB_INSTALL_DIR} -name "*.cmake")
for f in $_cmake_files ; do
sed -i "s|$D_ICUB_INSTALL_DIR||g" $f
done

echo "Fix path inside ini files"
_ini_files=$(find ${D_ICUB_INSTALL_DIR} -name "*.ini")
for f in $_ini_files ; do
sed -i "s|$D_ICUB_INSTALL_DIR||g" $f
done

}

main()
{
create_control_file
install_deps
build_icub
# Probably this step is not needed anymore after cmake components/modernization
fix_relocatable_files
create_deb
}

Expand Down
39 changes: 35 additions & 4 deletions .ci/packages_vars.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,47 @@
# LATEST MODIFICATION DATE (YYYY-MM-DD): 2020-06-11
#
YCM_PACKAGE="ycm-cmake-modules"
YCM_PACKAGE_URL_bionic="https://launchpad.net/~robotology/+archive/ubuntu/ppa/+files/${YCM_PACKAGE}_0.12.0-1~ubuntu18.04~robotology1_all.deb"
YCM_PACKAGE_URL_buster="https://launchpad.net/~robotology/+archive/ubuntu/ppa/+files/${YCM_PACKAGE}_0.12.0-1_all.deb"
YCM_PACKAGE_URL_focal="https://launchpad.net/~robotology/+archive/ubuntu/ppa/+files/${YCM_PACKAGE}_0.12.0-1_all.deb"
YCM_REQUIRED_VERSION="0.12.0"
YCM_PACKAGE_URL_buster="https://github.com/robotology/ycm/releases/download/v${YCM_REQUIRED_VERSION}/${YCM_PACKAGE}_${YCM_REQUIRED_VERSION}-1.debian10.robotology1_all.deb"
YCM_PACKAGE_URL_bionic="https://github.com/robotology/ycm/releases/download/v${YCM_REQUIRED_VERSION}/${YCM_PACKAGE}_${YCM_REQUIRED_VERSION}-1.ubuntu18.04.robotology2_all.deb"
YCM_PACKAGE_URL_focal="https://github.com/robotology/ycm/releases/download/v${YCM_REQUIRED_VERSION}/${YCM_PACKAGE}_${YCM_REQUIRED_VERSION}-1.ubuntu20.04.robotology1_all.deb"

YARP_REQUIRED_VERSION="3.4.0"
YARP_PACKAGE_URL_buster="https://github.com/robotology/yarp/releases/download/v${YARP_REQUIRED_VERSION}/yarp-${YARP_REQUIRED_VERSION}-2.buster_amd64.deb"
YARP_PACKAGE_URL_bionic="https://github.com/robotology/yarp/releases/download/v${YARP_REQUIRED_VERSION}/yarp-${YARP_REQUIRED_VERSION}-2.bionic_amd64.deb"
YARP_PACKAGE_URL_focal="https://github.com/robotology/yarp/releases/download/v${YARP_REQUIRED_VERSION}/yarp-${YARP_REQUIRED_VERSION}-2.focal_amd64.deb"

APT_OPTIONS="-q -y"

SUPPORTED_DISTRO_LIST="buster bionic focal"
SUPPORTED_TARGET_LIST="amd64"
CMAKE_MIN_REQ_VER="3.12.0"
ICUB_DEPS_COMMON="libace-dev libboost-filesystem-dev libboost-system-dev libboost-thread-dev libc6 python3 libgsl0-dev libncurses5-dev libsdl1.2-dev subversion git gfortran libxmu-dev libode-dev wget unzip qtbase5-dev qtdeclarative5-dev qtmultimedia5-dev libqt5svg5 libqt5opengl5-dev libopencv-dev freeglut3-dev libtinyxml-dev libblas-dev coinor-libipopt-dev liblapack-dev libmumps-dev qml-module-qtmultimedia qml-module-qtquick-dialogs qml-module-qtquick-controls libedit-dev libeigen3-dev libjpeg-dev libsimbody-dev libxml2-dev libjs-underscore portaudio19-dev ${YCM_PACKAGE}"
ICUB_DEPS_bionic="libode6"
ICUB_DEPS_focal="libode8"
ICUB_DEPS_buster="libode8"
ICUB_REPO_URL="https://github.com/robotology/icub-main"
#TO BE CHANGED!!!
ICUB_REPO_URL="https://github.com/Nicogene/icub-main.git"
ICUB_PACKAGE_MAINTAINER="Matteo Brunettini <matteo.brunettini@iit.it>"
export ICUB_DEBIAN_REVISION_NUMBER="1" # Always use a revision number >=1

ICUB_CMAKE_OPTIONS="\
-DCMAKE_BUILD_TYPE=Release \
-DICUB_USE_SDL=ON \
-DICUB_USE_ODE=ON \
-DIPOPT_DIR=/usr \
-DICUB_USE_IPOPT=ON \
-DICUB_USE_GLUT=ON \
-DENABLE_icubmod_canmotioncontrol=OFF \
-DENABLE_icubmod_cartesiancontrollerclient=ON \
-DENABLE_icubmod_cartesiancontrollerserver=ON \
-DENABLE_icubmod_fakecan=ON \
-DENABLE_icubmod_gazecontrollerclient=ON \
-DENABLE_icubmod_skinprototype=ON \
-DENABLE_icubmod_socketcan=ON \
-DENABLE_icubmod_static_grabber=ON \
-DENABLE_icubmod_xsensmtx=OFF \
-DYARP_FORCE_DYNAMIC_PLUGINS=ON"
CMAKE_OPTIONS_focal=""
CMAKE_OPTIONS_bionic=""
CMAKE_OPTIONS_buster=""
Loading

0 comments on commit 5c016e1

Please sign in to comment.