Android source code download method batch download Based on windows OS

Source: Internet
Author: User

 

  1. Install Gitbash for windows at http://msysgit.googlecode.com/files/git-1.6.0.2-preview20080923.exe.Select the default installation path(Otherwise, you need to manually modify the downloaded script ).Add C: \ Program Files \ Git \ bin to the System Path. Android source code here: http://git.source.android.com/
  2. To save some trouble, the download scripts are all fixed by writing the script path and the path to store the source code. You need to make room on disk FAt least 4 GB Space.Currently, at least 10 Gb space is available. Because I am about to download the package, the size of the package reaches and the occupied space reaches nearly 9 GB. If the disk space is insufficient, git will report an error, which is troublesome. I have suffered from this pain point.According to the Internet, the size of the android source code is nearly 3.8 GB.. Create the android_source_code directory and download_android-source_script under the drive root directory. As the name suggests, the former is used to store the source code, and the latter is used to store the download script.
  3. Here to download the https://www.sugarsync.com/pf/D033416_6684866_66541 download script, decompress all files placed in the f: \ download_android-source_script \ directory, note: the directory directly put these scripts, do not because of decompression, add unnecessary folders to the script. Just like this:

  1. Start --> Run --> cmd --> f: --> cd \ --> cd download_android-source_script --> dlBatchFile. bat then you can see the download interface as shown in, relatively slow.

The download progress is written in clone_result.log under the source code directory. If the network is interrupted, you can see where you downloaded it. Then manually modify dlBatchFile. bat

  1. In fact, these bat scripts and sh scripts are generated using python scripts. The scripts are very simple and can be written at will, without careful consideration and comments. The Code is as follows:

View sourceprint?

01
import os

02

03
fileP = open("git_reps.txt", "r");

04

05
logFileP = open("2.log","w")

06

07
for singleLine in fileP:

08

09
if ((not singleLine.startswith("\t")) and (not singleLine.startswith("\n")) and (not singleLine.startswith(" ")) and (not singleLine.startswith("\r\n"))):

10

11
logFileP.write(singleLine)

12

13
fileP.close();

14

15
logFileP.close()

16

17

18

19
sourceDir = "%android_source_code_path%"

20

21
allrepsFileP = open("2.log", "r")

22

23
dlBatchFileP = open("dlBatchFile.bat", "w")

24

25
gitRepHead = "git clone git://android.git.kernel.org/"

26

27
#device/htc/passion-common.git

28

29
i = 0

30

31
for singleAdd in allrepsFileP:

32

33
i = i + 1

34

35
print singleAdd

36

37
gitScriptFileName = "git_script_" + singleAdd.replace("/", "_")[:-1] + ".sh"

38

39
lastDa = singleAdd.rfind("/")

40

41
singleDir = singleAdd[0:lastDa]

42

43
singleDir = singleDir.replace("/", "\\")

44

45
print singleDir

46

47
dlBatchFileP.write("if not exist " + singleDir + " md " + singleDir + "\n")

48

49
dlBatchFileP.write("cd " + singleDir + "\n")

50

51
dlBatchFileP.write("copy " + "F:\\download_android-source_script\\" + gitScriptFileName + " /y \n")

52

53
dlBatchFileP.write("\"C:\\Program Files\\Git\\bin\\sh\" " + gitScriptFileName + "\n")

54

55
dlBatchFileP.write("del " + gitScriptFileName + "\n")

56

57
dlBatchFileP.write("cd \\" + "\n")

58

59
dlBatchFileP.write("cd " + sourceDir + "\n")

60

61
dlBatchFileP.write("echo " + str(i) + "---::" + singleDir + " >>clone_result.log \n")

62

63
dlBatchFileP.write("\n")

64

65
spFileP = open(gitScriptFileName,"w")

66

67
spFileP.write(gitRepHead + singleAdd[:-1])

68

69
spFileP.close()

70

71
dlBatchFileP.close()

72

73
allrepsFileP.close()

#Git_reps.txt is copied and pasted directly from http://git.source.android.com.

Ps: Su Zhengang mentioned the repo in the mail list, as follows: Fyr.

Su Zhengang

Sent to china-android -.

Show Details at (2 hours ago)

Why not use repo?

Download repo

Download thereposcript and make sure it is executable:
$ Curl http://android.git.kernel.org/repo> ~ /Bin/repo

$ Chmod a + x ~ /Bin/repo

Download android code

$ Repo init-u git: // android.git.kernel.org/platform/manifest.git

$ Repo sync

These can be, detailed description: http://source.android.com/source/download.html

Source android source code download method batch download Based on windows OS-Simoncook is a programmer-blog

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.