東川印記

一本東川,笑看爭龍斗虎;寰茫兦者,度橫佰昧人生。

CentOS6.4搭建repo服务器管理android source

2015年12月31日星期四



1,查看环境
  1. Last login: Sun Nov 22 00:54:21 2015 from 192.168.21.2
  2. [root@Android ~]# lsb_release -a
  3. -bash: lsb_release: command not found
  4. [root@Android ~]# cat /etc/redhat-release
  5. CentOS release 6.4 (Final)
  6. [root@Android ~]# df -Th
  7. 文件系统    类型      容量  已用  可用 已用%% 挂载点
  8. /dev/mapper/vg_andr0id-lv_root
  9.               ext4     50G  1.1G   46G   3% /
  10. tmpfs        tmpfs    1.9G     0  1.9G   0% /dev/shm
  11. /dev/sda1     ext4    485M   32M  428M   7% /boot
  12. /dev/mapper/vg_andr0id-lv_home
  13.               ext4    864G  200M  820G   1% /home
  14. [root@Android ~]# ifconfig
  15. eth0      Link encap:Ethernet  HWaddr 00:E0:4C:36:07:DD 
  16.           inet addr:10.5.10.145  Bcast:10.5.10.255  Mask:255.255.255.0
  17.           inet6 addr: fe80::2e0:4cff:fe36:7dd/64 Scope:Link
  18.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
  19.           RX packets:55550 errors:0 dropped:0 overruns:0 frame:0
  20.           TX packets:233 errors:0 dropped:0 overruns:0 carrier:0
  21.           collisions:0 txqueuelen:1000
  22.           RX bytes:3887551 (3.7 MiB)  TX bytes:27350 (26.7 KiB)
  23. lo        Link encap:Local Loopback 
  24.           inet addr:127.0.0.1  Mask:255.0.0.0
  25.           inet6 addr: ::1/128 Scope:Host
  26.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
  27.           RX packets:0 errors:0 dropped:0 overruns:0 frame:0
  28.           TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
  29.           collisions:0 txqueuelen:0
  30.           RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)
系统版本CentOS6.4,内网ip为10.5.10.145

2,搭建git服务器

1)安装支持库
[root@Android ~]# sudo yum install curl-devel expat-devel gettext-devel openssl-devel zlib-devel perl-devel
Loaded plugins: fastestmirror
base                                                    | 3.7 kB     00:00    
base/primary_db                                         | 4.6 MB     00:00    
extras                                                  | 3.4 kB     00:00    
extras/primary_db                                       |  33 kB     00:00    
updates                                                 | 3.4 kB     00:00    
updates/primary_db                                      | 2.6 MB     00:01    
Setting up Install Process
Resolving Dependencies
....
Complete!

2)安装git
下载最新的稳定版本github.com/git/git
当前最新的时V2.6.3,上传到服务器
编译安装
  1. mv git-2.6.3.tar.gz /usr/local/src/
  2. cd /usr/local/src
  3. tar -zvxf git-2.6.3.tar.gz
  4.  cd git-2.6.3
  5.  sudo make prefix=/usr/local/git all
  6. 报错,找不到cc,安装gcc
  7.  yum install gcc
  8.  sudo make prefix=/usr/local/git all
  9.  make prefix=/usr/local/git install
 增加软链接
  1. [root@Android git-2.6.3]# ln -s /usr/local/git/bin/* /usr/bin/
  2. 校验安装成功
  3. [root@Android git-2.6.3]# git --version
  4. git version 2.6.3
  5. [root@Android git-2.6.3]#
git安装完成

3)安装gitosis
  1. [root@Android ~]# sudo yum install python python-setuptools
  2. ....
  3. Installed:
  4.   python-setuptools.noarch 0:0.6.10-3.el6                                              

  5. Updated:
  6.   python.x86_64 0:2.6.6-64.el6                                                         

  7. Dependency Updated:
  8.   python-libs.x86_64 0:2.6.6-64.el6                                                    

  9. Complete!
  10. [root@Android ~]# cd /usr/local/src
  11. [root@Android src]# git clone git://github.com/res0nat0r/gitosis.git
  12. 正克隆到 'gitosis'...
  13. remote: Counting objects: 727, done.
  14. remote: Total 727 (delta 0), reused 0 (delta 0), pack-reused 727
  15. 接收对象中: 100% (727/727), 179.61 KiB | 98.00 KiB/s, 完成.
  16. 处理 delta 中: 100% (407/407), 完成.
  17. 检查连接... 完成。
  18. [root@Android src]# cd gitosis
  19. [root@Android gitosis]# python setup.py install 
  20. running install
  21. running bdist_egg
  22. running egg_info
  23. creating gitosis.egg-info
  24. writing requirements to gitosis.egg-info/requires.txt
  25. ....
  26. Installed /usr/lib/python2.6/site-packages/gitosis-0.2-py2.6.egg
  27. Processing dependencies for gitosis==0.2
  28. Searching for distribute==0.6.10
  29. Best match: distribute 0.6.10
  30. Adding distribute 0.6.10 to easy-install.pth file
  31. Installing easy_install script to /usr/bin
  32. Installing easy_install-2.6 script to /usr/bin

  33. Using /usr/lib/python2.6/site-packages
  34. Finished processing dependencies for gitosis==0.2
  35. [root@Android gitosis]#

4)在本机生成密钥,上传服务器
  1. senrsl@senrsl-T540p:~$ ssh-keygen -t rsa
  2. Generating public/private rsa key pair.
  3. Enter file in which to save the key (/home/senrsl/.ssh/id_rsa):
  4. /home/senrsl/.ssh/id_rsa already exists.
  5. Overwrite (y/n)? n
  6. senrsl@senrsl-T540p:~$ scp ~/.ssh/id_rsa.pub root@10.5.10.145:/tmp
  7. root@10.5.10.145's password:
  8. bash: scp: command not found
  9. lost connection
  10. senrsl@senrsl-T540p:~$ scp ?
呃。。。。大概就这么个意思。。。。

5)生成git用户,初始化gitosis
  1. #a.创建git版本管理用户
  2. [root@Android ~]# sudo useradd -c 'git version manage' -m -d /home/git -s /bin/bash git
  3. #b.更改密码
  4. [root@Android ~]# passwd git
  5. 更改用户 git 的密码 。
  6. 新的 密码:
  7. 重新输入新的 密码:
  8. passwd: 所有的身份验证令牌已经成功更新。
  9. #c.su到用户
  10. [root@Android ~]# su - git
  11. #d.初始化版本库
  12. [git@Android ~]$ gitosis-init < /tmp/id_rsa.pub
  13. 初始化空的 Git 仓库于 /home/git/repositories/gitosis-admin.git/
  14. 重新初始化现存的 Git 仓库于 /home/git/repositories/gitosis-admin.git/
  15. #e.删除密钥
  16. [git@Android ~]$ rm -rf /tmp/id_rsa.pub
  17. rm: 无法删除"/tmp/id_rsa.pub": 不允许的操作
  18. [git@Android ~]$ sudo rm -rf /tmp/id_rsa.pub
  19. We trust you have received the usual lecture from the local System
  20. Administrator. It usually boils down to these three things:
  21.     #1) Respect the privacy of others.
  22.     #2) Think before you type.
  23.     #3) With great power comes great responsibility.
  24. [sudo] password for git:
  25. git 不在 sudoers 文件中。此事将被报告。
  26. [git@Android ~]$ ll /tmp/
  27. 总用量 4
  28. -rw-r--r--  1 root root 401 11月 22 03:09 id_rsa.pub
  29. -rw-------. 1 root root   0 11月 21 00:40 yum.log
  30. [git@Android ~]$ su
  31. 密码:
  32. [root@Android git]# rm -rf /tmp/id_rsa.pub
  33. [root@Android git]#

6)本机上导出项目管理仓库
  1. senrsl@senrsl-T540p:~/test$ mkdir -p repo
  2. senrsl@senrsl-T540p:~/test$ cd repo/
  3. senrsl@senrsl-T540p:~/test/repo$ git clone git@10.5.10.145:gitosis-admin.git
  4. 正克隆到 'gitosis-admin'...
  5. remote: 对象计数中: 5, 完成.
  6. remote: 压缩对象中: 100% (5/5), 完成.
  7. remote: Total 5 (delta 0), reused 5 (delta 0)
  8. 接收对象中: 100% (5/5), done.
  9. 检查连接... 完成。
7)在本机增加及设置管理项目
  1. senrsl@senrsl-T540p:~/test/repo$ cd gitosis-admin/
  2. #查看git服务器上已上传密钥
  3. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ ls keydir/
  4. senrsl@senrsl-T540p.pub
  5. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ cat keydir/senrsl@senrsl-T540p.pub
  6. ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC6156/NAf9V+74M5vNkg+4ejMl8oSUfOIooxtTG28aIz6jtF4D/CEVjjVwSfPZI8X+e13Y62L8gBL5P2BFJcyoFHSG3u6HsizR3oflg4ajlEmm3ZvnnxrdDUx75sw29MpWRTgIqVps2GprdCAuaIXzQ29x3sgaE95JoJZryxwyPO369zy1iRjKZACODYhF+8yCFaoRA5HqiJe/wYxvaLlW78FmDaDyxBS44iiOAucnyXQUVC2rW1XQ7eI0Vi9W+FEugWF7JuDbyT4yJvqsbSH7muv0tfzzHpdXKmvWOcIbOSAGcRi3RjNGh0QlINkzjCkGbdt0cecxIly75u/XD565 senrsl@senrsl-T540p
  7. #更改配置文件为,在后面加上下面
  8. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ gedit gitosis.conf
  9. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ cat gitosis.conf
  10. [gitosis]
  11. [group gitosis-admin]
  12. members = senrsl@senrsl-T540p
  13. writable = gitosis-admin
  14. [group test-git]            # 具有写权限的组名称
  15. writable = test-git         # 该组可写的项目名称
  16. members = senrsl@senrsl-T540p     #该组的成员(密钥用户名) 多个用户协同开发时,以空格分隔
  17. # 如果要增加只读的组 参考如下
  18. # [group test-git-readnoly]          # 具有都权限的组名称
  19. # readonly = test-git                # 该组只读的项目名称
  20. # members = senrsl@senrsl-T540p      # 该组的成员
  21. #提交修改
  22. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ git add .
  23. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ git commit -a -m 'add test-git repo'
  24. [master c4678cb] add test-git repo
  25.  2 files changed, 26 insertions(+)
  26.  create mode 100644 gitosis.conf~
  27. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ git push
  28. warning: push.default 尚未设置,它的默认值在 Git 2.0 从 'matching'
  29. 变更为 'simple'。若要不再显示本信息并保持传统习惯,进行如下设置:
  30.   git config --global push.default matching
  31. 若要不再显示本信息并从现在开始采用新的使用习惯,设置:
  32.   git config --global push.default simple
  33. 当 push.default 设置为 'matching' 后,git 将推送和远程同名的所有
  34. 本地分支。
  35. 从 Git 2.0 开始,Git 缺省采用更为保守的 'simple' 模式,只推送当前
  36. 分支到远程关联的同名分支,即 'git push' 推送当前分支。
  37. 参见 'git help config' 并查找 'push.default' 以获取更多信息。
  38. ('simple' 模式由 Git 1.7.11 版本引入。如果您有时要使用老版本的 Git,
  39. 为保持兼容,请用 'current' 代替 'simple')
  40. Counting objects: 6, done.
  41. Delta compression using up to 8 threads.
  42. Compressing objects: 100% (4/4), done.
  43. Writing objects: 100% (4/4), 649 bytes | 0 bytes/s, done.
  44. Total 4 (delta 1), reused 0 (delta 0)
  45. To git@10.5.10.145:gitosis-admin.git
  46.    a455dcb..c4678cb  master -> master
  47. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$
8)在本机上初始,增加及使用项目test-git
  1. senrsl@senrsl-T540p:~/test/repo$ mkdir test-git
  2. senrsl@senrsl-T540p:~/test/repo$ cd test-git/
  3. senrsl@senrsl-T540p:~/test/repo/test-git$ git init
  4. 初始化空的 Git 版本库于 /home/senrsl/test/repo/test-git/.git/
  5. senrsl@senrsl-T540p:~/test/repo/test-git$ touch README
  6. senrsl@senrsl-T540p:~/test/repo/test-git$ git add .
  7. senrsl@senrsl-T540p:~/test/repo/test-git$ git commit -a -m 'init test-git'
  8. [master (根提交) 60dbe0f] init test-git
  9.  1 file changed, 0 insertions(+), 0 deletions(-)
  10.  create mode 100644 README
  11. senrsl@senrsl-T540p:~/test/repo/test-git$ git remote add origin git@10.5.10.145:test-git.git
  12. senrsl@senrsl-T540p:~/test/repo/test-git$ git push origin master
  13. 初始化空的 Git 仓库于 /home/git/repositories/test-git.git/
  14. Counting objects: 3, done.
  15. Writing objects: 100% (3/3), 204 bytes | 0 bytes/s, done.
  16. Total 3 (delta 0), reused 0 (delta 0)
  17. To git@10.5.10.145:test-git.git
  18.  * [new branch]      master -> master
  19. senrsl@senrsl-T540p:~/test/repo/test-git$
9)增加协同开发者的公钥到git服务器
  1. senrsl@senrsl-T540p:~/test/repo/test-git$ cd ../gitosis-admin/keydir/
  2. senrsl@senrsl-T540p:~/test/repo/gitosis-admin/keydir$ ll
  3. 总用量 12
  4. drwxrwxr-x 2 senrsl senrsl 4096 11月 21 20:21 ./
  5. drwxrwxr-x 4 senrsl senrsl 4096 11月 21 20:24 ../
  6. -rw-rw-r-- 1 senrsl senrsl  401 11月 21 20:21 senrsl@senrsl-T540p.pub
  7. senrsl@senrsl-T540p:~/test/repo/gitosis-admin/keydir$
把协同开发者的id_rsa.pub文件里的数据拷贝到对应开发者的【密钥用户名.pub】文件,如把a@b的id_rsa.pub文件中文本粘 贴到a@b.pub文 件里,并保存,然后将添加数据后的目录commit到服务器。

10)进阶1:添加已有git项目
  1. senrsl@senrsl-T540p:~/android/source/kernel/common$ git status
  2. 位于分支 android-3.4
  3. 您的分支与上游分支 'origin/android-3.4' 一致。
  4. 无文件要提交,干净的工作区
  5. senrsl@senrsl-T540p:~/android/source/kernel/common$ git branch
  6. * android-3.4
  7.   master
  8. senrsl@senrsl-T540p:~/android/source/kernel/common$ git remote -v
  9. origin    https://android.googlesource.com/kernel/common.git (fetch)
  10. origin    https://android.googlesource.com/kernel/common.git (push)
  11. senrsl@senrsl-T540p:~/android/source/kernel/common$ git clone --mirror android-3.4 kernel-android-common3.4.git
  12. fatal: 版本库 'android-3.4' 不存在
  13. senrsl@senrsl-T540p:~/android/source/kernel/common$ git clone --mirror common kernel-android-common3.4.git
  14. fatal: 版本库 'common' 不存在
  15. senrsl@senrsl-T540p:~/android/source/kernel/common$ git clone --mirror common common.git
  16. fatal: 版本库 'common' 不存在
  17. senrsl@senrsl-T540p:~/android/source/kernel/common$ cd ..
  18. senrsl@senrsl-T540p:~/android/source/kernel$ git clone --mirror common kernel-android-common.git
  19. 克隆到裸版本库 'kernel-android-common.git'...
  20. 完成。
  21. senrsl@senrsl-T540p:~/android/source/kernel$ mv kernel-android-common.git 服务器上的/home/git/repositories/
  22. senrsl@senrsl-T540p:~/android/source/kernel$

配置这个仓库的权限
  1. senrsl@senrsl-T540p:~/android/source/kernel$ cd ~/test/repo/
  2. senrsl@senrsl-T540p:~/test/repo$ gedit gitosis-admin/gitosis.conf
  3. 后面增加这个
  4. [group kernel-android-common]            # 具有写权限的组名称
  5. writable = kernel-android-common         # 该组可写的项目名称
  6. members = senrsl@senrsl-T540p     #该组的成员(密钥用户名) 多个用户协同开发时,以空格分隔

把这个文件夹放到服务器上,然后挪到git库目录去
  1. [root@Android ~]# mv kernel-android-common.git /home/git/repositories/
  2. #变更用户及分组为git
  3. [root@Android ~]# chown -R git.git /home/git/repositories/kernel-android-common.git
  4. [root@Android ~]# ll /home/git/repositories/
  5. 总用量 12
  6. drwxr-x--- 7 git git 4096 11月 22 04:25 gitosis-admin.git
  7. drwxrwxr-x 7 git git 4096 11月 21 21:27 kernel-android-common.git
  8. drwxr-x--- 6 git git 4096 11月 22 04:31 test-git.git

然后本地提交管理组配置
  1. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ git status
  2. 位于分支 master
  3. 您的分支与上游分支 'origin/master' 一致。
  4. 尚未暂存以备提交的变更:
  5.   (使用 "git add/rm <file>..." 更新要提交的内容)
  6.   (使用 "git checkout -- <file>..." 丢弃工作区的改动)
  7.     修改:         gitosis.conf
  8.     删除:         gitosis.conf~
  9. 修改尚未加入提交(使用 "git add" 和/或 "git commit -a")
  10. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ git add --all
  11. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ git commit -m 'add kernel-android-common.git'
  12. [master 3d4e573] add kernel-android-common.git
  13.  2 files changed, 4 insertions(+), 16 deletions(-)
  14.  delete mode 100644 gitosis.conf~
  15. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ git push origin master
  16. Counting objects: 5, done.
  17. Delta compression using up to 8 threads.
  18. Compressing objects: 100% (3/3), done.
  19. Writing objects: 100% (3/3), 349 bytes | 0 bytes/s, done.
  20. Total 3 (delta 1), reused 0 (delta 0)
  21. To git@10.5.10.145:gitosis-admin.git
  22.    c4678cb..3d4e573  master -> master
  23. senrsl@senrsl-T540p:~/test/repo/gitosis-admin$ cd ..

克隆这个库回来
  1. senrsl@senrsl-T540p:~/test/repo$ git clone git@10.5.10.145:kernel-android-common.git
  2. 正克隆到 'kernel-android-common'...
  3. remote: 对象计数中: 2464763, 完成.
  4. remote: 压缩对象中: 100% (382116/382116), 完成.
  5. remote: Total 2464763 (delta 2059484), reused 2462494 (delta 2058434)
  6. 接收对象中: 100% (2464763/2464763), 541.68 MiB | 11.20 MiB/s, done.
  7. 处理 delta 中: 100% (2059484/2059484), done.
  8. 检查连接... 完成。
  9. Checking out files: 100% (38857/38857), done.
  10. senrsl@senrsl-T540p:~/test/repo$ cd kernel-android-common/
  11. senrsl@senrsl-T540p:~/test/repo/kernel-android-common$ git branch
  12. * android-3.4
  13. senrsl@senrsl-T540p:~/test/repo/kernel-android-common$ git map
上去之前是俩分支,回来就剩一个分支了。。。。
之前的分支:
  1. #远程分支
  2. senrsl@senrsl-T540p:~/android/source/kernel/common$ git branch -a
  3. * android-3.4
  4.   master
  5.   remotes/origin/HEAD -> origin/master
  6.   remotes/origin/android-2.6.39
  7.   remotes/origin/android-3.0
  8.   remotes/origin/android-3.10
  9.   remotes/origin/android-3.10-adf
  10.   remotes/origin/android-3.10.y
  11.   remotes/origin/android-3.14
  12.   remotes/origin/android-3.18
  13.   remotes/origin/android-3.3
  14.   remotes/origin/android-3.4
  15.   remotes/origin/android-3.4-compat
  16.   remotes/origin/bcmdhd-3.10
  17.   remotes/origin/coupled-cpuidle
  18.   remotes/origin/experimental/android-3.10
  19.   remotes/origin/experimental/android-3.10-rc5
  20.   remotes/origin/experimental/android-3.14
  21.   remotes/origin/experimental/android-3.18
  22.   remotes/origin/experimental/android-3.8
  23.   remotes/origin/experimental/android-3.9
  24.   remotes/origin/experimental/android-3.9-rc2
  25.   remotes/origin/experimental/android-3.9-rc7
  26.   remotes/origin/linux-bcm43xx-2.6.39
  27.   remotes/origin/master
  28. #本地分支
  29. senrsl@senrsl-T540p:~/android/source/kernel/common$ git branch
  30. * android-3.4
  31.   master
  32. senrsl@senrsl-T540p:~/android/source/kernel/common$

之后的分支
  1. #远程分支
  2. senrsl@senrsl-T540p:~/test/repo/kernel-android-common$ git branch -a
  3. * android-3.4
  4.   remotes/origin/HEAD -> origin/android-3.4
  5.   remotes/origin/android-3.4
  6.   remotes/origin/master
  7. #本地分支
  8. senrsl@senrsl-T540p:~/test/repo/kernel-android-common$ git branch
  9. * android-3.4
  10. senrsl@senrsl-T540p:~/test/repo/kernel-android-common$
这是把之前的检出的分支当做了远程分支,之前没检出的就不见了啊。。。。

怎么让服务器上的那个继续去官方拉代码呢?


3,搭建repo服务器

1) 创建repo管理权限用户dc,在该用户权限下初始化mainfest.git库
  1. [root@Android /]# useradd -c 'repo manager' -m -d /home/dc -s /bin/bash dc
  2. [root@Android /]# passwd dc
  3. 更改用户 dc 的密码 。
  4. 新的 密码:
  5. 无效的密码: 它基于字典单词
  6. 无效的密码: 过于简单
  7. 重新输入新的 密码:
  8. passwd: 所有的身份验证令牌已经成功更新。
  9. [root@Android /]# su - dc
  10. [dc@Android ~]$ ll /home/
  11. 总用量 24
  12. drwx------  3 dc   dc    4096 11月 22 22:59 dc
  13. drwx------  6 git  git   4096 11月 22 06:23 git
  14. drwx------. 2 root root 16384 11月 21 00:40 lost+found
  15. [dc@Android ~]$ pwd
  16. /home/dc
  17. [dc@Android ~]$ mkdir repos
  18. [dc@Android ~]$ cd repos/
  19. [dc@Android repos]$ git init --bare manifest.git
  20. 初始化空的 Git 仓库于 /home/dc/repos/manifest.git/
  21. [dc@Android repos]$  git init --bare pro/pro1.git
  22. 初始化空的 Git 仓库于 /home/dc/repos/pro/pro1.git/
  23. [dc@Android repos]$ git init --bare pro/pro2.git
  24. 初始化空的 Git 仓库于 /home/dc/repos/pro/pro2.git/
  25. [dc@Android repos]$ git init --bare pro3.git
  26. 初始化空的 Git 仓库于 /home/dc/repos/pro3.git/
  27. [dc@Android repos]$
2)安装守护进程git-daemon
在ubuntu上是senrsl@senrsl-T540p:~$ sudo apt-get install git-daemon-run
在centos上没有这个。。。。
然后尝试安装[root@Android repos]# yum install git-daemon
坑了,结果安上一堆东西,把原来的git都给覆盖成1.7.1版了。。。。

然后挨个卸载,重新加git软链接,测试运行。。。。

然后研究了半天文档(git-scm.com/book/zh/v2/服务器上的-Git-Git-守护进程),他应该就是一个脚本,一直在运 行,然后监测git服务是否正常运行
试了下文档上的这句
  1. [root@Android repos]# su - dc
  2. [dc@Android ~]$ pwd
  3. /home/dc
  4. [dc@Android ~]$ git daemon --reuseaddr --base-path=/home/git/ /home/git/
  5. ^Z
  6. [1]+  Stopped                 git daemon --reuseaddr --base-path=/home/git/ /home/git/
  7. [dc@Android ~]$
上面那句命令会一直运行着。。。。

然后按文档所说的,写个脚本放到/etc/event.d/local-git-daemon,建一个对仓库拥有只读权限的用户来运行这个脚本。


对于git-daemon,也可以自己编译安装,这样版本就对了
然后找到了这个
[dc@Android git-core]$ ls git-da*
git-daemon
[dc@Android git-core]$ pwd
/usr/local/git/libexec/git-core

其实已经编译好了。。。。
可惜不知道怎么用!!!
尝试执行一下
  1. [dc@Android git-core]$ ./git-daemon
  2. [6178] Could not bind to 0.0.0.0: ??????
  3. [6178] Could not bind to ::: ??????
  4. fatal: unable to allocate any listen sockets on port 9418
  5. [dc@Android git-core]$


好吧,还是按文档上说的自己试着建脚本吧。。。。

首先,建一个对仓库只读权限的用户
  1. [root@Android event.d]# sudo useradd -c 'git  read only' -m -d /home/git-ro -s /bin/bash git-ro
  2. [root@Android ~]# passwd git-ro
  3. #软链接
  4. [root@Android ~]# ln -s /home/git/repositories/ /home/git-ro/
  5. [root@Android event.d]# vi local-git-daemon
  6. [root@Android event.d]# cat local-git-daemon
  7. start on startup
  8. stop on shutdown
  9. exec /usr/bin/git daemon \
  10.    --export-all \
  11.     --user=git-ro --group=git-ro \
  12.     --reuseaddr \
  13.     --base-path=/home/git/ \
  14.     /home/git/
  15. respawn
  16. [root@Android event.d]#
对仓库只读权限的用户,这个怎么搞。。。。


其中--export-all是给所有git仓库进行非授权访问,如果不加这个,那么就要在每个罗仓库中增加这个文件
  1. [git@Android repositories]$ cd test-git.git/
  2. [git@Android test-git.git]$ ll
  3. 总用量 24
  4. -rw-r--r--  1 git git   66 11月 22 04:31 config
  5. -rw-r--r--  1 git git   23 11月 22 04:31 HEAD
  6. drwxr-xr-x  2 git git 4096 11月 22 04:31 hooks
  7. drwxr-xr-x  2 git git 4096 11月 22 23:34 info
  8. drwxr-xr-x 10 git git 4096 11月 22 23:34 objects
  9. drwxr-xr-x  4 git git 4096 11月 22 04:31 refs
  10. [git@Android test-git.git]$ touch git-daemon-export-ok
问题遗留:
①git-ro只读权限,何解?
②自启动脚本无法运行
[root@Android event.d]# initctl start local-git-daemon
initctl: Unknown job: local-git-daemon


3)定制mainfest.git
这个地方刚先配置了 gitosis.conf,后来发现不配也行。。。。
  1. senrsl@senrsl-T540p:~/test/repo$ git clone dc@10.5.10.145:manifest.git
  2. 正克隆到 'manifest'...
  3. dc@10.5.10.145's password:
  4. fatal: 'manifest.git' does not appear to be a git repository
  5. fatal: Could not read from remote repository.
  6. Please make sure you have the correct access rights
  7. and the repository exists.
  8. senrsl@senrsl-T540p:~/test/repo$ git clone dc@10.5.10.145:/home/dc/repos/manifest.git
  9. 正克隆到 'manifest'...
  10. dc@10.5.10.145's password:
  11. warning: 您似乎克隆了一个空版本库。
  12. 检查连接... 完成。
  13. senrsl@senrsl-T540p:~/test/repo$ cd manifest/
  14. senrsl@senrsl-T540p:~/test/repo/manifest$ touch default.xml
  15. senrsl@senrsl-T540p:~/test/repo/manifest$ gedit default.xml
  16. senrsl@senrsl-T540p:~/test/repo/manifest$ git add .
  17. senrsl@senrsl-T540p:~/test/repo/manifest$ git commit -m 'add default.xml'
  18. [master (根提交) 1e4054e] add default.xml
  19.  2 files changed, 16 insertions(+)
  20.  create mode 100644 default.xml
  21.  create mode 100644 default.xml~
  22. senrsl@senrsl-T540p:~/test/repo/manifest$ git push origin master
  23. dc@10.5.10.145's password:
  24. Counting objects: 3, done.
  25. Delta compression using up to 8 threads.
  26. Compressing objects: 100% (3/3), done.
  27. Writing objects: 100% (3/3), 385 bytes | 0 bytes/s, done.
  28. Total 3 (delta 0), reused 0 (delta 0)
  29. To dc@10.5.10.145:/home/dc/repos/manifest.git
  30.  * [new branch]      master -> master
  31. senrsl@senrsl-T540p:~/test/repo/manifest$
其中default.xml内容
  1. senrsl@senrsl-T540p:~/test/repo/manifest$ cat default.xml
  2. <?xml version="1.0" encoding="UTF-8"?>
  3. <manifest>
  4.   <remote name="origin"  fetch="git://10.5.10.145/repos"/>
  5.   <default revision="master" remote="origin" />
  6.   <project path="pro/pro1" name="pro/pro1" />
  7.  <project path="pro/pro2" name="pro/pro2" />
  8.   <project path="pro3" name="pro3" />
  9. </manifest>
  10. senrsl@senrsl-T540p:~/test/repo/manifest$
