summaryrefslogtreecommitdiff
path: root/easynav-simple-common.spec
blob: 1cd8543c85a64f838669bd7becd20456544b7d5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# 由 AI 引包流程生成(build-rpm skill,遵循 spec-rules-ros.md)
# 包:easynav-simple-common —— EasyNavigation/easynav_plugins monorepo 子包
# 形态:ament_cmake;安装前缀 /opt/ros/humble
# 源码结构:monorepo 根为 easynav_plugins 仓库,本包 CMakeLists.txt 位于
#   common/easynav_simple_common/ 子目录,%build 进入该子目录构建。
# 元数据来源:pkgs/easynav-simple-common/ros_pkg_manifest.json(target_version=0.5.0-1)
#   + sources/easynav-simple-common/common/easynav_simple_common/package.xml
#   + sources/easynav-simple-common/common/easynav_simple_common/CMakeLists.txt
# 无 reference 基线、无 package_fix 修正资产、无同语言 lessons,从零按 §2-§7 生成。
#
# 依赖说明(spec-rules-ros.md §6 反幻觉铁律):
#   - ROS 标准包 nav_msgs 已在 ros-projects.list(SIG 源已有)逐项确认,照写 ros-humble-nav-msgs。
#   - easynav_common 属 EasyNavigation 基座框架包(独立基座仓 EasyNavigation/EasyNavigation),
#     ros-projects.list 第 195 行已收录,dep_registry 显示 ros-humble-easynav-common 已
#     build_done(由 easynav-simple-controller 引入),照写 ros-humble-easynav-common。
#   - <test_depend>(ament_cmake_gtest/ament_lint_auto/ament_lint_common)按 §5 不写 BuildRequires。
# 版本说明:target_version=0.5.0-1(清单指定)→ Version 0.5.0(发布号 -1 剥离)。
#   ros_fetch 检出 humble 分支 HEAD=2580d29(仓库虽有 0.5.0 tag 但 HEAD 不在其上,
#   describe 无 tag 命中),用 commit 归档保证产物可追溯(与同批 maps-manager 一致)。

%define ros_distro humble
%define RosPkgName easynav-simple-common

Name:           ros-%{ros_distro}-%{RosPkgName}
Version:        0.5.0
Release:        1%{?dist}
Summary:        Easy Navigation: Simple Common package.

License:        Apache-2.0
URL:            https://github.com/EasyNavigation/easynav_plugins
# 实际检出 commit(ros_fetch checkout humble 分支 HEAD),用于产物追溯
%global commit 2580d29baefe77305c6e9336dca743aa5ce51c2c
# GitHub commit 归档解压根目录 = easynav_plugins-<full-sha>(实测 tar tzf 确认),
# 直接用归档原生目录名,不依赖 build-rpm skill §4 的 tar --transform——
# submit_fix.py 的 transform 前缀取 gate_result version(含 release 号
# 0.5.0-1),与 spec 的 %%autosetup -n(仅 0.5.0)不一致会导致 %%prep cd 失败。
Source0:        https://github.com/EasyNavigation/easynav_plugins/archive/%{commit}.tar.gz

# /opt 前缀下 debug 子包无意义(strip/debugedit 路径非常规),统一关闭
%global debug_package %{nil}
# /opt 下 python 字节码编译会写标准 sitelib 路径,摘掉 brp-python-bytecompile
%global __os_install_post %(echo '%{__os_install_post}' | sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g')
# ROS 包不做自动依赖扫描(.so 全在 /opt/ros 下,由 ament 间接依赖模型替代)
%global __provides_exclude_from ^/opt/ros/%{ros_distro}/.*$
%global __requires_exclude_from ^/opt/ros/%{ros_distro}/.*$

# 基础构建工具链(ament_cmake C++ 构建必需,非 ROS 依赖、非幻觉)
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  make
# ament_cmake 构建工具(package.xml <buildtool_depend>)
BuildRequires:  ros-%{ros_distro}-ament-cmake
# package.xml <depend> —— ROS 标准包(ros-projects.list 已确认 SIG 源已有)
BuildRequires:  ros-%{ros_distro}-nav-msgs
# package.xml <depend>easynav_common</depend>——EasyNavigation 基座框架包
# (独立 EasyNavigation 基座仓,ros-projects.list 第 195 行已收录,dep_registry
# 显示 ros-humble-easynav-common 已 build_done,由 easynav-simple-controller 引入)。
# CMakeLists find_package(easynav_common REQUIRED) + target_link_libraries(
# ... easynav_common::easynav_common),BR 补齐后构建可通过。
# <test_depend>(ament_cmake_gtest/ament_lint_auto/ament_lint_common)按 §5 不写
# BuildRequires,BUILD_TESTING=OFF 关闭测试。
BuildRequires:  ros-%{ros_distro}-easynav-common

# 运行时 Requires(/opt/ros 被 __requires_exclude_from 豁免、autodeps 扫不到,
# 少了这些 Requires 构建照样成功但装上后环境不就绪——spec-rules-ros.md §6)
Requires:       ros-%{ros_distro}-ros-workspace
Requires:       ros-%{ros_distro}-ament-cmake
# package.xml <depend> = build+run(REP 149),运行时 Requires 同上映射
Requires:       ros-%{ros_distro}-nav-msgs
Requires:       ros-%{ros_distro}-easynav-common

# 单包策略:严禁拆实体子包(路径重叠致安装事务冲突),改用虚拟别名兼容依赖方
# (spec-rules-ros.md §7)
Provides:       %{name}-devel = %{version}-%{release}
Provides:       %{name}-doc = %{version}-%{release}
Provides:       %{name}-runtime = %{version}-%{release}

%description
Easy Navigation: Simple Common package.
easynav_simple_common provides the SimpleMap data structures and shared
common code for the EasyNav plugin family, built as an ament_cmake ROS 2
component installed under /opt/ros/%{ros_distro}.

%prep
# GitHub commit 归档原生根目录(实测确认:<repo>-<full-sha>),不依赖 transform
%autosetup -n easynav_plugins-%{commit}

%build
# ROS 基座环境(chroot 可能未装 setup.sh,用 [ -f ] 守卫——|| true 挡不住严格 sh)
[ -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 子包:CMakeLists.txt 位于 common/easynav_simple_common/
cd common/easynav_simple_common
# 显式 out-of-source 构建(规避 openEuler %%cmake 宏位置参数坑,spec-rules-ros.md §5)
mkdir -p .obj
cd .obj
%cmake3 \
    -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
[ -f /opt/ros/%{ros_distro}/setup.sh ] && source /opt/ros/%{ros_distro}/setup.sh || true
# install 阶段起始 cwd 回到解压根,重新进入构建目录
cd common/easynav_simple_common/.obj
%make_install

%files
%license LICENSE
# 整树拥有(spec-rules-ros.md §7,对「装了没打包」类错误免疫;不逐目录精确列)
/opt/ros/%{ros_distro}

%changelog
* Tue Oct 20 2026 AI Importer <ai-importer@opencode.local> - 0.5.0-1
- Fix %prep: use GitHub archive native root dir (easynav_plugins-<commit>)
  instead of relying on tar --transform redirect (fix build 113764 %prep cd failure
  caused by gate version 0.5.0-1 vs spec -n 0.5.0 mismatch)
- Initial RPM package for easynav_simple_common (ROS 2 humble)
- Generated from EasyNavigation/easynav_plugins humble branch (commit 2580d29)
- ament_cmake build type; installs under /opt/ros/humble