From f0cc9a6fc194f9fc8d0f3fe5ccb8c24ec1bf1623 Mon Sep 17 00:00:00 2001 From: Sergi Hernandez Juan Date: Mon, 6 Jul 2020 12:47:05 +0200 Subject: [PATCH 1/2] Changed the deprecated auto_ptr for the unique_ptr. Changed the xsd library to generate code with the C++11 standard. --- src/dynamixel_motor.cpp | 4 ++-- src/dynamixel_motor_group.cpp | 6 +++--- src/xml/CMakeLists.txt | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/dynamixel_motor.cpp b/src/dynamixel_motor.cpp index d67ac1f..6648e98 100644 --- a/src/dynamixel_motor.cpp +++ b/src/dynamixel_motor.cpp @@ -438,7 +438,7 @@ void CDynamixelMotor::read_config(std::string &filename,TDynamixel_config &confi { // try to open the specified file try{ - std::auto_ptr cfg(dynamixel_motor_config(filename.c_str(), xml_schema::flags::dont_validate)); + std::unique_ptr cfg(dynamixel_motor_config(filename.c_str(), xml_schema::flags::dont_validate)); // configure the parameters of the controller config.max_angle=cfg->max_angle(); config.min_angle=cfg->min_angle(); @@ -477,7 +477,7 @@ void CDynamixelMotor::load_config(std::string &filename) { // try to open the specified file try{ - std::auto_ptr cfg(dynamixel_motor_config(filename.c_str(), xml_schema::flags::dont_validate)); + std::unique_ptr cfg(dynamixel_motor_config(filename.c_str(), xml_schema::flags::dont_validate)); // configure the parameters of the controller this->set_turn_off_alarms(cfg->alarm_shtdwn()); this->set_position_range(cfg->min_angle(), cfg->max_angle()); diff --git a/src/dynamixel_motor_group.cpp b/src/dynamixel_motor_group.cpp index f29b675..3f4f935 100644 --- a/src/dynamixel_motor_group.cpp +++ b/src/dynamixel_motor_group.cpp @@ -660,7 +660,7 @@ TDynamixelGroup_config CDynamixelMotorGroup::read_config(std::string &filename) { // try to open the specified file try{ - std::auto_ptr cfg(dyn_motor_group_config(filename.c_str(), xml_schema::flags::dont_validate)); + std::unique_ptr cfg(dyn_motor_group_config(filename.c_str(), xml_schema::flags::dont_validate)); config.id.resize(cfg->dyn_motor_config().size()); config.dyn_config.resize(cfg->dyn_motor_config().size()); config.pid_control.resize(cfg->dyn_motor_config().size()); @@ -703,7 +703,7 @@ void CDynamixelMotorGroup::load_config(std::string &filename) { // try to open the specified file try{ - std::auto_ptr cfg(dyn_motor_group_config(filename.c_str(), xml_schema::flags::dont_validate)); + std::unique_ptr cfg(dyn_motor_group_config(filename.c_str(), xml_schema::flags::dont_validate)); pid.resize(cfg->dyn_motor_config().size()); punch.resize(cfg->dyn_motor_config().size()); compliance.resize(cfg->dyn_motor_config().size()); @@ -717,7 +717,7 @@ void CDynamixelMotorGroup::load_config(std::string &filename) this->init_motor(iterator->id()); // load the configuration file full_path=path+iterator->config_file(); - std::auto_ptr motor(dynamixel_motor_config(full_path.c_str(),xml_schema::flags::dont_validate)); + std::unique_ptr motor(dynamixel_motor_config(full_path.c_str(),xml_schema::flags::dont_validate)); this->set_position_range(i,motor->min_angle(),motor->max_angle()); this->set_temperature_limit(i,motor->temp_limit()); this->set_voltage_limits(i,motor->min_voltage(),motor->max_voltage()); diff --git a/src/xml/CMakeLists.txt b/src/xml/CMakeLists.txt index 2dea08f..458170b 100644 --- a/src/xml/CMakeLists.txt +++ b/src/xml/CMakeLists.txt @@ -37,7 +37,7 @@ IF(XSD_FOUND) ADD_CUSTOM_TARGET(xsd_files_gen DEPENDS ${XSD_SOURCES_INT}) ADD_CUSTOM_COMMAND( OUTPUT ${XSD_SOURCES_INT} - COMMAND xsdcxx cxx-tree --generate-serialization ${XSD_FILES} + COMMAND xsdcxx cxx-tree --std c++11 --generate-serialization ${XSD_FILES} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEPENDS ${XSD_PATH_FILES} COMMENT "Parsing the xml template file ${XSD_FILES}") -- GitLab From fe34650736864095c88ff0bdf782a89293f18955 Mon Sep 17 00:00:00 2001 From: Alopez Date: Tue, 3 Nov 2020 16:37:34 +0100 Subject: [PATCH 2/2] Adapted to Ubuntu 18.04 package generation --- .gitlab-ci.yml | 7 +++---- CMakeLists.txt | 2 +- scripts/debian/postinst | 22 ++++++++++++++++++++++ scripts/debian/prerm | 22 ++++++++++++++++++++++ 4 files changed, 48 insertions(+), 5 deletions(-) create mode 100755 scripts/debian/postinst create mode 100644 scripts/debian/prerm diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index e626a67..3ab0cb1 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: docker.io/labrobotica/labrobotica +image: docker.io/labrobotica/labrobotica:latest stages: - build @@ -8,10 +8,9 @@ stages: build-package: stage: build script: + - apt update || apt -y install ca-certificates && apt update # Uncomment to install dependencies -# - apt update # - apt -y install iri--dev - - apt update - apt -y install iri-iriutils-dev iri-comm-dev iri-trajectory-dev iri-dynamixel-dev - apt install -y libxerces-c-dev xsdcxx - mkdir -pv build @@ -30,7 +29,7 @@ update_repo: script: - cd build - "scp -i /root/.ssh/iriLabKeyNopwd -r *dynamixel-motor-cont*.deb irilabo@labrepo.iri.upc.edu:packages/" - - "ssh irilabo@labrepo.iri.upc.edu -i /root/.ssh/iriLabKeyNopwd -tt /home/irilabo/repo_scripts/update_repo.sh dynamixel-motor-cont" + - "ssh irilabo@labrepo.iri.upc.edu -i /root/.ssh/iriLabKeyNopwd -tt /home/irilabo/repo_scripts/update_repo.sh dynamixel-motor-cont $(lsb_release -cs)" only: - tags diff --git a/CMakeLists.txt b/CMakeLists.txt index aa3bc65..a88a31d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,7 +86,7 @@ IF (UNIX) SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "labrobotica - labrobotica@iri.upc.edu") # Uncomment to add the necessary mantainer scripts -# SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/package_scripts/preinst;${CMAKE_SOURCE_DIR}/package_scripts/postinst;${CMAKE_SOURCE_DIR}/package_scripts/prerm;${CMAKE_SOURCE_DIR}/package_scripts/postrm") + SET(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_SOURCE_DIR}/scripts/debian/postinst;${CMAKE_SOURCE_DIR}/scripts/debian/prerm") # Uncomment to add dependencies comma separated # SET(CPACK_DEBIAN_PACKAGE_DEPENDS "iri--dev (>= 1.0~${DISTRIB})") diff --git a/scripts/debian/postinst b/scripts/debian/postinst new file mode 100755 index 0000000..2920ec9 --- /dev/null +++ b/scripts/debian/postinst @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +case "$1" in + configure) + echo " Trying to add library to ldconfig..." + /usr/share/iri/add_lib_to_ld_config.sh -l dynamixel_motor_cont -p && echo " Done." || echo " /usr/share/iri/add_lib_to_ld_config.sh doesn't exists. Download it from iriutils and execute it." + + ;; + abort-upgrade) + + ;; + abort-remove) + + ;; + abort-deconfigure) + + ;; +esac + +exit 0 diff --git a/scripts/debian/prerm b/scripts/debian/prerm new file mode 100644 index 0000000..1632690 --- /dev/null +++ b/scripts/debian/prerm @@ -0,0 +1,22 @@ +#!/bin/bash + +set -e + +case "$1" in + remove) + echo " Trying to remove library from ldconfig..." + /usr/share/iri/remove_lib_from_ld_config.sh -l dynamixel_motor_cont -p && echo " Done." || echo " /usr/share/iri/remove_lib_from_ld_config.sh doesn't exists. Download it from iriutils and execute it." + + ;; + upgrade) + + ;; + deconfigure) + + ;; + failed-upgrade) + + ;; +esac + +exit 0 -- GitLab