4)初始化那三个测试仓库
  1. senrsl@senrsl-T540p:~/test/repo/manifest$ cd ..
  2. senrsl@senrsl-T540p:~/test/repo$ git clone dc@10.5.10.145:/home/dc/repos/pro/pro1.git
  3. 正克隆到 'pro1'...
  4. dc@10.5.10.145's password:
  5. warning: 您似乎克隆了一个空版本库。
  6. 检查连接... 完成。
  7. senrsl@senrsl-T540p:~/test/repo$ git clone dc@10.5.10.145:/home/dc/repos/pro/pro2.git
  8. 正克隆到 'pro2'...
  9. dc@10.5.10.145's password:
  10. warning: 您似乎克隆了一个空版本库。
  11. 检查连接... 完成。
  12. senrsl@senrsl-T540p:~/test/repo$ git clone dc@10.5.10.145:/home/dc/repos/pro3.git
  13. 正克隆到 'pro3'...
  14. dc@10.5.10.145's password:
  15. warning: 您似乎克隆了一个空版本库。
  16. 检查连接... 完成。
  17. senrsl@senrsl-T540p:~/test/repo$ ll
  18. 总用量 36
  19. drwxrwxr-x  9 senrsl senrsl 4096 11月 22 18:52 ./
  20. drwxrwxr-x  7 senrsl senrsl 4096 11月 21 19:34 ../
  21. drwxrwxr-x  4 senrsl senrsl 4096 11月 22 17:48 gitosis-admin/
  22. drwxrwxr-x 25 senrsl senrsl 4096 11月 21 21:54 kernel-android-common/
  23. drwxrwxr-x  3 senrsl senrsl 4096 11月 22 18:48 manifest/
  24. drwxrwxr-x  3 senrsl senrsl 4096 11月 22 18:51 pro1/
  25. drwxrwxr-x  3 senrsl senrsl 4096 11月 22 18:52 pro2/
  26. drwxrwxr-x  3 senrsl senrsl 4096 11月 22 18:52 pro3/
  27. drwxrwxr-x  3 senrsl senrsl 4096 11月 21 20:29 test-git/
  28. senrsl@senrsl-T540p:~/test/repo$ cd pro1/
  29. senrsl@senrsl-T540p:~/test/repo/pro1$ touch README
  30. senrsl@senrsl-T540p:~/test/repo/pro1$ echo 'test'>>README
  31. senrsl@senrsl-T540p:~/test/repo/pro1$ cp README ../pro2/
  32. senrsl@senrsl-T540p:~/test/repo/pro1$ cp README ../pro3/
  33. senrsl@senrsl-T540p:~/test/repo/pro1$ git add --all / git add .
  34. fatal: /:'/' 在版本库之外
  35. senrsl@senrsl-T540p:~/test/repo/pro1$ git status
  36. 位于分支 master
  37. 初始提交
  38. 未跟踪的文件:
  39.   (使用 "git add <file>..." 以包含要提交的内容)
  40.     README
  41. 提交为空,但是存在尚未跟踪的文件(使用 "git add" 建立跟踪)
  42. senrsl@senrsl-T540p:~/test/repo/pro1$ git add .
  43. senrsl@senrsl-T540p:~/test/repo/pro1$ git commit -m 'init'
  44. [master (根提交) a47f3f4] init
  45.  1 file changed, 1 insertion(+)
  46.  create mode 100644 README
  47. senrsl@senrsl-T540p:~/test/repo/pro1$ git push origin master
  48. dc@10.5.10.145's password:
  49. Counting objects: 3, done.
  50. Writing objects: 100% (3/3), 204 bytes | 0 bytes/s, done.
  51. Total 3 (delta 0), reused 0 (delta 0)
  52. To dc@10.5.10.145:/home/dc/repos/pro/pro1.git
  53.  * [new branch]      master -> master
  54. senrsl@senrsl-T540p:~/test/repo/pro1$ cd ..
  55. senrsl@senrsl-T540p:~/test/repo$ cd pro
  56. bash: cd: pro: 没有那个文件或目录
  57. senrsl@senrsl-T540p:~/test/repo$ cd pro2/
  58. senrsl@senrsl-T540p:~/test/repo/pro2$ git add .
  59. senrsl@senrsl-T540p:~/test/repo/pro2$ git commit -m 'init2'
  60. [master (根提交) 3c94f3a] init2
  61.  1 file changed, 1 insertion(+)
  62.  create mode 100644 README
  63. senrsl@senrsl-T540p:~/test/repo/pro2$ git push origin master
  64. dc@10.5.10.145's password:
  65. Counting objects: 3, done.
  66. Writing objects: 100% (3/3), 206 bytes | 0 bytes/s, done.
  67. Total 3 (delta 0), reused 0 (delta 0)
  68. To dc@10.5.10.145:/home/dc/repos/pro/pro2.git
  69.  * [new branch]      master -> master
  70. senrsl@senrsl-T540p:~/test/repo/pro2$ cd ../pro3
  71. senrsl@senrsl-T540p:~/test/repo/pro3$ git add .
  72. senrsl@senrsl-T540p:~/test/repo/pro3$ git commit -m 'init'
  73. [master (根提交) 3ca740f] init
  74.  1 file changed, 1 insertion(+)
  75.  create mode 100644 README
  76. senrsl@senrsl-T540p:~/test/repo/pro3$ git push origin master
  77. dc@10.5.10.145's password:
  78. Counting objects: 3, done.
  79. Writing objects: 100% (3/3), 205 bytes | 0 bytes/s, done.
  80. Total 3 (delta 0), reused 0 (delta 0)
  81. To dc@10.5.10.145:/home/dc/repos/pro3.git
  82.  * [new branch]      master -> master
  83. senrsl@senrsl-T540p:~/test/repo/pro3$
5)服务器安装repo工具
  1. [root@Android ~]# su - dc
  2. [dc@Android ~]$ ll
  3. 总用量 4
  4. drwxrwxr-x 5 dc dc 4096 11月 23 03:04 repos
  5. [dc@Android ~]$ cd repos/
  6. [dc@Android repos]$ wget https://github.com/android/tools_repo/archive/master.zip
  7. --2015-11-23 03:08:20--  https://github.com/android/tools_repo/archive/master.zip
  8. ....
  9. [dc@Android repos]$ unzip master.zip
  10. Archive:  master.zip
  11. e7a3bcbbb8083e812ce07a5459f0e6d30edfb9fe
  12. ....
  13. [dc@Android repos]$ mv tools_repo-master repo
  14. [dc@Android repos]$ ll
  15. 总用量 116
  16. drwxrwxr-x 7 dc dc   4096 11月 22 23:01 manifest.git
  17. -rw-rw-r-- 1 dc dc 100049 11月 23 03:08 master.zip
  18. drwxrwxr-x 4 dc dc   4096 11月 23 02:44 pro
  19. drwxrwxr-x 7 dc dc   4096 11月 23 02:44 pro3.git
  20. drwxrwxr-x 6 dc dc   4096 1月  11 2011 repo
  21. [dc@Android repos]$

给repo工具加入版本管理
  1. [dc@Android repos]$ cd repo/
  2. [dc@Android repo]$ git init
  3. 初始化空的 Git 仓库于 /home/dc/repos/repo/.git/
  4. [dc@Android repo]$ git add --all
  5. [dc@Android repo]$ git commit -m 'init'

6)本地测试repo
初始化报错
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init --repo-url=git://10.5.10.145/repos/repo  --no-repo-verify --repo-branch=master  –u git://10.5.10.145/repos/manifest.git
  2. fatal: manifest url (-u) is required.
  3. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init -u git://10.5.10.145/repos/manifest.git
  4. Get git://10.5.10.145/repos/repo.git
  5. fatal: unable to connect to 10.5.10.145:
  6. 10.5.10.145[0: 10.5.10.145]: errno=没有到主机的路由
改成这样就好了。。。。至少能找到了
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init --repo-url=dc@10.5.10.145:/home/dc/repos/repo --no-repo-verify --repo-branch=master -u dc@10.5.10.145:/home/dc/repos/manifest.git
  2. Get dc@10.5.10.145:/home/dc/repos/repo
  3. dc@10.5.10.145's password:
  4. remote: 对象计数中: 57, 完成.
  5. remote: 压缩对象中: 100% (54/54), 完成.
  6. remote: Total 57 (delta 9), reused 0 (delta 0)
  7. Unpacking objects: 100% (57/57), done.
  8. 来自 10.5.10.145:/home/dc/repos/repo
  9.  * [新分支]          master     -> origin/master
  10. Getting manifest ...
  11.    from dc@10.5.10.145:/home/dc/repos/manifest.git
  12. dc@10.5.10.145's password: dc@10.5.10.145's password:
  13. Permission denied, please try again.
  14. dc@10.5.10.145's password:
  15. remote: 对象计数中: 12, 完成.
  16. remote: 压缩对象中: 100% (9/9), 完成.
  17. remote: Total 12 (delta 3), reused 0 (delta 0)
  18. Unpacking objects: 100% (12/12), done.
  19. 来自 10.5.10.145:/home/dc/repos/manifest
  20.  * [新分支]          master     -> origin/master
  21. Traceback (most recent call last):
  22.   File "/home/senrsl/test/repo/repo_test/.repo/repo/main.py", line 234, in <module>
  23.     _Main(sys.argv[1:])
  24.   File "/home/senrsl/test/repo/repo_test/.repo/repo/main.py", line 216, in _Main
  25.     repo._Run(argv)
  26.   File "/home/senrsl/test/repo/repo_test/.repo/repo/main.py", line 121, in _Run
  27.     cmd.Execute(copts, cargs)
  28.   File "/home/senrsl/test/repo/repo_test/.repo/repo/subcmds/init.py", line 272, in Execute
  29.     self._SyncManifest(opt)
  30.   File "/home/senrsl/test/repo/repo_test/.repo/repo/subcmds/init.py", line 183, in _SyncManifest
  31.     self._LinkManifest(opt.manifest_name)
  32.   File "/home/senrsl/test/repo/repo_test/.repo/repo/subcmds/init.py", line 198, in _LinkManifest
  33.     self.manifest.Link(name)
  34.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 87, in Link
  35.     self.Override(name)
  36.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 80, in Override
  37.     self._Load()
  38.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 232, in _Load
  39.     self._ParseManifest(True)
  40.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 250, in _ParseManifest
  41.     root = xml.dom.minidom.parse(self._manifestFile)
  42.   File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
  43.     return expatbuilder.parse(file)
  44.   File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse
  45.     result = builder.parseFile(fp)
  46.   File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
  47.     parser.Parse(buffer, 0)
  48. xml.parsers.expat.ExpatError: XML declaration not well-formed: line 1, column 19
  49. senrsl@senrsl-T540p:~/test/repo/repo_test$
好吧,反应了半天,看来必须要安装git-damon-run.....
senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init --repo-url=git://10.5.10.145/repos/repo --no-repo-verify --repo-branch=master -u git://10.5.10.145/repos/manifest.git
Get git://10.5.10.145/repos/repo
fatal: unable to connect to 10.5.10.145:
10.5.10.145[0: 10.5.10.145]: errno=没有到主机的路由
我屮,我屮,我屮
大晚上的折腾好几个小时,在服务器上把防火墙关了,返回的错误立马就变了。。。。
  1. Last login: Mon Nov 23 05:28:01 2015 from 192.168.21.2
  2. [root@Android ~]# /etc/init.d/iptables stop
  3. iptables:清除防火墙规则:                                 [确定]
  4. iptables:将链设置为政策 ACCEPT:filter                    [确定]
  5. iptables:正在卸载模块:                                   [确定]
  6. [root@Android ~]#
日志变了
....
然后。。。。

把用户换一下
  1. [root@Android ~]# git daemon --export-all --user=dc --group=dc --reuseaddr --base-path=/home/dc /home/dc
  2. ^C
  3. [root@Android ~]# su - dc
  4. [dc@Android ~]$ git daemon --export-all --user=dc --group=dc --reuseaddr --base-path=/home/dc /home/dc
  5. fatal: cannot drop privileges
root运行的时候,客户机就可以拉去repo代码,但是项目代码报错
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init --repo-url=git://10.5.10.145/repos/repo --no-repo-verify --repo-branch=master -u git://10.5.10.145/repos/manifest.git
  2. Get git://10.5.10.145/repos/repo
  3. remote: warning: 不能访问 '/root/.config/git/attributes':????
  4. remote: 对象计数中: 57, 完成.
  5. remote: 压缩对象中: 100% (54/54), 完成.
  6. remote: Total 57 (delta 9), reused 0 (delta 0)
  7. Unpacking objects: 100% (57/57), done.
  8. 来自 git://10.5.10.145/repos/repo
  9.  * [新分支]          master     -> origin/master
  10. Getting manifest ...
  11.    from git://10.5.10.145/repos/manifest.git
  12. remote: warning: 不能访问 '/root/.config/git/attributes':????
  13. remote: 对象计数中: 16, 完成.
  14. remote: 压缩对象中: 100% (12/12), 完成.
  15. remote: Total 16 (delta 4), reused 0 (delta 0)
  16. Unpacking objects: 100% (16/16), done.
  17. 来自 git://10.5.10.145/repos/manifest
  18.  * [新分支]          master     -> origin/master
  19. Traceback (most recent call last):
  20.   File "/home/senrsl/test/repo/repo_test/.repo/repo/main.py", line 234, in <module>
  21.     _Main(sys.argv[1:])
  22.   File "/home/senrsl/test/repo/repo_test/.repo/repo/main.py", line 216, in _Main
  23.     repo._Run(argv)
  24.   File "/home/senrsl/test/repo/repo_test/.repo/repo/main.py", line 121, in _Run
  25.     cmd.Execute(copts, cargs)
  26.   File "/home/senrsl/test/repo/repo_test/.repo/repo/subcmds/init.py", line 272, in Execute
  27.     self._SyncManifest(opt)
  28.   File "/home/senrsl/test/repo/repo_test/.repo/repo/subcmds/init.py", line 183, in _SyncManifest
  29.     self._LinkManifest(opt.manifest_name)
  30.   File "/home/senrsl/test/repo/repo_test/.repo/repo/subcmds/init.py", line 198, in _LinkManifest
  31.     self.manifest.Link(name)
  32.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 87, in Link
  33.     self.Override(name)
  34.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 80, in Override
  35.     self._Load()
  36.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 232, in _Load
  37.     self._ParseManifest(True)
  38.   File "/home/senrsl/test/repo/repo_test/.repo/repo/manifest_xml.py", line 250, in _ParseManifest
  39.     root = xml.dom.minidom.parse(self._manifestFile)
  40.   File "/usr/lib/python2.7/xml/dom/minidom.py", line 1918, in parse
  41.     return expatbuilder.parse(file)
  42.   File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 924, in parse
  43.     result = builder.parseFile(fp)
  44.   File "/usr/lib/python2.7/xml/dom/expatbuilder.py", line 207, in parseFile
  45.     parser.Parse(buffer, 0)
  46. xml.parsers.expat.ExpatError: XML declaration not well-formed: line 1, column 19
  47. senrsl@senrsl-T540p:~/test/repo/repo_test$

又验证了下,repo这个库不需要在mainfest里配

上面那个错,靠,xml 1行19列有错。。。。

2015年11月22日22:32:52

明日

2015年11月23日20:07:49
原来是xml没搞那些空格
然后把xml格式改对,服务器上
  1. Last login: Mon Nov 23 05:58:04 2015 from 192.168.21.2
  2. [root@Android ~]# git daemon --export-all --user=dc --group=dc --reuseaddr --base-path=/home/dc /home/dc
本机
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$  repo init --repo-url=git://10.5.10.145/repos/repo --no-repo-verify --repo-branch=master -u git://10.5.10.145/repos/manifest.git
  2. Get git://10.5.10.145/repos/repo
  3. fatal: unable to connect to 10.5.10.145:
  4. 10.5.10.145[0: 10.5.10.145]: errno=拒绝连接
  5. senrsl@senrsl-T540p:~/test/repo/repo_test$ ll
  6. 总用量 12
  7. drwxrwxr-x  3 senrsl senrsl 4096 11月 23 20:01 ./
  8. drwxrwxr-x 10 senrsl senrsl 4096 11月 22 19:13 ../
  9. drwxrwxr-x  2 senrsl senrsl 4096 11月 23 20:01 .repo/
  10. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init --repo-url=git://10.5.10.145/repos/repo --no-repo-verify --repo-branch=master -u git://10.5.10.145/repos/manifest.git
  11. Get git://10.5.10.145/repos/repo
  12. remote: warning: 不能访问 '/root/.config/git/attributes':????
  13. remote: 对象计数中: 57, 完成.
  14. remote: 压缩对象中: 100% (54/54), 完成.
  15. remote: Total 57 (delta 9), reused 0 (delta 0)
  16. Unpacking objects: 100% (57/57), done.
  17. 来自 git://10.5.10.145/repos/repo
  18.  * [新分支]          master     -> origin/master
  19. Getting manifest ...
  20.    from git://10.5.10.145/repos/manifest.git
  21. remote: warning: 不能访问 '/root/.config/git/attributes':????
  22. remote: 对象计数中: 23, 完成.
  23. remote: 压缩对象中: 100% (17/17), 完成.
  24. remote: Total 23 (delta 6), reused 0 (delta 0)
  25. Unpacking objects: 100% (23/23), done.
  26. 来自 git://10.5.10.145/repos/manifest
  27.  * [新分支]          master     -> origin/master
  28. Your Name  [senRsl]:
  29. Your Email [senRsl@163.com]:
  30. Your identity is: senRsl <senRsl@163.com>
  31. is this correct [y/n]? y
  32. repo initialized in /home/senrsl/test/repo/repo_test
  33. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo branch
  34.    (no branches)
  35. senrsl@senrsl-T540p:~/test/repo/repo_test$ cd .repo/manifests
  36. senrsl@senrsl-T540p:~/test/repo/repo_test/.repo/manifests$ git branch -a | cut -d / -f 3
  37. * default
  38. mastersenrsl@senrsl-T540p:~/test/repo/repo_test/.repo/manifests$ repo sync
  39. Initializing project pro/pro1 ...
  40. remote: warning: 不能访问 '/root/.config/git/attributes':????
  41. remote: 对象计数中: 3, 完成.
  42. remote: Total 3 (delta 0), reused 0 (delta 0)
  43. Unpacking objects: 100% (3/3), done.
  44. 来自 git://10.5.10.145/repos/pro/pro1
  45.  * [新分支]          master     -> origin/master
  46. Initializing project pro/pro2 ...
  47. remote: warning: 不能访问 '/root/.config/git/attributes':????
  48. remote: 对象计数中: 3, 完成.
  49. remote: Total 3 (delta 0), reused 0 (delta 0)
  50. Unpacking objects: 100% (3/3), done.
  51. 来自 git://10.5.10.145/repos/pro/pro2
  52.  * [新分支]          master     -> origin/master
  53. Initializing project pro3 ...
  54. remote: warning: 不能访问 '/root/.config/git/attributes':????
  55. remote: 对象计数中: 3, 完成.
  56. remote: Total 3 (delta 0), reused 0 (delta 0)
  57. Unpacking objects: 100% (3/3), done.
  58. 来自 git://10.5.10.145/repos/pro3
  59.  * [新分支]          master     -> origin/master
  60. senrsl@senrsl-T540p:~/test/repo/repo_test$ tree
  61. .
  62. ├── pro
  63. │   ├── pro1
  64. │   │   └── README
  65. │   └── pro2
  66. │       └── README
  67. └── pro3
  68.     └── README
  69. 4 directories, 3 files
  70. senrsl@senrsl-T540p:~/test/repo/repo_test$

这样就把库都拉取下来了,就可以按正常的操作走了。。。。

然后,权限配置;脚本;

6.1)关闭防火墙
  1. #重启后永久关闭
  2. [root@Android ~]# chkconfig iptables off
  3. #立即关闭,重启后自动开启
  4. [root@Android ~]# service iptables stop
  5. iptables:清除防火墙规则:                                 [确定]
  6. iptables:将链设置为政策 ACCEPT:filter                    [确定]
  7. iptables:正在卸载模块:                                   [确定]
6.2)权限配置


6.3)测试连接
服务器执行
  1. [root@Android ~]# git daemon --export-all --user=git-ro --group=git-ro --reuseaddr --base-path=/home/git-ro /home/git-ro
本机执行
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init --repo-url=git://10.5.10.145/repos/repo --no-repo-verify --repo-branch=master -u git://10.5.10.145/repos/manifest.git
  2. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo sync



6.4)尝试git-daemon

①软链接
[root@Android ~]# ln -s /usr/local/git/libexec/git-core /usr/libexec/

我屮,我屮,我屮,果然还是要用git-daemon啊
之前不管怎么搞,一直不能访问 '/root/.config/git/attributes':????,改用git-daemon,就没这问题了
②写个脚本:
  1. senrsl@senrsl-T540p:~/test/repo$ cat gitd
  2. #!/bin/sh
  3. #
  4. #   Startup/shutdown script for Git Daemon
  5. #   chkconfig: 345 56 10
  6. #
  7. #   description: Startup/shutdown script for Git Daemon
  8. #
  9. . /etc/init.d/functions
  10. DAEMON=/usr/libexec/git-core/git-daemon
  11. USER=git-ro
  12. GROUP=git-ro
  13. BASE_PATH=/home/git-ro/
  14. ARGS="--user=$USER --group=$GROUP --detach --base-path=$BASE_PATH --export-all"
  15. prog=git-daemon
  16. start () {
  17.     echo -n $"Starting $prog: "
  18.     # start daemon
  19.     daemon $DAEMON $ARGS
  20.         RETVAL=$?
  21.     echo
  22.     [ $RETVAL = 0 ] && touch /var/lock/git-daemon
  23.     return $RETVAL
  24. }
  25. stop () {
  26.     # stop daemon
  27.     echo -n $"Stopping $prog: "
  28.     killproc $DAEMON
  29.     RETVAL=$?
  30.     echo
  31.     [ $RETVAL = 0 ] && rm -f /var/lock/git-daemon
  32. }
  33. restart() {
  34.     stop
  35.     start
  36. }
  37. case $1 in
  38.     start)
  39.         start
  40.         ;;
  41.     stop)
  42.         stop
  43.         ;;
  44.     restart)
  45.         restart
  46.         ;;
  47.     status)
  48.         status $DAEMON
  49.         RETVAL=$?
  50.         ;;
  51.     *)
  52.         echo $"Usage: $prog {start|stop|restart|status}"
  53.         exit 3
  54.         ;;
  55. esac
  56. exit $RETVAL
  57. senrsl@senrsl-T540p:~/test/repo$
然后把这个脚本放到
  1. [root@Android init.d]# cp ~/tools/gitd  /etc/init.d/

③脚本权限755
  1. [root@Android init.d]# chmod 755 gitd

④测试
  1. [root@Android init.d]# service gitd status
  2. git-daemon 已停
  3. [root@Android init.d]# service gitd start
  4. 正在启动 git-daemon:                                      [确定]
  5. [root@Android init.d]# service gitd status
  6. git-daemon (pid 1439) 正在运行...
  7. [root@Android init.d]# service gitd stop
  8. 停止 git-daemon:                                          [确定]
  9. [root@Android init.d]# service gitd status
  10. git-daemon 已停
  11. [root@Android init.d]# service gitd start
  12. 正在启动 git-daemon:                                      [确定]
然后本机
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo init --repo-url=git://10.5.10.145/repos/repo --no-repo-verify --repo-branch=master -u git://10.5.10.145/repos/manifest.git
  2. Get git://10.5.10.145/repos/repo
  3. remote: 对象计数中: 57, 完成.
  4. remote: 压缩对象中: 100% (54/54), 完成.
  5. remote: Total 57 (delta 9), reused 0 (delta 0)
  6. 展开对象中: 100% (57/57), 完成.
  7. 来自 git://10.5.10.145/repos/repo
  8.  * [新分支]          master     -> origin/master
  9. Getting manifest ...
  10.    from git://10.5.10.145/repos/manifest.git
  11. remote: 对象计数中: 23, 完成.
  12. remote: 压缩对象中: 100% (17/17), 完成.
  13. remote: Total 23 (delta 6), reused 0 (delta 0)
  14. 展开对象中: 100% (23/23), 完成.
  15. 来自 git://10.5.10.145/repos/manifest
  16.  * [新分支]          master     -> origin/master
  17. Your Name  [senRsl]:
  18. Your Email [senRsl@163.com]:
  19. Your identity is: senRsl <senRsl@163.com>
  20. is this correct [y/n]? y
  21. repo initialized in /home/senrsl/test/repo/repo_test
  22. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo sync
  23. Initializing project pro/pro1 ...
  24. remote: 对象计数中: 3, 完成.
  25. remote: Total 3 (delta 0), reused 0 (delta 0)
  26. 展开对象中: 100% (3/3), 完成.
  27. 来自 git://10.5.10.145/repos/pro/pro1
  28.  * [新分支]          master     -> origin/master
  29. Initializing project pro/pro2 ...
  30. remote: 对象计数中: 3, 完成.
  31. remote: Total 3 (delta 0), reused 0 (delta 0)
  32. 展开对象中: 100% (3/3), 完成.
  33. 来自 git://10.5.10.145/repos/pro/pro2
  34.  * [新分支]          master     -> origin/master
  35. Initializing project pro3 ...
  36. remote: 对象计数中: 3, 完成.
  37. remote: Total 3 (delta 0), reused 0 (delta 0)
  38. 展开对象中: 100% (3/3), 完成.
  39. 来自 git://10.5.10.145/repos/pro3
  40.  * [新分支]          master     -> origin/master
  41. senrsl@senrsl-T540p:~/test/repo/repo_test$
终于不报警告了!!!!!!!

以上 读测完了,以下测写

6.5)本地使用测试

①检出分支,编写代码
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo branches
  2.    (no branches)
  3. senrsl@senrsl-T540p:~/test/repo/repo_test$ cd .repo/manifests
  4. senrsl@senrsl-T540p:~/test/repo/repo_test/.repo/manifests$ git branch -a | cut -d / -f 3
  5. * default
  6. master
  7. senrsl@senrsl-T540p:~/test/repo/repo_test/.repo/manifests$ cd ../..
  8. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo start master --all
  9. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo branches
  10. *  master                    | in all projects
  11. senrsl@senrsl-T540p:~/test/repo/repo_test$
②修改文件,查看差异
  1. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo diff
  2. project pro3/
  3. diff --git a/README b/README
  4. index 9daeafb..3edd806 100644
  5. --- a/README
  6. +++ b/README
  7. @@ -1 +1,3 @@
  8.  test
  9. +
  10. +在本机修改文件,提交至服务器
  11. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo diff pro3
  12. project pro3/
  13. diff --git a/README b/README
  14. index 9daeafb..3edd806 100644
  15. --- a/README
  16. +++ b/README
  17. @@ -1 +1,3 @@
  18.  test
  19. +
  20. +在本机修改文件,提交至服务器
  21. senrsl@senrsl-T540p:~/test/repo/repo_test$ repo status
  22. # on branch master
  23. project pro3/                                   branch master
  24.  -m     README
  25. senrsl@senrsl-T540p:~/test/repo/repo_test$
对于repo status的说明

Ø         每个小节的首行显示羡慕名称,以及所在分支的名称
Ø         第一个字母表示暂存区的文件修改状态
l         -:没有改变
l         A:添加(不在HEAD中,在暂存区中)
l         M:修改(在HEAD中,在暂存区中,内容不同)
l         D:删除(在HEAD中,不在暂存区)
l         R:重命名(不在HEAD中,在暂存区,路径修改)
l         C:拷贝(不在HEAD中,在暂存区,从其他文件拷贝)
l         T:文件状态改变(在HEAD中,在暂存区,内容相同)
l         U:未合并,需要冲突解决
Ø         第二个字母表示工作区文件的更改状态
l         -:新/未知(不在暂存区,在工作区)
l         m:修改(在暂存区,在工作区,被修改)
l         d:删除(在暂存区,不在工作区)
Ø         两个表示状态的字母后面,显示文件名信息。如果有文件重名还会显示改变前后的文件名及文件的相似度
③设置远程仓库
地址对应mainfest.xml
senrsl@senrsl-T540p:~/test/repo/repo_test$ repo remote add origin git://10.5.10.145/repos
repo: 'remote' is not a repo command.  See 'repo help'.
senrsl@senrsl-T540p:~/test/repo/repo_test$
看来google的这个没有,需要搞个完整版的。。。。
折腾半天,原来repo remote跟repo push都是自己写的。。。。
那样的话就需要给repo添加指令。。。。


④提交代码

坑,看了一遭发现默认的提交需要先提交到代码审核服务器上。。。。

如果不安代码审核服务器,就得需要自己写repo脚本,绕过去。。。。



4,搭建代码审核服务器Gerrit


1)下载

官网是www.gerritcodereview.com,最新版本2.11.5,下载到gerrit 2.11.5.war

2)安装

2.1)创建用户
创建个用户,切换到这个用户下安装
  1. [root@Android gitosis]# useradd -c 'gerrit' -m -d /home/gerrit -s /bin/bash gerrit
  2. [root@Android gitosis]# passwd gerrit
  3. 更改用户 gerrit 的密码 。
  4. 新的 密码:
  5. 无效的密码: 它基于字典单词
  6. 重新输入新的 密码:
  7. passwd: 所有的身份验证令牌已经成功更新。
  8. [root@Android gitosis]# su gerrit
发现竟然没java环境。。。。
安java....

2.2)安装JDK
跑oracle下jdk,jdk-8u65-linux-x64.rpm
然后切root,安
  1. [root@Android tools]# rpm -ivh jdk-8u65-linux-x64.rpm
  2. Preparing...                                                            (100########################################### [100%]
  3.    1:jdk1.8.0_65                                                        (  1########################################### [100%]
  4. Unpacking JAR files...
  5.     tools.jar...
  6.     plugin.jar...
  7.     javaws.jar...
  8.     deploy.jar...
  9.     rt.jar...
  10.     jsse.jar...
  11.     charsets.jar...
  12.     localedata.jar...
  13.     jfxrt.jar...
  14. [root@Android tools]# java -version
  15. java version "1.8.0_65"
  16. Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
  17. Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
然后尝试安装

2.3)配置mysql服务器
回到另一台服务器上,把mysql开起来,不用H2的数据库了,用mysql
  1. mysql> select user,password,host from user;
  2. +------+-------------------------------------------+-----------+
  3. | user | password                                  | host      |
  4. +------+-------------------------------------------+-----------+
  5. | root | *FE1C2745E806B636F29EF399A36108BF0BF845CF | localhost |
  6. | root |                                           | 126    |
  7. | root |                                           | 127.0.0.1 |
  8. |      |                                           | localhost |
  9. |      |                                           | 126    |
  10. +------+-------------------------------------------+-----------+
  11. 5 rows in set (0.00 sec)
  12. mysql> grant all privileges on *.* to root@'%' identified by '0123' with grant option;
  13. Query OK, 0 rows affected (0.00 sec)
  14. mysql> flush privileges;
  15. Query OK, 0 rows affected (0.00 sec)
之前的mysql不可以在其他地方登陆,更改下权限就ok

然后本机安上navicat,方便操作。
创建用户,创建表
  1. mysql> create user 'gerrit'@'localhost' identified by 'gerrit01';
  2. Query OK, 0 rows affected (0.00 sec)
  3. mysql> create database gerritdb;
  4. Query OK, 1 row affected (0.01 sec)
  5. mysql> alter database gerritdb charset=latin1;
  6. Query OK, 1 row affected (0.00 sec)
  7. mysql> grant all on gerritdb.* to 'gerrit'@'localhost';
  8. Query OK, 0 rows affected (0.00 sec)
  9. mysql> flush privileges;
  10. Query OK, 0 rows affected (0.00 sec)
然后,回到版本控制服务器上

还后需要配置用户访问库的权限
  1. mysql> grant all privileges on gerritdb.* to gerrit@'10.5.10.145' identified by 'gerrit01';
  2. Query OK, 0 rows affected (0.00 sec)
语法:
  1. mysql> grant 权限1,权限2,…权限n on 数据库名称.表名称 to 用户名@用户地址 identified by '连接口令';

2.4)安装支持软件
①yum更新源

  1. [root@Android gerrit]# yum clean all && yum clean metadata && yum clean dbcache && yum makecache && yum update
