Files
documents/autobuild.md
Xu, Shunxuan 8238c7d06e 修改注意事项的markdown格式。
修改:   autobuild.md

Signed-off-by: Xu, Shunxuan <sxxu@linx-info.com>
2015-08-24 14:05:58 +08:00

215 lines
7.2 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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.
# 搭建4.2自动编译环境说明 #
## 1 引言 ##
### 1.1 概述 ###
  本文档为搭建4.2自动编译环境的配置说明文档以便实施测试人员部署自动编译环境参考。本文档主要概述在已有编译机服务器的情况下如何搭建自动编译环境的虚拟机因目前4.2系统为在172.16.0.250服务器的基础上搭建运行监测并自动编译的虚拟机,故以虚拟机编译环境搭建为例)。
### 1.2 术语定义 ###
  软件包:可使用软件包管理器进行安装的压缩包。
  编译:指的是源码包生成软件包的过程。在此过程中包括配置、编译、安装、打包等子过程。
  pkg包特指以.pkg.tar.gz为后缀的编译完成的安装包。
  src包指的是未经编译的源码包。
  光盘环境:指的是光盘镜像的目录结构,而不是从光盘启动进入安装光盘系统后的环境。  
### 1.3 适用范围 ###
  本文档只适用于Rocky6.0.42.41以及以后的版本。
### 1.4 参考资料 ###
  】《pkg命令说明文档》V0.2,李志,韦帅
  】《Rocky6.0.42版本构建方法》,韦帅
## 2 自动编译环境搭建 ##
### 2.1 自动编译环境介绍 ###
  Rocky4.2自动编译系统通过对4.2软件包git库的监控管理实现4.2自动编译出盘及发布的版本控制系统。即在linx6.0.4系统服务器172.16.0.250)上实现编译环境虚拟机的搭建、自动编译的存储、网页服务器、通知邮件的发送等。
  在编译环境虚拟机Rocky6.0.42.41系统中进行软件包git库监控当检测到新的git库内容提交时自动进行搭建最小环境、自动编译、自动集成出盘、收集编译信息并制作发布网页然后存储到服务器并通知服务器发送通知邮件。
#### 2.1.1 编译服务器介绍 ####
  服务器ip172.16.0.250
  软件环境服务器Linx6.0.4系统、编译机Rocky6.0.42.41系统(服务器上的自动编译虚拟机)
  :zap: **注意事项:**服务器172.16.0.250上的/home/builder中原有的文件`不能删除`此为4.2系统自动编译程序的核心重要文件!
#### 2.1.2 环境搭建准备 ####
  git库 autobuild-tools自动编译的工具集合、chroot_x86-64_git4.2最小编译环境)
  debian8.0最小环境用于markdown文档处理 http://172.16.0.85/chroot-env/base-jessie_amd64.cow.xz
### 2.2 自动编译环境搭建 ###
#### 2.2.1 虚拟机安装 ####
  在服务器6.0系统上安装编译机4.2.41虚拟机使用kvm进行安装并配置好网络桥接网卡分区大小100G左右。内存2服务器8G
  关于kvm安装后期补充
#### 2.2.2 自动编译环境配置及搭建 ####
##### 2.2.2.1 环境配置与准备 #####
  创建工作目录(/home/x86_64-workdir)和ftp挂载目录(/home/builder)
```
mkdir /home/x86_64-workdir /home/builder
```
  配置ftp自动挂载将服务器的/home/builder目录挂载到编译机的/home/builder修改配置文件/etc/fstab重启生效添加如下行
```
172.16.0.250:/home/builder /home/builder nfs nolock 0 0
```
  安装光盘制作需要的包此包可在4.2.41系统编译获得待将源码提交到git库中xorriso#1.3.6-x86_64-linx-Rocky4.3.pkg.tar.gz
  git clone自动编译环境搭建的工具在工作目录下执行
```
git clone http://gitlab.rd.in.linx/linx6.0.42/autobuild-tools.git
```
  git clone自动编译需要的4.2最小环境(在工作目录下执行):
