repo是基于git的python脚本,官方使用python2.7,已经更新到python3.x了
.repo/manifests
AOSP项目清单git库下,只有一个文件default.xml,是一个标准的XML,描述了当前repo管理的所有信息
repo
提供了一个种更为灵活的定制方式local_manifests
:
所有的定制是遵循default.xml
规范的,文件名可以自定义,譬如local_manifest.xml
。
repo会遍历.repo/local_manifests
目录下的所有*.xml
文件,
最终与default.xml
合并成一个总的项目清单文件manifest.xml
。
.repo/repo
.repo/projects
工作目录
所有被管理git库的仓库目录都是分开存放的。同时,也会保留工作目录的.git,但里面所有的文件都是到.repo的链接。
null
替换Google镜像为清华大学镜像
参考Google教程,
将https://android.googlesource.com/
全部使用https://aosp.tuna.tsinghua.edu.cn/
代替即可。
下载 https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar
,下载完成后记得根据 checksum.txt 的内容校验一下
由于所有代码都是从隐藏的.repo
目录中checkout
出来的,所以我们只保留了.repo
目录,下载后解压 再repo sync
一遍即可得到完整的目录。
使用方法如下:
wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
tar xf aosp-latest.tar
cd AOSP # 解压得到的 AOSP 工程目录
# 这时 ls 的话什么也看不到,因为只有一个隐藏的 .repo 目录
repo sync # 正常同步一遍即可得到完整目录
# 或 repo sync -l 仅checkout代码
此后,每次只需运行repo sync
即可保持同步。 我们强烈建议您保持每天同步,并尽量选择凌晨等低峰时间
#Google
repo init -u https://android.googlesource.com/mirror/manifest --mirror
#中国科学技术大学
repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest --mirror
#清华大学
repo init -u https://aosp.tuna.tsinghua.edu.cn/mirror/manifest --mirror
同步当前repo 即将镜像与服务器同步
repo sync
同步完成后,运行git daemon --verbose --export-all --base-path=WORKING_DIR WORKING_DIR
(WORKING_DIR为代码树所在目录) 。
此后,其他用户使用git://your_ip/
作为镜像即可。
替换为清华大学镜像源
如果你之前已经通过某种途径获得了 AOSP 的源码(或者你只是 init 这一步完成后), 你希望以后通过 TUNA 同步 AOSP 部分的代码
将 .repo/manifest.xml
-> aosp
这个remote
的fetch
-> 从 https://android.googlesource.com
改为 https://aosp.tuna.tsinghua.edu.cn/
同时,修改 .repo/manifests.git/config
-> url = https://android.googlesource.com/platform/manifest
-> url = https://aosp.tuna.tsinghua.edu.cn/platform/manifest
改为其它源同理
从本地镜像创建新客户端 repo init -u git://ip.to.mirror/platform/manifest.git
同步当前repo 即将客户端与镜像同步 repo sync
init时没-b指定分支的话 状态是no branches
后续必须执行repo start建分支才能开发,对每个仓库创建工作分支,checkout
repo start 分支
将以下公钥加载到您的 GnuPG 密钥数据库中。该密钥用于对代表各版本的带注释标记进行签名。
gpg --import
复制并粘贴以下密钥,然后输入 EOF (Ctrl-D) 以结束输入并处理密钥。
(已复制到文件中)
导入密钥后,您可以通过以下命令验证任何标记:
git tag -v TAG_NAME