我屮,手贱了,执行完发现他把系统升级了。。。。。
  1. [root@Android ~]#  cat /etc/redhat-release
  2. CentOS release 6.7 (Final)

②安装sendmail
  1. [root@Android ~]# yum install -y sendmail

③安装apache
带有权限的认证,可以用http认证,需要使用反向代理,需要安装apache。。。。
  1. [root@Android ~]# yum install -y httpd

2.5)安装gerrit
切换用户,安装
  1. [gerrit@Android ~]$  java -jar gerrit-2.11.5.war  init -d  review
  2. Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
  3. [2015-12-08 01:59:06,209] INFO  com.google.gerrit.server.config.GerritServerConfigProvider : No /home/gerrit/review/etc/gerrit.config; assuming defaults
  4. *** Gerrit Code Review 2.11.5
  5. ***
  6. Create '/home/gerrit/review'   [Y/n]?
  7. *** Git Repositories
  8. ***
  9. Location of Git repositories   [git]:
  10. *** SQL Database
  11. ***
  12. Database server type           [h2]: ?
  13.        Supported options are:
  14.          h2
  15.          jdbc
  16.          maxdb
  17.          mysql
  18.          oracle
  19.          postgresql
  20. Database server type           [h2]: mysql
  21. Gerrit Code Review is not shipped with MySQL Connector/J 5.1.21
  22. **  This library is required for your configuration. **
  23. Download and install it now [Y/n]?
  24. Downloading http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar ... OK
  25. Checksum mysql-connector-java-5.1.21.jar OK
  26. Server hostname                [localhost]: 10.5.8.102
  27. Server port                    [(mysql default)]:
  28. Database name                  [reviewdb]: gerritdb
  29. Database username              [gerrit]:
  30. gerrit's password              :
  31.               confirm password :
  32. *** Index
  33. ***
  34. Type                           [LUCENE/?]:
  35. *** User Authentication
  36. ***
  37. Authentication method          [OPENID/?]: ?
  38.        Supported options are:
  39.          openid
  40.          openid_sso
  41.          http
  42.          http_ldap
  43.          client_ssl_cert_ldap
  44.          ldap
  45.          ldap_bind
  46.          custom_extension
  47.          development_become_any_account
  48.          oauth
  49. Authentication method          [OPENID/?]: http
  50. Get username from custom HTTP header [y/N]?
  51. SSO logout URL                 :
  52. *** Review Labels
  53. ***
  54. Install Verified label         [y/N]?
  55. *** Email Delivery
  56. ***
  57. SMTP server hostname           [localhost]:
  58. SMTP server port               [(default)]:
  59. SMTP encryption                [NONE/?]:
  60. SMTP username                  :
  61. *** Container Process
  62. ***
  63. Run as                         [gerrit]:
  64. Java runtime                   [/usr/java/jdk1.8.0_65/jre]:
  65. Copy gerrit-2.11.5.war to /home/gerrit/review/bin/gerrit.war [Y/n]?
  66. Copying gerrit-2.11.5.war to /home/gerrit/review/bin/gerrit.war
  67. *** SSH Daemon
  68. ***
  69. Listen on address              [*]:
  70. Listen on port                 [29418]:
  71. Gerrit Code Review is not shipped with Bouncy Castle Crypto SSL v151
  72.   If available, Gerrit can take advantage of features
  73.   in the library, but will also function without it.
  74. Download and install it now [Y/n]?
  75. Downloading http://www.bouncycastle.org/download/bcpkix-jdk15on-151.jar ... OK
  76. Checksum bcpkix-jdk15on-151.jar OK
  77. Gerrit Code Review is not shipped with Bouncy Castle Crypto Provider v151
  78. ** This library is required by Bouncy Castle Crypto SSL v151. **
  79. Download and install it now [Y/n]?
  80. Downloading http://www.bouncycastle.org/download/bcprov-jdk15on-151.jar ... OK
  81. Checksum bcprov-jdk15on-151.jar OK
  82. Generating SSH host key ... rsa... dsa... done
  83. *** HTTP Daemon
  84. ***
  85. Behind reverse proxy           [y/N]? y
  86. Proxy uses SSL (https://)      [y/N]? ?
  87. Proxy uses SSL (https://)      [y/N]?
  88. Subdirectory on proxy server   [/]: /gerrit
  89. Listen on address              [*]:
  90. Listen on port                 [8081]:
  91. Canonical URL                  [http://202.106.199.36/gerrit]: http://10.5.10.145/gerrit
  92. *** Plugins
  93. ***
  94. Installing plugins.
  95. Install plugin commit-message-length-validator version v2.11.5 [y/N]?
  96. Install plugin download-commands version v2.11.5 [y/N]?
  97. Install plugin replication version v2.11.5 [y/N]?
  98. Install plugin reviewnotes version v2.11.5 [y/N]?
  99. Install plugin singleusergroup version v2.11.5 [y/N]?
  100. Initializing plugins.
  101. No plugins found with init steps.
  102. fatal: DbInjector failed
  103. fatal: Unable to determine SqlDialect
  104. fatal:   caused by java.sql.SQLException: Access denied for user 'gerrit'@'10.5.10.145' (using password: YES)
  105. #找了一遭发现授权的时候把数据库名写错了。。。。
  106. [gerrit@Android ~]$  java -jar gerrit-2.11.5.war  init -d  review
  107. Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
  108. *** Gerrit Code Review 2.11.5
  109. ***
  110. *** Git Repositories
  111. ***
  112. Location of Git repositories   [git]:
  113. *** SQL Database
  114. ***
  115. Database server type           [mysql]:
  116. Server hostname                [10.5.8.102]:
  117. Server port                    [(mysql default)]:
  118. Database name                  [gerritdb]:
  119. Database username              [gerrit]:
  120. Change gerrit's password       [y/N]?
  121. *** Index
  122. ***
  123. Type                           [LUCENE/?]:
  124. The index must be rebuilt before starting Gerrit:
  125.   java -jar gerrit.war reindex -d site_path
  126. *** User Authentication
  127. ***
  128. Authentication method          [HTTP/?]:
  129. Get username from custom HTTP header [y/N]?
  130. SSO logout URL                 :
  131. *** Review Labels
  132. ***
  133. Install Verified label         [y/N]?
  134. *** Email Delivery
  135. ***
  136. SMTP server hostname           [localhost]:
  137. SMTP server port               [(default)]:
  138. SMTP encryption                [NONE/?]:
  139. SMTP username                  :
  140. *** Container Process
  141. ***
  142. Run as                         [gerrit]:
  143. Java runtime                   [/usr/java/jdk1.8.0_65/jre]:
  144. Upgrade /home/gerrit/review/bin/gerrit.war [Y/n]?
  145. Copying gerrit-2.11.5.war to /home/gerrit/review/bin/gerrit.war
  146. *** SSH Daemon
  147. ***
  148. Listen on address              [*]:
  149. Listen on port                 [29418]:
  150. *** HTTP Daemon
  151. ***
  152. Behind reverse proxy           [Y/n]?
  153. Proxy uses SSL (https://)      [y/N]?
  154. Subdirectory on proxy server   [/gerrit]:
  155. Listen on address              [*]:
  156. Listen on port                 [8081]:
  157. Canonical URL                  [http://10.5.10.145/gerrit]:
  158. *** Plugins
  159. ***
  160. Installing plugins.
  161. Install plugin commit-message-length-validator version v2.11.5 [y/N]?
  162. Install plugin download-commands version v2.11.5 [y/N]?
  163. Install plugin replication version v2.11.5 [y/N]?
  164. Install plugin reviewnotes version v2.11.5 [y/N]?
  165. Install plugin singleusergroup version v2.11.5 [y/N]?
  166. Initializing plugins.
  167. No plugins found with init steps.
  168. Initialized /home/gerrit/review
  169. [gerrit@Android ~]$
终于看到安装成功,但是为什么没有启动。。。。
手动启动尝试
  1. [gerrit@Android ~]$ ./review/bin/gerrit.sh start
  2. Starting Gerrit Code Review: OK
查看可知开了俩端口
  1. [gerrit@Android ~]$ netstat -ltpn | grep -i gerrit
  2. (Not all processes could be identified, non-owned process info
  3.  will not be shown, you would have to be root to see it all.)
  4. tcp        0      0 :::29418                    :::*                        LISTEN      1509/GerritCodeRevi
  5. tcp        0      0 :::8081                     :::*                        LISTEN      1509/GerritCodeRevi

设置开机自启
  1. [root@Android gerrit]# ln -s /home/gerrit/review/bin/gerrit.sh /etc/init.d/gerrit.sh
  2. #没切目录,导致后面不能开机自启
  3. [root@Android gerrit]# chkconfig --level 345 gerrit.sh on
后来发现上面的软链接不管用了,尝试
  1. [root@Android ~]# ln -sf /home/gerrit/review/bin/gerrit.sh /etc/init.d/gerrit
  2. [root@Android ~]# ln -sf /etc/init.d/gerrit /etc/rc3.d/S90gerrit
  3. [root@Android ~]# rm  /etc/init.d/gerrit.sh
  4. rm:是否删除符号链接 "/etc/init.d/gerrit.sh"?yes
  5. [root@Android ~]#
文件
  1. [root@Android default]# pwd
  2. /etc/default
  3. [root@Android default]# touch gerritcodereview
  4. [root@Android default]# echo 'GERRIT_SITE=/home/gerrit/review'>>gerritcodereview
  5. [root@Android default]# cat gerritcodereview
  6. GERRIT_SITE=/home/gerrit/review
  7. [root@Android default]#
就好了。。。。。

2.6)配置apache反向代理
创建文件夹,创建文件
  1. [root@Android gerrit]# cd /etc/httpd
  2. [root@Android httpd]# ll
  3. 总用量 8
  4. drwxr-xr-x 2 root root 4096 12月  8 01:55 conf
  5. drwxr-xr-x 2 root root 4096 12月  8 01:55 conf.d
  6. lrwxrwxrwx 1 root root   19 12月  8 01:55 logs -> ../../var/log/httpd
  7. lrwxrwxrwx 1 root root   29 12月  8 01:55 modules -> ../../usr/lib64/httpd/modules
  8. lrwxrwxrwx 1 root root   19 12月  8 01:55 run -> ../../var/run/httpd
  9. [root@Android httpd]# mkdir init.d
  10. [root@Android httpd]# cd init.d/
  11. [root@Android init.d]# touch gerrit.conf
  12. [root@Android init.d]# vi gerrit.conf
  13. #写入配置
  14. #重启服务,配置服务开机自启
  15. [root@Android init.d]# service httpd restart
  16. 停止 httpd:                                               [失败]
  17. 正在启动 httpd:                                           [确定]
  18. [root@Android init.d]# chkconfig --level 345 httpd on
好吧,实验证明上面放到init.d里根本没加载。。。。
放到conf.d里就好了
  1. [root@Android conf.d]# pwd
  2. /etc/httpd/conf.d
  3. [root@Android conf.d]# ll
  4. 总用量 12
  5. -rw-r--r-- 1 root root 540 12月  8 19:32 gerrit.conf
  6. -rw-r--r-- 1 root root 392 8月  25 01:53 README
  7. -rw-r--r-- 1 root root 299 8月  18 13:57 welcome.conf
  8. [root@Android conf.d]#
gerrit.conf内容
  1. [root@Android conf.d]# cat gerrit.conf
  2. <Directory / >
  3.     Options FollowSymLinks
  4.     AllowOverride None
  5. </Directory>
  6. SetEnv GIT_PROJECT_ROOT /home/dc/repos/
  7. SetEnv GIT_HTTP_EXPORT_ALL
  8. ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
  9. ServerName localhost
  10. ProxyRequests Off
  11. ProxyVia Off
  12. ProxyPreserveHost On
  13. <Proxy *>
  14.     Order deny,allow
  15.     Allow from all
  16. </Proxy>
  17. <Location "/gerrit/login/">
  18.     AuthType Basic
  19.     AuthName "Gerrit Code Review"
  20.     AuthBasicProvider file
  21.     AuthUserFile /etc/gerrit.passwd
  22.     Require valid-user
  23. </Location>
  24. ProxyPass /gerrit http://localhost:8081/gerrit
  25. [root@Android conf.d]#


上面的配置文件,指定口令文件地址为/etc/gerrit.passwd

2.7)注册gerrit用户
增加用户进上面那个文件

  1. [root@Android ~]# htpasswd -m /etc/gerrit.passwd dc
  2. htpasswd: cannot modify file /etc/gerrit.passwd; use '-c' to create it
  3. [root@Android ~]# htpasswd -c -m /etc/gerrit.passwd dc
  4. New password:
  5. Re-type new password:
  6. Adding password for user dc
  7. [root@Android ~]#
2.8)客户端启动配置
客户端浏览器连不上
gerrit开机自启有问题;
apache的配置文件代理有问题
2015年12月07日19:27:37

配置文件什么的都配好之后,输入
http://10.5.10.145/gerrit/
会让输入账号密码



然后登陆以后



3)配置gerrit

3.1)登陆后,注册邮箱
点击Register New mail按钮,填入邮件,点击注册。
如果报错什么的,去服务器
  1. [root@Android conf.d]# mailq
  2.         /var/spool/mqueue (1 request)
  3. -----Q-ID----- --Size-- -----Q-Time----- ------------Sender/Recipient-----------
  4. tB8Bd3Ig004648      628 Tue Dec  8 19:39 <gerrit@bt-199-038.bta.net.cn>
  5.                  (Deferred: 451 DT:SPM 163 mx6,OMCowEC5oUAzUGZWkLAYAA--.13316S)
  6.                      <senRsl@163.com>
  7.         Total requests: 1
  8. [root@Android conf.d]# ls /var/spool/mqueue/dft*648
  9. /var/spool/mqueue/dftB8Bd3Ig004648
  10. [root@Android conf.d]# cat /var/spool/mqueue/dftB8Bd3Ig004648
  11. Welcome to Gerrit Code Review at 10.5.10.145.
  12. To add a verified email address to your user account, please
  13. click on the following link while signed in as dc:
  14. http://10.5.10.145/gerrit/#/VE/qiF/5rtmv6LbYGBY9842E1ZlqiePc+nDNxxFdQ==$MTpzZW5Sc2xAMTYzLmNvbQ==
  15. If you have received this mail in error, you do not need to take any
  16. action to cancel the account.  The address will not be activated, and
  17. you will not receive any further emails.
  18. If clicking the link above does not work, copy and paste the URL in a
  19. new browser window instead.
  20. This is a send-only email address.  Replies to this message will not
  21. be read or answered.
  22. [root@Android conf.d]#
把地址粘出来,放入浏览器,注册成功




第一个注册的邮箱有管理员权限,以后注册的用户默认没有管理员权限,权限的修改可由管理员完成。

3.2)新增加管理员

people--ListGroups--Administrators--增加

3.3)添加公钥
跟git的公钥一样

右上角,用户名-Setting--SSH public keys,Add
然后本地
senrsl@senrsl-T540p:~$ cat ~/.ssh/id_rsa.pub
把内容粘上,Add.

3.4)创建新的项目库
一图党



创建这个库的用户默认关注,其他用户可以设置关注这个库


3.5)对库配置单独权限
一图党

上面是评审权限,下面是提交权限

4)检出代码

本机
  1. senrsl@senrsl-T540p:~/test/repo/gerrit$ git clone http://10.5.10.145/gerrit/test-gerrit
  2. 正克隆到 'test-gerrit'...
  3. remote: Counting objects: 2, done
  4. remote: Finding sources: 100% (2/2)
  5. 展开对象中: 100% (2/2), 完成.
  6. remote: Total 2 (delta 0), reused 0 (delta 0)
  7. 检查连接... 完成。
  8. senrsl@senrsl-T540p:~/test/repo/gerrit$
为什么不用输密码。。。。

5)代码提交评审

  1. #记住密码
  2. senrsl@senrsl-T540p:~/test/repo/gerrit$ git config --global credential.helper store
进入项目,修改,提交
  1. senrsl@senrsl-T540p:~/test/repo/gerrit$ cd test-gerrit/
  2. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ ll
  3. 总用量 12
  4. drwxrwxr-x 3 senrsl senrsl 4096 12月  8 14:48 ./
  5. drwxrwxr-x 3 senrsl senrsl 4096 12月  8 14:48 ../
  6. drwxrwxr-x 8 senrsl senrsl 4096 12月  8 14:48 .git/
  7. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ touch README
  8. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ echo 'test'>>README
  9. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ cat README
  10. test
  11. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ vi .git/config
  12. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 dc@10.5.10.145:hooks/commit-msg ${gitdir}/hooks/
  13. The authenticity of host '[10.5.10.145]:29418 ([10.5.10.145]:29418)' can't be established.
  14. RSA key fingerprint is 35:58:ee:bd:fe:02:4a:d1:e1:20:a0:59:23:df:aa:d7.
  15. Are you sure you want to continue connecting (yes/no)? yes
  16. Warning: Permanently added '[10.5.10.145]:29418' (RSA) to the list of known hosts.
  17. Permission denied (publickey).
  18. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git status
  19. 位于分支 master
  20. 您的分支与上游分支 'origin/master' 一致。
  21. 未跟踪的文件:
  22.   (使用 "git add <文件>..." 以包含要提交的内容)
  23.     README
  24. 提交为空,但是存在尚未跟踪的文件(使用 "git add" 建立跟踪)
  25. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git add .
  26. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git commit -m 'test'
  27. [master c7c0bd5] test
  28.  1 file changed, 1 insertion(+)
  29.  create mode 100644 README
  30. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git push origin HEAD:refs/for/master
  31. Username for 'http://10.5.10.145': dc
  32. Password for 'http://dc@10.5.10.145':
  33. remote: Unauthorized
  34. fatal: Authentication failed for 'http://10.5.10.145/gerrit/test-gerrit/'
  35. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git push origin HEAD:refs/for/master
  36. Username for 'http://10.5.10.145': dc
  37. Password for 'http://dc@10.5.10.145':
  38. 对象计数中: 3, 完成.
  39. 写入对象中: 100% (3/3), 234 bytes | 0 bytes/s, 完成.
  40. Total 3 (delta 0), reused 0 (delta 0)
  41. remote: Processing changes: refs: 1, done   
  42. remote: ERROR: missing Change-Id in commit message footer
  43. remote:
  44. remote: Hint: To automatically insert Change-Id, install the hook:
  45. remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 dc@10.5.10.145:hooks/commit-msg ${gitdir}/hooks/
  46. remote: And then amend the commit:
  47. remote:   git commit --amend
  48. remote:
  49. To http://10.5.10.145/gerrit/test-gerrit
  50.  ! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit message footer)
  51. error: 无法推送一些引用到 'http://10.5.10.145/gerrit/test-gerrit'
  52. #按上面所说的,还需要加一个说明
  53. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git commit --amend
  54. [master 0903621] ssssssss shuoming
  55.  Date: Tue Dec 8 14:54:19 2015 +0800
  56.  1 file changed, 1 insertion(+)
  57.  create mode 100644 README
  58. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git log
  59. commit 0903621a1182a54686d019e3e64abcab92ee5396
  60. Author: senRsl <senRsl@163.com>
  61. Date:   Tue Dec 8 14:54:19 2015 +0800
  62.     ssssssss shuoming
  63.    
  64.     Change-Id: Ifb57da9eeeb817cf2e0a6f87b3e0478462803f1a
  65. commit 464efb7585dc8cb172187537b49ac9f0c6f142e6
  66. Author: senRsl <senRsl@163.com>
  67. Date:   Tue Dec 8 22:26:17 2015 +0800
  68.     Initial empty repository
  69. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git push origin HEAD:refs/for/master
  70. 对象计数中: 3, 完成.
  71. 写入对象中: 100% (3/3), 285 bytes | 0 bytes/s, 完成.
  72. Total 3 (delta 0), reused 0 (delta 0)
  73. remote: Processing changes: new: 1, refs: 1, done   
  74. remote:
  75. remote: New Changes:
  76. remote:   http://10.5.10.145/gerrit/1 ssssssss shuoming
  77. remote:
  78. To http://10.5.10.145/gerrit/test-gerrit
  79.  * [new branch]      HEAD -> refs/for/master
  80. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$

6)评审代码
提交之后据说关注的会收到邮件。。。。

点击

找了一遭,点那个蓝色的试试。。。。


然后点 submit

这个意思看起来是已经合并了啊。。。。

客户端同步代码
  1. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git pull
  2. 来自 http://10.5.10.145/gerrit/test-gerrit
  3.    464efb7..0903621  master     -> origin/master
  4. Already up-to-date.
  5. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$

7)中文乱码
客户端
  1. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ echo '中文'>>README
  2. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ ll
  3. 总用量 16
  4. drwxrwxr-x 3 senrsl senrsl 4096 12月  8 14:49 ./
  5. drwxrwxr-x 3 senrsl senrsl 4096 12月  8 14:48 ../
  6. drwxrwxr-x 8 senrsl senrsl 4096 12月  8 15:22 .git/
  7. -rw-rw-r-- 1 senrsl senrsl   12 12月  8 15:25 README
  8. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git commit -am '中文测试'
  9. [master 4263d13] 中文测试
  10.  1 file changed, 1 insertion(+)
  11. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git push origin HEAD:refs/for/master
  12. 对象计数中: 3, 完成.
  13. 写入对象中: 100% (3/3), 298 bytes | 0 bytes/s, 完成.
  14. Total 3 (delta 0), reused 0 (delta 0)
  15. remote: Processing changes: new: 1, refs: 1, done   
  16. remote:
  17. remote: New Changes:
  18. remote:   http://10.5.10.145/gerrit/2 中文测试
  19. remote:
  20. To http://10.5.10.145/gerrit/test-gerrit
  21.  * [new branch]      HEAD -> refs/for/master
  22. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$
服务器上效果

列表上中文乱码
进去后中文正常

然后翻一下数据库
  1. mysql> use gerritdb
  2. No connection. Trying to reconnect...
  3. Connection id:    914
  4. Current database: *** NONE ***
  5. Reading table information for completion of table and column names
  6. You can turn off this feature to get a quicker startup with -A
  7. Database changed
  8. mysql> select subject,original_subject from changes;
  9. +-------------------+-------------------+
  10. | subject           | original_subject  |
  11. +-------------------+-------------------+
  12. | ssssssss shuoming | ssssssss shuoming |
  13. | ????              | ????              |
  14. | ????2222          | ????2222          |
  15. +-------------------+-------------------+
  16. 3 rows in set (0.00 sec)
7.1)修改数据库为utf-8编码
查看当前:
  1. mysql> show variables like 'character_set%';
  2. +--------------------------+----------------------------+
  3. | Variable_name            | Value                      |
  4. +--------------------------+----------------------------+
  5. | character_set_client     | latin1                     |
  6. | character_set_connection | latin1                     |
  7. | character_set_database   | latin1                     |
  8. | character_set_filesystem | binary                     |
  9. | character_set_results    | latin1                     |
  10. | character_set_server     | latin1                     |
  11. | character_set_system     | utf8                       |
  12. | character_sets_dir       | /usr/share/mysql/charsets/ |
  13. +--------------------------+----------------------------+
  14. 8 rows in set (0.01 sec)
修改编码
  1. [root@126 etc]# cat /etc/my.cnf
  2. [client] 
  3. port=3306 
  4. socket=/var/lib/mysql/mysql.sock 
  5. default-character-set=utf8 
  6.  
  7. [mysqld] 
  8. datadir=/var/lib/mysql 
  9. socket=/var/lib/mysql/mysql.sock 
  10. user=mysql 
  11. # Disabling symbolic-links is recommended to prevent assorted security risks 
  12. symbolic-links=0 
  13. character-set-server=utf8 
  14. #改掉引擎,不然后面会报长度不够
  15. default-storage-engine=INNODB
  16.  
  17. [mysql] 
  18. no-auto-rehash 
  19. default-character-set=utf8 
  20.  
  21. [mysqld_safe] 
  22. log-error=/var/log/mysqld.log 
  23. pid-file=/var/run/mysqld/mysqld.pid
  24. [root@126 etc]# service mysqld restart
  25. Stopping mysqld:                                           [  OK  ]
  26. Starting mysqld:                                           [  OK  ]
  27. [root@126 etc]# mysql -u root -p
  28. Enter password:
  29. Welcome to the MySQL monitor.  Commands end with ; or \g.
  30. Your MySQL connection id is 7
  31. Server version: 5.1.73 Source distribution
  32. Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
  33. Oracle is a registered trademark of Oracle Corporation and/or its
  34. affiliates. Other names may be trademarks of their respective
  35. owners.
  36. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
  37. mysql> show variables like 'character_set%';
  38. +--------------------------+----------------------------+
  39. | Variable_name            | Value                      |
  40. +--------------------------+----------------------------+
  41. | character_set_client     | utf8                       |
  42. | character_set_connection | utf8                       |
  43. | character_set_database   | utf8                       |
  44. | character_set_filesystem | binary                     |
  45. | character_set_results    | utf8                       |
  46. | character_set_server     | utf8                       |
  47. | character_set_system     | utf8                       |
  48. | character_sets_dir       | /usr/share/mysql/charsets/ |
  49. +--------------------------+----------------------------+
  50. 8 rows in set (0.00 sec)
  51. mysql>
然后单个数据库的



7.2)修改gerrit mysql配置链接
修改链接。。。。
  1. [root@Android etc]# cat gerrit.config
  2. [gerrit]
  3.     basePath = git
  4.     canonicalWebUrl = http://10.5.10.145/gerrit
  5. [database]
  6.     type = mysql
  7.     url = jdbc:mysql://10.5.8.102:3306/gerritdb?user=gerrit&password=gerrit01&useUnicode=true&characterEncoding=utf8
  8. [index]
  9.     type = LUCENE
  10. [auth]
  11.     type = HTTP
  12. [sendemail]
  13.     smtpServer = localhost
  14. [container]
  15.     user = gerrit
  16.     javaHome = /usr/java/jdk1.8.0_65/jre
  17. [sshd]
  18.     listenAddress = *:29418
  19. [httpd]
  20.     listenUrl = proxy-http://*:8081/gerrit
  21. [cache]
  22.     directory = cache
  23. [root@Android etc]# cat secure.config
  24. [auth]
  25.     registerEmailPrivateKey = zplwLw+88VWGm/vtyNWIcEiC7EYJTsEcmDk=
  26.     restTokenPrivateKey = BAFq4jL7577lE8sI6Ta/ouOPP4cWC/OQxAM=
  27. [root@Android etc]#

7.3)测试
  1. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ echo '中文444测试'>>README
  2. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git commit -am '中文测试444'
  3. [master 5d6a26e] 中文测试444
  4.  1 file changed, 1 insertion(+)
  5. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git push origin HEAD:refs/for/master
  6. 对象计数中: 6, 完成.
  7. Delta compression using up to 8 threads.
  8. 压缩对象中: 100% (3/3), 完成.
  9. 写入对象中: 100% (6/6), 608 bytes | 0 bytes/s, 完成.
  10. Total 6 (delta 0), reused 0 (delta 0)
  11. remote: Processing changes: refs: 2, done   
  12. To http://10.5.10.145/gerrit/test-gerrit
  13.  ! [remote rejected] HEAD -> refs/for/master (internal server error)
  14. error: 无法推送一些引用到 'http://10.5.10.145/gerrit/test-gerrit'

