创建AOSP次级镜像服务器及其使用
1、创建AOSP镜像服务器
由于AOSP镜像比较大、Git服务占用资源较多,对于团队开发,建议建立AOSP次级镜像,供团队内使用。
初始化并同步源码树:
$ repo init -u https://aosp.tuna.tsinghua.edu.cn/mirror/manifest --mirror
$ repo sync
由于网络不稳定等原因,可能造成同步失败:
$ repo sync
...
Fetching project platform/external/cldr
remote: Counting Objects: 8606, done MiB | 337.00 KiB/s
error: RPC failed; curl 56 GnuTLS recv error (-110): The TLS connection was non-properly terminated.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
我们可以使用以下脚本进行重试:
#!/bin/sh
repo sync -f --no-clone-bundle
while [ $? == 1 ]; do
repo sync -f --no-clone-bundle
done
待出现以下字样后,代表同步源码树完成:
Fetching projects: 100% (730/730)
Fetching projects: 100% (730/730), done.
同步完成后,我们可以删除同步失败时产生的临时文件tmp_pack_xxxxxx:
$ find <repo-dir> -name "tmp_pack_*" | xargs -I rm -rf {}
以上步骤完成后,我们开始启用git镜像服务:
$ git daemon --verbose --export-all --base-path=<repo-absolute-path>
2、次级镜像服务的使用
在次级镜像服务启动完成后,我们在本地客户端使用git://<ip.to.mirror>/作为镜像。
用repo从本地镜像服务器下载代码:
$ repo init -u git://<ip.to.mirror>/<aosp-repo-relative-path>/platform/manifest.git
或者直接通过ssh下载:
$ repo init -u <git-user>@<ip.to.mirror>:<aosp-repo-absolute-path>/platform/manifest.git