Ceph编译加速的小技巧

总结了几个小技巧,用于在ceph编译过程中,能够更快一点

修改clone的地址

git clone https://github.com/ceph/ceph.git

可以修改成

git clone git://github.com/ceph/ceph.git

某些时候可能可以加快一些
1.png-5.9kB

1.png-5.

根据需要下载分支

假如现在想看10.2.5版本的代码

常规做法

先下载整个库

git clone git://github.com/ceph/ceph.git all

总共的下载对象数目为46万

Counting objects: 460384

这个是包含所有的分支和分支内的文件的所有版本的
我们切换到分支

[root@lab8106 mytest]#cd all
[root@lab8106 all]# git branch
* master
[root@lab8106 all]# git checkout -b all10.2.5  v10.2.5
Switched to a new branch 'all10.2.5'
[root@lab8106 all]# git branch
* all10.2.5
  master
[root@lab8106 all]# ls -R|wc -l
4392
可以看到有这么多的文件

现在只复制一个分支的

[root@lab8106 mytest]# git clone -b v10.2.5 --single-branch   git://github.com/ceph/ceph.git single

总共下载的对象数目为34万

Counting objects: 344026

[root@lab8106 mytest]# cd single/
[root@lab8106 single]# git checkout -b single10.2.5
Switched to a new branch 'single10.2.5'
[root@lab8106 single]# git branch
* single10.2.5
[root@lab8106 single]# ls -R |wc -l
4392

现在只复制一个分支的最后一个版本的代码

[root@lab8106 mytest]# git clone -b v10.2.5 --single-branch --depth 1  git://github.com/ceph/ceph.git singledep1

总共下载的对象数目为3682

Counting objects: 3682

[root@lab8106 mytest]#  cd singledep1/
 [root@lab8106 singledep1]# git checkout -b singledep110.2.5
Switched to a new branch 'singledep110.2.5'
[root@lab8106 singledep1]# git branch
* singledep110.2.5
[root@lab8106 singledep1]# ls -R |wc -l
4392

从上面的可以看到三个版本的代码是一致的,那么区别在哪里

  • clone:包含所有分支和分支的所有文件版本
  • clone single-branch:包含指定分支和指定分支的所有文件的版本
  • clone single-branch depth 1 :包含指定分支和指定分支的最后一个版本的文件

准备编译前的install-deps慢

提前准备好epel

yum install http://mirrors.aliyun.com/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
rm -rf /etc/yum.repos.d/epel*

装完了删除,这个是为了绕过包验证

wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

删除慢速的 aliyuncs

sed -i '/aliyuncs/d' /etc/yum.repos.d/epel.repo 

install-deps.sh第72行的需要修改

yum-config-manager --add-repo https://dl.fedoraproject.org/pub/epel/$MAJOR_VERSION/x86_64/
执行下面的命令

sed -i 's/https:\/\/dl.fedoraproject.org\/pub\//http:\/\/mirrors.aliyun.com\//g' install-deps.sh

然后执行install-deps.sh,这样会快很多的

总结

目前就这么多,后续有更多的影响速度的地方会增加上去

posted @ 2017-01-05 18:37  武汉-磨渣  阅读(305)  评论(0编辑  收藏  举报