找日志
  1. [root@Android review]# less logs/error_log
  2. [2015-12-09 01:12:55,016] ERROR com.google.gerrit.server.git.ReceiveCommits : Can't insert change/patchset for test-gerrit
  3. com.google.gerrit.server.git.InsertException: Error inserting change/patchset
  4.     at com.google.gerrit.server.git.ReceiveCommits$1.apply(ReceiveCommits.java:270)
  5.     at com.google.gerrit.server.git.ReceiveCommits$1.apply(ReceiveCommits.java:261)
  6.     at com.google.common.util.concurrent.Futures$MappingCheckedFuture.mapException(Futures.java:1809)
  7.     at com.google.common.util.concurrent.AbstractCheckedFuture.checkedGet(AbstractCheckedFuture.java:85)
  8.     at com.google.gerrit.server.git.ReceiveCommits.insertChangesAndPatchSets(ReceiveCommits.java:804)
  9.     at com.google.gerrit.server.git.ReceiveCommits.processCommands(ReceiveCommits.java:589)
  10.     at com.google.gerrit.server.git.AsyncReceiveCommits$Worker.run(AsyncReceiveCommits.java:89)
  11.     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  12.     at com.google.gerrit.server.util.RequestScopePropagator$5.call(RequestScopePropagator.java:222)
  13.     at com.google.gerrit.server.util.RequestScopePropagator$4.call(RequestScopePropagator.java:201)
  14.     at com.google.inject.servlet.GuiceFilter$Context.call(GuiceFilter.java:203)
  15.     at com.google.inject.servlet.ServletScopes$3.call(ServletScopes.java:232)
  16.     at com.google.gerrit.server.util.RequestScopePropagator$1.call(RequestScopePropagator.java:98)
  17.     at com.google.gerrit.server.util.RequestScopePropagator$2.run(RequestScopePropagator.java:131)
  18.     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
  19.     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  20.     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
  21.     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
  22.     at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:379)
  23.     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
  24.     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
  25.     at java.lang.Thread.run(Thread.java:745)
  26. Caused by: java.util.concurrent.ExecutionException: com.google.gwtorm.server.OrmException: insert failure on changes
  27.     at java.util.concurrent.FutureTask.report(FutureTask.java:122)
  28.     at java.util.concurrent.FutureTask.get(FutureTask.java:192)
  29.     at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:63)
  30.     at com.google.common.util.concurrent.AbstractCheckedFuture.checkedGet(AbstractCheckedFuture.java:78)
  31.     ... 18 more
  32. Caused by: com.google.gwtorm.server.OrmException: insert failure on changes
  33.     at com.google.gwtorm.schema.sql.SqlDialect.convertError(SqlDialect.java:158)
  34.     at com.google.gwtorm.schema.sql.DialectMySQL.convertError(DialectMySQL.java:232)
  35.     at com.google.gwtorm.jdbc.JdbcAccess.convertError(JdbcAccess.java:459)
  36.     at com.google.gwtorm.jdbc.JdbcAccess.insert(JdbcAccess.java:170)
  37.     at com.google.gerrit.server.change.ChangeInserter.insert(ChangeInserter.java:210)
  38.     at com.google.gerrit.server.git.ReceiveCommits$CreateRequest.insertChange(ReceiveCommits.java:1724)
  39.     at com.google.gerrit.server.git.ReceiveCommits$CreateRequest.access$900(ReceiveCommits.java:1654)
  40.     at com.google.gerrit.server.git.ReceiveCommits$CreateRequest$1.call(ReceiveCommits.java:1685)
  41.     at com.google.gerrit.server.git.ReceiveCommits$CreateRequest$1.call(ReceiveCommits.java:1681)
  42.     at com.google.gerrit.server.util.RequestScopePropagator$1.call(RequestScopePropagator.java:96)
  43.     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
  44.     at com.google.common.util.concurrent.MoreExecutors$DirectExecutorService.execute(MoreExecutors.java:299)
  45.     at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:134)
  46.     at com.google.common.util.concurrent.AbstractListeningExecutorService.submit(AbstractListeningExecutorService.java:58)
  47.     at com.google.gerrit.server.git.ReceiveCommits$CreateRequest.insertChange(ReceiveCommits.java:1680)
  48.     at com.google.gerrit.server.git.ReceiveCommits.insertChangesAndPatchSets(ReceiveCommits.java:800)
  49.     ... 17 more
  50. Caused by: java.sql.BatchUpdateException: Incorrect string value: '\xE6\x98\xAFis ...' for column 'subject' at row 1
  51.     at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2054)
  52.     at com.mysql.jdbc.PreparedStatement.executeBatch(PreparedStatement.java:1467)
  53.     at com.google.gwtorm.schema.sql.SqlDialect.executeBatch(SqlDialect.java:442)
  54.     at com.google.gwtorm.jdbc.JdbcAccess.execute(JdbcAccess.java:449)
  55.     at com.google.gwtorm.jdbc.JdbcAccess.insertAsBatch(JdbcAccess.java:212)
  56.     at com.google.gwtorm.jdbc.JdbcAccess.insert(JdbcAccess.java:165)
  57.     ... 29 more
  58. Caused by: java.sql.SQLException: Incorrect string value: '\xE6\x98\xAFis ...' for column 'subject' at row 1
  59.     at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1074)
  60.     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4074)
  61.     at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:4006)
  62.     at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2468)
  63.     at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2629)
  64.     at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2719)
  65.     at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2155)
  66.     at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:2450)
  67.     at com.mysql.jdbc.PreparedStatement.executeBatchSerially(PreparedStatement.java:2006)
  68.     ... 34 more
说明中文插不进去。。。。
找了找,发现只把库编码改了,里面的表和列的编码没改。。。。
  1. #库编码
  2. mysql> alter database gerritdb default character set utf8;
  3. Query OK, 1 row affected (0.00 sec)
  4. #表和列编码
  5. mysql> alter table account_diff_preferences convert to character set utf8 collate utf8_general_ci;
  6. Query OK, 0 rows affected (0.02 sec)
  7. Records: 0  Duplicates: 0  Warnings: 0
  8. #每张表都还要跑
删了库重建好了,真蛋疼。。。。
我屮删了重建也会出现这个问题
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: Specified key was too long; max key length is 1000 bytes

好吧,修改引擎为innodb。。。。。

然后,又重新建库,建项目什么的,重新来了一遍,终于好了。。。。



8)配置git-web
在gerrit的error.log里发现这么一句
[2015-12-09 02:41:05,108] WARN  com.google.gerrit.httpd.GitWebConfig : gitweb not installed (no /usr/lib/cgi-bin/gitweb.cgi found)
挂个链接过去
  1. [root@Android lib]# mkdir cgi-bin
  2. [root@Android lib]# ll
  3. 总用量 40
  4. drwxr-xr-x. 3 root root 4096 11月 21 00:42 anaconda-runtime
  5. drwxr-xr-x. 3 root root 4096 11月 21 00:42 bonobo
  6. drwxr-xr-x  2 root root 4096 12月  9 03:13 cgi-bin
  7. drwxr-xr-x. 5 root root 4096 11月 21 00:42 ConsoleKit
  8. dr-xr-xr-x. 2 root root 4096 9月  23 2011 games
  9. drwxr-xr-x  3 root root 4096 11月 22 02:52 gcc
  10. dr-xr-xr-x. 2 root root 4096 11月 22 01:45 locale
  11. drwxr-xr-x. 3 root root 4096 7月  24 04:23 python2.6
  12. drwxr-xr-x. 3 root root 4096 12月  8 01:45 rpm
  13. lrwxrwxrwx  1 root root   30 12月  8 01:46 sendmail -> /etc/alternatives/mta-sendmail
  14. lrwxrwxrwx  1 root root   24 12月  8 01:46 sendmail.postfix -> ../sbin/sendmail.postfix
  15. lrwxrwxrwx  1 root root   25 12月  8 01:34 sendmail.sendmail -> ../sbin/sendmail.sendmail
  16. drwxr-xr-x. 2 root root 4096 7月  24 18:27 yum-plugins
  17. [root@Android lib]# cd cgi-bin/
  18. [root@Android cgi-bin]# ln -s /usr/local/git/share/gitweb/gitweb.cgi /usr/lib/cgi-bin/
  19. [root@Android cgi-bin]# ll
  20. 总用量 0
  21. lrwxrwxrwx 1 root root 38 12月  9 03:15 gitweb.cgi -> /usr/local/git/share/gitweb/gitweb.cgi
然后重启gerrit,看后面有了,但是点一片空白


好吧,那换个方法试试,把之前那个cgi/bin目录删了,然后
  1. [root@Android gerrit]# ln -s /usr/local/git/share/gitweb/ /usr/local/share/
  2. [root@Android gerrit]# rm  -rf /usr/lib/cgi-bin/
  3. [root@Android gerrit]# cd /home/gerrit/
  4. [root@Android gerrit]# cd review/etc/
  5. [root@Android etc]# vi gerrit.config
  6. [root@Android etc]# cat gerrit.config
  7. [gerrit]
  8.     basePath = git
  9.     canonicalWebUrl = http://10.5.10.145/gerrit
  10. [database]
  11.     type = mysql
  12.     hostname = 10.5.8.102
  13.     database = gerritdb
  14.     username = gerrit
  15. [index]
  16.     type = LUCENE
  17. [auth]
  18.     type = HTTP
  19. [sendemail]
  20.     smtpServer = localhost
  21. [container]
  22.     user = gerrit
  23.     javaHome = /usr/java/jdk1.8.0_65/jre
  24. [sshd]
  25.     listenAddress = *:29418
  26. [httpd]
  27.     listenUrl = proxy-http://*:8081/gerrit
  28. [cache]
  29.     directory = cache
  30. [gitweb]
  31.     cgi=/usr/local/share/gitweb/gitweb.cgi
  32. [root@Android etc]#
看起来应该是有依赖没安。。。。
然后看error.log
  1. [2015-12-09 03:36:16,630] ERROR com.google.gerrit.httpd.gitweb.GitWebServlet : CGI: BEGIN failed--compilation aborted at /usr/local/git/share/gitweb/gitweb.cgi line 13.
  2. [2015-12-09 03:36:16,631] ERROR com.google.gerrit.httpd.gitweb.GitWebServlet : Non-zero exit status (2) from /usr/local/git/share/gitweb/gitweb.cgi
2015年12月08日19:50:45
2015年12月14日17:07:54
服务器变动
10.5.10.145更改为10.1.11.145
10.5.8.102更改为?
之前的好多配置都没了。。。。gerrit都不完全了发现。。。。
to9#
2015年12月21日16:28:08
回来看问题
  1. [2015-12-22 16:19:54,047] [Gitweb-ErrorLogger] ERROR com.google.gerrit.httpd.gitweb.GitwebServlet : CGI: Can't locate CGI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at /usr/local/git/share/gitweb/gitweb.cgi line 13.
  2. [2015-12-22 16:19:54,048] [Gitweb-ErrorLogger] ERROR com.google.gerrit.httpd.gitweb.GitwebServlet : CGI: BEGIN failed--compilation aborted at /usr/local/git/share/gitweb/gitweb.cgi line 13.
  3. [2015-12-22 16:19:54,048] [HTTP-48 - /gerrit/gitweb?p=test-gerrit.git;a=summary] DEBUG org.eclipse.jetty.server.HttpConnection : org.eclipse.jetty.server.HttpConnection$SendCallback@7ff94613[PROCESSING][i=ResponseInfo{HTTP/1.1 200 null,-1,false},cb=org.eclipse.jetty.server.HttpChannel$CommitCallback@7845fa6] generate: NEED_HEADER (null,[p=0,l=0,c=0,r=0],true)@START

应该是环境没装好

百度好久,终于找到了
  1. [root@Android ~]# yum install -y perl-BerkeleyDB perl-Class-Singleton perl-Convert-BER perl-DateTime perl-DateTime-Format-DateParse perl-DateTime-Locale perl-DateTime-TimeZone perl-DBIx-TableHash perl-List-MoreUtils perl-Net-MAC-Vendor perl-Params-Validate  perl-rrdtool perl-SNMP-Multi  perl-SNMP-Simple perl-String-CRC32 perl-Unicode-Map perl-XML-DOM perl-XML-RegExp  rrdtool perl-XML-Parser  perl-Compress-Zlib perl-Time-HiRes perl-CGI
然后直接再去点项目的gitweb,就能打开了


2015年12月22日16:26:50突然发现用一个普通用户登陆,点gitweb显示Not Found....
貌似是没权限
呃,换了IE,直接报404.。。。

查了一遭,好像是个bug.....

然后可以这么解决


增加 refs/meta/config, 就可以访问了,但是这样的话普通用户可以改配置并且发起配置的review。。。。

暂时所有用户都是管理员,看来后面需要把gitweb换掉

看了看android的review,竟然也能edit,提交review。。。。那我就放心了。。。。
然后看了看gerrit的review,他的就没有edit,看来还是要换。。。。

9)中文版gerrit
既然环境没了,那就尝试下搞个中文版的gerrit好了
  1. senrsl@senrsl-T540p:~/tools/gerrit$ git add .
  2. senrsl@senrsl-T540p:~/tools/gerrit$ git commit -m 'checkout tag 2 brach : bv2.12-rc2'
  3. [bv2.12-rc2 0096373] checkout tag 2 brach : bv2.12-rc2
  4.  1 file changed, 1 insertion(+)
  5.  create mode 100644 README
  6. senrsl@senrsl-T540p:~/tools/gerrit$ git push origin bv2.12-rc2
  7. 对象计数中: 3, 完成.
  8. Delta compression using up to 8 threads.
  9. 压缩对象中: 100% (2/2), 完成.
  10. 写入对象中: 100% (3/3), 298 bytes | 0 bytes/s, 完成.
  11. Total 3 (delta 1), reused 0 (delta 0)
  12. To git@github.com:senRsl/gerrit.git
  13.  * [new branch]      bv2.12-rc2 -> bv2.12-rc2
  14. senrsl@senrsl-T540p:~/tools/gerrit$ git branch
  15. * bv2.12-rc2
  16.   master
  17. senrsl@senrsl-T540p:~/tools/gerrit$ ll
  18. 总用量 260
  19. drwxrwxr-x 45 senrsl senrsl  4096 12月 14 17:59 ./
  20. drwxrwxr-x  7 senrsl senrsl  4096 12月 14 17:49 ../
  21. -rw-rw-r--  1 senrsl senrsl  1045 12月 14 17:57 BUCK
  22. -rw-rw-r--  1 senrsl senrsl   647 12月 14 17:57 .buckconfig
  23. drwxrwxr-x  2 senrsl senrsl  4096 12月 14 17:50 bucklets/
  24. -rw-rw-r--  1 senrsl senrsl    41 12月 14 17:57 .buckversion
  25. drwxrwxr-x  4 senrsl senrsl  4096 12月 14 17:50 contrib/
  26. -rw-rw-r--  1 senrsl senrsl 11358 12月 14 17:50 COPYING
  27. drwxrwxr-x  3 senrsl senrsl 12288 12月 14 17:57 Documentation/
  28. -rw-rw-r--  1 senrsl senrsl   171 12月 14 17:50 .editorconfig
  29. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-acceptance-framework/
  30. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-acceptance-tests/
  31. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-antlr/
  32. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-cache-h2/
  33. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-common/
  34. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-extension-api/
  35. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-gpg/
  36. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-gwtdebug/
  37. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-gwtexpui/
  38. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-gwtui/
  39. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-gwtui-common/
  40. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-httpd/
  41. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-launcher/
  42. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-lucene/
  43. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-main/
  44. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-oauth/
  45. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-openid/
  46. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-patch-commonsnet/
  47. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-patch-jgit/
  48. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-pgm/
  49. drwxrwxr-x  2 senrsl senrsl  4096 12月 14 17:57 gerrit-plugin-api/
  50. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-plugin-archetype/
  51. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-plugin-gwt-archetype/
  52. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-plugin-gwtui/
  53. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-plugin-js-archetype/
  54. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-prettify/
  55. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-reviewdb/
  56. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-server/
  57. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-sshd/
  58. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-util-cli/
  59. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-util-http/
  60. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 gerrit-util-ssl/
  61. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:57 gerrit-war/
  62. drwxrwxr-x  8 senrsl senrsl  4096 12月 14 18:00 .git/
  63. -rw-rw-r--  1 senrsl senrsl   391 12月 14 17:57 .gitignore
  64. -rw-rw-r--  1 senrsl senrsl   659 12月 14 17:50 .gitmodules
  65. -rw-rw-r--  1 senrsl senrsl    30 12月 14 17:50 INSTALL
  66. drwxrwxr-x 22 senrsl senrsl  4096 12月 14 17:57 lib/
  67. -rw-rw-r--  1 senrsl senrsl  5419 12月 14 17:50 .mailmap
  68. drwxrwxr-x  8 senrsl senrsl  4096 12月 14 17:57 plugins/
  69. -rw-rw-r--  1 senrsl senrsl   302 12月 14 17:50 .pydevproject
  70. -rw-rw-r--  1 senrsl senrsl    29 12月 14 17:59 README
  71. -rw-rw-r--  1 senrsl senrsl  2693 12月 14 17:50 README.md
  72. drwxrwxr-x  2 senrsl senrsl  4096 12月 14 17:50 ReleaseNotes/
  73. drwxrwxr-x  2 senrsl senrsl  4096 12月 14 17:50 .settings/
  74. -rw-rw-r--  1 senrsl senrsl  2733 12月 14 17:50 SUBMITTING_PATCHES
  75. drwxrwxr-x  5 senrsl senrsl  4096 12月 14 17:57 tools/
  76. -rw-rw-r--  1 senrsl senrsl   168 12月 14 17:57 VERSION
  77. -rw-rw-r--  1 senrsl senrsl    76 12月 14 17:50 .watchmanconfig
  78. drwxrwxr-x  3 senrsl senrsl  4096 12月 14 17:50 website/
  79. senrsl@senrsl-T540p:~/tools/gerrit$ buck build release
  80. 未找到 'buck' 命令,您要输入的是否是:
  81.  命令 'suck' 来自于包 'suck' (universe)
  82. buck:未找到命令
  83. senrsl@senrsl-T540p:~/tools/gerrit$ cd ..
  84. senrsl@senrsl-T540p:~/tools$ ll
  85. 总用量 6642072
  86. drwxrwxr-x  7 senrsl senrsl       4096 12月 14 17:49 ./
  87. drwxr-xr-x 52 senrsl senrsl       4096 12月 14 10:22 ../
  88. drwxrwxr-x  4 senrsl senrsl       4096  9月 10 21:24 arm/
  89. -rw-------  1 senrsl senrsl 4148166656  1月 19  2015 CentOS-7.0-1406-x86_64-DVD.iso
  90. -rw-------  1 senrsl senrsl 2653276160 10月 13  2011 cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso
  91. drwxrwxr-x  3 senrsl senrsl       4096  6月  5  2013 dex2jar-0.0.9.15/
  92. drwxrwxr-x 45 senrsl senrsl       4096 12月 14 17:59 gerrit/
  93. drwxrwxr-x  8 senrsl senrsl       4096 10月 20 15:40 SoftEtherVPN/
  94. drwxr-xr-x  7 senrsl senrsl       4096 10月 16 19:20 teamviewer/
  95. senrsl@senrsl-T540p:~/tools$ git clone https://github.com/facebook/buck.git
  96. 正克隆到 'buck'...
  97. remote: Counting objects: 107769, done.
  98. remote: Total 107769 (delta 0), reused 0 (delta 0), pack-reused 107769
  99. 接收对象中: 100% (107769/107769), 289.47 MiB | 311.00 KiB/s, 完成.
  100. 处理 delta 中: 100% (65686/65686), 完成.
  101. 检查连接... 完成。
  102. senrsl@senrsl-T540p:~/tools$ cd buck/
  103. senrsl@senrsl-T540p:~/tools/buck$ ant
  104. 程序"ant"尚未安装。 您可以使用以下命令安装:
  105. sudo apt-get install ant
  106. senrsl@senrsl-T540p:~/tools/buck$ sudo apt-get install ant
  107. [sudo] password for senrsl:
  108. 正在读取软件包列表... 完成
  109. 正在分析软件包的依赖关系树      
  110. 正在读取状态信息... 完成      
  111. 下列软件包是自动安装的并且现在不需要了:
  112.   git-man liberror-perl
  113. Use 'apt-get autoremove' to remove them.
  114. 将会安装下列额外的软件包:
  115.   ant-optional libxerces2-java libxml-commons-external-java
  116.   libxml-commons-resolver1.1-java
  117. 建议安装的软件包:
  118.   ant-doc ant-gcj ant-optional-gcj antlr javacc junit jython libbcel-java
  119.   libbsf-java libcommons-logging-java libcommons-net-java libgnumail-java
  120.   libjaxp1.3-java libjdepend-java libjsch-java liblog4j1.2-java liboro-java
  121.   libregexp-java libxalan2-java libxerces2-java-doc libxerces2-java-gcj
  122.   libxml-commons-resolver1.1-java-doc
  123. 下列【新】软件包将被安装:
  124.   ant ant-optional libxerces2-java libxml-commons-external-java
  125.   libxml-commons-resolver1.1-java
  126. 升级了 0 个软件包,新安装了 5 个软件包,要卸载 0 个软件包,有 213 个软件包未被升级。
  127. 需要下载 3,869 kB 的软件包。
  128. 解压缩后会消耗掉 5,210 kB 的额外空间。
  129. 您希望继续执行吗? [Y/n] Y
  130. 获取:1 http://archive.ubuntu.com/ubuntu/ trusty/main libxml-commons-resolver1.1-java all 1.2-7build1 [91.6 kB]
  131. 获取:2 http://archive.ubuntu.com/ubuntu/ trusty/main libxml-commons-external-java all 1.4.01-2build1 [245 kB]
  132. 获取:3 http://archive.ubuntu.com/ubuntu/ trusty/main libxerces2-java all 2.11.0-7 [1,362 kB]
  133. 获取:4 http://archive.ubuntu.com/ubuntu/ trusty/main ant all 1.9.3-2build1 [1,869 kB]
  134. 获取:5 http://archive.ubuntu.com/ubuntu/ trusty/main ant-optional all 1.9.3-2build1 [302 kB]
  135. 下载 3,869 kB,耗时 21秒 (183 kB/s)                                           
  136. 正在选中未选择的软件包 libxml-commons-resolver1.1-java。
  137. (正在读取数据库 ... 系统当前共安装有 215739 个文件和目录。)
  138. 正准备解包 .../libxml-commons-resolver1.1-java_1.2-7build1_all.deb  ...
  139. 正在解包 libxml-commons-resolver1.1-java (1.2-7build1) ...
  140. 正在选中未选择的软件包 libxml-commons-external-java。
  141. 正准备解包 .../libxml-commons-external-java_1.4.01-2build1_all.deb  ...
  142. 正在解包 libxml-commons-external-java (1.4.01-2build1) ...
  143. 正在选中未选择的软件包 libxerces2-java。
  144. 正准备解包 .../libxerces2-java_2.11.0-7_all.deb  ...
  145. 正在解包 libxerces2-java (2.11.0-7) ...
  146. 正在选中未选择的软件包 ant。
  147. 正准备解包 .../ant_1.9.3-2build1_all.deb  ...
  148. 正在解包 ant (1.9.3-2build1) ...
  149. 正在选中未选择的软件包 ant-optional。
  150. 正准备解包 .../ant-optional_1.9.3-2build1_all.deb  ...
  151. 正在解包 ant-optional (1.9.3-2build1) ...
  152. 正在处理用于 man-db (2.6.7.1-1ubuntu1) 的触发器 ...
  153. 正在设置 libxml-commons-resolver1.1-java (1.2-7build1) ...
  154. 正在设置 libxml-commons-external-java (1.4.01-2build1) ...
  155. 正在设置 libxerces2-java (2.11.0-7) ...
  156. 正在设置 ant (1.9.3-2build1) ...
  157. 正在设置 ant-optional (1.9.3-2build1) ...
  158. senrsl@senrsl-T540p:~/tools/buck$ ant
  159. Buildfile: /home/senrsl/tools/buck/build.xml
  160. checkversion:
  161. BUILD FAILED
  162. /home/senrsl/tools/buck/build.xml:179: Require JDK 7 or higher
  163. Total time: 0 seconds
  164. senrsl@senrsl-T540p:~/tools/buck$ source ~/.bashrc
  165. senrsl@senrsl-T540p:~/tools/buck$ ant
  166. Buildfile: /home/senrsl/tools/buck/build.xml
  167. checkversion:
  168. compile-testrunner:
  169.     [mkdir] Created dir: /home/senrsl/tools/buck/build/testrunner/classes
  170.     [javac] Compiling 13 source files to /home/senrsl/tools/buck/build/testrunner/classes
  171. compile-aosp:
  172.     [mkdir] Created dir: /home/senrsl/tools/buck/build/aosp/classes
  173.     [javac] Compiling 17 source files to /home/senrsl/tools/buck/build/aosp/classes
  174.     [javac] [compiled 5594 lines in 930 ms: 6015.0 lines/s]
  175.     [javac] [34 .class files generated]
  176. tracing-api:
  177.     [mkdir] Created dir: /home/senrsl/tools/buck/build/tracing-api/classes
  178.     [javac] Compiling 2 source files to /home/senrsl/tools/buck/build/tracing-api/classes
  179.     [javac] [compiled 150 lines in 291 ms: 515.4 lines/s]
  180.     [javac] [2 .class files generated]
  181.       [jar] Building jar: /home/senrsl/tools/buck/build/tracing-api/tracing-api.jar
  182. bootstrapper:
  183.     [mkdir] Created dir: /home/senrsl/tools/buck/build/bootstrapper/classes
  184.     [javac] Compiling 8 source files to /home/senrsl/tools/buck/build/bootstrapper/classes
  185.     [javac] [compiled 341 lines in 333 ms: 1024.0 lines/s]
  186.     [javac] [8 .class files generated]
  187.       [jar] Building jar: /home/senrsl/tools/buck/build/bootstrapper/bootstrapper.jar
  188. package-resources:
  189.     [mkdir] Created dir: /home/senrsl/tools/buck/build/classes/com/facebook/buck/cli/quickstart/android
  190.       [zip] Building zip: /home/senrsl/tools/buck/build/classes/com/facebook/buck/cli/quickstart/android/android-template.zip
  191.     [mkdir] Created dir: /home/senrsl/tools/buck/build/classes/com/facebook/buck/cli/quickstart/ios
  192.       [zip] Building zip: /home/senrsl/tools/buck/build/classes/com/facebook/buck/cli/quickstart/ios/ios-template.zip
  193. dx-check-build:
  194. dx:
  195.     [mkdir] Created dir: /home/senrsl/tools/buck/build/dx_classes
  196.     [javac] Compiling 385 source files to /home/senrsl/tools/buck/build/dx_classes
  197.     [javac] 注: 某些输入文件使用了未经检查或不安全的操作。
  198.     [javac] 注: 有关详细信息, 请使用 -Xlint:unchecked 重新编译。
  199.     [javac] Creating empty /home/senrsl/tools/buck/build/dx_classes/com/android/dx/rop/package-info.class
  200.     [javac] Creating empty /home/senrsl/tools/buck/build/dx_classes/com/android/dx/ssa/package-info.class
  201.       [jar] Building jar: /home/senrsl/tools/buck/build/dx.jar
  202. check-immutables:
  203. generate-immutables:
  204.     [mkdir] Created dir: /home/senrsl/tools/buck/build/immutables
  205.     [javac] Compiling 90 source files
  206. compile:
  207.      [copy] Copying 1 file to /home/senrsl/tools/buck/build/classes/com/facebook/buck/json
  208.     [javac] Compiling 1329 source files to /home/senrsl/tools/buck/build/classes
  209.     [javac] [compiled 219689 lines in 6229 ms: 35268.7 lines/s]
  210.     [javac] [2591 .class files generated]
  211. javac-tracing:
  212.     [mkdir] Created dir: /home/senrsl/tools/buck/build/javac-tracing/classes
  213.     [javac] Compiling 3 source files to /home/senrsl/tools/buck/build/javac-tracing/classes
  214.     [javac] [compiled 253 lines in 276 ms: 916.6 lines/s]
  215.     [javac] [4 .class files generated]
  216.       [jar] Building jar: /home/senrsl/tools/buck/build/javac-tracing/javac-tracing-compiler-plugin.jar
  217.      [copy] Copying 1 file to /home/senrsl/tools/buck/build/classes/com/facebook/buck/jvm/java/tracing
  218. report-generator-jar:
  219.       [jar] Building jar: /home/senrsl/tools/buck/build/report-generator.jar
  220. default:
  221. BUILD SUCCESSFUL
  222. Total time: 19 seconds
  223. senrsl@senrsl-T540p:~/tools/buck$ ./bin/buck --help
  224. Buck does not appear to have been built -- building Buck!
  225. All done, continuing with build.
  226. Not using buckd because watchman isn't installed.
  227. buck build tool
  228. usage:
  229.   buck [options]
  230.   buck command --help
  231.   buck command [command-options]
  232. available commands:
  233.   audit       lists the inputs for the specified target
  234.   build       builds the specified target
  235.   cache       makes calls to the artifact cache
  236.   clean       deletes any generated files
  237.   fetch       downloads remote resources to your local machine
  238.   install     builds and installs an application
  239.   project     generates project configuration files for an IDE
  240.   publish     builds and publishes a library to a central repository
  241.   query       provides facilities to query information about the target nodes graph
  242.   quickstart  generates a default project directory
  243.   run         runs a target as a command
  244.   server      query and control the http server
  245.   simulate    timed simulation of a build without running the steps
  246.   targets     prints the list of buildable targets
  247.   test        builds and runs the tests for the specified target
  248.   uninstall   uninstalls an APK
  249. options:
  250.  --help         : Shows this screen and exits.
  251.  --version (-V) : Show version number.
  252. senrsl@senrsl-T540p:~/tools/buck$

下gerrit源码,发现编译需要buck,看了下这是facebook封装了以下ant,多线程编译
然后安buck,发现也需要从源码开搞,然后下载,发现需要ant编译
然后安ant,编译

然后编译好后去编gerrit
  1. senrsl@senrsl-T540p:~/tools/gerrit$ ~/tools/buck/bin/buck build release
  2. Buck is at d451e7185efa38ca7118f294606869418d505f2a, but should be 1b03b4313b91b634bd604fc3487a05f877e59dee.
  3. Buck is updating itself. To disable this, add a '.nobuckcheck'
  4. file to your project root. In general, you should only disable
  5. this if you are developing Buck.
  6. Buck does not appear to have been built -- building Buck!
  7. All done, continuing with build.
  8. Not using buckd because watchman isn't installed.
  9. No Android platform target specified. Using default: Google Inc.:Google APIs:21
  10. [-] PROCESSING BUCK FILES...FINISHED 1.6s [100%]
  11. [+] BUILDING...1.5s [28%] (6/772 JOBS, 5 UPDATED, 0.6% CACHE MISS)
  12.  |=> IDLE
  13.  |=> IDLE
  14.  |=> IDLE
  15.  |=> IDLE
  16.  |=> IDLE
  17.  |=> IDLE
  18.  |=> IDLE
  19.  |=> IDLE
  20.  |=> IDLE
  21.  |=> IDLE
  22. BUILD FAILED: Google APIs not found in /home/senrsl/android/android-sdk-linux/add-ons/addon-google_apis-google-21/libs.
  23. Please run '/home/senrsl/android/android-sdk-linux/tools/android sdk' and select both 'SDK Platform' and 'Google APIs' under Android (API 21)
  24. senrsl@senrsl-T540p:~/tools/gerrit$
