Best way to change android repository versions eff

2019-03-16 01:44发布

I've got a situation where I need to build a set of static copies of Android source code of different release versions.

Simply doing an repo init -b $version; repo sync will take forever (init requires interaction, and the syncs will be wasteful of my bandwidth across versions).

My current setup is to download one base version (say 1.6_r1), copy it to a new folder (android-1.6_r2) and then rerun init and sync (repo init -b android-1.6_r2; repo sync). The sync fails sometimes though, with errors like:

ndk/build/platforms/android-3/arch-arm/usr/incl
Aborting
Syncing work tree: 100% (153/153), done.

error: development/: platform/development checkout caf83cb2b0ffde1a4cfb7cb258cbe012e283d9e1 Repo sync returned FAIL on android-2.1_r2.1s

I've found some posts with similar errors that indicate this might be caused by repo being out of sync with "changed" files in the filesystem, but I'm wondering if my errors are caused by changing versions under repo's nose.

Is this the right way to go about changing repository versions? More generally, is there a time/bandwidth efficient way to turn an android-1.6_r1 repository into an android-1.6_r2?

2条回答
霸刀☆藐视天下
2楼-- · 2019-03-16 02:22

(UPDATE: my initial answer imply that we can incrementally init a new repo from a previous one, for example 1.6_r1 to 1.6_r2, but the correct setup should have been having one local "main mirror" repo where we can point the reference to when starting a new init. I have modified the text below to avoid the incorrect implication.)

Instead of copying, try adding --reference=/path/to/main/repo to your repo init command on the new directory.

For example, if you already have a repo in /repos/aosp-main directory downloaded earlier (and synced to googlesource.com), you can do:

$ mkdir /repos/aosp-1.6_r1
$ cd /repos/aosp-1.6_r1
$ repo init -b android-1.6_r1 -u https://android.googlesource.com/platform/manifest --reference=/repos/aosp-main
$ repo sync

And then, if you want a different version:

$ mkdir /repos/aosp-1.6_r2
$ cd /repos/aosp-1.6_r2
$ repo init -b android-1.6_r2 -u https://android.googlesource.com/platform/manifest --reference=/repos/aosp-main
$ repo sync

This way, we only need to sync to the googlesource.com address when there is new stuff we haven't downloaded yet and it should just use the already synced main repo to initialize additional repos locally.

查看更多
相关推荐>>
3楼-- · 2019-03-16 02:23

Have you made sure to update the repo script just to be sure?

$ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
查看更多
登录 后发表回答