使用deb 打包开发的postgres extension 另外一种方法
已经写过一个deb 包打包的方法,我们同时也可以使用dpkg-deb 命令
安装依赖工具包
- 推荐安装全点的
sudo apt-get install build-essential autoconf automake \
autotools-dev dh-make debhelper devscripts fakeroot \
xutils lintian pbuilder
项目结构
可以参考github项目https://github.com/rongfengliang/nvl-pg-extension
- 项目代码结构
├── DEBIAN
│ └── control
├── Makefile
├── README.md
├── nvlfunc--1.0.sql
├── nvlfunc.control
└── usr
└── share
└── postgresql
└── 10
└── extension
├── nvlfunc--1.0.sql
└── nvlfunc.control
- 说明
DEBIAN/control 以及usr/ 目录内容是核心
打包说明
- control 文件
Package: nvl-pg-extension
Version: 0.2
Maintainer: dalongrong
Architecture: all
Description: nvl-pg-extension
-
deb 包内容
手工创建 usr/share/postgresql/10/extension 目录并添加deb包需要的文件,实际上需要的就是nvlfunc--1.0.sql nvlfunc.control -
打包
dpkg-deb --build nvl-pg-extension/
效果
dpkg -i nvl-pg-extension.deb
(Reading database ... 115428 files and directories currently installed.)
Preparing to unpack nvl-pg-extension.deb ...
Unpacking nvl-pg-extension (0.2) over (0.2) ...
Setting up nvl-pg-extension (0.2) ...
Processing triggers for postgresql-common (199.pgdg18.04+1) ...
Building PostgreSQL dictionaries from installed myspell/hunspell packages...
Removing obsolete dictionary files:
效果
dpkg-deb --build nvl-pg-extension/
dpkg-deb: building package 'nvl-pg-extension' in 'nvl-pg-extension.deb'.
- 安装包
dpkg -i nvl-pg-extension.deb
说明
此种方法比较简单,实际上control 文件可以做好多事情,比如make build。。。,可以参考下面的连接
参考资料
https://coderwall.com/p/urkybq/how-to-create-debian-package-from-source
https://github.com/rongfengliang/nvl-pg-extension
http://www.king-foo.com/2011/11/creating-debianubuntu-deb-packages/
https://www.debian.org/doc/debian-policy/ch-controlfields.html