毛。。。。
安watchman,watchman也需要从源码安。。。。
需要先安automak
  1. senrsl@senrsl-T540p:~/tools/gerrit$ sudo apt-get install automake
然后下watchman源码,编译安装
  1. senrsl@senrsl-T540p:~/tools$ git clone https://github.com/facebook/watchman.git
  2. senrsl@senrsl-T540p:~/tools$ cd watchman/
  3. senrsl@senrsl-T540p:~/tools/watchman$ ./autogen.sh
  4. senrsl@senrsl-T540p:~/tools/watchman$ ./configure
  5. senrsl@senrsl-T540p:~/tools/watchman$ make
  6. #报错 pywatchman/bser.c:31:20: fatal error: Python.h: 没有那个文件或目录
  7. senrsl@senrsl-T540p:~/tools/watchman$ sudo apt-get install python-dev
  8. senrsl@senrsl-T540p:~/tools/watchman$ make clean
  9. senrsl@senrsl-T540p:~/tools/watchman$ make
  10. senrsl@senrsl-T540p:~/tools/watchman$ sudo make install
  11. senrsl@senrsl-T540p:~/tools/watchman$ watchman --version
  12. 4.3.0
  13. senrsl@senrsl-T540p:~/tools/watchman$

然后解决后面,android api 版本小于21。。。。

没找到在哪配置版本,那就下个21吧
  1. senrsl@senrsl-T540p:~$ cd android/android-sdk-linux/tools/
  2. senrsl@senrsl-T540p:~/android/android-sdk-linux/tools$ android sdk

编了半天
各种报错
  1. senrsl@senrsl-T540p:~/tools$ git clone --recursive https://gerrit.googlesource.com/gerrit
  2. 正克隆到 'gerrit'...
  3. remote: Sending approximately 52.40 MiB ...
  4. remote: Counting objects: 161, done
  5. remote: Finding sources: 100% (161/161)
  6. remote: Total 236358 (delta 122568), reused 236358 (delta 122568)
  7. 接收对象中: 100% (236358/236358), 52.40 MiB | 101.00 KiB/s, 完成.
  8. 处理 delta 中: 100% (122589/122589), 完成.
  9. 检查连接... 完成。
  10. 子模组 'plugins/commit-message-length-validator' (https://gerrit.googlesource.com/plugins/commit-message-length- validator) 未对路径 'plugins/commit-message-length-validator' 注册
  11. 子模组 'plugins/cookbook-plugin' (https://gerrit.googlesource.com/plugins/cookbook-plugin) 未对路径 'plugins/cookbook-plugin' 注册
  12. 子模组 'plugins/download-commands' (https://gerrit.googlesource.com/plugins/download-commands) 未对路径 'plugins/download-commands' 注册
  13. 子模组 'plugins/replication' (https://gerrit.googlesource.com/plugins/replication) 未对路径 'plugins/replication' 注册
  14. 子模组 'plugins/reviewnotes' (https://gerrit.googlesource.com/plugins/reviewnotes) 未对路径 'plugins/reviewnotes' 注册
  15. 子模组 'plugins/singleusergroup' (https://gerrit.googlesource.com/plugins/singleusergroup) 未对路径 'plugins/singleusergroup' 注册
  16. 正克隆到 'plugins/commit-message-length-validator'...
  17. remote: Counting objects: 47, done
  18. remote: Finding sources: 100% (47/47)
  19. remote: Total 251 (delta 20), reused 251 (delta 20)
  20. 接收对象中: 100% (251/251), 53.74 KiB | 0 bytes/s, 完成.
  21. 处理 delta 中: 100% (20/20), 完成.
  22. 检查连接... 完成。
  23. 子模组路径 'plugins/commit-message-length-validator':检出 '8d295ed48e8f52eef5661b6eb10d6402d197c776'
  24. 正克隆到 'plugins/cookbook-plugin'...
  25. remote: Counting objects: 42, done
  26. remote: Finding sources: 100% (42/42)
  27. remote: Total 1360 (delta 210), reused 1360 (delta 210)
  28. 接收对象中: 100% (1360/1360), 273.82 KiB | 133.00 KiB/s, 完成.
  29. 处理 delta 中: 100% (210/210), 完成.
  30. 检查连接... 完成。
  31. 子模组路径 'plugins/cookbook-plugin':检出 'eea84e7e07ecf6ebb70ea5a6b0cde67f5a5576af'
  32. 正克隆到 'plugins/download-commands'...
  33. remote: Counting objects: 43, done
  34. remote: Finding sources: 100% (43/43)
  35. remote: Total 511 (delta 56), reused 511 (delta 56)
  36. 接收对象中: 100% (511/511), 106.65 KiB | 0 bytes/s, 完成.
  37. 处理 delta 中: 100% (56/56), 完成.
  38. 检查连接... 完成。
  39. 子模组路径 'plugins/download-commands':检出 '87075138f5b27e9aba91a3af56ddcf1cda3be6b1'
  40. 正克隆到 'plugins/replication'...
  41. remote: Counting objects: 50, done
  42. remote: Finding sources: 100% (50/50)
  43. remote: Total 1812 (delta 333), reused 1812 (delta 333)
  44. 接收对象中: 100% (1812/1812), 658.72 KiB | 121.00 KiB/s, 完成.
  45. 处理 delta 中: 100% (333/333), 完成.
  46. 检查连接... 完成。
  47. 子模组路径 'plugins/replication':检出 '4ab29b755a147a69d88bf000e276a7a2eaa6403b'
  48. 正克隆到 'plugins/reviewnotes'...
  49. remote: Counting objects: 47, done
  50. remote: Finding sources: 100% (47/47)
  51. remote: Total 509 (delta 37), reused 509 (delta 37)
  52. 接收对象中: 100% (509/509), 161.57 KiB | 210.00 KiB/s, 完成.
  53. 处理 delta 中: 100% (37/37), 完成.
  54. 检查连接... 完成。
  55. 子模组路径 'plugins/reviewnotes':检出 '26f38c4514687c388472be19c9789eaa84b1d564'
  56. 正克隆到 'plugins/singleusergroup'...
  57. remote: Counting objects: 30, done
  58. remote: Finding sources: 100% (30/30)
  59. remote: Total 124 (delta 11), reused 124 (delta 11)
  60. 接收对象中: 100% (124/124), 35.74 KiB | 0 bytes/s, 完成.
  61. 处理 delta 中: 100% (11/11), 完成.
  62. 检查连接... 完成。
  63. 子模组路径 'plugins/singleusergroup':检出 'f6df7121d2704e73c2a315a660e5cc4e12ab1ab9'
  64. senrsl@senrsl-T540p:~/tools$ ll
  65. 总用量 6642080
  66. drwxrwxr-x  9 senrsl senrsl       4096 12月 15 15:46 ./
  67. drwxr-xr-x 53 senrsl senrsl       4096 12月 15 13:45 ../
  68. drwxrwxr-x  4 senrsl senrsl       4096  9月 10 21:24 arm/
  69. drwxrwxr-x 18 senrsl senrsl       4096 12月 15 15:25 buck/
  70. -rw-------  1 senrsl senrsl 4148166656  1月 19  2015 CentOS-7.0-1406-x86_64-DVD.iso
  71. -rw-------  1 senrsl senrsl 2653276160 10月 13  2011 cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso
  72. drwxrwxr-x  3 senrsl senrsl       4096  6月  5  2013 dex2jar-0.0.9.15/
  73. drwxrwxr-x 46 senrsl senrsl       4096 12月 15 15:56 gerrit/
  74. drwxrwxr-x  8 senrsl senrsl       4096 10月 20 15:40 SoftEtherVPN/
  75. drwxr-xr-x  7 senrsl senrsl       4096 10月 16 19:20 teamviewer/
  76. drwxrwxr-x 17 senrsl senrsl       4096 12月 15 13:58 watchman/
  77. senrsl@senrsl-T540p:~/tools$ cd gerrit/
  78. senrsl@senrsl-T540p:~/tools/gerrit$ buck build release
  79. Using watchman.
  80. No Android platform target specified. Using default: Google Inc.:Google APIs:21
  81. [-] PROCESSING BUCK FILES...FINISHED 2.0s [100%]
  82. [+] BUILDING...6.8s [28%] (415/879 JOBS, 415 UPDATED, 2.0% CACHE MISS)
  83.  |=> //lib/js:iron-resizable-behavior__download_bower...  4.7s (running genrule)
  84.  |=> //lib/js:promise-polyfill__download_bower...  4.5s (running genrule[4.5s])
  85.  |=> //lib/js:web-animations-js__download_bower...  4.7s (running genrule[4.7s])
  86.  |=> //gerrit-gwtui-common:client#abi...  0.1s (checking local cache)
  87.  |=> //lib/js:font-roboto__download_bower...  4.6s (running genrule[4.6s])
  88.  |=> //lib/js:paper-styles__download_bower...  4.8s (running genrule[4.7s])
  89.  |=> //lib/js:iron-fit-behavior__download_bower...  4.8s (running genrule[4.7s])
  90.  |=> //lib/gwt:dev...  4.4s (running calculate_abi[4.3s])
  91.  |=> //lib/js:neon-animation__download_bower...  1.5s (running genrule[1.5s])
  92.  |=> //lib/js:iron-ajax__download_bower...  4.3s (running genrule[4.3s])
  93. /usr/bin/env: node: ���������������������������
  94. Traceback (most recent call last):
  95.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  96.     self.execute_entry(entry_point, args)
  97.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  98.     runner(entry_point)
  99.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  100.     runpy.run_module(module_name, run_name='__main__')
  101.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  102.     fname, loader, pkg_name)
  103.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  104.     exec code in run_globals
  105.   File "tools/js/run_npm_binary.py", line 91, in <module>
  106.   File "tools/js/run_npm_binary.py", line 87, in main
  107.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  108.     raise CalledProcessError(retcode, cmd)
  109. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'web-animations/web-animations-js#2.1.2']' returned non-zero exit status 127
  110. Traceback (most recent call last):
  111.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  112.     self.execute_entry(entry_point, args)
  113.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  114.     runner(entry_point)
  115.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  116.     runpy.run_module(module_name, run_name='__main__')
  117.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  118.     fname, loader, pkg_name)
  119.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  120.     exec code in run_globals
  121.   File "tools/js/download_bower.py", line 121, in <module>
  122.   File "tools/js/download_bower.py", line 92, in main
  123.   File "tools/js/download_bower.py", line 46, in bower_info
  124. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'web-animations/web-animations-js#2.1.2']
  125. /usr/bin/env: node: ���������������������������
  126. Traceback (most recent call last):
  127.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  128.     self.execute_entry(entry_point, args)
  129.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  130.     runner(entry_point)
  131.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  132.     runpy.run_module(module_name, run_name='__main__')
  133.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  134.     fname, loader, pkg_name)
  135.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  136.     exec code in run_globals
  137.   File "tools/js/run_npm_binary.py", line 91, in <module>
  138.   File "tools/js/run_npm_binary.py", line 87, in main
  139.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  140.     raise CalledProcessError(retcode, cmd)
  141. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerelements/paper-styles#1.0.13']' returned non-zero exit status 127
  142. Traceback (most recent call last):
  143.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  144.     self.execute_entry(entry_point, args)
  145.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  146.     runner(entry_point)
  147.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  148.     runpy.run_module(module_name, run_name='__main__')
  149.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  150.     fname, loader, pkg_name)
  151.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  152.     exec code in run_globals
  153.   File "tools/js/download_bower.py", line 121, in <module>
  154.   File "tools/js/download_bower.py", line 92, in main
  155.   File "tools/js/download_bower.py", line 46, in bower_info
  156. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerelements/paper-styles#1.0.13']
  157. /usr/bin/env: node: ���������������������������
  158. Traceback (most recent call last):
  159.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  160.     self.execute_entry(entry_point, args)
  161.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  162.     runner(entry_point)
  163.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  164.     runpy.run_module(module_name, run_name='__main__')
  165.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  166.     fname, loader, pkg_name)
  167.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  168.     exec code in run_globals
  169.   File "tools/js/run_npm_binary.py", line 91, in <module>
  170.   File "tools/js/run_npm_binary.py", line 87, in main
  171.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  172.     raise CalledProcessError(retcode, cmd)
  173. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerelements/font-roboto#1.0.1']' returned non-zero exit status 127
  174. Traceback (most recent call last):
  175.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  176.     self.execute_entry(entry_point, args)
  177.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  178.     runner(entry_point)
  179.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  180.     runpy.run_module(module_name, run_name='__main__')
  181.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  182.     fname, loader, pkg_name)
  183.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  184.     exec code in run_globals
  185.   File "tools/js/download_bower.py", line 121, in <module>
  186.   File "tools/js/download_bower.py", line 92, in main
  187.   File "tools/js/download_bower.py", line 46, in bower_info
  188. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerelements/font-roboto#1.0.1']
  189. /usr/bin/env: node: ���������������������������
  190. Traceback (most recent call last):
  191.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  192.     self.execute_entry(entry_point, args)
  193.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  194.     runner(entry_point)
  195.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  196.     runpy.run_module(module_name, run_name='__main__')
  197.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  198.     fname, loader, pkg_name)
  199.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  200.     exec code in run_globals
  201.   File "tools/js/run_npm_binary.py", line 91, in <module>
  202.   File "tools/js/run_npm_binary.py", line 87, in main
  203.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  204.     raise CalledProcessError(retcode, cmd)
  205. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerelements/iron-overlay-behavior#1.1.1']' returned non-zero exit status 127
  206. Traceback (most recent call last):
  207.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  208.     self.execute_entry(entry_point, args)
  209.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  210.     runner(entry_point)
  211.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  212.     runpy.run_module(module_name, run_name='__main__')
  213.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  214.     fname, loader, pkg_name)
  215.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  216.     exec code in run_globals
  217.   File "tools/js/download_bower.py", line 121, in <module>
  218.   File "tools/js/download_bower.py", line 92, in main
  219.   File "tools/js/download_bower.py", line 46, in bower_info
  220. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerelements/iron-overlay-behavior#1.1.1']
  221. /usr/bin/env: node: ���������������������������
  222. Traceback (most recent call last):
  223.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  224.     self.execute_entry(entry_point, args)
  225.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  226.     runner(entry_point)
  227.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  228.     runpy.run_module(module_name, run_name='__main__')
  229.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  230.     fname, loader, pkg_name)
  231.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  232.     exec code in run_globals
  233.   File "tools/js/run_npm_binary.py", line 91, in <module>
  234.   File "tools/js/run_npm_binary.py", line 87, in main
  235.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  236.     raise CalledProcessError(retcode, cmd)
  237. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerelements/iron-resizable-behavior#1.0.2']' returned non-zero exit status 127
  238. Traceback (most recent call last):
  239.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  240.     self.execute_entry(entry_point, args)
  241.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  242.     runner(entry_point)
  243.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  244.     runpy.run_module(module_name, run_name='__main__')
  245.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  246.     fname, loader, pkg_name)
  247.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  248.     exec code in run_globals
  249.   File "tools/js/download_bower.py", line 121, in <module>
  250.   File "tools/js/download_bower.py", line 92, in main
  251.   File "tools/js/download_bower.py", line 46, in bower_info
  252. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerelements/iron-resizable-behavior#1.0.2']
  253. /usr/bin/env: node: ���������������������������
  254. Traceback (most recent call last):
  255.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  256.     self.execute_entry(entry_point, args)
  257.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  258.     runner(entry_point)
  259.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  260.     runpy.run_module(module_name, run_name='__main__')
  261.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  262.     fname, loader, pkg_name)
  263.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  264.     exec code in run_globals
  265.   File "tools/js/run_npm_binary.py", line 91, in <module>
  266.   File "tools/js/run_npm_binary.py", line 87, in main
  267.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  268.     raise CalledProcessError(retcode, cmd)
  269. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerlabs/promise-polyfill#1.0.0']' returned non-zero exit status 127
  270. Traceback (most recent call last):
  271.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  272.     self.execute_entry(entry_point, args)
  273.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  274.     runner(entry_point)
  275.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  276.     runpy.run_module(module_name, run_name='__main__')
  277.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  278.     fname, loader, pkg_name)
  279.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  280.     exec code in run_globals
  281.   File "tools/js/download_bower.py", line 121, in <module>
  282.   File "tools/js/download_bower.py", line 92, in main
  283.   File "tools/js/download_bower.py", line 46, in bower_info
  284. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerlabs/promise-polyfill#1.0.0']
  285. /usr/bin/env: node: ���������������������������
  286. Traceback (most recent call last):
  287.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  288.     self.execute_entry(entry_point, args)
  289.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  290.     runner(entry_point)
  291.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  292.     runpy.run_module(module_name, run_name='__main__')
  293.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  294.     fname, loader, pkg_name)
  295.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  296.     exec code in run_globals
  297.   File "tools/js/run_npm_binary.py", line 91, in <module>
  298.   File "tools/js/run_npm_binary.py", line 87, in main
  299.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  300.     raise CalledProcessError(retcode, cmd)
  301. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerelements/iron-fit-behavior#1.0.5']' returned non-zero exit status 127
  302. Traceback (most recent call last):
  303.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  304.     self.execute_entry(entry_point, args)
  305.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  306.     runner(entry_point)
  307.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  308.     runpy.run_module(module_name, run_name='__main__')
  309.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  310.     fname, loader, pkg_name)
  311.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  312.     exec code in run_globals
  313.   File "tools/js/download_bower.py", line 121, in <module>
  314.   File "tools/js/download_bower.py", line 92, in main
  315.   File "tools/js/download_bower.py", line 46, in bower_info
  316. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerelements/iron-fit-behavior#1.0.5']
  317. /usr/bin/env: node: ���������������������������
  318. Traceback (most recent call last):
  319.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  320.     self.execute_entry(entry_point, args)
  321.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  322.     runner(entry_point)
  323.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  324.     runpy.run_module(module_name, run_name='__main__')
  325.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  326.     fname, loader, pkg_name)
  327.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  328.     exec code in run_globals
  329.   File "tools/js/run_npm_binary.py", line 91, in <module>
  330.   File "tools/js/run_npm_binary.py", line 87, in main
  331.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  332.     raise CalledProcessError(retcode, cmd)
  333. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerelements/iron-ajax#1.1.0']' returned non-zero exit status 127
  334. Traceback (most recent call last):
  335.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  336.     self.execute_entry(entry_point, args)
  337.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  338.     runner(entry_point)
  339.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  340.     runpy.run_module(module_name, run_name='__main__')
  341.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  342.     fname, loader, pkg_name)
  343.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  344.     exec code in run_globals
  345.   File "tools/js/download_bower.py", line 121, in <module>
  346.   File "tools/js/download_bower.py", line 92, in main
  347.   File "tools/js/download_bower.py", line 46, in bower_info
  348. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerelements/iron-ajax#1.1.0']
  349. /usr/bin/env: node: ���������������������������
  350. Traceback (most recent call last):
  351.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  352.     self.execute_entry(entry_point, args)
  353.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  354.     runner(entry_point)
  355.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  356.     runpy.run_module(module_name, run_name='__main__')
  357.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  358.     fname, loader, pkg_name)
  359.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  360.     exec code in run_globals
  361.   File "tools/js/run_npm_binary.py", line 91, in <module>
  362.   File "tools/js/run_npm_binary.py", line 87, in main
  363.   File "/usr/lib/python2.7/subprocess.py", line 540, in check_call
  364.     raise CalledProcessError(retcode, cmd)
  365. CalledProcessError: Command '['/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5-59d457122a161e42cc1625bbab8179c214b7ac11/package/bin/bower', '-l=error', '-j', 'info', 'polymerelements/neon-animation#1.0.8']' returned non-zero exit status 127
  366. Traceback (most recent call last):
  367.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 223, in execute
  368.     self.execute_entry(entry_point, args)
  369.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 271, in execute_entry
  370.     runner(entry_point)
  371.   File "/home/senrsl/tools/gerrit/buck-out/gen/tools/js/download_bower.pex/.bootstrap/_twitter_common_python/pex.py", line 288, in execute_module
  372.     runpy.run_module(module_name, run_name='__main__')
  373.   File "/usr/lib/python2.7/runpy.py", line 180, in run_module
  374.     fname, loader, pkg_name)
  375.   File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  376.     exec code in run_globals
  377.   File "tools/js/download_bower.py", line 121, in <module>
  378.   File "tools/js/download_bower.py", line 92, in main
  379.   File "tools/js/download_bower.py", line 46, in bower_info
  380. OSError: Command failed: ['/home/senrsl/tools/gerrit/buck-out/gen/tools/js/run_npm_binary.pex', '/home/senrsl/tools/gerrit/buck-out/gen/lib/js/bower/bower@1.6.5.npm_binary.tgz', '-l=error', '-j', 'info', 'polymerelements/neon-animation#1.0.8']
  381. senrsl@senrsl-T540p:~/tools/gerrit$
