减小 Android Source Repository .repo 目录的大小 [英] Reduce the Size of the Android Source Repository .repo Directory

查看:27
本文介绍了减小 Android Source Repository .repo 目录的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在使用如下命令在 Android 源代码的几个分支之间切换:

I have been switching between several branches of the Android source code with the commands like:

repo init -u https://android.googlesource.com/platform/manifest -b android-4.4_r1.2
repo sync

最近的标签是 android-5.0.0_r2.我注意到我的 .repo 目录现在大小为 30 GB.这是预期的大小吗?如果没有,那么我推测我使用的其他分支/标签的历史记录存储在 .repo 目录中.

The most recent tag was android-5.0.0_r2. I noticed my .repo directory is now 30 GB in size. Is that the expected size? If not, then I'm speculating I have history from the other branches/tags I've used stored in the .repo directory.

有没有办法减小 .repo 目录的大小?我想仅限于源/对象/图像/等.我需要我正在处理的特定分支.对我来说,硬盘空间比下载时间更重要.

Is there a way to reduce the size of the .repo directory? I would like to limit to only the source/objects/images/etc. I need for the particular branch I'm working on. HDD space is more important to me than download time.

我看到 git gc 用于 .git 存储库,但在这种情况下不起作用..repo 存储库是否有等价物?

I see git gc is used on .git repositories, but that doesn't work in this case. Is there an equivalent for .repo repositories?

注意:我确实尝试过 repo prune,但这并没有减少 .repo 目录的大小.

Note: I did try repo prune, but that did not reduce the size of the .repo directory.

推荐答案

-c 标志似乎不再受支持,但您可以这样做.

The -c flag doesn't seem to be supported any more, but here's what you can do.

在撰写本文时,repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r5 创建 33GB 的文件.

At the time of writing, repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r5 creates 33GB worth of files.

添加 --depth=1 将其减少到 21GB.

Adding --depth=1 reduces this to 21GB.

添加 --groups=all,-notdefault,-device,-darwin,-x86,-mips,-exynos5 以排除您不感兴趣的设备和组件,将其减少到 19GB.

Adding --groups=all,-notdefault,-device,-darwin,-x86,-mips,-exynos5 to exclude devices and components you're not interested in reduces this to 19GB.

仅用于存储,您可以删除 .repo/中每个 .git 存储库的检出文件以节省更多空间,但我不确定如何编写脚本.如果您这样做了,repo sync 会在需要时检查丢失"的文件.

For storage only, you could remove the checked-out files for each .git repository inside .repo/ to save even more space, but I'm not sure how to script this. If you did do this, repo sync would check out the "missing" files when needed.

作为参考,我的完整命令行是
repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r5 --depth=1 --groups=all,-notdefault,-device,-darwin,-x86,-mips,-exynos5,mako
所以这棵树只适用于 Nexus 4.我还没有尝试从这棵树构建,但没有理由它不起作用.

For reference, my complete command line was
repo init -u https://android.googlesource.com/platform/manifest -b android-5.1.0_r5 --depth=1 --groups=all,-notdefault,-device,-darwin,-x86,-mips,-exynos5,mako
so this tree would only work for the Nexus 4. I have not yet tried to build from this tree but there's no reason it wouldn't work.

您还可以通过指定本地清单来删除不使用的项目,甚至可以使用压缩文件系统像具有正确挂载选项的 btrfs,但我不确定对性能的影响.

You could also remove projects you're not using by specifying a local manifest, or even work from a compressed filesystem like btrfs with the right mount options, but I'm unsure of the performance impact.

这篇关于减小 Android Source Repository .repo 目录的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