Linux SDK 利用 repo 打包
git本地提交
目前在SDK有进行各种各样git追踪改动,想要消掉这些改动,所以需要进入具体的目录进行本地git提交。
具体的改动可以在sdk根目录下,运行 .repo/repo/repo status 查看有哪些目录有改动。
# 1. 查看所有修改
.repo/repo/repo status
# 2. 批量提交有改动的git项目
.repo/repo/repo forall -p -c '
if ! git diff --quiet || ! git diff --cached --quiet; then
git add -A
git commit -m "适配泰山派3M-$(date +%Y%m%d-%H%M%S)"
echo "✓ 已提交: $REPO_PROJECT"
fi
'
生成新的repo追踪文件
在 SDK 根目录运行下面的命令,生成新的同步xml文件:
文件名字随意
为什么要同步?
将我们自己的提交记录到 .repo/ 文件夹中,这样的话,我们其实可以删除其他的文件夹,只保留 .repo/ 这个文件夹,这个发给别人之后,用 .repo/repo/repo sync -l -j88 命令就可以将所有的文件夹和源码还原出来。
进入 .repo/manifest.xml 文件,将 <include name="******.xml" /> 修改为:
因为我们生成的xml文件是全量追踪的,所以不需要其他的一些overlay配置了。
然后进入.repo/manifests/ 目录提交下更新到本地,这样就不会显示更新了。
放弃远程追踪(使用本地配置)
配置 Manifest 仓库完全本地化
# 进入 manifest 仓库
cd .repo/manifests
# 查看所在分支
git branch -a
# 1. 创建并切换到taishanpi-3m-local分支
git checkout -b taishanpi-3m-local
# 如果已经存在则查看当前分支,如果是default,且已经向这个分支提交了改动。
# 那么我们切换到taishanpi-3m-local分支:git checkout taishanpi-3m-local
# 然后合并default的提交到taishanpi-3m-local分支:git merge default
# 2. 配置 remote 使用相对路径(关键!可移植)
git config remote.origin.url ".repo/manifests"
# 3. 配置分支跟踪本地(防止 repo sync 切换分支)
git config branch.taishanpi-3m-local.remote "."
git config branch.taishanpi-3m-local.merge "refs/heads/taishanpi-3m-local"
# 4. 同时配置 default 分支
git config branch.default.remote "."
git config branch.default.merge "refs/heads/taishanpi-3m-local"
# 5. 返回主目录
cd ../..
# 使用相对路径初始化 repo
.repo/repo/repo init -u .repo/manifests -b taishanpi-3m-local \
-m tspi_3m_rk3576_linux.xml --no-repo-verify
# 输入【N】
Testing colorized output (for 'repo diff', 'repo status'):
black red green yellow blue magenta cyan white
bold dim ul reverse
Enable color display in this user account (y/N)? n
同步出SDK源码
这时候就可以删除sdk除了.repo/目录外的所有东西。
后面需要用这个SDK的时候,使用下面这个命令同步SDK就会出现SDK源码了:


评论