OSDN Git Service

am ec2d1b8f: (-s ours) am 84d83ba8: Merge "DO NOT MERGE Tool for compressing/decompre...
[android-x86/development.git] / docs / howto_SDK_git_cygwin.txt
1 Copyright (C) 2009 The Android Open Source Project
2
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
6
7      http://www.apache.org/licenses/LICENSE-2.0
8
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14
15
16 Subject: How to get the android source code using Cygwin and Git
17 Date:    2009/04/27
18 Updated: 2009/05/21
19
20
21 Table of content:
22   1- Goals and Requirements
23   2- Getting the code, the simple way
24   3- SSH issues
25   4- Advanced Tricks
26
27
28 -------------------------
29 1- Goals and Requirements
30 -------------------------
31
32 This document explains how to checkout the Android source from the git
33 repositories under Windows.
34
35 As stated in development/docs/howto_build_SDK.txt, one can't build the whole
36 Android source code under Windows. You can only build a the SDK tools for
37 Windows.
38
39 There are a number of caveats in checking out the code from Git under Windows. 
40 This document tries to explain them.
41
42 First you will need to meet the following requirements:
43 - You must have Cygwin installed.
44   See http://www.cygwin.com/
45
46 - You must install Cyginw using the "Unix / Binary" mode.
47   If you don't do that, git will fail to properly compute some SHA1 keys.
48
49 - You need the "git" and "curl" packages to checkout the code.
50   If you plan to contribute, you might want to get "gitk" also.
51
52   Note: if you want to build the SDK, check the howto_build_SDK.txt file
53   for a list of extra required packages.
54
55
56 -----------------------------------
57 2- Getting the code, the simple way
58 -----------------------------------
59
60 Out of the box, "repo" and "git" will work just fine under Cygwin:
61
62   $ repo init -u git://android.git.kernel.org/platform/manifest.git
63   $ repo sync
64
65 And you're done. You can build as explained in howto_build_SDK.txt and ignore
66 the rest of this document.
67
68
69 -------------
70 3- SSH issues
71 -------------
72
73 If you maintain your own private repository using an SSH server, you might get
74 some "mux/ssh" errors. In this case try this:
75
76   $ repo init -u ssh://my.private.ssh.repo/platform/manifest.git
77   $ export GIT_SSH=ssh
78   $ repo sync
79
80
81 ------------------
82 4- Advanced Tricks
83 ------------------
84
85 There is one remaining issue with the default repo/git options:
86
87 If you plan on contributing, you will notice that even after a fresh "repo
88 sync" some projects are marked as having modified files. This happens on the
89 "bionic" and the "external/iptables" project. The issue is that they have files
90 which have the same name yet differ only by their case-sensitivity. Since the
91 Windows filesystem is not case-sensitive, this confuses Git.
92
93 Solution: we can simply ignore these projects as they are not needed to build
94 the Windows SDK.
95
96 To do this you just need to create a file .repo/local_manifest.xml that
97 provides a list of projects to ignore:
98
99 <?xml version="1.0" encoding="UTF-8"?>
100 <manifest>
101   <remove-project name="platform/external/iptables" />
102 </manifest>
103
104 The other thing we can do is tell git not to track the files that cause
105 problems:
106
107   cd bionic
108   git update-index --assume-unchanged \
109     libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
110     libc/kernel/common/linux/netfilter/xt_MARK.h \
111     libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
112
113   cd external/tcpdump;
114   git update-index --assume-unchanged \
115     tests/print-X.new \
116     tests/print-XX.new
117
118
119 Here's a script that takes care of all these details. It performs the repo
120 init, creates the appropriate local_manifest.xml, does a repo sync as
121 needed and tell git to ignore the offending files:
122
123 ------------
124 #!/bin/bash
125
126 set -e  # fail on errors
127
128 URL=ssh://android-git.corp.google.com:29418/platform/manifest.git
129 BRANCH=donut
130 if [ "$1" == "-b" ]; then shift; BRANCH=$1; shift; fi
131
132 # repo init if there's no .repo directory
133 if [[ ! -d .repo ]]; then
134     repo init -u $URL -b $BRANCH
135 fi
136
137 # create a local_manifest to exclude projects that cause problems under Windows
138 # due to the case-insenstivines of the file system.
139 L=.repo/local_manifest.xml
140 if [[ ! -f $L ]]; then
141
142     cat > $L <<EOF
143 <?xml version="1.0" encoding="UTF-8"?>
144 <manifest>
145 <remove-project name="platform/external/iptables" />
146 </manifest>
147 EOF
148 fi
149
150 # sync using the native ssh client if necessary
151 [[ $URL != ${URL/ssh/} ]] && export GIT_SSH=ssh
152 repo sync $@
153
154
155 # These files cause trouble too, we need to ignore them
156 (cd bionic;
157 git update-index --assume-unchanged \
158     libc/kernel/common/linux/netfilter/xt_CONNMARK.h \
159     libc/kernel/common/linux/netfilter/xt_MARK.h \
160     libc/kernel/common/linux/netfilter_ipv6/ip6t_HL.h
161 )
162 (cd external/tcpdump;
163 git update-index --assume-unchanged \
164     tests/print-X.new \
165     tests/print-XX.new
166 )
167 ------------
168
169 Simply extract this to a "my_sync.sh" file and try the following:
170   $ mkdir android_src
171   $ cd android_src
172   $ chmod +x mysync.sh
173   $ ./mysync.sh
174
175
176 -end-
177
178
179
180