Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ros/humble for v3.20 #1019

Draft
wants to merge 17 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
22 changes: 22 additions & 0 deletions .aports.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,28 @@ repos:
- remote: "mirror"
paths: ["v3.20/ros/noetic"]
archive_paths: ["archives/v3.20/ros/noetic"]
humble-3.20:
main_ref: "master"
deps:
backports-3.20: /home/builder/deps/backports
build_args:
ALPINE_VERSION: "3.20"
ROS_DISTRO: "humble"
envs:
JOBS: 4
PURGE_OBSOLETE: "yes"
STACK_PROTECTOR: "on"
args: ["v3.20/ros/humble"]
repo_path: "/home/builder/packages/humble"
cache_path: "/cache"
sign_key_path: "/home/builder/.abuild/[email protected]"
upload:
- remote: "main"
paths: ["v3.20/ros/humble"]
archive_paths: ["archives/v3.20/ros/humble"]
- remote: "mirror"
paths: ["v3.20/ros/humble"]
archive_paths: ["archives/v3.20/ros/humble"]
backports-3.17:
main_ref: "master"
build_args:
Expand Down
257 changes: 257 additions & 0 deletions v3.20/ros/humble/ros-humble-action-msgs/APKBUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,257 @@
pkgname=ros-humble-action-msgs
_pkgname=action_msgs
pkgver=1.2.1
pkgrel=0
pkgdesc="$_pkgname package for ROS humble"
url="https://index.ros.org/p/$_pkgname"
arch="all"
license="Apache License 2.0"

depends="ros-humble-builtin-interfaces ros-humble-ros-workspace ros-humble-rosidl-default-runtime ros-humble-unique-identifier-msgs ros-humble-builtin-interfaces ros-humble-unique-identifier-msgs"
makedepends="py3-setuptools py3-rosdep py3-rosinstall-generator py3-vcstool chrpath ros-humble-ament-cmake ros-humble-ament-lint-auto ros-humble-ament-lint-common ros-humble-builtin-interfaces ros-humble-rosidl-default-generators ros-humble-unique-identifier-msgs"

subpackages="$pkgname-dbg $pkgname-doc"

source=""
builddir="$startdir/abuild"
srcdir="/tmp/dummy-src-dir"
buildlog="$builddir/ros-abuild-build.log"
checklog="$builddir/ros-abuild-check.log"
statuslog="$builddir/ros-abuild-status.log"
if [ x${GENERATE_BUILD_LOGS} != "xyes" ]; then
buildlog="/dev/null"
checklog="/dev/null"
statuslog="/dev/null"
fi

export ROS_PYTHON_VERSION=3
export PYTHON_VERSION=$(python3 -c 'import sys; print("%i.%i" % (sys.version_info.major, sys.version_info.minor))')
if [ ! -f /usr/ros/humble/setup.sh ]; then
export PYTHONPATH=/usr/ros/humble/lib/python${PYTHON_VERSION}/site-packages:$PYTHONPATH
export AMENT_PREFIX_PATH=/usr/ros/humble
fi
rosinstall="- git:
local-name: action_msgs
uri: https://github.com/ros2-gbp/rcl_interfaces-release.git
version: release/humble/action_msgs/1.2.1-1
"