我屮,闹心好久
然后
  1. senrsl@senrsl-T540p:~/tools/gerrit$ sudo apt-get install npm
  2. [sudo] password for senrsl:
  3. 正在读取软件包列表... 完成
  4. 正在分析软件包的依赖关系树      
  5. 正在读取状态信息... 完成      
  6. 下列软件包是自动安装的并且现在不需要了:
  7.   git-man liberror-perl
  8. Use 'apt-get autoremove' to remove them.
  9. 将会安装下列额外的软件包:
  10.   gyp javascript-common libc-ares-dev libc-ares2 libjs-node-uuid
  11.   libv8-3.14-dev libv8-3.14.5 node-abbrev node-ansi node-archy node-async
  12.   node-block-stream node-combined-stream node-cookie-jar node-delayed-stream
  13.   node-forever-agent node-form-data node-fstream node-fstream-ignore
  14.   node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits
  15.   node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime
  16.   node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  17.   node-normalize-package-data node-npmlog node-once node-osenv node-qs
  18.   node-read node-read-package-json node-request node-retry node-rimraf
  19.   node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
  20.   node-which nodejs nodejs-dev
  21. 建议安装的软件包:
  22.   apache2 lighttpd httpd node-hawk node-aws-sign node-oauth-sign
  23.   node-http-signature
  24. 下列【新】软件包将被安装:
  25.   gyp javascript-common libc-ares-dev libc-ares2 libjs-node-uuid
  26.   libv8-3.14-dev libv8-3.14.5 node-abbrev node-ansi node-archy node-async
  27.   node-block-stream node-combined-stream node-cookie-jar node-delayed-stream
  28.   node-forever-agent node-form-data node-fstream node-fstream-ignore
  29.   node-github-url-from-git node-glob node-graceful-fs node-gyp node-inherits
  30.   node-ini node-json-stringify-safe node-lockfile node-lru-cache node-mime
  31.   node-minimatch node-mkdirp node-mute-stream node-node-uuid node-nopt
  32.   node-normalize-package-data node-npmlog node-once node-osenv node-qs
  33.   node-read node-read-package-json node-request node-retry node-rimraf
  34.   node-semver node-sha node-sigmund node-slide node-tar node-tunnel-agent
  35.   node-which nodejs nodejs-dev npm
  36. 升级了 0 个软件包,新安装了 54 个软件包,要卸载 0 个软件包,有 213 个软件包未被升级。
  37. 需要下载 3,241 kB 的软件包。
  38. 解压缩后会消耗掉 14.1 MB 的额外空间。
  39. 您希望继续执行吗? [Y/n] Y
  40. 获取:1 http://archive.ubuntu.com/ubuntu/ trusty/main libc-ares2 amd64 1.10.0-2 [38.5 kB]
  41. 获取:2 http://archive.ubuntu.com/ubuntu/ trusty/universe gyp all 0.1~svn1729-3ubuntu1 [201 kB]
  42. 获取:3 http://archive.ubuntu.com/ubuntu/ trusty/main javascript-common all 11 [6,066 B]
  43. 获取:4 http://archive.ubuntu.com/ubuntu/ trusty/universe libjs-node-uuid all 1.4.0-1 [11.1 kB]
  44. 获取:5 http://archive.ubuntu.com/ubuntu/ trusty/universe libv8-3.14.5 amd64 3.14.5.8-5ubuntu2 [1,189 kB]
  45. 获取:6 http://archive.ubuntu.com/ubuntu/ trusty/universe libv8-3.14-dev amd64 3.14.5.8-5ubuntu2 [57.6 kB]
  46. 获取:7 http://archive.ubuntu.com/ubuntu/ trusty/universe nodejs amd64 0.10.25~dfsg2-2ubuntu1 [684 kB]
  47. 获取:8 http://archive.ubuntu.com/ubuntu/ trusty/universe node-async all 0.2.5-1 [17.7 kB]
  48. 获取:9 http://archive.ubuntu.com/ubuntu/ trusty/universe node-node-uuid all 1.4.0-1 [2,530 B]
  49. 获取:10 http://archive.ubuntu.com/ubuntu/ trusty/main libc-ares-dev amd64 1.10.0-2 [109 kB]
  50. 获取:11 http://archive.ubuntu.com/ubuntu/ trusty/universe node-abbrev all 1.0.4-2 [3,814 B]
  51. 获取:12 http://archive.ubuntu.com/ubuntu/ trusty/universe node-ansi all 0.2.1-1 [8,692 B]
  52. 获取:13 http://archive.ubuntu.com/ubuntu/ trusty/universe node-archy all 0.0.2-1 [3,660 B]
  53. 获取:14 http://archive.ubuntu.com/ubuntu/ trusty/universe node-inherits all 2.0.0-1 [3,090 B]
  54. 获取:15 http://archive.ubuntu.com/ubuntu/ trusty/universe node-block-stream all 0.0.7-1 [4,832 B]
  55. 获取:16 http://archive.ubuntu.com/ubuntu/ trusty/universe node-delayed-stream all 0.0.5-1 [4,750 B]
  56. 获取:17 http://archive.ubuntu.com/ubuntu/ trusty/universe node-combined-stream all 0.0.4-1 [4,686 B]
  57. 获取:18 http://archive.ubuntu.com/ubuntu/ trusty/universe node-cookie-jar all 0.3.1-1 [3,746 B]
  58. 获取:19 http://archive.ubuntu.com/ubuntu/ trusty/universe node-forever-agent all 0.5.1-1 [3,194 B]
  59. 获取:20 http://archive.ubuntu.com/ubuntu/ trusty/universe node-mime all 1.2.11-1 [20.2 kB]
  60. 获取:21 http://archive.ubuntu.com/ubuntu/ trusty/universe node-form-data all 0.1.0-1 [6,412 B]
  61. 获取:22 http://archive.ubuntu.com/ubuntu/ trusty/universe node-rimraf all 2.2.2-2 [5,392 B]
  62. 获取:23 http://archive.ubuntu.com/ubuntu/ trusty/universe node-mkdirp all 0.3.5-1 [4,146 B]
  63. 获取:24 http://archive.ubuntu.com/ubuntu/ trusty/universe node-graceful-fs all 2.0.0-2 [6,718 B]
  64. 获取:25 http://archive.ubuntu.com/ubuntu/ trusty/universe node-fstream all 0.1.24-1 [19.5 kB]
  65. 获取:26 http://archive.ubuntu.com/ubuntu/ trusty/universe node-lru-cache all 2.3.1-1 [5,674 B]
  66. 获取:27 http://archive.ubuntu.com/ubuntu/ trusty/universe node-sigmund all 1.0.0-1 [3,818 B]
  67. 获取:28 http://archive.ubuntu.com/ubuntu/ trusty/universe node-minimatch all 0.2.12-1 [14.9 kB]
  68. 获取:29 http://archive.ubuntu.com/ubuntu/ trusty/universe node-fstream-ignore all 0.0.6-2 [5,586 B]
  69. 获取:30 http://archive.ubuntu.com/ubuntu/ trusty/universe node-github-url-from-git all 1.1.1-1 [3,138 B]
  70. 获取:31 http://archive.ubuntu.com/ubuntu/ trusty/universe node-glob all 3.2.6-1 [13.7 kB]
  71. 获取:32 http://archive.ubuntu.com/ubuntu/ trusty/universe nodejs-dev amd64 0.10.25~dfsg2-2ubuntu1 [169 kB]
  72. 获取:33 http://archive.ubuntu.com/ubuntu/ trusty/universe node-nopt all 2.1.2-1 [11.8 kB]
  73. 获取:34 http://archive.ubuntu.com/ubuntu/ trusty/universe node-npmlog all 0.0.4-1 [5,844 B]
  74. 获取:35 http://archive.ubuntu.com/ubuntu/ trusty/universe node-osenv all 0.0.3-1 [3,810 B]
  75. 获取:36 http://archive.ubuntu.com/ubuntu/ trusty/universe node-tunnel-agent all 0.3.1-1 [4,018 B]
  76. 获取:37 http://archive.ubuntu.com/ubuntu/ trusty/universe node-json-stringify-safe all 5.0.0-1 [3,544 B]
  77. 获取:38 http://archive.ubuntu.com/ubuntu/ trusty/universe node-qs all 0.6.5-1 [5,876 B]
  78. 获取:39 http://archive.ubuntu.com/ubuntu/ trusty/universe node-request all 2.26.1-1 [14.5 kB]
  79. 获取:40 http://archive.ubuntu.com/ubuntu/ trusty/universe node-semver all 2.1.0-2 [16.2 kB]
  80. 获取:41 http://archive.ubuntu.com/ubuntu/ trusty/universe node-tar all 0.1.18-1 [18.3 kB]
  81. 获取:42 http://archive.ubuntu.com/ubuntu/ trusty/universe node-which all 1.0.5-2 [3,678 B]
  82. 获取:43 http://archive.ubuntu.com/ubuntu/ trusty/universe node-gyp all 0.10.10-2 [22.6 kB]
  83. 获取:44 http://archive.ubuntu.com/ubuntu/ trusty/universe node-ini all 1.1.0-1 [4,770 B]
  84. 获取:45 http://archive.ubuntu.com/ubuntu/ trusty/universe node-lockfile all 0.4.1-1 [5,450 B]
  85. 获取:46 http://archive.ubuntu.com/ubuntu/ trusty/universe node-mute-stream all 0.0.3-1 [3,738 B]
  86. 获取:47 http://archive.ubuntu.com/ubuntu/ trusty/universe node-normalize-package-data all 0.2.2-1 [9,286 B]
  87. 获取:48 http://archive.ubuntu.com/ubuntu/ trusty/universe node-once all 1.1.1-1 [2,608 B]
  88. 获取:49 http://archive.ubuntu.com/ubuntu/ trusty/universe node-read all 1.0.4-1 [4,282 B]
  89. 获取:50 http://archive.ubuntu.com/ubuntu/ trusty/universe node-read-package-json all 1.1.3-1 [7,762 B]
  90. 获取:51 http://archive.ubuntu.com/ubuntu/ trusty/universe node-retry all 0.6.0-1 [6,172 B]
  91. 获取:52 http://archive.ubuntu.com/ubuntu/ trusty/universe node-sha all 1.2.3-1 [4,272 B]
  92. 获取:53 http://archive.ubuntu.com/ubuntu/ trusty/universe node-slide all 1.1.4-1 [6,118 B]
  93. 获取:54 http://archive.ubuntu.com/ubuntu/ trusty/universe npm all 1.3.10~dfsg-1 [442 kB]
  94. 下载 3,241 kB,耗时 42秒 (75.7 kB/s)                                          
  95. 正在从软件包中解出模板:100%
  96. 正在选中未选择的软件包 libc-ares2:amd64。
  97. (正在读取数据库 ... 系统当前共安装有 216392 个文件和目录。)
  98. 正准备解包 .../libc-ares2_1.10.0-2_amd64.deb  ...
  99. 正在解包 libc-ares2:amd64 (1.10.0-2) ...
  100. 正在选中未选择的软件包 gyp。
  101. 正准备解包 .../gyp_0.1~svn1729-3ubuntu1_all.deb  ...
  102. 正在解包 gyp (0.1~svn1729-3ubuntu1) ...
  103. 正在选中未选择的软件包 javascript-common。
  104. 正准备解包 .../javascript-common_11_all.deb  ...
  105. 正在解包 javascript-common (11) ...
  106. 正在选中未选择的软件包 libjs-node-uuid。
  107. 正准备解包 .../libjs-node-uuid_1.4.0-1_all.deb  ...
  108. 正在解包 libjs-node-uuid (1.4.0-1) ...
  109. 正在选中未选择的软件包 libv8-3.14.5。
  110. 正准备解包 .../libv8-3.14.5_3.14.5.8-5ubuntu2_amd64.deb  ...
  111. 正在解包 libv8-3.14.5 (3.14.5.8-5ubuntu2) ...
  112. 正在选中未选择的软件包 libv8-3.14-dev。
  113. 正准备解包 .../libv8-3.14-dev_3.14.5.8-5ubuntu2_amd64.deb  ...
  114. 正在解包 libv8-3.14-dev (3.14.5.8-5ubuntu2) ...
  115. 正在选中未选择的软件包 nodejs。
  116. 正准备解包 .../nodejs_0.10.25~dfsg2-2ubuntu1_amd64.deb  ...
  117. 正在解包 nodejs (0.10.25~dfsg2-2ubuntu1) ...
  118. 正在选中未选择的软件包 node-async。
  119. 正准备解包 .../node-async_0.2.5-1_all.deb  ...
  120. 正在解包 node-async (0.2.5-1) ...
  121. 正在选中未选择的软件包 node-node-uuid。
  122. 正准备解包 .../node-node-uuid_1.4.0-1_all.deb  ...
  123. 正在解包 node-node-uuid (1.4.0-1) ...
  124. 正在选中未选择的软件包 libc-ares-dev:amd64。
  125. 正准备解包 .../libc-ares-dev_1.10.0-2_amd64.deb  ...
  126. 正在解包 libc-ares-dev:amd64 (1.10.0-2) ...
  127. 正在选中未选择的软件包 node-abbrev。
  128. 正准备解包 .../node-abbrev_1.0.4-2_all.deb  ...
  129. 正在解包 node-abbrev (1.0.4-2) ...
  130. 正在选中未选择的软件包 node-ansi。
  131. 正准备解包 .../node-ansi_0.2.1-1_all.deb  ...
  132. 正在解包 node-ansi (0.2.1-1) ...
  133. 正在选中未选择的软件包 node-archy。
  134. 正准备解包 .../node-archy_0.0.2-1_all.deb  ...
  135. 正在解包 node-archy (0.0.2-1) ...
  136. 正在选中未选择的软件包 node-inherits。
  137. 正准备解包 .../node-inherits_2.0.0-1_all.deb  ...
  138. 正在解包 node-inherits (2.0.0-1) ...
  139. 正在选中未选择的软件包 node-block-stream。
  140. 正准备解包 .../node-block-stream_0.0.7-1_all.deb  ...
  141. 正在解包 node-block-stream (0.0.7-1) ...
  142. 正在选中未选择的软件包 node-delayed-stream。
  143. 正准备解包 .../node-delayed-stream_0.0.5-1_all.deb  ...
  144. 正在解包 node-delayed-stream (0.0.5-1) ...
  145. 正在选中未选择的软件包 node-combined-stream。
  146. 正准备解包 .../node-combined-stream_0.0.4-1_all.deb  ...
  147. 正在解包 node-combined-stream (0.0.4-1) ...
  148. 正在选中未选择的软件包 node-cookie-jar。
  149. 正准备解包 .../node-cookie-jar_0.3.1-1_all.deb  ...
  150. 正在解包 node-cookie-jar (0.3.1-1) ...
  151. 正在选中未选择的软件包 node-forever-agent。
  152. 正准备解包 .../node-forever-agent_0.5.1-1_all.deb  ...
  153. 正在解包 node-forever-agent (0.5.1-1) ...
  154. 正在选中未选择的软件包 node-mime。
  155. 正准备解包 .../node-mime_1.2.11-1_all.deb  ...
  156. 正在解包 node-mime (1.2.11-1) ...
  157. 正在选中未选择的软件包 node-form-data。
  158. 正准备解包 .../node-form-data_0.1.0-1_all.deb  ...
  159. 正在解包 node-form-data (0.1.0-1) ...
  160. 正在选中未选择的软件包 node-rimraf。
  161. 正准备解包 .../node-rimraf_2.2.2-2_all.deb  ...
  162. 正在解包 node-rimraf (2.2.2-2) ...
  163. 正在选中未选择的软件包 node-mkdirp。
  164. 正准备解包 .../node-mkdirp_0.3.5-1_all.deb  ...
  165. 正在解包 node-mkdirp (0.3.5-1) ...
  166. 正在选中未选择的软件包 node-graceful-fs。
  167. 正准备解包 .../node-graceful-fs_2.0.0-2_all.deb  ...
  168. 正在解包 node-graceful-fs (2.0.0-2) ...
  169. 正在选中未选择的软件包 node-fstream。
  170. 正准备解包 .../node-fstream_0.1.24-1_all.deb  ...
  171. 正在解包 node-fstream (0.1.24-1) ...
  172. 正在选中未选择的软件包 node-lru-cache。
  173. 正准备解包 .../node-lru-cache_2.3.1-1_all.deb  ...
  174. 正在解包 node-lru-cache (2.3.1-1) ...
  175. 正在选中未选择的软件包 node-sigmund。
  176. 正准备解包 .../node-sigmund_1.0.0-1_all.deb  ...
  177. 正在解包 node-sigmund (1.0.0-1) ...
  178. 正在选中未选择的软件包 node-minimatch。
  179. 正准备解包 .../node-minimatch_0.2.12-1_all.deb  ...
  180. 正在解包 node-minimatch (0.2.12-1) ...
  181. 正在选中未选择的软件包 node-fstream-ignore。
  182. 正准备解包 .../node-fstream-ignore_0.0.6-2_all.deb  ...
  183. 正在解包 node-fstream-ignore (0.0.6-2) ...
  184. 正在选中未选择的软件包 node-github-url-from-git。
  185. 正准备解包 .../node-github-url-from-git_1.1.1-1_all.deb  ...
  186. 正在解包 node-github-url-from-git (1.1.1-1) ...
  187. 正在选中未选择的软件包 node-glob。
  188. 正准备解包 .../node-glob_3.2.6-1_all.deb  ...
  189. 正在解包 node-glob (3.2.6-1) ...
  190. 正在选中未选择的软件包 nodejs-dev。
  191. 正准备解包 .../nodejs-dev_0.10.25~dfsg2-2ubuntu1_amd64.deb  ...
  192. 正在解包 nodejs-dev (0.10.25~dfsg2-2ubuntu1) ...
  193. 正在选中未选择的软件包 node-nopt。
  194. 正准备解包 .../node-nopt_2.1.2-1_all.deb  ...
  195. 正在解包 node-nopt (2.1.2-1) ...
  196. 正在选中未选择的软件包 node-npmlog。
  197. 正准备解包 .../node-npmlog_0.0.4-1_all.deb  ...
  198. 正在解包 node-npmlog (0.0.4-1) ...
  199. 正在选中未选择的软件包 node-osenv。
  200. 正准备解包 .../node-osenv_0.0.3-1_all.deb  ...
  201. 正在解包 node-osenv (0.0.3-1) ...
  202. 正在选中未选择的软件包 node-tunnel-agent。
  203. 正准备解包 .../node-tunnel-agent_0.3.1-1_all.deb  ...
  204. 正在解包 node-tunnel-agent (0.3.1-1) ...
  205. 正在选中未选择的软件包 node-json-stringify-safe。
  206. 正准备解包 .../node-json-stringify-safe_5.0.0-1_all.deb  ...
  207. 正在解包 node-json-stringify-safe (5.0.0-1) ...
  208. 正在选中未选择的软件包 node-qs。
  209. 正准备解包 .../node-qs_0.6.5-1_all.deb  ...
  210. 正在解包 node-qs (0.6.5-1) ...
  211. 正在选中未选择的软件包 node-request。
  212. 正准备解包 .../node-request_2.26.1-1_all.deb  ...
  213. 正在解包 node-request (2.26.1-1) ...
  214. 正在选中未选择的软件包 node-semver。
  215. 正准备解包 .../node-semver_2.1.0-2_all.deb  ...
  216. 正在解包 node-semver (2.1.0-2) ...
  217. 正在选中未选择的软件包 node-tar。
  218. 正准备解包 .../node-tar_0.1.18-1_all.deb  ...
  219. 正在解包 node-tar (0.1.18-1) ...
  220. 正在选中未选择的软件包 node-which。
  221. 正准备解包 .../node-which_1.0.5-2_all.deb  ...
  222. 正在解包 node-which (1.0.5-2) ...
  223. 正在选中未选择的软件包 node-gyp。
  224. 正准备解包 .../node-gyp_0.10.10-2_all.deb  ...
  225. 正在解包 node-gyp (0.10.10-2) ...
  226. 正在选中未选择的软件包 node-ini。
  227. 正准备解包 .../node-ini_1.1.0-1_all.deb  ...
  228. 正在解包 node-ini (1.1.0-1) ...
  229. 正在选中未选择的软件包 node-lockfile。
  230. 正准备解包 .../node-lockfile_0.4.1-1_all.deb  ...
  231. 正在解包 node-lockfile (0.4.1-1) ...
  232. 正在选中未选择的软件包 node-mute-stream。
  233. 正准备解包 .../node-mute-stream_0.0.3-1_all.deb  ...
  234. 正在解包 node-mute-stream (0.0.3-1) ...
  235. 正在选中未选择的软件包 node-normalize-package-data。
  236. 正准备解包 .../node-normalize-package-data_0.2.2-1_all.deb  ...
  237. 正在解包 node-normalize-package-data (0.2.2-1) ...
  238. 正在选中未选择的软件包 node-once。
  239. 正准备解包 .../node-once_1.1.1-1_all.deb  ...
  240. 正在解包 node-once (1.1.1-1) ...
  241. 正在选中未选择的软件包 node-read。
  242. 正准备解包 .../node-read_1.0.4-1_all.deb  ...
  243. 正在解包 node-read (1.0.4-1) ...
  244. 正在选中未选择的软件包 node-read-package-json。
  245. 正准备解包 .../node-read-package-json_1.1.3-1_all.deb  ...
  246. 正在解包 node-read-package-json (1.1.3-1) ...
  247. 正在选中未选择的软件包 node-retry。
  248. 正准备解包 .../node-retry_0.6.0-1_all.deb  ...
  249. 正在解包 node-retry (0.6.0-1) ...
  250. 正在选中未选择的软件包 node-sha。
  251. 正准备解包 .../node-sha_1.2.3-1_all.deb  ...
  252. 正在解包 node-sha (1.2.3-1) ...
  253. 正在选中未选择的软件包 node-slide。
  254. 正准备解包 .../node-slide_1.1.4-1_all.deb  ...
  255. 正在解包 node-slide (1.1.4-1) ...
  256. 正在选中未选择的软件包 npm。
  257. 正准备解包 .../npm_1.3.10~dfsg-1_all.deb  ...
  258. 正在解包 npm (1.3.10~dfsg-1) ...
  259. 正在处理用于 man-db (2.6.7.1-1ubuntu1) 的触发器 ...
  260. 正在处理用于 doc-base (0.10.5) 的触发器 ...
  261. Processing 5 added doc-base files...
  262. 正在设置 libc-ares2:amd64 (1.10.0-2) ...
  263. 正在设置 gyp (0.1~svn1729-3ubuntu1) ...
  264. 正在设置 javascript-common (11) ...
  265. 正在设置 libjs-node-uuid (1.4.0-1) ...
  266. 正在设置 libv8-3.14.5 (3.14.5.8-5ubuntu2) ...
  267. 正在设置 libv8-3.14-dev (3.14.5.8-5ubuntu2) ...
  268. 正在设置 nodejs (0.10.25~dfsg2-2ubuntu1) ...
  269. update-alternatives: using /usr/bin/nodejs to provide /usr/bin/js (js) in 自动模式
  270. 正在设置 node-async (0.2.5-1) ...
  271. 正在设置 node-node-uuid (1.4.0-1) ...
  272. 正在设置 libc-ares-dev:amd64 (1.10.0-2) ...
  273. 正在设置 node-abbrev (1.0.4-2) ...
  274. 正在设置 node-ansi (0.2.1-1) ...
  275. 正在设置 node-archy (0.0.2-1) ...
  276. 正在设置 node-inherits (2.0.0-1) ...
  277. 正在设置 node-block-stream (0.0.7-1) ...
  278. 正在设置 node-delayed-stream (0.0.5-1) ...
  279. 正在设置 node-combined-stream (0.0.4-1) ...
  280. 正在设置 node-cookie-jar (0.3.1-1) ...
  281. 正在设置 node-forever-agent (0.5.1-1) ...
  282. 正在设置 node-mime (1.2.11-1) ...
  283. 正在设置 node-form-data (0.1.0-1) ...
  284. 正在设置 node-rimraf (2.2.2-2) ...
  285. 正在设置 node-mkdirp (0.3.5-1) ...
  286. 正在设置 node-graceful-fs (2.0.0-2) ...
  287. 正在设置 node-fstream (0.1.24-1) ...
  288. 正在设置 node-lru-cache (2.3.1-1) ...
  289. 正在设置 node-sigmund (1.0.0-1) ...
  290. 正在设置 node-minimatch (0.2.12-1) ...
  291. 正在设置 node-fstream-ignore (0.0.6-2) ...
  292. 正在设置 node-github-url-from-git (1.1.1-1) ...
  293. 正在设置 node-glob (3.2.6-1) ...
  294. 正在设置 nodejs-dev (0.10.25~dfsg2-2ubuntu1) ...
  295. 正在设置 node-nopt (2.1.2-1) ...
  296. 正在设置 node-npmlog (0.0.4-1) ...
  297. 正在设置 node-osenv (0.0.3-1) ...
  298. 正在设置 node-tunnel-agent (0.3.1-1) ...
  299. 正在设置 node-json-stringify-safe (5.0.0-1) ...
  300. 正在设置 node-qs (0.6.5-1) ...
  301. 正在设置 node-request (2.26.1-1) ...
  302. 正在设置 node-semver (2.1.0-2) ...
  303. 正在设置 node-tar (0.1.18-1) ...
  304. 正在设置 node-which (1.0.5-2) ...
  305. 正在设置 node-gyp (0.10.10-2) ...
  306. 正在设置 node-ini (1.1.0-1) ...
  307. 正在设置 node-lockfile (0.4.1-1) ...
  308. 正在设置 node-mute-stream (0.0.3-1) ...
  309. 正在设置 node-normalize-package-data (0.2.2-1) ...
  310. 正在设置 node-once (1.1.1-1) ...
  311. 正在设置 node-read (1.0.4-1) ...
  312. 正在设置 node-read-package-json (1.1.3-1) ...
  313. 正在设置 node-retry (0.6.0-1) ...
  314. 正在设置 node-sha (1.2.3-1) ...
  315. 正在设置 node-slide (1.1.4-1) ...
  316. 正在设置 npm (1.3.10~dfsg-1) ...
  317. 正在处理用于 libc-bin (2.19-0ubuntu6.6) 的触发器 ...
  318. senrsl@senrsl-T540p:~/tools/gerrit$ npm -v
  319. 1.3.10
  320. senrsl@senrsl-T540p:~/tools/gerrit$ buck clean
  321. Shutting down nailgun server...
  322. Using watchman.
  323. senrsl@senrsl-T540p:~/tools/gerrit$ buck build release
  324. No Android platform target specified. Using default: Google Inc.:Google APIs:21
  325. No Android platform target specified. Using default: Google Inc.:Google APIs:21
  326. No Android platform target specified. Using default: Google Inc.:Google APIs:21
  327. [+] PROCESSING BUCK FILES...0.3s [100%]
  328. SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
  329. SLF4J: Defaulting to no-operation (NOP) logger implementation
  330. SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
  331. [-] PROCESSING BUCK FILES...FINISHED 1.8s [100%]
  332. [-] BUILDING...FINISHED 86.0s [100%] (466/879 JOBS, 466 UPDATED, 10.5% CACHE MI)
  333. senrsl@senrsl-T540p:~/tools/gerrit$
竟然编译完成了。。。。
结果生成于
  1. /home/senrsl/tools/gerrit/buck-out/gen/release/release.war
看起来应该是使用了缓存,第二次clean,build秒编完成
  1. senrsl@senrsl-T540p:~/tools/gerrit$ buck clean
  2. Shutting down nailgun server...
  3. Using watchman.
  4. senrsl@senrsl-T540p:~/tools/gerrit$ buck build release
  5. [-] PROCESSING BUCK FILES...FINISHED 1.8s [100%]
  6. [-] BUILDING...FINISHED 1.5s [100%] (1/879 JOBS, 1 UPDATED, 0.0% CACHE MISS)
  7. senrsl@senrsl-T540p:~/tools/gerrit$

然后各种改.properties,改完编译运行
看起来还不错哈



中文版搞定!

