解决ros-foxy打包package为deb安装包问题

解决ros-foxy打包package为deb安装包问题

安装依赖

1
sudo apt install python3-bloom python3-rosdep fakeroot debhelper dh-python

rosdep init失败

打开host及相关文件进行修改

1
2
sudo gedit /etc/hosts


在ipv4的部分加入
1
2
3
4
5
6
7
8
185.199.108.133    raw.githubusercontent.com

185.199.109.133 raw.githubusercontent.com

185.199.110.133 raw.githubusercontent.com

185.199.111.133 raw.githubusercontent.com


再次运行sudo rosdep init,需要多尝试几次

rosdep update报错

通过git clone将安装包下载

1
2
git clone https://github.com/ros/rosdistro.git

修改rep3.py

进入路径

1
cd /usr/lib/python3/dist-packages

修改文件
1
sudo gedit rosdep2/rep3.py

将原来的 REP3_TARGETS_URL = ‘https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml’用 # 注释掉,修改成以下代码,主要是把你的文件路径进行替换,下面的文件路径是我装的时候的路径


1
REP3_TARGETS_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/releases/targets.yaml'

替换为
1
2
REP3_TARGETS_URL = 'file:///home/qiang/Documents/rosdistro/releases/targets.yaml'  


其中/home/qiang/Documents/rosdistro为rosdistro文件所在路径,根据文件所在位置改成自己的路径

修改sources_list.py

1
2
sudo gedit rosdep2/sources_list.py


1
DEFAULT_SOURCES_LIST_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list'

替换为
1
2
DEFAULT_SOURCES_LIST_URL = 'file:///home/qiang/Documents/rosdistro/rosdep/sources.list.d/20-default.list'

修改init.py

1
2
sudo gedit rosdistro/__init__.py


1
DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'

替换为
1
2
DEFAULT_INDEX_URL = 'file:///home/qiang/Documents/rosdistro/index-v4.yaml' 

修改20-default.list

1
2
cd /etc/ros/rosdep/sources.list.d 

1
2
sudo gedit 20-default.list


1
2
3
4
5
6
7
8
9
10
11
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx

# generic
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte

# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead


替换为
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17

# os-specific listings first

yaml file:///home/qiang/Documents/rosdistro/rosdep/osx-homebrew.yaml osx



# generic

yaml file:///home/qiang/Documents/rosdistro/rosdep/base.yaml

yaml file:///home/qiang/Documents/rosdistro/rosdep/python.yaml

yaml file:///home/qiang/Documents/rosdistro/rosdep/ruby.yaml

gbpdistro file:///home/qiang/Documents/rosdistro/releases/fuerte.yaml fuerte

修改另一处init.py

1
cd /usr/local/lib/python3.8/dist-packages/rosdistro


1
DEFAULT_INDEX_URL = 'https://raw.githubusercontent.com/ros/rosdistro/master/index-v4.yaml'

替换为
1
DEFAULT_INDEX_URL = 'file:///home/qiang/Documents/rosdistro/index-v4.yaml'

rosdep update

1
rosdep update --include-eol-distros

Build the debian from the package

1
2
3
cd /path/to/pkg_source  # this should be the directory that contains the package.xml 
bloom-generate rosdebian
fakeroot debian/rules binary

解决ros-foxy打包package为deb安装包问题
https://qiangsun89.github.io/2023/07/14/解决ros-foxy打包package为deb安装包问题/
作者
Qiang Sun
发布于
2023年7月14日
许可协议