# 禁止硬编码 distro/包名/版本——一律走宏(spec-rules-ros.md §2) %define ros_distro humble %define RosPkgName nebula-hesai-common # 源码取自 tier4/nebula 仓库 main 分支 HEAD,记录 commit 以保证产物可追溯 %global commit 8ce64073f41c2ec1166334ce7f8fb2edc13c86e5 Name: ros-%{ros_distro}-%{RosPkgName} Version: 1.2.0 Release: 1%{?dist} Summary: Nebula Common Hesai Libraries and headers License: Apache-2.0 URL: https://github.com/tier4/nebula # 实测 GitHub commit 归档解压根目录为纯完整 commit SHA(§2 Source0 归档解压目录名) Source0: https://github.com/tier4/nebula/archive/%{commit}.tar.gz # /opt 前缀下 debug 子包无意义,统一关闭(§2) %global debug_package %{nil} # 摘掉 brp-python-bytecompile,避免 /opt 下 Python 字节码写入标准 sitelib(§2) %global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g') # ROS 包不做自动依赖扫描,由 ament 间接依赖模型替代(§2) %global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$ %global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$ # 构建工具依赖(buildtool_depend + ament_cmake 形态基座,§5/§6) BuildRequires: ros-%{ros_distro}-ament-cmake BuildRequires: ros-%{ros_distro}-autoware-cmake BuildRequires: ros-%{ros_distro}-ros-environment # ROS 库依赖(package.xml ,§6 反幻觉铁律:同批 sibling nebula-core-common 已在 COPR 递归构建) BuildRequires: ros-%{ros_distro}-nebula-core-common # 运行时 Requires:/opt/ros 被 __requires_exclude_from 豁免、autodeps 扫不到,必须手写(§6) Requires: ros-%{ros_distro}-ros-workspace Requires: ros-%{ros_distro}-ament-cmake Requires: ros-%{ros_distro}-nebula-core-common # 单包策略:禁止拆实体子包,改用虚拟别名兼容依赖方(§7) Provides: %{name}-devel = %{version}-%{release} Provides: %{name}-doc = %{version}-%{release} Provides: %{name}-runtime = %{version}-%{release} %description Nebula Common Hesai Libraries and headers — TIER IV Nebula 激光雷达驱动栈中 Hesai 传感器的公共头文件 INTERFACE 库,提供 Hesai 驱动各子包共享的类型定义与接口。 构建自 tier4/nebula monorepo(包名:nebula_hesai_common)。 %prep # 归档解压根目录为纯完整 commit SHA,已实测确认(§2) %autosetup -n %{commit} %build # ROS 基座环境引导:setup.sh 可能不存在,须用 [ -f ] 守卫(§4) [ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true export PYTHONPATH=/opt/ros/%{ros_distro}/lib/python%{python3_version}/site-packages${PYTHONPATH:+:$PYTHONPATH} export PKG_CONFIG_PATH=/opt/ros/%{ros_distro}/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH} # monorepo 子目录构建:nebula_hesai_common 位于 src/nebula_hesai/nebula_hesai_common cd src/nebula_hesai/nebula_hesai_common mkdir -p .obj cd .obj # ament_cmake 形态:显式 out-of-source 构建,避免 cmake 宏位置参数坑(§3/§5/§9) cmake \ -DCMAKE_INSTALL_PREFIX="/opt/ros/%{ros_distro}" \ -DAMENT_PREFIX_PATH="/opt/ros/%{ros_distro}" \ -DCMAKE_PREFIX_PATH="/opt/ros/%{ros_distro}" \ -UINCLUDE_INSTALL_DIR -ULIB_INSTALL_DIR -USYSCONF_INSTALL_DIR -USHARE_INSTALL_PREFIX -ULIB_SUFFIX \ -DSETUPTOOLS_DEB_LAYOUT=OFF \ -DBUILD_TESTING=OFF \ .. %make_build %install cd src/nebula_hesai/nebula_hesai_common/.obj %make_install DESTDIR=%{buildroot} %files # 整树拥有 /opt/ros/,对"装了没打包"类错误免疫(§7) /opt/ros/%{ros_distro} %changelog * Thu Oct 08 2026 AI Importer - 1.2.0-1 - 初始引入 ros-humble-nebula-hesai-common - Version 取自 manifest target_version 1.2.0;源码为 tier4/nebula main 分支 HEAD(commit 8ce6407)