Files
documents/4.2-new-pkg/new-pkg.md
Zhang, Guodong 1c347d43a7 添加修改大纲
新文件:   4.2-new-pkg/new-pkg.md
Signed-off-by: Zhang, Guodong <gdzhang@linx-info.com>
2016-03-03 15:02:46 +08:00

100 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 总体目标 #
## 软件包依赖存储到软件包中 ##
### 使用实现简单合理的存储格式 ###
1. 备选json理由格式简单易读有现成的解析库内容可以根据需求自定义。
2. 基于json设计4.2软件包的control文件
通过分析dependency.xml 以及 debian redhat 的control文件和spec文件设计出合理的可扩展的定义格式
3. control文件命名
control文件存放到软件包的 `/var/lib/pkginfo/control-pkgname.jq`
4. 获取软件包信息
读取软件包信息时可以只读取一个控制文件,节省开销参考命令:
```
tar --wildcards -xvf pkgname.pkg.tar.gz /var/lib/pkginfo/control-*.jq
读取文件信息
```
5. 实现control文件内元素基础解析函数
使用现成的解析库命令行工具jq实现json格式control文件已定义元素的增、删、改、查基本函数。
6. 基于` 上一条`的基本函数实现,多个软件包信息的合并,软件包信息的获取(名称,版本号,依赖等),软件包依赖的计算等。 相当于debian系统中的源索引生成处理工具。
## 拆分applicatons库 ##
使用git命令将applications库中的软件包拆分每个包一个git库。并且保留历史记录。
参考代码:
```
#! /bin/bash
WORKDIR=`cd $(dirname $0) && pwd`
ORIG_GIT=$WORKDIR/applications
echo "$WORKDIR $ORIG_GIT"
info(){
echo $@ 1>&2
}
if [ -d $ORIG_GIT ]
then
info "Found $ORIG_GIT"
else
info "Not found $ORIG_GIT"
exit 0
fi
if [ -f $WORKDIR/list ]
then
info "Found list!"
else
info "There's no list!"
cd $ORIG_GIT
find -name Pkgfile | sort | sed -e 's|^./||g' | awk -F "/Pkgfile" '{print $1}' >> $WORKDIR/list
cd -
fi
cat ${WORKDIR}/list | while read f
do
new_branch=$(echo $f | awk -F "/" '{print $NF}')
info "$new_branch"
cd $ORIG_GIT
git checkout -b ${new_branch}
git filter-branch -f --prune-empty --subdirectory-filter $f ${new_branch}
mkdir ../${new_branch}.git ; cd ../${new_branch}.git ; git init --bare ; cd -
git remote add ${new_branch} file:///`pwd`/../${new_branch}.git
git push ${new_branch} ${new_branch}:master
git checkout 4.2/daily-build
done
```
## 构建软件包源 ##
### 实现类似debian 系统中的 apt-get install/source 等命令统一管理二进制软件包 ###
### 基于源构建依赖编译软件包 ###
### 基于源安装软件包 ###
## 依托gitlab-ci实现软件包在线自动化编译 ##
### 当前自动编译集成工具的改造 ###
### 对开发分支提供在线编译下载 ###