10)服务器搬迁
搬完发现gerrit不完整了。。。。好吧,重装
用自己编的中文版的
自己编的中文版比之前那个版本高,会自动升级数据库
  1. [gerrit@Android ~]$ java -jar release.war init -d review
  2. Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
  3. [2015-12-19 00:05:49,571] [main] INFO  com.google.gerrit.server.config.GerritServerConfigProvider : No /home/gerrit/review/etc/gerrit.config; assuming defaults
  4. *** Gerrit Code Review 2.12-rc2-380-g70f9ae2-dirty
  5. ***
  6. Create '/home/gerrit/review'   [Y/n]?
  7. *** Git Repositories
  8. ***
  9. Location of Git repositories   [git]:
  10. *** SQL Database
  11. ***
  12. Database server type           [h2]: mysql
  13. Gerrit Code Review is not shipped with MySQL Connector/J 5.1.21
  14. **  This library is required for your configuration. **
  15. Download and install it now [Y/n]?
  16. Downloading http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar ... OK
  17. Checksum mysql-connector-java-5.1.21.jar OK
  18. Server hostname                [localhost]: 10.1.8.102
  19. Server port                    [(mysql default)]:
  20. Database name                  [reviewdb]: gerritdb
  21. Database username              [gerrit]:
  22. gerrit's password              :
  23.               confirm password :
  24. *** Index
  25. ***
  26. Type                           [LUCENE/?]:
  27. *** User Authentication
  28. ***
  29. Authentication method          [OPENID/?]: http
  30. Get username from custom HTTP header [y/N]?
  31. SSO logout URL                 :
  32. Enable signed push support     [y/N]?
  33. *** Review Labels
  34. ***
  35. Install Verified label         [y/N]?
  36. *** Email Delivery
  37. ***
  38. SMTP server hostname           [localhost]:
  39. SMTP server port               [(default)]:
  40. SMTP encryption                [NONE/?]:
  41. SMTP username                  :
  42. *** Container Process
  43. ***
  44. Run as                         [gerrit]:
  45. Java runtime                   [/usr/java/jdk1.8.0_65/jre]:
  46. Copy release.war to review/bin/gerrit.war [Y/n]?
  47. Copying release.war to review/bin/gerrit.war
  48. *** SSH Daemon
  49. ***
  50. Listen on address              [*]:
  51. Listen on port                 [29418]:
  52. Gerrit Code Review is not shipped with Bouncy Castle Crypto SSL v152
  53.   If available, Gerrit can take advantage of features
  54.   in the library, but will also function without it.
  55. Download and install it now [Y/n]?
  56. Downloading http://www.bouncycastle.org/download/bcpkix-jdk15on-152.jar ... OK
  57. Checksum bcpkix-jdk15on-152.jar OK
  58. Gerrit Code Review is not shipped with Bouncy Castle Crypto Provider v152
  59. ** This library is required by Bouncy Castle Crypto SSL v152. **
  60. Download and install it now [Y/n]?
  61. Downloading http://www.bouncycastle.org/download/bcprov-jdk15on-152.jar ... OK
  62. Checksum bcprov-jdk15on-152.jar OK
  63. Generating SSH host key ... rsa... dsa... done
  64. *** HTTP Daemon
  65. ***
  66. Behind reverse proxy           [y/N]? y
  67. Proxy uses SSL (https://)      [y/N]?
  68. Subdirectory on proxy server   [/]: /gerrit
  69. Listen on address              [*]:
  70. Listen on port                 [8081]:
  71. Canonical URL                  [http://bt-199-037.bta.net.cn/gerrit]: http://10.1.11.145/gerrit
  72. *** Plugins
  73. ***
  74. Installing plugins.
  75. Install plugin commit-message-length-validator version v2.12-rc2 [y/N]?
  76. Install plugin download-commands version v2.12-rc2 [y/N]?
  77. Install plugin singleusergroup version v2.12-rc2 [y/N]?
  78. Install plugin replication version v2.12-rc2-5-g4ab29b7 [y/N]?
  79. Install plugin reviewnotes version v2.12-rc2 [y/N]?
  80. Initializing plugins.
  81. No plugins found with init steps.
  82. Upgrading schema to 108 ...
  83. Upgrading schema to 109 ...
  84. Upgrading schema to 110 ...
  85. Upgrading schema to 111 ...
  86. Upgrading schema to 112 ...
  87. Upgrading schema to 113 ...
  88. Upgrading schema to 114 ...
  89. Upgrading schema to 115 ...
  90. Upgrading schema to 116 ...
  91. Migrating data to schema 108 ...
  92. Listing all changes ...
  93. done
  94. Updating groups for open changes ...
  95. done
  96. Migrating data to schema 109 ...
  97. Migrating data to schema 110 ...
  98. Migrating data to schema 111 ...
  99. Migrating data to schema 112 ...
  100. Migrating data to schema 113 ...
  101. Migrating data to schema 114 ...
  102. Migrating data to schema 115 ...
  103. Migrating data to schema 116 ...
  104. Migrate user preference copySelfOnEmail to emailStrategy
  105. Execute the following SQL to drop unused objects:
  106.   DROP TABLE account_diff_preferences;
  107.   DROP TABLE patch_set_ancestors;
  108.   ALTER TABLE accounts DROP COLUMN contact_filed_on;
  109.   ALTER TABLE accounts DROP COLUMN copy_self_on_email;
  110. Execute now [Y/n]?
  111. Initialized /home/gerrit/review
  112. Executing /home/gerrit/review/bin/gerrit.sh start
  113. Starting Gerrit Code Review: OK
  114. Waiting for server on 10.1.11.145:80 ... OK
  115. Opening http://10.1.11.145/gerrit/#/admin/projects/ ...FAILED
  116. Open Gerrit with a JavaScript capable browser:
  117.   http://10.1.11.145/gerrit/#/admin/projects/
  118. [gerrit@Android ~]$

升级之后发现本地的git下的库都没了,报找不到,好吧,还是重装。。。。

重装之后发现发送验证邮件有问题。
然后尝试
重装sendmail,
安装mail,
配置邮件发送为163的smtp

  1. [root@Android ~]# yum remove sendmail
  2. [root@Android ~]# yum install -y sendmail
  3. [root@Android ~]# yum install mail
  4. [root@Android ~]# which mail
  5. /bin/mail
  6. [root@Android ~]# tail -n 2 /etc/mail.rc
  7. set from=senrsl01@163.com smtp=smtp.163.com
  8. set smtp-auth-user=senrsl01@163.com  smtp-auth-password=ovcnkhecycjgzkaw smtp-auth=login
  9. [root@Android ~]# echo test | mail -s test senrsl01@163.com
  10. [gerrit@Android etc]$ cat gerrit.config
  11. [gerrit]
  12.     basePath = git
  13.     canonicalWebUrl = http://10.1.11.145/gerrit
  14. [database]
  15.     type = mysql
  16.     hostname = 10.1.8.102
  17.     database = gerritdb
  18.     username = gerrit
  19. [index]
  20.     type = LUCENE
  21. [auth]
  22.     type = HTTP
  23. [receive]
  24.     enableSignedPush = false
  25. [sendemail]
  26.     smtpServer = smtp.163.com
  27.     smtpServerPort = 465
  28.     smtpEncryption = SSL
  29.     smtpUser = senRsl01@163.com
  30.     from = senRsl01@163.com
  31. [container]
  32.     user = gerrit
  33.     javaHome = /usr/java/jdk1.8.0_65/jre
  34. [sshd]
  35.     listenAddress = *:29418
  36. [httpd]
  37.     listenUrl = proxy-http://*:8081/gerrit
  38. [cache]
  39.     directory = cache
  40. [gerrit@Android etc]$

第一个发送test成功


第二个发送注册验证报错
  1. com.google.gerrit.server.account.CreateEmail : Cannot send email verification message to senRsl@126.com
  2. com.google.gerrit.common.errors.EmailException: Mail Error: Server smtp.163.com rejected message body: 554 DT:SPM 163 smtp2,DNGowEDZmU_1bndWvfIQAA--.859S2 1450667769,please see http://mail.163.com/help/help_spam_16.htm?ip=61.50.103.158&hostid=smtp2&time=1450667769
查看代码
. 554 DT:SPM 发送的邮件内容包含了未被许可的信息,或被系统识别为垃圾邮件。请检查是否有用户发送病毒或者垃圾邮件;

。。。。
改成公司的邮箱就好了。。。。


邮件模板位置在:
  1. senrsl@senrsl-T540p:~/tools/gerrit$ ls gerrit-server/src/main/resources/com/google/gerrit/server/mail/
  2. Abandoned.vm      CommentFooter.vm  MergeFail.vm         ReplacePatchSet.vm
  3. AddKey.vm         Comment.vm        NewChange.vm         Restored.vm
  4. ChangeFooter.vm   Footer.vm         old                  Reverted.vm
  5. ChangeSubject.vm  Merged.vm         RegisterNewEmail.vm
  6. senrsl@senrsl-T540p:~/tools/gerrit$

可以改中文,
改完,编译,删掉之前的那些重装好了
  1. [gerrit@Android ~]$ java -jar release.war init -d review
  2. log4j:WARN No such property [target] in org.apache.log4j.DailyRollingFileAppender.
  3. log4j:WARN File option not set for appender [stdout].
  4. log4j:WARN Are you using FileAppender instead of ConsoleAppender?
  5. log4j:ERROR Either File or DatePattern options are not set for appender [stdout].
  6. Using secure store: com.google.gerrit.server.securestore.DefaultSecureStore
  7. [2015-12-21 22:07:24,258] [main] INFO  com.google.gerrit.server.config.GerritServerConfigProvider : No /home/gerrit/review/etc/gerrit.config; assuming defaults
  8. log4j:ERROR No output stream or file set for the appender named [stdout].
  9. *** Gerrit Code Review 2.12-rc2-381-g31c519d-dirty
  10. ***
  11. Create '/home/gerrit/review'   [Y/n]?
  12. *** Git Repositories
  13. ***
  14. Location of Git repositories   [git]:
  15. *** SQL Database
  16. ***
  17. Database server type           [h2]: mysql
  18. Gerrit Code Review is not shipped with MySQL Connector/J 5.1.21
  19. **  This library is required for your configuration. **
  20. Download and install it now [Y/n]?
  21. Downloading http://repo2.maven.org/maven2/mysql/mysql-connector-java/5.1.21/mysql-connector-java-5.1.21.jar ... OK
  22. Checksum mysql-connector-java-5.1.21.jar OK
  23. Server hostname                [localhost]: 10.1.8.102
  24. Server port                    [(mysql default)]:
  25. Database name                  [reviewdb]: gerritdb
  26. Database username              [gerrit]:
  27. gerrit's password              :
  28.               confirm password :
  29. *** Index
  30. ***
  31. Type                           [LUCENE/?]:
  32. *** User Authentication
  33. ***
  34. Authentication method          [OPENID/?]: http
  35. Get username from custom HTTP header [y/N]?
  36. SSO logout URL                 : http://10.1.11.145
  37. Enable signed push support     [y/N]?
  38. *** Review Labels
  39. ***
  40. Install Verified label         [y/N]?
  41. *** Email Delivery
  42. ***
  43. SMTP server hostname           [localhost]: smtp.126.com
  44. SMTP server port               [(default)]: 25
  45. SMTP encryption                [NONE/?]:
  46. SMTP username                  [gerrit]: senRsl@126.com
  47. senRsl@126.com's password :
  48.               confirm password :
  49. *** Container Process
  50. ***
  51. Run as                         [gerrit]:
  52. Java runtime                   [/usr/java/jdk1.8.0_65/jre]:
  53. Copy release.war to review/bin/gerrit.war [Y/n]?
  54. Copying release.war to review/bin/gerrit.war
  55. *** SSH Daemon
  56. ***
  57. Listen on address              [*]:
  58. Listen on port                 [29418]:
  59. Gerrit Code Review is not shipped with Bouncy Castle Crypto SSL v152
  60.   If available, Gerrit can take advantage of features
  61.   in the library, but will also function without it.
  62. Download and install it now [Y/n]?
  63. Downloading http://www.bouncycastle.org/download/bcpkix-jdk15on-152.jar ... OK
  64. Checksum bcpkix-jdk15on-152.jar OK
  65. Gerrit Code Review is not shipped with Bouncy Castle Crypto Provider v152
  66. ** This library is required by Bouncy Castle Crypto SSL v152. **
  67. Download and install it now [Y/n]?
  68. Downloading http://www.bouncycastle.org/download/bcprov-jdk15on-152.jar ... OK
  69. Checksum bcprov-jdk15on-152.jar OK
  70. Generating SSH host key ... rsa... dsa... done
  71. *** HTTP Daemon
  72. ***
  73. Behind reverse proxy           [y/N]? y
  74. Proxy uses SSL (https://)      [y/N]?
  75. Subdirectory on proxy server   [/]: /gerrit
  76. Listen on address              [*]:
  77. Listen on port                 [8081]:
  78. Canonical URL                  [http://bt-199-037.bta.net.cn/gerrit]: http://10.1.11.145/gerrit
  79. *** Plugins
  80. ***
  81. Installing plugins.
  82. Install plugin commit-message-length-validator version v2.12-rc2 [y/N]?
  83. Install plugin download-commands version v2.12-rc2 [y/N]?
  84. Install plugin singleusergroup version v2.12-rc2 [y/N]?
  85. Install plugin replication version v2.12-rc2-5-g4ab29b7 [y/N]?
  86. Install plugin reviewnotes version v2.12-rc2 [y/N]?
  87. Initializing plugins.
  88. No plugins found with init steps.
  89. fatal: CInitialized /home/gerrit/review
  90. Executing /home/gerrit/review/bin/gerrit.sh start
  91. Starting Gerrit Code Review: OK
  92. Waiting for server on 10.1.11.145:80 ... OK
  93. Opening http://10.1.11.145/gerrit/#/admin/projects/ ...FAILED
  94. Open Gerrit with a JavaScript capable browser:
  95.   http://10.1.11.145/gerrit/#/admin/projects/
  96. [gerrit@Android ~]$

发现发邮件竟然使用的默认的


改掉
  1. [gerrit@Android review]$ cat etc/gerrit.config
  2. [gerrit]
  3.     basePath = git
  4.     canonicalWebUrl = http://10.1.11.145/gerrit
  5. [database]
  6.     type = mysql
  7.     hostname = 10.1.8.102
  8.     database = gerritdb
  9.     username = gerrit
  10. [index]
  11.     type = LUCENE
  12. [auth]
  13.     type = HTTP
  14.     logoutUrl = http://10.1.11.145
  15. [receive]
  16.     enableSignedPush = false
  17. [sendemail]
  18.     smtpServer = smtp.126.com
  19.     smtpServerPort = 25
  20.     smtpUser = senRsl@126.com
  21.     from = gerrit@126.com
  22. [container]
  23.     user = gerrit
  24.     javaHome = /usr/java/jdk1.8.0_65/jre
  25. [sshd]
  26.     listenAddress = *:29418
  27. [httpd]
  28.     listenUrl = proxy-http://*:8081/gerrit
  29. [cache]
  30.     directory = cache
  31. [gerrit@Android review]$
等打起来了找运维给弄个专门的邮箱。。。。

新建个账户
Last login: Mon Dec 21 21:45:11 2015 from 192.168.6.5
[root@Android ~]# htpasswd -m /etc/gerrit.passwd senRsl
New password:
Re-type new password:
Adding password for user senRsl
[root@Android ~]#
然后登陆,注册邮件


竟然显示代发。。。。
好吧,还是把from改回本尊,不要代发,到时候直接找运维新开个好了

然后新建测试项目,修改代码,提交评审。。。。
直接按上面的跑就好
然后加这个的时候折腾了一会
  1. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$  gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  2. Permission denied (publickey).
  3. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  4. commit-msg                                    100% 4678     4.6KB/s   00:00   
  5. senrsl@senrsl-T540p:~/test/repo/gerrit/test-gerrit$ git status
这是因为没有把SSH配上,配上就好了。

为什么不显示 git clone那个地址。。。。。。。

呃。。。。。之前就搞到这儿。回#8去搞git-web

终于把拖欠了俩月的工资结了。。。。

11)gerrit删除项目
  1. [root@Android gerrit]# service gerrit stop
  2. Stopping Gerrit Code Review: OK
  3. [gerrit@Android git]$ rm -rf test01.git
  4. [root@Android gerrit]# service gerrit start
  5. Starting Gerrit Code Review: OK
  6. [root@Android gerrit]#

关闭服务,然后到项目库路径下删除文件夹,启动服务。。。。

示例为test01.git

12)SSH命令访问gerrit
senrsl@senrsl-T540p:~/test/repo/kernel-android-common$ ssh -p 29418 zym@10.1.11.145

  ****    欢迎使用代码审核服务    ****

  Hi 赵玉明, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://zym@10.1.11.145:29418/REPOSITORY_NAME.git

Connection to 10.1.11.145 closed.
senrsl@senrsl-T540p:~/test/repo/kernel-android-common$ ssh -p 29418 -i ~/.ssh/id_rsa.pub 10.1.11.145 -l zym

  ****    欢迎使用代码审核服务    ****

  Hi 赵玉明, you have successfully connected over SSH.

  Unfortunately, interactive shells are disabled.
  To clone a hosted Git repository, use:

  git clone ssh://zym@10.1.11.145:29418/REPOSITORY_NAME.git

Connection to 10.1.11.145 closed.


5,揉和

1)存储部署
初期估计部署三套gerrit服务器,分别为
  1. 第一套:平时测试学习用;
  2. 第二套:公司内部正式项目用;
  3. 第三套:对外
以第一套为例。
结构设计如下:
  1. [gerrit@Android git]$ tree -L 1
  2. .
  3. ├── All-Projects.git
  4. ├── All-Users.git
  5. ├── KERNEL -> /home/git-ro/repos/kernel
  6. ├── KVT49L -> /home/git-ro/repos/kvt49l
  7. ├── RELEASE -> /home/git-ro/repos/release
  8. └── test-gerrit.git
  9. 6 directories, 0 files
  10. [gerrit@Android git]$
目录名展示全部大写。
实际结构如下:
  1. [dc@Android repos]$ tree -L 2
  2. .
  3. ├── kernel
  4. │   ├── test
  5. │   └── test03.git
  6. ├── kvt49l
  7. │   └── test01.git
  8. ├── manifest.git
  9. │   ├── branches
  10. │   ├── config
  11. │   ├── description
  12. │   ├── HEAD
  13. │   ├── hooks
  14. │   ├── info
  15. │   ├── objects
  16. │   └── refs
  17. ├── master.zip
  18. ├── pro
  19. │   ├── pro1.git
  20. │   └── pro2.git
  21. ├── pro3.git
  22. │   ├── branches
  23. │   ├── config
  24. │   ├── description
  25. │   ├── HEAD
  26. │   ├── hooks
  27. │   ├── info
  28. │   ├── objects
  29. │   └── refs
  30. ├── release
  31. │   ├── deb4.4.2r2.git
  32. │   └── deb6.0.0r26.git
  33. ├── repo
  34. │   ├── color.py
  35. │   ├── command.py
  36. │   ├── COPYING
  37. │   ├── docs
  38. │   ├── editor.py
  39. │   ├── error.py
  40. │   ├── git_command.py
  41. │   ├── git_config.py
  42. │   ├── git_refs.py
  43. │   ├── git_ssh
  44. │   ├── hooks
  45. │   ├── main.py
  46. │   ├── manifest_loader.py
  47. │   ├── manifest.py
  48. │   ├── manifest_submodule.py
  49. │   ├── manifest_xml.py
  50. │   ├── pager.py
  51. │   ├── progress.py
  52. │   ├── project.py
  53. │   ├── repo
  54. │   ├── subcmds
  55. │   ├── SUBMITTING_PATCHES
  56. │   ├── tests
  57. │   └── trace.py
  58. └── repo.git
  59. 29 directories, 27 files
  60. [dc@Android repos]$
无视上面的几个测试数据吧,那是之前的遗留。。。。

在网页上显示效果如下:


这个设计需要各种文件夹区分,就像是android source拉取的时候 repo init -u https://android.googlesource.com /platform/manifest库在platform文件夹下。。。。

在网页上直接创建这种结构pro/pro1直接报错。。。。
昨日百思不得其解

然后晚上拉屎的时候突然顿悟,直接在目录上mkdir然后建库不就行了吗。。。。
然后今天早上试,果然,在磁盘上改了以后重启下service gerrit stop,再start网页上就显示这种多层结构了。。。。

然后网页上虽然显示了,但点击这种多层的库,显示找不到或没权限,
然后又找了小半天,终于找到是apache默认不支持%2F这种方式,,,,在日志里看到路径都是这种。。。。

然后,百度谷歌都说直接在apache的配置文件里加AllowEncodedSlashes On就好了。。。。
但是我试半天不行。。。。
然后,偶然在ProxyPass加了个nocanon参数,突然就能访问了。。。。。
现在的这个配置文件变成了这样:
  1. [root@Android conf.d]# cat gerrit.conf
  2. <Directory / >
  3.     Options FollowSymLinks
  4.     AllowOverride None
  5. </Directory>
  6. SetEnv GIT_PROJECT_ROOT /home/dc/repos/
  7. SetEnv GIT_HTTP_EXPORT_ALL
  8. ScriptAlias /git/ /usr/libexec/git-core/git-http-backend/
  9. ServerName localhost
  10. ProxyRequests Off
  11. ProxyVia Off
  12. ProxyPreserveHost On
  13. AllowEncodedSlashes On
  14. <Proxy *>
  15.     Order deny,allow
  16.     Allow from all
  17. </Proxy>
  18. <Location "/gerrit/login/">
  19.     AuthType Basic
  20.     AuthName "GCR"
  21.     AuthBasicProvider file
  22.     AuthUserFile /etc/gerrit.passwd
  23.     Require valid-user
  24. </Location>
  25. ProxyPass /gerrit http://localhost:8081/gerrit nocanon
  26. [root@Android conf.d]# pwd
  27. /etc/httpd/conf.d
  28. [root@Android conf.d]#
增加了上面那俩标黑的。。。。

回头一看,上面这一段牢骚得有多少然后啊。。。。。算了,还是不检查上面这段了。。。。

目前结构里的三个文件夹:

  1. KERNEL 下面放所有内核的库;
  2. KVT49L 这个是我用的Nexus7的源码版本号,里面放这套的android source,新的android source跟他平级,要是都建文件夹显得多空啊。。。。
  3. RELEASE 这里面放的是编译好生成了可以直接拿来用的东西,里面的俩deb*是之前编译的Nexus7的俩系统版本
因为用的是git-ro的软链,所以应该是有读的权限没有写的权限,估计还得改权限,或者用之前的gitosis之类的配置权限。。。。
所以需要先对测试库进行测试,再上传本地的代码库。。。。

2)测试测试库
拉取代码,修改,上传审核,同步
切换普通用户
拉取代码,修改,上传审核,同步
以release/deb4.4.2r2为例
①不能修改库的描述信息
找了一遭发现当前用户是gerrit,库的组是dc,组内权限770就能写了。。。。
②不能拉取
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/RELEASE/deb4.4.2r2.git
  2. 正克隆到 'deb4.4.2r2'...
  3. 检查连接... 完成。
  4. warning: 远程 HEAD 指向一个不存在的引用,无法检出。
  5. senrsl@senrsl-T540p:~/test/repo/repo_test4$
试了下,从其他地方git init --bare test01.git这种方式建的库链过去不能拉取。。。。
从gerrit网页建的库再挪到外面修改所有者再链回来就能拉取。。。。
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/test_r/test-gerrit.git
  2. 正克隆到 'test-gerrit'...
  3. remote: Counting objects: 8, done
  4. remote: Finding sources: 100% (8/8)
  5. 展开对象中: 100% (8/8), 完成.
  6. remote: Total 8 (delta 0), reused 6 (delta 0)
  7. 检查连接... 完成。
  8. senrsl@senrsl-T540p:~/test/repo/repo_test4$

说明两者结构有不同的地方

也就是说,要把既有库迁移到gerrit上
可以先在gerrit上创建,然后把既有的push上。
或者
这个问题,一开始怀疑配置不同,找了一遭也不是配置不同;
又怀疑所有者或者权限问题,试了半天也不是;
然后把之前的pro3.git ln -s过去,发现pro3正常。。。。
难道不能clone空的版本库???
然后尝试
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone dc@10.1.11.145:/home/dc/repos/test/test02.git
  2. 正克隆到 'test02'...
  3. dc@10.1.11.145's password:
  4. Permission denied, please try again.
  5. dc@10.1.11.145's password:
  6. Permission denied, please try again.
  7. dc@10.1.11.145's password:
  8. 检查连接... 完成。
  9. warning: 远程 HEAD 指向一个不存在的引用,无法检出。
  10. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone git://10.1.11.145/repos/test/test02.git
  11. 正克隆到 'test02'...
  12. 检查连接... 完成。
  13. warning: 远程 HEAD 指向一个不存在的引用,无法检出。
  14. senrsl@senrsl-T540p:~/test/repo/repo_test4$

这肯定是建的库有问题。。。。。。。

服务器上新建一个test_r/test03.git
  1. [dc@Android test]$ git init --bare test03.git
  2. 初始化空的 Git 仓库于 /home/dc/repos/test/test03.git/
  3. [dc@Android test]$


客户端
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone git://10.1.11.145/repos/test/test03.git
  2. 正克隆到 'test03'...
  3. warning: 您似乎克隆了一个空仓库。
  4. 检查连接... 完成。
  5. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone dc@10.1.11.145:/home/dc/repos/test/test03.git
  6. 正克隆到 'test03'...
  7. dc@10.1.11.145's password:
  8. warning: 您似乎克隆了一个空仓库。
  9. 检查连接... 完成。
  10. #此时重启gerrit完成,gerrit已读到test_r/test03.git
  11. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/test_r/test03.git
  12. 正克隆到 'test03'...
  13. 检查连接... 完成。
  14. warning: 远程 HEAD 指向一个不存在的引用,无法检出。
  15. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone git://10.1.11.145/repos/test/test03.git
  16. 正克隆到 'test03'...
  17. warning: 您似乎克隆了一个空仓库。
  18. 检查连接... 完成。
  19. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone dc@10.1.11.145:/home/dc/repos/test/test03.git
  20. 正克隆到 'test03'...
  21. dc@10.1.11.145's password:
  22. warning: 您似乎克隆了一个空仓库。
  23. 检查连接... 完成。
  24. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/test_r/test03.git
  25. 正克隆到 'test03'...
  26. 检查连接... 完成。
  27. warning: 远程 HEAD 指向一个不存在的引用,无法检出。
  28. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone dc@10.1.11.145:/home/dc/repos/test/test03.git
  29. 正克隆到 'test03'...
  30. dc@10.1.11.145's password:
  31. warning: 您似乎克隆了一个空仓库。
  32. 检查连接... 完成。
  33. senrsl@senrsl-T540p:~/test/repo/repo_test4$ cd test03/
  34. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ ll
  35. 总用量 12
  36. drwxrwxr-x 3 senrsl senrsl 4096 12月 25 19:40 ./
  37. drwxrwxr-x 5 senrsl senrsl 4096 12月 25 19:40 ../
  38. drwxrwxr-x 7 senrsl senrsl 4096 12月 25 19:40 .git/
  39. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ touch README
  40. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ echo 'test03'>>README
  41. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ git commit -am 'test'
  42. 位于分支 master
  43. 初始提交
  44. 未跟踪的文件:
  45.     README
  46. 提交为空,但是存在尚未跟踪的文件
  47. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ git add .
  48. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ git commit -m 'test'
  49. [master(根提交) 48b916e] test
  50.  1 file changed, 1 insertion(+)
  51.  create mode 100644 README
  52. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ git push origin master
  53. dc@10.1.11.145's password:
  54. 对象计数中: 3, 完成.
  55. 写入对象中: 100% (3/3), 204 bytes | 0 bytes/s, 完成.
  56. Total 3 (delta 0), reused 0 (delta 0)
  57. To dc@10.1.11.145:/home/dc/repos/test/test03.git
  58.  * [new branch]      master -> master
  59. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ git pull
  60. dc@10.1.11.145's password:
  61. Already up-to-date.
  62. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ git clone http://10.1.11.145/gerrit/test_r/test03.git
  63. 正克隆到 'test03'...
  64. remote: Counting objects: 3, done
  65. remote: Finding sources: 100% (3/3)
  66. 展开对象中: 100% (3/3), 完成.
  67. remote: Total 3 (delta 0), reused 0 (delta 0)
  68. 检查连接... 完成。
  69. senrsl@senrsl-T540p:~/test/repo/repo_test4/test03$ cd ~/test/repo/repo_test4
  70. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/test_r/test03.git
  71. 正克隆到 'test03'...
  72. remote: Counting objects: 3, done
  73. remote: Finding sources: 100% (3/3)
  74. 展开对象中: 100% (3/3), 完成.
  75. remote: Total 3 (delta 0), reused 0 (delta 0)
  76. 检查连接... 完成。
  77. senrsl@senrsl-T540p:~/test/repo/repo_test4$
哎,果然不能是空的呢。。。。
然后测试其他的
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone dc@10.1.11.145:/home/dc/repos/release/deb4.4.2r2.git
  2. 正克隆到 'deb4.4.2r2'...
  3. dc@10.1.11.145's password:
  4. 检查连接... 完成。
  5. warning: 远程 HEAD 指向一个不存在的引用,无法检出。
  6. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone dc@10.1.11.145:/home/dc/repos/release/deb6.0.0r26.git
  7. 正克隆到 'deb6.0.0r26'...
  8. dc@10.1.11.145's password:
  9. Permission denied, please try again.
  10. dc@10.1.11.145's password:
  11. warning: 您似乎克隆了一个空仓库。
  12. 检查连接... 完成。
  13. senrsl@senrsl-T540p:~/test/repo/repo_test4$

然后把deb6.0.0r26的内容拷过来上传
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ cd deb6.0.0r26/
  2. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ ll
  3. 总用量 543016
  4. drwxrwxr-x 3 senrsl senrsl      4096 12月 25 19:51 ./
  5. drwxrwxr-x 7 senrsl senrsl      4096 12月 25 19:50 ../
  6. -rw-rw-r-- 1 senrsl senrsl        26 11月 21 16:33 android-info.txt
  7. -rw-r--r-- 1 senrsl senrsl   7645184 11月 21 17:28 boot.img
  8. -rw-r--r-- 1 senrsl senrsl   4776084 11月 21 17:23 cache.img
  9. -rw-rw-r-- 1 senrsl senrsl     72951 11月 21 17:37 clean_steps.mk
  10. drwxrwxr-x 7 senrsl senrsl      4096 12月 25 19:50 .git/
  11. -rw-rw-r-- 1 senrsl senrsl     76336 11月 21 17:58 installed-files.txt
  12. -rw-rw-r-- 1 senrsl senrsl   6720784 11月 21 16:56 kernel
  13. -rw-rw-r-- 1 senrsl senrsl       808 11月 21 17:37 previous_build_config.mk
  14. -rw-rw-r-- 1 senrsl senrsl    921319 11月 21 17:28 ramdisk.img
  15. -rw-rw-r-- 1 senrsl senrsl   1683595 11月 21 17:40 ramdisk-recovery.img
  16. -rw-rw-r-- 1 senrsl senrsl        67 11月 21 17:40 recovery.id
  17. -rw-r--r-- 1 senrsl senrsl   8409088 11月 21 17:40 recovery.img
  18. -rw-r--r-- 1 senrsl senrsl 385087792 11月 21 17:59 system.img
  19. -rw-r--r-- 1 senrsl senrsl 140606144 11月 21 17:46 userdata.img
  20. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ touch README
  21. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ echo '6.0.0r26'>>README
  22. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git add .
  23. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git commit -m 'init'
  24. [master(根提交) d053be4] init
  25.  14 files changed, 1571 insertions(+)
  26.  create mode 100644 README
  27.  create mode 100644 android-info.txt
  28.  create mode 100644 boot.img
  29.  create mode 100644 cache.img
  30.  create mode 100644 clean_steps.mk
  31.  create mode 100644 installed-files.txt
  32.  create mode 100644 kernel
  33.  create mode 100644 previous_build_config.mk
  34.  create mode 100644 ramdisk-recovery.img
  35.  create mode 100644 ramdisk.img
  36.  create mode 100644 recovery.id
  37.  create mode 100644 recovery.img
  38.  create mode 100644 system.img
  39.  create mode 100644 userdata.img
  40. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git push origin master
  41. dc@10.1.11.145's password:
  42. 对象计数中: 16, 完成.
  43. Delta compression using up to 8 threads.
  44. 压缩对象中: 100% (14/14), 完成.
  45. 写入对象中: 100% (16/16), 210.63 MiB | 3.91 MiB/s, 完成.
  46. Total 16 (delta 5), reused 0 (delta 0)
  47. To dc@10.1.11.145:/home/dc/repos/release/deb6.0.0r26.git
  48.  * [new branch]      master -> master
  49. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git pull
  50. dc@10.1.11.145's password:
  51. Already up-to-date.
  52. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ cd
  53. senrsl@senrsl-T540p:~$ cd test/repo/repo_test4
  54. senrsl@senrsl-T540p:~/test/repo/repo_test4$ ll
  55. 总用量 24
  56. drwxrwxr-x  6 senrsl senrsl 4096 12月 25 19:55 ./
  57. drwxrwxr-x 14 senrsl senrsl 4096 12月 25 16:58 ../
  58. drwxrwxr-x  3 senrsl senrsl 4096 12月 25 19:49 deb4.4.2r2/
  59. drwxrwxr-x  3 senrsl senrsl 4096 12月 25 19:21 pro3/
  60. drwxrwxr-x  3 senrsl senrsl 4096 12月 25 19:42 test03/
  61. drwxrwxr-x  3 senrsl senrsl 4096 12月 25 19:19 test-gerrit/
  62. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git
  63. 正克隆到 'deb6.0.0r26'...
  64. remote: Counting objects: 16, done
  65. remote: Finding sources: 100% (16/16)
  66. remote: Total 16 (delta 0), reused 0 (delta 0)
  67. 展开对象中: 100% (16/16), 完成.
  68. 检查连接... 完成。
  69. senrsl@senrsl-T540p:~/test/repo/repo_test4$ cd deb6.0.0r26/
  70. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ echo '上传'>>README
  71. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git add .
  72. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ $ git commit -m '审核测'[master b3bf6ae] 审核测试
  73.  1 file changed, 1 insertion(+)
  74. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git push origin HEAD:refs/for/master
  75. 对象计数中: 3, 完成.
  76. Delta compression using up to 8 threads.
  77. 压缩对象中: 100% (2/2), 完成.
  78. 写入对象中: 100% (3/3), 293 bytes | 0 bytes/s, 完成.
  79. Total 3 (delta 1), reused 0 (delta 0)
  80. remote: Resolving deltas: 100% (1/1)
  81. remote: Processing changes: refs: 1, done   
  82. remote: ERROR: missing Change-Id in commit message footer
  83. remote:
  84. remote: Hint: To automatically insert Change-Id, install the hook:
  85. remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  86. remote: And then amend the commit:
  87. remote:   git commit --amend
  88. remote:
  89. To http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git
  90.  ! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit message footer)
  91. error: 无法推送一些引用到 'http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git'
  92. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  93. commit-msg                                    100% 4663     4.6KB/s   00:00   
  94. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git push origin HEAD:refs/for/master
  95. 对象计数中: 3, 完成.
  96. Delta compression using up to 8 threads.
  97. 压缩对象中: 100% (2/2), 完成.
  98. 写入对象中: 100% (3/3), 293 bytes | 0 bytes/s, 完成.
  99. Total 3 (delta 1), reused 0 (delta 0)
  100. remote: Resolving deltas: 100% (1/1)
  101. remote: Processing changes: refs: 1, done   
  102. remote: ERROR: missing Change-Id in commit message footer
  103. remote:
  104. remote: Hint: To automatically insert Change-Id, install the hook:
  105. remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  106. remote: And then amend the commit:
  107. remote:   git commit --amend
  108. remote:
  109. To http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git
  110.  ! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit message footer)
  111. error: 无法推送一些引用到 'http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git'
  112. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git log
  113. commit b3bf6ae426bae8a39e64c9e72714e60c6d92295f
  114. Author: senRsl <senRsl@163.com>
  115. Date:   Fri Dec 25 19:58:18 2015 +0800
  116.     审核测试
  117. commit d053be4d8f265d4a577395fb83e811fd30b7b2d5
  118. Author: senRsl <senRsl@163.com>
  119. Date:   Fri Dec 25 19:52:46 2015 +0800
  120.     init
  121. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git commit --amend
  122. [master 25ae950] this is  审核测试
  123.  Date: Fri Dec 25 19:58:18 2015 +0800
  124.  1 file changed, 1 insertion(+)
  125. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git push origin HEAD:refs/for/master
  126. 对象计数中: 3, 完成.
  127. Delta compression using up to 8 threads.
  128. 压缩对象中: 100% (2/2), 完成.
  129. 写入对象中: 100% (3/3), 340 bytes | 0 bytes/s, 完成.
  130. Total 3 (delta 1), reused 0 (delta 0)
  131. remote: Resolving deltas: 100% (1/1)
  132. remote: Processing changes: new: 1, refs: 1, done   
  133. remote:
  134. remote: New Changes:
  135. remote:   http://10.1.11.145/gerrit/6 this is  审核测试
  136. remote:
  137. To http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git
  138.  * [new branch]      HEAD -> refs/for/master
  139. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git pull
  140. 来自 http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26
  141.    d053be4..25ae950  master     -> origin/master
  142. Already up-to-date.
  143. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$
原路提交回去,然后用gerrit拉取,然后修改,拉取都可以

然后在网页修改这个项目的描述,本地再拉取修改
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git
  2. 正克隆到 'deb6.0.0r26'...
  3. remote: Counting objects: 19, done
  4. remote: Finding sources: 100% (19/19)
  5. remote: Total 19 (delta 1), reused 4 (delta 1)
  6. 展开对象中: 100% (19/19), 完成.
  7. 检查连接... 完成。
  8. senrsl@senrsl-T540p:~/test/repo/repo_test4$ cd deb6.0.0r26/
  9. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ ll
  10. 总用量 403412
  11. drwxrwxr-x 3 senrsl senrsl      4096 12月 25 20:06 ./
  12. drwxrwxr-x 7 senrsl senrsl      4096 12月 25 20:05 ../
  13. -rw-rw-r-- 1 senrsl senrsl        26 12月 25 20:06 android-info.txt
  14. -rw-rw-r-- 1 senrsl senrsl   7645184 12月 25 20:06 boot.img
  15. -rw-rw-r-- 1 senrsl senrsl   4776084 12月 25 20:06 cache.img
  16. -rw-rw-r-- 1 senrsl senrsl     72951 12月 25 20:06 clean_steps.mk
  17. drwxrwxr-x 8 senrsl senrsl      4096 12月 25 20:06 .git/
  18. -rw-rw-r-- 1 senrsl senrsl     76336 12月 25 20:06 installed-files.txt
  19. -rw-rw-r-- 1 senrsl senrsl   6720784 12月 25 20:06 kernel
  20. -rw-rw-r-- 1 senrsl senrsl       808 12月 25 20:06 previous_build_config.mk
  21. -rw-rw-r-- 1 senrsl senrsl    921319 12月 25 20:06 ramdisk.img
  22. -rw-rw-r-- 1 senrsl senrsl   1683595 12月 25 20:06 ramdisk-recovery.img
  23. -rw-rw-r-- 1 senrsl senrsl        16 12月 25 20:06 README
  24. -rw-rw-r-- 1 senrsl senrsl        67 12月 25 20:06 recovery.id
  25. -rw-rw-r-- 1 senrsl senrsl   8409088 12月 25 20:06 recovery.img
  26. -rw-rw-r-- 1 senrsl senrsl 385087792 12月 25 20:06 system.img
  27. -rw-rw-r-- 1 senrsl senrsl 140606144 12月 25 20:06 userdata.img
  28. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ echo 'modify desc'>>README
  29. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git add .
  30. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git commit -m 'modify'
  31. [master e280a5e] modify
  32.  1 file changed, 1 insertion(+)
  33. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git push origin HEAD:refs/for/master
  34. 对象计数中: 3, 完成.
  35. Delta compression using up to 8 threads.
  36. 压缩对象中: 100% (2/2), 完成.
  37. 写入对象中: 100% (3/3), 289 bytes | 0 bytes/s, 完成.
  38. Total 3 (delta 1), reused 0 (delta 0)
  39. remote: Resolving deltas: 100% (1/1)
  40. remote: Processing changes: refs: 1, done   
  41. remote: ERROR: missing Change-Id in commit message footer
  42. remote:
  43. remote: Hint: To automatically insert Change-Id, install the hook:
  44. remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  45. remote: And then amend the commit:
  46. remote:   git commit --amend
  47. remote:
  48. To http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git
  49.  ! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit message footer)
  50. error: 无法推送一些引用到 'http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git'
  51. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  52. commit-msg                                    100% 4663     4.6KB/s   00:00   
  53. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git commit --amend
  54. [master 4f25984] this is is modify
  55.  Date: Fri Dec 25 20:07:07 2015 +0800
  56.  1 file changed, 1 insertion(+)
  57. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git push origin HEAD:refs/for/master
  58. 对象计数中: 3, 完成.
  59. Delta compression using up to 8 threads.
  60. 压缩对象中: 100% (2/2), 完成.
  61. 写入对象中: 100% (3/3), 335 bytes | 0 bytes/s, 完成.
  62. Total 3 (delta 1), reused 0 (delta 0)
  63. remote: Resolving deltas: 100% (1/1)
  64. remote: Processing changes: new: 1, refs: 1, done   
  65. remote:
  66. remote: New Changes:
  67. remote:   http://10.1.11.145/gerrit/7 this is is modify
  68. remote:
  69. To http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26.git
  70.  * [new branch]      HEAD -> refs/for/master
  71. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$ git pull
  72. 来自 http://10.1.11.145/gerrit/RELEASE/deb6.0.0r26
  73.    25ae950..4f25984  master     -> origin/master
  74. Already up-to-date.
  75. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb6.0.0r26$
