如何在Android回购清单库的工作?清单、如何在、工作、Android

2023-09-14 00:07:34 作者:-年少气盛

借助 Android源是一个大型层次结构的Git仓库的。他们是由一个自定义的脚本调用回购管理。回购确定哪些git仓库使用的manifest.xml管理。 Android的的的manifest.xml托管在一个Git仓库连同所有其他Git代码库。

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.

如何在Android的这个仓库管理?具体怎么都承载在组织的每个分支机构的不同部门和不同的文件?

推荐答案

首先,回购的init创建的.repo 目录,克隆Git仓库的 https://android.googlesource.com/tool​​s/repo 以的.repo /回购,并与 -u 选项,以纯仓库在的.repo / manifests.git 指定的Git仓库。在此之后,它会创建的.repo /舱单目录,通过从创建符号链接转换成一个Git仓库的.repo /体现/ git的的.repo / manifests.git 。然后检查出 -b 指定的分支,并创建一个符号链接的.repo / manifest.xml的指向指定文件( -m 选项)的的.repo /舱单,默认的.repo /manifests/default.xml

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.

大致如下:


  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  

您可以跟踪真正与回购--trace初始化...

然后,回购同步克隆git仓库到的.repo /项目的manifest.xml 每个项目 local_manifest.xml ,产生具有符号链接到相应的纯仓库的工作目录与 git的,签出指定的分支清单和更新的.repo / project.list 。其中,项目已经在万一有略有不同,基本上是执行混帐拉--rebase

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.