prepare() {
set -o pipefail
mkdir -p $builddir
echo "preparing" > $statuslog
cd "$builddir"
rm -rf src || true
mkdir -p src
echo "$rosinstall" > pkg.rosinstall
vcs import --shallow --input pkg.rosinstall src
find $startdir -maxdepth 1 -name "*.patch" | while read patchfile; do
echo "Applying $patchfile"
(cd src/* && patch -p1 -i $patchfile)
done
}

build() {
set -o pipefail
echo "building" > $statuslog
cd "$builddir"
if [ -f /usr/ros/humble/setup.sh ]; then
source /usr/ros/humble/setup.sh
fi
mkdir build
cd build
cmake ../src/$_pkgname \
-DCMAKE_INSTALL_PREFIX=/usr/ros/humble \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_INSTALL_LIBDIR=lib 2>&1 | tee $buildlog
make 2>&1 | tee -a $buildlog
}

check() {
if [ -f $startdir/NOCHECK ]; then
echo "Check skipped" | tee $checklog
return 0
fi
set -o pipefail
echo "checking" >> $statuslog
cd "$builddir"
if [ -f /usr/ros/humble/setup.sh ]; then
source /usr/ros/humble/setup.sh
fi
export PYTHONPATH="$builddir"/tmp/pkg/usr/ros/humble/lib/python${PYTHON_VERSION}/site-packages:${PYTHONPATH}
export AMENT_PREFIX_PATH="$builddir"/tmp/pkg/usr/ros/humble:${AMENT_PREFIX_PATH}
export PATH="$builddir"/tmp/pkg/usr/ros/humble/bin:${PATH}
export LD_LIBRARY_PATH="$builddir"/tmp/pkg/usr/ros/humble/lib:${LD_LIBRARY_PATH}
mkdir -p "$builddir"/tmp/pkg
cd build
make install DESTDIR="$builddir"/tmp/pkg
if [ $(make -q test > /dev/null 2> /dev/null; echo $?) -eq 1 ]; then
make test 2>&1 | tee $checklog
fi
}

dbg() {
mkdir -p "$subpkgdir"
default_dbg
}

package() {
echo "packaging" >> $statuslog
mkdir -p "$pkgdir"
cd "$builddir"
export DESTDIR="$pkgdir"

if [ -f /usr/ros/humble/setup.sh ]; then
source /usr/ros/humble/setup.sh
fi
cd build
make install

# Tweak invalid RPATH
find $pkgdir -name "*.so" | while read so; do
chrpath_out=$(chrpath ${so} || true)
if echo ${chrpath_out} | grep -q "R\(UN\)\?PATH="; then
rpath=$(echo -n "${chrpath_out}" | sed -e "s/^.*R\(UN\)\?PATH=//")
if echo "${rpath}" | grep -q -e "\(home\|aports\)"; then
echo "RPATH contains home/aports!: ${rpath}"
rpathfix=$(echo -n "${rpath}" | tr ":" "\n" \
| grep -v -e home | grep -v -e aports \
| tr "\n" ":" | sed -e "s/:$//; s/::/:/;")
echo "Fixing to ${rpathfix}"
chrpath -r ${rpathfix} ${so} || (echo chrpath failed; false)
fi
fi
done

# Tweak hardcoded library versions
find $pkgdir -name "*.cmake" | while read cm; do
libs=$(sed -n '/^set(libraries/{s/^.*"\(.*\)")$/\1/;s/;/ /g;p}' $cm)
for lib in $libs; do
rep=
# lib.so.0.1.2 -> lib.so.0.1
if echo $lib | grep -q -e '\.so\.[0-9]\{1,\}\.[0-9]\{1,\}\.[0-9]\{1,\}$'; then
rep=$(echo $lib | sed -e 's/\(\.so\.[0-9]\{1,\}\.[0-9]\{1,\}\)\.[0-9]\{1,\}$/\1/')
fi
# lib-0.1.so.2 -> lib-0.1.so
if echo $lib | grep -q -e '-[0-9]\{1,\}\.[0-9]\{1,\}\.so\.[0-9]\{1,\}$'; then
rep=$(echo $lib | sed -e 's/\(-[0-9]\{1,\}\.[0-9]\{1,\}\.so\)\.[0-9]\{1,\}$/\1/')
fi

if [ ! -z "$rep" ]; then
if [ -f $rep ]; then
echo "$cm: $lib -> $rep"
sed -e "s|\([\";]\)$lib\([\";]\)|\1$rep\2|g" -i $cm
else
echo "$cm: $lib is specified, but $rep doesn't exist"
fi
fi
done
done

# Install license files
licensedir="$pkgdir"/usr/share/licenses/$pkgname/
cd $builddir/src/$_pkgname
find . \
-iname "license*" -or \
-iname "copyright*" -or \
-iname "copying*" -or \
-iname "gnu-*gpl*" \
| while read file; do
# Copy license files under the source
if echo $file | grep -e '^\./\.'; then
# Omit files under hidden directory
continue
fi
if echo $file | grep -e '^\./build/'; then
# Omit files under build directory
continue
fi
echo "Copying license files from source tree: $file"
install -Dm644 $file "$licensedir"/$file
done
if [ -f $startdir/LICENSE ]; then
# If LICENSE file is in aports directory, copy it
echo "Copying license file from aports"
install -Dm644 $startdir/LICENSE "$licensedir"/LICENSE
fi
if [ -f $startdir/LICENSE_URLS ]; then
# If LICENSE_URLS file is in aports directory, download it
echo "Downloading license file from URLs"
cat $startdir/LICENSE_URLS | while read url; do
echo "- $url"
mkdir -p "$licensedir"
wget -O "$licensedir"/$(basename $url) $url
done
fi
if [ -z "$(find "$licensedir" -type f)" ]; then
# If no explicit license file found, extract from source files
mkdir -p "$licensedir"
echo "Copying license from source file headers"
find . -name "*.h" -or -name "*.c" -or -name "*.cpp" -or -name "*.py" | while read file; do
echo "Checking license header in $file"
tmplicense=$(mktemp)
# Extract heading comment
sed -n '1{/^#!/d};
/\/\*/{/\*\//d; :l0; p; n; /\*\//!b l0; p; q};
/^\s*#/{:l1; /^#!/!p; n; /^\s*#/b l1; q};
/^\s*\/\//{:l2; p; n; /^\s*\/\//b l2; q};' $file > $tmplicense
# Remove comment syntax
sed 's/\/\*//; s/\*\///; s/^s*\/\/\s\{0,1\}//;
s/^ \* \{0,1\}//; s/^\s*# \{0,1\}//; s/\s\+$//;' -i $tmplicense
# Trim empty lines
sed ':l0; /^$/d; n; /^$/!b l0; :l1; n; b l1;' -i $tmplicense
sed '${/^$/d}' -i $tmplicense

if ! grep -i -e "\(license\|copyright\|copyleft\)" $tmplicense > /dev/null; then
# Looks not like a license statement
echo "No license statement"
rm -f $tmplicense
continue
fi

echo "Checking duplication"
licenses=$(mktemp)
find "$licensedir" -type f > $licenses
savethis=true
while read existing; do
if diff -bBiw $tmplicense $existing > /dev/null; then
# Same license statement found
savethis=false
break
fi
done < $licenses

if $savethis; then
# Save license statement
local num=0
while true; do
newfile="$licensedir"/LICENSE.$num
if [ ! -f "$newfile" ]; then
echo "Saving license statement as $newfile"
mv $tmplicense $newfile
break
fi
num=$(expr $num + 1)
done
fi

rm -f $licenses $tmplicense
done
fi
# List license files
echo "License files:"
find "$licensedir" -type f | xargs -n1 echo "-"

echo "finished" >> $statuslog
}

doc() {
mkdir -p $subpkgdir

default_doc
}

if [ -f ./apkbuild_hook.sh ]; then
. ./apkbuild_hook.sh
apkbuild_hook
fi
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 003082c..e4d6438 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -33,6 +33,9 @@ rosidl_generate_interfaces(${PROJECT_NAME}

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
+ list(APPEND AMENT_LINT_AUTO_EXCLUDE
+ ament_cmake_copyright
+ )
ament_lint_auto_find_test_dependencies()
endif()

Loading