基本可以说明只要项目不是空的再修改描述就没问题了。。。。

果然上过第一次之后再随便折腾都很容易上了吗。。。。

看一下体积
客户端上的:
  1. senrsl@senrsl-T540p:~$ cd android/source/out/
  2. senrsl@senrsl-T540p:~/android/source/out$ du -h --max-depth=1 deb6.0.0r26
  3. 531M    deb6.0.0r26
  4. senrsl@senrsl-T540p:~/android/source/out$ cd ~/test/repo/repo_test4/
  5. senrsl@senrsl-T540p:~/test/repo/repo_test4$ du -h --max-depth=1 deb6.0.0r26
  6. 236M    deb6.0.0r26/.git
  7. 629M    deb6.0.0r26
  8. senrsl@senrsl-T540p:~/test/repo/repo_test4$
服务器上的:
  1. [dc@Android repos]$ du -h --max-depth=1 release/deb6.0.0r26.git
  2. 16K    release/deb6.0.0r26.git/logs
  3. 52K    release/deb6.0.0r26.git/refs
  4. 4.0K    release/deb6.0.0r26.git/branches
  5. 44K    release/deb6.0.0r26.git/hooks
  6. 8.0K    release/deb6.0.0r26.git/info
  7. 235M    release/deb6.0.0r26.git/objects
  8. 236M    release/deb6.0.0r26.git
  9. [dc@Android repos]$ du -h --max-depth=1 release
  10. 128K    release/deb4.4.2r2.git
  11. 236M    release/deb6.0.0r26.git
  12. 236M    release
  13. [dc@Android repos]$
哎,新申请的1T服务器又可以使劲作了~~~

3)本地代码上传

①方式:继承于上
上传另一个release,deb442版本
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone dc@10.1.11.145:/home/dc/repos/release/deb4.4.2r2.git
  2. 正克隆到 'deb4.4.2r2'...
  3. dc@10.1.11.145's password:
  4. warning: 您似乎克隆了一个空仓库。
  5. 检查连接... 完成。
  6. senrsl@senrsl-T540p:~/test/repo/repo_test4$ cd deb4.4.2r2/
  7. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ touch README
  8. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ echo 'deb442r2'>>README
  9. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ git add .
  10. gisenrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ git commit -m 'init'
  11. [master(根提交) beaa4b5] init
  12.  13 files changed, 1344 insertions(+)
  13.  create mode 100644 README
  14.  create mode 100644 android-info.txt
  15.  create mode 100644 boot.img
  16.  create mode 100644 cache.img
  17.  create mode 100644 clean_steps.mk
  18.  create mode 100644 installed-files.txt
  19.  create mode 100644 kernel
  20.  create mode 100644 previous_build_config.mk
  21.  create mode 100644 ramdisk-recovery.img
  22.  create mode 100644 ramdisk.img
  23.  create mode 100644 recovery.img
  24.  create mode 100644 system.img
  25.  create mode 100644 userdata.img
  26. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ git push origin master
  27. dc@10.1.11.145's password:
  28. 对象计数中: 15, 完成.
  29. Delta compression using up to 8 threads.
  30. 压缩对象中: 100% (13/13), 完成.
  31. 写入对象中: 100% (15/15), 172.39 MiB | 11.22 MiB/s, 完成.
  32. Total 15 (delta 5), reused 0 (delta 0)
  33. To dc@10.1.11.145:/home/dc/repos/release/deb4.4.2r2.git
  34.  * [new branch]      master -> master
  35. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ cd ..
  36. senrsl@senrsl-T540p:~/test/repo/repo_test4$ rm -rf deb4.4.2r2
  37. #此时,服务器上gerrit可以修改deb442的desc
  38. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/RELEASE/deb4.4.2r2.git
  39. 正克隆到 'deb4.4.2r2'...
  40. remote: Counting objects: 15, done
  41. remote: Finding sources: 100% (15/15)
  42. remote: Total 15 (delta 0), reused 0 (delta 0)
  43. 展开对象中: 100% (15/15), 完成.
  44. 检查连接... 完成。
  45. senrsl@senrsl-T540p:~/test/repo/repo_test4$ cd deb4.4.2r2/
  46. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ echo 'hook'>>README
  47. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ git add .
  48. gsenrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ git commit -m 'hook'
  49. [master e865758] hook
  50.  1 file changed, 1 insertion(+)
  51. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  52. commit-msg                                    100% 4663     4.6KB/s   00:00   
  53. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$  git commit --amend
  54. [master 07ed2a1] is hook
  55.  Date: Fri Dec 25 20:38:32 2015 +0800
  56.  1 file changed, 1 insertion(+)
  57. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ git push origin HEAD:refs/for/master
  58. 对象计数中: 3, 完成.
  59. Delta compression using up to 8 threads.
  60. 压缩对象中: 100% (2/2), 完成.
  61. 写入对象中: 100% (3/3), 313 bytes | 0 bytes/s, 完成.
  62. Total 3 (delta 1), reused 0 (delta 0)
  63. remote: Resolving deltas: 100% (1/1)
  64. remote: Processing changes: new: 1, refs: 1, done   
  65. remote:
  66. remote: New Changes:
  67. remote:   http://10.1.11.145/gerrit/8 is hook
  68. remote:
  69. To http://10.1.11.145/gerrit/RELEASE/deb4.4.2r2.git
  70.  * [new branch]      HEAD -> refs/for/master
  71. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$ git pull
  72. 来自 http://10.1.11.145/gerrit/RELEASE/deb4.4.2r2
  73.    beaa4b5..07ed2a1  master     -> origin/master
  74. Already up-to-date.
  75. senrsl@senrsl-T540p:~/test/repo/repo_test4/deb4.4.2r2$
这么搞太麻烦了,那么一堆库。。。。

应该尝试服务器初始化,本地直接上传过去,然后gerrit拉取验证。。。。也很麻烦。。。。
应该写个脚本自己搞。。。。
这个也很麻烦。。。。

②方式:本地已存库
对于单纯的git仓库,这种方式好
  1. senrsl@senrsl-T540p:~/android/source/kernel/goldfish$ git branch
  2.   android-3.10
  3.   android-3.4
  4.   android-goldfish-2.6.29
  5. * android-goldfish-3.4
  6.   master
  7. senrsl@senrsl-T540p:~/android/source/kernel/goldfish$ cd ..
  8. senrsl@senrsl-T540p:~/android/source/kernel$ git clone --bare goldfish goldfish.git
  9. 克隆到纯仓库 'goldfish.git'...
  10. 完成。
  11. senrsl@senrsl-T540p:~/android/source/kernel$ cd goldfish.git/
  12. senrsl@senrsl-T540p:~/android/source/kernel/goldfish.git$ git branch
  13.   android-3.10
  14.   android-3.4
  15.   android-goldfish-2.6.29
  16. * android-goldfish-3.4
  17.   master
  18. senrsl@senrsl-T540p:~/android/source/kernel/goldfish.git$ cd ..
  19. senrsl@senrsl-T540p:~/android/source/kernel$
分支都克隆下来了。。。。

然后把他移动到服务器上去
用scp

centos上默认没装,安装
  1. [root@Android kernel]# yum install scp
  2. 已加载插件:fastestmirror
  3. 设置安装进程
  4. Determining fastest mirrors
  5.  * base: mirrors.aliyun.com
  6.  * extras: mirrors.yun-idc.com
  7.  * updates: mirrors.yun-idc.com
  8. base                                                 | 3.7 kB     00:00    
  9. extras                                               | 2.9 kB     00:00    
  10. updates                                              | 3.4 kB     00:00    
  11. No package scp available.
  12. 错误:无须任何处理
  13. [root@Android kernel]# yum install openssh-clients
  14. 已加载插件:fastestmirror
  15. 设置安装进程
  16. Loading mirror speeds from cached hostfile
  17.  * base: mirrors.aliyun.com
  18.  * extras: mirrors.yun-idc.com
  19.  * updates: mirrors.yun-idc.com
  20. 解决依赖关系
  21. --> 执行事务检查
  22. ---> Package openssh-clients.x86_64 0:5.3p1-112.el6_7 will be 安装
  23. --> 处理依赖关系 libedit.so.0()(64bit),它被软件包 openssh-clients-5.3p1-112.el6_7.x86_64 需要
  24. --> 执行事务检查
  25. ---> Package libedit.x86_64 0:2.11-4.20080712cvs.1.el6 will be 安装
  26. --> 完成依赖关系计算
  27. 依赖关系解决
  28. ============================================================================
  29.  软件包             架构      版本                         仓库        大小
  30. ============================================================================
  31. 正在安装:
  32.  openssh-clients    x86_64    5.3p1-112.el6_7              updates    438 k
  33. 为依赖而安装:
  34.  libedit            x86_64    2.11-4.20080712cvs.1.el6     base        74 k
  35. 事务概要
  36. ============================================================================
  37. Install       2 Package(s)
  38. 总下载量:513 k
  39. Installed size: 1.4 M
  40. 确定吗?[y/N]:y
  41. 下载软件包:
  42. (1/2): libedit-2.11-4.20080712cvs.1.el6.x86_64.rpm   |  74 kB     00:00    
  43. (2/2): openssh-clients-5.3p1-112.el6_7.x86_64.rpm    | 438 kB     00:00    
  44. ----------------------------------------------------------------------------
  45. 总计                                        2.3 MB/s | 513 kB     00:00    
  46. 运行 rpm_check_debug
  47. 执行事务测试
  48. 事务测试成功
  49. 执行事务
  50.   正在安装   : libedit-2.11-4.20080712cvs.1.el6.x86_64                  1/2
  51.   正在安装   : openssh-clients-5.3p1-112.el6_7.x86_64                   2/2
  52.   Verifying  : openssh-clients-5.3p1-112.el6_7.x86_64                   1/2
  53.   Verifying  : libedit-2.11-4.20080712cvs.1.el6.x86_64                  2/2
  54. 已安装:
  55.   openssh-clients.x86_64 0:5.3p1-112.el6_7                                 
  56. 作为依赖被安装:
  57.   libedit.x86_64 0:2.11-4.20080712cvs.1.el6                                
  58. 完毕!
  59. [root@Android kernel]# scp
  60. usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
  61.            [-l limit] [-o ssh_option] [-P port] [-S program]
  62.            [[user@]host1:]file1 ... [[user@]host2:]file2
  63. [root@Android kernel]#
然后本地复制过去
  1. senrsl@senrsl-T540p:~/android/source/kernel$ scp
  2. usage: scp [-12346BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
  3.            [-l limit] [-o ssh_option] [-P port] [-S program]
  4.            [[user@]host1:]file1 ... [[user@]host2:]file2
  5. senrsl@senrsl-T540p:~/android/source/kernel$ scp -r goldfish.git dc@10.1.11.145:/home/dc/repos/kernel/
  6. dc@10.1.11.145's password:
  7. bash: scp: command not found
  8. lost connection
  9. senrsl@senrsl-T540p:~/android/source/kernel$ scp -r goldfish.git dc@10.1.11.145:/home/dc/repos/kernel/
  10. dc@10.1.11.145's password:
  11. exclude                                       100%  240     0.2KB/s   00:00   
  12. HEAD                                          100%   37     0.0KB/s   00:00   
  13. packed-refs                                   100%  376     0.4KB/s   00:00   
  14. config                                        100%  135     0.1KB/s   00:00   
  15. pre-push.sample                               100% 1348     1.3KB/s   00:00   
  16. pre-commit.sample                             100% 1642     1.6KB/s   00:00   
  17. post-update.sample                            100%  189     0.2KB/s   00:00   
  18. applypatch-msg.sample                         100%  478     0.5KB/s   00:00   
  19. pre-rebase.sample                             100% 4951     4.8KB/s   00:00   
  20. update.sample                                 100% 3611     3.5KB/s   00:00   
  21. pre-applypatch.sample                         100%  424     0.4KB/s   00:00   
  22. prepare-commit-msg.sample                     100% 1239     1.2KB/s   00:00   
  23. commit-msg.sample                             100%  896     0.9KB/s   00:00   
  24. pack-31c915b9a9f50a1073ea797a7912d63d8c3d8937 100%  622MB  11.1MB/s   00:56   
  25. pack-31c915b9a9f50a1073ea797a7912d63d8c3d8937 100%   83MB  11.8MB/s   00:07   
  26. description                                   100%   73     0.1KB/s   00:00   
  27. senrsl@senrsl-T540p:~/android/source/kernel$
然后在网页上加上desc,然后测试拉取代码
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4$ git clone http://10.1.11.145/gerrit/KERNEL/goldfish.git
  2. 正克隆到 'goldfish'...
  3. remote: Counting objects: 3089386, done
  4. remote: Finding sources: 100% (3089386/3089386)
  5. remote: Total 3089386 (delta 2595426), reused 3089367 (delta 2595426)
  6. 接收对象中: 100% (3089386/3089386), 619.49 MiB | 11.22 MiB/s, 完成.
  7. 处理 delta 中: 100% (2595426/2595426), 完成.
  8. 检查连接... 完成。
  9. 正在检出文件: 100% (38890/38890), 完成.
  10. senrsl@senrsl-T540p:~/test/repo/repo_test4$ cd goldfish/
  11. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git branch
  12. * android-goldfish-3.4
  13. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git branchs
  14. git:'branchs' 不是一个 git 命令。参见 'git --help'。
  15. 您指的是这个么?
  16.     branch
  17. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git branch -r
  18.   origin/HEAD -> origin/android-goldfish-3.4
  19.   origin/android-3.10
  20.   origin/android-3.4
  21.   origin/android-goldfish-2.6.29
  22.   origin/android-goldfish-3.4
  23.   origin/master
  24. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$
然后测试修改代码
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ vi README
  2. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git add .
  3. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git commit -m 'edit README'
  4. [android-goldfish-3.4 56b6a6b] edit README
  5.  1 file changed, 7 insertions(+)
  6. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git push origin master
  7. error: src refspec master does not match any.
  8. error: 无法推送一些引用到 'http://10.1.11.145/gerrit/KERNEL/goldfish.git'
  9. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git branch
  10. * android-goldfish-3.4
  11. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git push origin android-goldfish-3.4
  12. 对象计数中: 3, 完成.
  13. Delta compression using up to 8 threads.
  14. 压缩对象中: 100% (3/3), 完成.
  15. 写入对象中: 100% (3/3), 325 bytes | 0 bytes/s, 完成.
  16. Total 3 (delta 2), reused 0 (delta 0)
  17. remote: Resolving deltas: 100% (2/2)
  18. remote: Processing changes: refs: 1, done   
  19. To http://10.1.11.145/gerrit/KERNEL/goldfish.git
  20.    ea97df6..56b6a6b  android-goldfish-3.4 -> android-goldfish-3.4
  21. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$
跑网页gitweb里看上传结果。

然后测试审核推送
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ vi README
  2. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git add .
  3. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git commit -m 'gcr test'
  4. [android-goldfish-3.4 ad59a73] gcr test
  5.  1 file changed, 1 insertion(+)
  6. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git push origin HEAD:refs/for/master
  7. 对象计数中: 3, 完成.
  8. Delta compression using up to 8 threads.
  9. 压缩对象中: 100% (3/3), 完成.
  10. 写入对象中: 100% (3/3), 318 bytes | 0 bytes/s, 完成.
  11. Total 3 (delta 2), reused 0 (delta 0)
  12. remote: Resolving deltas: 100% (2/2)
  13. remote: Processing changes: refs: 1, done   
  14. To http://10.1.11.145/gerrit/KERNEL/goldfish.git
  15.  ! [remote rejected] HEAD -> refs/for/master (no common ancestry)
  16. error: 无法推送一些引用到 'http://10.1.11.145/gerrit/KERNEL/goldfish.git'
  17. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  18. commit-msg                                    100% 4663     4.6KB/s   00:00   
  19. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git push origin HEAD:refs/for/android-goldfish-3.4
  20. 对象计数中: 3, 完成.
  21. Delta compression using up to 8 threads.
  22. 压缩对象中: 100% (3/3), 完成.
  23. 写入对象中: 100% (3/3), 318 bytes | 0 bytes/s, 完成.
  24. Total 3 (delta 2), reused 0 (delta 0)
  25. remote: Resolving deltas: 100% (2/2)
  26. remote: Processing changes: refs: 1, done   
  27. remote: ERROR: missing Change-Id in commit message footer
  28. remote:
  29. remote: Hint: To automatically insert Change-Id, install the hook:
  30. remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 zym@10.1.11.145:hooks/commit-msg ${gitdir}/hooks/
  31. remote: And then amend the commit:
  32. remote:   git commit --amend
  33. remote:
  34. To http://10.1.11.145/gerrit/KERNEL/goldfish.git
  35.  ! [remote rejected] HEAD -> refs/for/android-goldfish-3.4 (missing Change-Id in commit message footer)
  36. error: 无法推送一些引用到 'http://10.1.11.145/gerrit/KERNEL/goldfish.git'
  37. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ ^C
  38. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git commit --amend
  39. [android-goldfish-3.4 5ffe58e] this is is is is amend
  40.  Date: Mon Dec 28 14:45:56 2015 +0800
  41.  1 file changed, 1 insertion(+)
  42. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git push origin HEAD:refs/for/android-goldfish-3.4
  43. 对象计数中: 3, 完成.
  44. Delta compression using up to 8 threads.
  45. 压缩对象中: 100% (3/3), 完成.
  46. 写入对象中: 100% (3/3), 373 bytes | 0 bytes/s, 完成.
  47. Total 3 (delta 2), reused 0 (delta 0)
  48. remote: Resolving deltas: 100% (2/2)
  49. remote: Processing changes: new: 1, refs: 1, done   
  50. remote:
  51. remote: New Changes:
  52. remote:   http://10.1.11.145/gerrit/9 this is is is is amend
  53. remote:
  54. To http://10.1.11.145/gerrit/KERNEL/goldfish.git
  55.  * [new branch]      HEAD -> refs/for/android-goldfish-3.4
  56. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git log -2
  57. commit 5ffe58e2d45a57476c90d121e2e88297d7413f20
  58. Author: senRsl <senRsl@163.com>
  59. Date:   Mon Dec 28 14:45:56 2015 +0800
  60.     this is is is is amend
  61.    
  62.     gcr test
  63.    
  64.     Change-Id: I793a64bab5019180658c7a028f91030d0a764e5a
  65. commit 56b6a6b23ef242d57f4fdb12e258b5814c7ea47e
  66. Author: senRsl <senRsl@163.com>
  67. Date:   Mon Dec 28 14:43:11 2015 +0800
  68.     edit README
  69. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$

网页审核,审核提交后本地再拉取代码
  1. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$ git pull
  2. 来自 http://10.1.11.145/gerrit/KERNEL/goldfish
  3.    56b6a6b..5ffe58e  android-goldfish-3.4 -> origin/android-goldfish-3.4
  4. Already up-to-date.
  5. senrsl@senrsl-T540p:~/test/repo/repo_test4/goldfish$
这种方式可行!!!

③方式:本地文件夹建库
服务器创建空白库
  1. [dc@Android abi]$ git init --bare cpp.git
  2. 初始化空的 Git 仓库于 /home/dc/repos/mx6/source/abi/cpp.git/
客户端初始化,然后指向上传
  1. senrsl@senrsl-T540p:~/android/source/MX6$ cd android_kk4.4.2_1.0.0/abi/cpp/
  2. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/abi/cpp$ git init
  3. 初始化空的 Git 仓库于 /home/senrsl/android/source/MX6/android_kk4.4.2_1.0.0/abi/cpp/.git/
  4. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/abi/cpp$ git remote add origin dc@10.1.11.145:/home/dc/repos/mx6/source/abi/cpp.git
  5. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/abi/cpp$ git add .
  6. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/abi/cpp$ git commit -m 'init'
  7. [master(根提交) 0ec1f81] init
  8.  19 files changed, 1259 insertions(+)
  9.  create mode 100644 Android.mk
  10.  create mode 100644 include/cxxabi.h
  11.  create mode 100644 include/new
  12.  create mode 100644 include/typeinfo
  13.  create mode 100644 src/array_type_info.cc
  14.  create mode 100644 src/class_type_info.cc
  15.  create mode 100644 src/delete.cc
  16.  create mode 100644 src/dynamic_cast.cc
  17.  create mode 100644 src/enum_type_info.cc
  18.  create mode 100644 src/function_type_info.cc
  19.  create mode 100644 src/fundamental_type_info.cc
  20.  create mode 100644 src/new.cc
  21.  create mode 100644 src/pbase_type_info.cc
  22.  create mode 100644 src/pointer_to_member_type_info.cc
  23.  create mode 100644 src/pointer_type_info.cc
  24.  create mode 100644 src/si_class_type_info.cc
  25.  create mode 100644 src/type_info.cc
  26.  create mode 100644 src/vmi_class_type_info.cc
  27.  create mode 100644 use_rtti.mk
  28. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/abi/cpp$ git push -u origin master
  29. dc@10.1.11.145's password:
  30. 对象计数中: 23, 完成.
  31. Delta compression using up to 8 threads.
  32. 压缩对象中: 100% (23/23), 完成.
  33. 写入对象中: 100% (23/23), 9.45 KiB | 0 bytes/s, 完成.
  34. Total 23 (delta 14), reused 0 (delta 0)
  35. To dc@10.1.11.145:/home/dc/repos/mx6/source/abi/cpp.git
  36.  * [new branch]      master -> master
  37. 分支 master 设置为跟踪来自 origin 的远程分支 master。
  38. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/abi/cpp$

这种方式也可以

④方式:三的升级
写个脚本好了
  1. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/bionic$ cat push.sh
  2. #!/bin/bash
  3. git init
  4. #每次拷过去先改这个的路径
  5. git remote add origin dc@10.1.11.145:/home/dc/repos/mx6/source/bionic.git
  6. git add .
  7. git commit -m 'init'
  8. git push -u origin master
  9. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0/bionic$
服务器上也写个脚本好了
  1. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0$ cat bare.sh
  2. #!/bin/bash
  3. git init --bare bootable.git
  4. git init --bare build.git
  5. git init --bare cts.git
  6. git init --bare dalvik.git
  7. git init --bare developers.git
  8. git init --bare development.git
  9. git init --bare device.git
  10. git init --bare docs.git
  11. git init --bare external.git
  12. git init --bare frameworks.git
  13. git init --bare hardware.git
  14. git init --bare kernel_imx.git
  15. git init --bare libcore.git
  16. git init --bare libnativehelper.git
  17. git init --bare ndk.git
  18. git init --bare packages.git
  19. git init --bare pdk.git
  20. git init --bare prebuilts.git
  21. git init --bare sdk.git
  22. git init --bare system.git
  23. git init --bare tools.git
  24. senrsl@senrsl-T540p:~/android/source/MX6/android_kk4.4.2_1.0.0$
然后扔服务器上去,自动初始化这一堆库
本地上边拷push.sh边改。
哎,要是能写个自动轮询目录然后自动获取文件夹名就好了,那样直接一执行就OK了。。。。

4)加入repo脚本
之前上传了厂商给的源码。。。。。

然后组织成repo来下来提交。。。。
库结构
  1. [dc@Android source]$ tree -L 1
  2. .
  3. ├── abi
  4. │   └── cpp.git
  5. ├── art.git
  6. ├── bare.sh
  7. ├── bionic.git
  8. ├── bootable.git
  9. ├── build.git
  10. ├── cts.git
  11. ├── dalvik.git
  12. ├── developers.git
  13. ├── development.git
  14. ├── device.git
  15. ├── docs.git
  16. ├── external.git
  17. ├── frameworks.git
  18. ├── hardware.git
  19. ├── kernel_imx.git
  20. ├── libcore.git
  21. ├── libnativehelper.git
  22. ├── ndk.git
  23. ├── packages.git
  24. ├── pdk.git
  25. ├── prebuilts.git
  26. ├── sdk.git
  27. ├── system.git
  28. └── tools.git
  29. 24 directories, 1 file
  30. [dc@Android source]$
建manifest库,写xml....





6,android源码服务器

之前下载到本地的那200G看来是下错了,貌似是需要加一个镜像的参数才行。。。。

服务器1:定时从官方同步代码;
服务器2:部署同步下来的代码,对公司内部使用;

1)从官方拉取镜像
本想找运维再开个虚拟机,一说要300G立马就不好了。。。。
好吧,那就从本机建个虚拟机搞吧。。。。

哎,没那么大空间。。。。算了,还是从本机开搞吧。。。。

  1. senrsl@senrsl-T540p:~/android/source$ mkdir MIRROR
  2. senrsl@senrsl-T540p:~/android/source$ cd MIRROR/
  3. senrsl@senrsl-T540p:~/android/source/MIRROR$ repo init -u https://android.googlesource.com/platform/manifest.git --mirror
  4. 。。。。
  5. repo mirror has been initialized in /home/senrsl/android/source/MIRROR
  6. senrsl@senrsl-T540p:~/android/source/MIRROR$ repo sync -j16
原来官网上就有教程。。。。


好吧,那就按官网上的地址来。。。。
把地址改成mirror。。。。
  1. senrsl@senrsl-T540p:~/android/source/MIRROR$ repo init -u https://android.googlesource.com/mirror/manifest --mirror
  2. senrsl@senrsl-T540p:~/android/source/MIRROR$ ./sync_16.sh
  3. 。。。。
  4. Fetching projects: 100% (955/955), done.
  5. senrsl@senrsl-T540p:~/android/source/MIRROR$
那么快就好了,而且90%的下载都没挂vpn....
  1. senrsl@senrsl-T540p:~/android/source/MIRROR$ du -h --max-depth=1
  2. 536K    ./mirror
  3. 5.7M    ./.repo
  4. 41G    ./platform
  5. 27G    ./device
  6. 524K    ./brillo
  7. 9.3G    ./kernel
  8. 436K    ./product
  9. 1.2G    ./toolchain
  10. 69M    ./trusty
  11. 132K    ./accessories
  12. 3.9M    ./git-repo.git
  13. 3.8M    ./tools
  14. 78G    .
  15. senrsl@senrsl-T540p:~/android/source/MIRROR$
库的体积果然要小很多呢。。。。
然后拷到服务器上
  1. senrsl@senrsl-T540p:~/android/source$ scp -r MIRROR/* dc@10.1.11.145:/home/dc/repos/asop/
传完以后拉取提交测试。。。。

这个应该先在本地测试再上传,不过昨个赶着下班还是先上传吧。。。。

一开始扔服务器上,然后init -b的方式下载失败。。。。

还是得本地测试。。。。

  1. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo-internal init -u /home/senrsl/android/source/MIRROR/platform/manifest.git
  2. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo sync -j16
  3. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ cd .repo/manifests
  4. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY/.repo/manifests$ git branch -a | cut -d / -f 3
  5. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ cd ..
  6. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo init -b android-4.4.2_r2
  7. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo sync -j16
  8. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ cd .repo/manifests
  9. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY/.repo/manifests$ git branch -a | cut -d / -f 3
这样成功检出master跟4.4.2r2分支
  1. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo-internal init -u /home/senrsl/android/source/MIRROR/platform/manifest.git -b android-4.4.2_r2
  2. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo sync -j16
  3. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ cd .repo/manifests
  4. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY/.repo/manifests$ git branch -a | cut -d / -f 3
这么同步也正常。。。。
为什么扔到服务器上就不行了。。。。

  1. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo-local init -u /home/senrsl/android/source/MIRROR/platform/manifest
  2. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo-internal init -u http://10.1.11.145/gerrit/AOSP/platform/manifest
本地版测试一切正常,扔到内网服务器一堆404.。。。
  1. Get http://10.1.11.145/gerrit/AOSP/platform/manifest
  2.   % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
  3.                                  Dload  Upload   Total   Spent    Left  Speed
  4.    0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  5. curl: (22) The requested URL returned error: 404 Not Found
  6. Server does not provide clone.bundle; ignoring.
搜了一下说是下载源码的时候出现这个问题要去谷歌官方做认证。。。。

我这内网的服务器去哪认证。。。。
然后继续搜,突然发现清华有专门的教程!!!
  还有专门一个地址教怎么建。。。mirrors.tuna.tsinghua.edu.cn/help/#AOSP
靠,怎么没早看见。。。。
他上面说 无视即可。。。。
可是无视一直同步失败啊。。。。

然后顺着找到了lug.ustc.edu.cn/wiki/mirrors/help/aosp这个大学的。。。。

哎,好想静静。。。。

可以考虑使用https....毕竟官方用的就是
我屮,这不科学啊。。。。
  1. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo-internal init -u http://10.1.11.145/gerrit/AOSP/platform/manifest
  2. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$ repo sync
  3. 。。。。
  4. 正在检出文件: 100% (1186/1186), 完成.
  5. 正在检出文件: 100% (4269/4269), 完成.在检出文件:  19% (837/4269)  
  6. 正在检出文件: 100% (19/19), 完成.  正在检出文件:  26% (5/19)  
  7. Syncing work tree: 100% (503/503), done. 
  8. senrsl@senrsl-T540p:~/android/source/WORKING_DIRECTORY$
竟然同步成功了。。。。是因为没有加-j16吗。。。。
还是说因为刚才重启了一下服务器。。。。

好吧,能用了。。。。
2015年12月31日17:34:48

--
senRsl
2014年11月17日16:25:44

没有评论 :

发表评论