```
git clone http://gitlab.rd.in.linx/chroot_git/chroot_x86_64_git.git
```
  下载debian8.0最小环境(在工作目录下执行):
```
wget http://172.16.0.85/chroot-env/base-jessie_amd64.cow.xz
```
##### 2.2.2.2 环境搭建 #####
  1.搭建构建环境:在工作目录下执行准备环境的命令脚本
```
./autobuild-tools/build-pkg/pre.sh
```
  注意,此准备工具执行会克隆4.2的git库。
  2.搭建4.2最小环境在工作目录下克隆的chroot_x86_64_git的目录中执行
```
./preps.sh
```
  3.搭建处理markdown文件的debian8.0最小环境在工作目录下解压base-jessie_amd64.cow.xz
```
tar -xf base-jessie_amd64.cow.xz
```
  在解压后的debian8.0的最小环境的根目录下克隆转换markdown为pdf文件的工具库。
```
git clone git@gitlab.rd.in.linx:linx6.0.42/progit.git
```
  chroot到解压的最小环境目录下安装处理markdown文件需要的包及git库最小环境中已配置好源。
```
chroot base-jessie_amd64.cow
apt-get update (可能需要跟新源)
aptitude install pandoc ruby texlive-xetex texlive-fonts-recommended \
fonts-lmodern fonts-arphic-ukai fonts-arphic-gbsn00lp ttf-wqy-microhei \
ttf-wqy-zenhei
```
  安装配置处理markdown文件的debian8.0最小环境时,配置问题:
  问题1
```
localhost:/progit# ./makepdfs
Will generate pdf for the following languages:
zh
The generation process will start now.
zh:
Parsing markdown... ./latex/makepdf:74:in `gsub!': invalid byte sequence in US-ASCII (ArgumentError)
from ./latex/makepdf:74:in `block in pre_pandoc'
from ./latex/makepdf:59:in `instance_eval'
from ./latex/makepdf:59:in `block in replace'
from ./latex/makepdf:57:in `instance_eval'
from ./latex/makepdf:57:in `replace'
from ./latex/makepdf:71:in `pre_pandoc'
from ./latex/makepdf:166:in `block (3 levels) in <main>'
from ./latex/makepdf:165:in `popen'
from ./latex/makepdf:165:in `block (2 levels) in <main>'
from ./latex/makepdf:25:in `call'
from ./latex/makepdf:25:in `figures'
from ./latex/makepdf:156:in `block in <main>'
from ./latex/makepdf:155:in `each'
from ./latex/makepdf:155:in `<main>'
```
  解决方法:(添加环境变量)export RUBYOPT="-U -Ku -E utf-8:utf-8"
  问题2
```
localhost:/progit# ./makepdfs
Will generate pdf for the following languages:
zh
The generation process will start now.
zh:
Parsing markdown... done
Creating main.tex for zh... done
Running XeTeX:
Pass 1... failed with:
! I can't find file `pzdr'.
Consider running this again with --debug.
```
  解决方法安装包texlive-fonts-recommended
  问题3
```
localhost:/progit# ./makepdfs
Will generate pdf for the following languages:
zh
The generation process will start now.
zh:
Parsing markdown... done
Creating main.tex for zh... done
Running XeTeX:
Pass 1... failed with:
! Font EU1/lmr/m/n/10=[lmroman10-regular]:mapping=tex-text at 10.0pt not loadab
Consider running this again with --debug.
```
  解决方法安装包fonts-lmodern
## 3 自动编译监测运行 ##
### 3.1 自动编译启动 ###
  运行自动编译执行脚本,在工作目录下执行:(直接按以下命令执行,为每天凌晨1点监测执行)
```
./autobuild-tools/build-pkg/auto_gitcheck.sh
```
  若要即刻执行自动编译:
```
./autobuild-tools/build-pkg/auto_gitcheck.sh -m
```
  配置自动编译系统开机自启动,修改配置文件/etc/rc.d/rc.local ,在exit 0行之前添加如下行
```
nohup /home/x86_64-workdir/autobuild-tools/build-pkg/auto_gitcheck.sh
>> /home/x86_64-workdir/auto_gitcheck.log &
```