Android 存储库清单存储库如何工作? [英] How does the Android repo manifest repository work?
问题描述
Android 源 是一个 大型 git 存储库层次结构.它们由名为 repo 的自定义脚本管理.Repo 使用 manifest.xml 确定要管理哪些 git 存储库.Android 的manifest.xml 托管在git 存储库以及所有其他 git 存储库.
Android 中如何管理此存储库?具体来说,不同的分支以及每个分支中托管的不同文件是如何组织的?
首先,repo init 创建.repo
目录,克隆git仓库https://android.googlesource.com/tools/repo 到 .repo/repo
,以及使用-u
选项到 .repo/manifests.git
的裸仓库.之后,它会创建.repo/manifests
目录,通过创建从.repo/manifests/.git
到.repo 的符号链接将其转换为git 存储库/manifests.git
.然后它检出 -b
中指定的分支,并创建一个符号链接 .repo/manifest.xml
指向指定的文件 (-m
> 选项)在 .repo/manifests
中,默认为 .repo/manifests/default.xml
.
大致如下:
<前>回购初始化 -u $URL -b $BRANCH -m $MANIFEST--------------------mkdir .repo;光盘.repogit 克隆 https://android.googlesource.com/tools/repogit clone --bare $URL manifests.gitmkdir -p manifests/.git;cd 清单/.git对于我在 ../../manifests.git/*;做 ln -s $ı .;完毕光盘..git checkout $BRANCH -- .光盘..ln -s manifests/$MANIFEST manifest.xml你可以用 repo --trace init ...
然后,repo sync 为 manifest.xml
和 local_manifest.xml
中的每个项目克隆 git 存储库到 .repo/projects
,创建工作.git
的目录具有指向相应裸存储库的符号链接,检查清单中指定的分支,并更新 .repo/project.list
.项目已经存在的情况略有不同,本质上是执行git pull --rebase
.
The Android source is a large hierarchy of git repositories. They are managed by a custom script called repo. Repo determines which git repositories to manage using a manifest.xml. The manifest.xml of Android is hosted in a git repository along with all the other git repositories.
How is this repository managed in Android? Specifically how are the different branches and the different files hosted in each branch organised?
First, repo init creates the .repo
directory, clones the git repository https://android.googlesource.com/tools/repo to .repo/repo
, and the git repository specified with the -u
option to a bare repository at .repo/manifests.git
. After that, it creates the .repo/manifests
directory, converts it into a git repository through creating symbolic links from .repo/manifests/.git
to .repo/manifests.git
. It then checks out the branch specified in -b
, and creates a symbolic link .repo/manifest.xml
pointing to the specified file (-m
option) in .repo/manifests
, by default .repo/manifests/default.xml
.
Roughly as follows:
repo init -u $URL -b $BRANCH -m $MANIFEST -------------------- mkdir .repo; cd .repo git clone https://android.googlesource.com/tools/repo git clone --bare $URL manifests.git mkdir -p manifests/.git; cd manifests/.git for i in ../../manifests.git/*; do ln -s $ı .; done cd .. git checkout $BRANCH -- . cd .. ln -s manifests/$MANIFEST manifest.xml
You can trace what really happens with repo --trace init ...
Then, repo sync clones git repositories to .repo/projects
for each project in manifest.xml
and local_manifest.xml
, creates working directories with .git
having symlinks to the corresponding bare repository, checks out the branch specified in the manifest, and updates .repo/project.list
. The case where the projects are already there is slightly different, essentially performing a git pull --rebase
.
这篇关于Android 存储库清单存储库如何工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!