development.7: Fix the git documentation URL.
[dragonfly.git] / share / man / man7 / development.7
1 .\"
2 .\" Copyright (c) 2008
3 .\"     The DragonFly Project.  All rights reserved.
4 .\"
5 .\" Redistribution and use in source and binary forms, with or without
6 .\" modification, are permitted provided that the following conditions
7 .\" are met:
8 .\"
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\"    notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\"    notice, this list of conditions and the following disclaimer in
13 .\"    the documentation and/or other materials provided with the
14 .\"    distribution.
15 .\" 3. Neither the name of The DragonFly Project nor the names of its
16 .\"    contributors may be used to endorse or promote products derived
17 .\"    from this software without specific, prior written permission.
18 .\"
19 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 .\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 .\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 .\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
23 .\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24 .\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25 .\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27 .\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .Dd May 7, 2012
33 .Dt DEVELOPMENT 7
34 .Os
35 .Sh NAME
36 .Nm development
37 .Nd quick starter for development with the DragonFly codebase
38 .Sh DESCRIPTION
39 .Dx
40 uses the
41 .Xr git 1
42 distributed revision control system.
43 If it is not already on the system, it needs to be installed via
44 .Xr pkgsrc 7
45 .Pa ( /usr/pkgsrc/devel/scmgit ) .
46 .Pp
47 The
48 .Sx EXAMPLES
49 section gives initial information to get going with development on
50 .Dx .
51 Please refer to the
52 .Xr git 1
53 manual pages and other related documents for further information on git's
54 capabilities and how to use them.
55 The
56 .Sx SEE ALSO
57 section below has some links.
58 .Pp
59 For information on how to build the
60 .Dx
61 system from source code, see
62 .Xr build 7 .
63 For information on how to build the LiveCD, LiveDVD or thumb drive image, see
64 .Xr release 7 .
65 .Pp
66 For a specification of
67 .Dx Ap s
68 preferred source code style, refer to
69 .Xr style 9 .
70 An
71 .Xr emacs 1
72 function to switch C-mode to this style (more or less) can be found in
73 .Pa /usr/share/misc/dragonfly.el .
74 .Sh EXAMPLES
75 A fresh copy of the repository can be cloned anywhere.
76 Note that the directory to clone into
77 .Pa ( /usr/src
78 in the following example) must not exist, so all previous work in this
79 directory has to be saved and the directory be removed prior to cloning.
80 Also note that while the main repository is on
81 .Pa crater ,
82 it is recommended that one of the
83 .Dx
84 mirrors be used instead.
85 .Pp
86 Simple setup and updating of local repository is done using
87 .Pa /usr/Makefile :
88 .Bd -literal -offset 4n
89 cd /usr
90 make help               # get help
91 make src-checkout       # initial setup
92 make src-update
93 .Ed
94 .Pp
95 Somewhat finer control can be achieved using
96 .Xr git 1
97 directly.
98 To clone the repository and check out the master branch (this will take
99 some time):
100 .Bd -literal -offset 4n
101 cd /usr
102 git clone -o crater git://crater.dragonflybsd.org/dragonfly.git src
103 cd src
104 .Ed
105 .Pp
106 The repository can be held up to date by pulling frequently (to set up a
107 .Xr cron 8
108 job,
109 .Xr git 1 Ap s
110 .Fl Fl git-dir
111 option can be used):
112 .Bd -literal -offset 4n
113 cd /usr/src
114 git pull
115 .Ed
116 .Pp
117 It is not recommended to work directly in the master branch.
118 To create and checkout a working branch:
119 .Bd -literal -offset 4n
120 git checkout -b work
121 .Ed
122 .Pp
123 To create and checkout a branch of the
124 .Dx 2.0
125 release (called
126 .Sy rel2_0 ) :
127 .Bd -literal -offset 4n
128 git checkout -b rel2_0 crater/DragonFly_RELEASE_2_0
129 .Ed
130 .Pp
131 Branches can be deleted just as easy:
132 .Bd -literal -offset 4n
133 git branch -d work
134 .Ed
135 .Pp
136 After changes have been made to a branch, they can be committed:
137 .Bd -literal -offset 4n
138 git commit -a
139 .Ed
140 .Pp
141 .Xr git-commit 1 Ap s
142 .Fl m
143 and
144 .Fl F
145 options can be used to specify a commit message on the command line or read
146 it from a file, respectively.
147 .Pp
148 Finally, branches can be merged with the (updated) master by using
149 .Cm rebase :
150 .Bd -literal -offset 4n
151 git checkout master
152 git pull
153 git checkout work
154 git rebase master
155 .Ed
156 .Sh VENDOR IMPORTS
157 When importing vendor sources, make sure that you don't import
158 too many unnecessary sources.
159 Especially test suites that are not used by the
160 .Dx
161 build are good candidates for being stripped away.
162 These instructions assume that you have already extracted
163 the source package into its final directory and that they are
164 trimmed appropriately.
165 .Pp
166 .Em \&Do not change the vendor sources before importing them
167 on the vendor branch!
168 Necessary changes to the vendor sources can be applied to
169 .Pa master
170 after the import.
171 .Pp
172 For the following commands, we will import the imaginary package
173 .Nm foo-2.3
174 into
175 .Pa /usr/src/contrib/foo .
176 If this is the first import of
177 .Nm foo ,
178 you will have to choose the name of the vendor branch.
179 Customarily, this will be
180 .Pa vendor/FOO .
181 However, if you intend to maintain multiple vendor sources for the
182 same package
183 .Em concurrently ,
184 you should choose a branch name which includes part of the version,
185 i.e.\&
186 .Pa vendor/FOO2 .
187 .Pp
188 As a first step, we trick git to work on the vendor branch instead of on
189 .Pa master .
190 Be careful, since after issuing this command all your commits will go to the
191 vendor branch, but you will commit
192 .Em the whole working tree
193 and not just the vendor sources!
194 Thus you have to specify the exact directory for
195 .Li git commit .
196 In order to commit, you will have to add the new sources first.
197 .Pp
198 If the vendor branch already exists, make sure that you have a local vendor
199 branch which is up to date.
200 To this end, run:
201 .Bd -literal -offset 4n
202 git update-ref refs/heads/vendor/FOO origin/vendor/FOO
203 .Ed
204 .Pp
205 The next commands perform the actual import.
206 .Bd -literal -offset 4n
207 git symbolic-ref HEAD refs/heads/vendor/FOO
208 git add contrib/foo
209 git commit -m "Import foo-2.3" contrib/foo
210 .Ed
211 .Pp
212 With these commands we have imported the vendor sources on their own branch.
213 In the next step, we merge the vendor branch into master.
214 .Bd -literal -offset 4n
215 git checkout master
216 git merge vendor/FOO
217 .Ed
218 .Pp
219 Now you are free to change the sources in contrib/foo, since you are
220 back on the
221 .Pa master
222 branch.
223 The first thing to do is to add
224 .Pa README.DRAGONFLY
225 and
226 .Pa README.DELETED .
227 The former documents how the imported sources can be obtained, including
228 a checksum of the tarball.
229 The latter lists all files and directories that have been removed from the
230 source package.
231 You should use the
232 .Pa /usr/src/tools/tools/genreadmedeleted/genreadmedeleted
233 shell script to generate this file.
234 Commit the
235 .Pa README Ns s
236 first, then commit your local changes to the sources:
237 .Bd -literal -offset 4n
238 git add contrib/foo/README.D*
239 git commit -m "foo: add our READMEs"
240 .Ed
241 .Pp
242 Finally, push master and the vendor branch to crater:
243 .Bd -literal -offset 4n
244 git push crater master vendor/FOO
245 .Ed
246 .Sh SEE ALSO
247 .Xr git 1 Pq Pa pkgsrc/devel/scmgit ,
248 .Xr build 7 ,
249 .Xr committer 7 ,
250 .Xr release 7
251 .Rs
252 .%T "Documentation on git's page"
253 .%O "http://git-scm.com/documentation"
254 .Re
255 .Rs
256 .%T "Git Magic"
257 .%O "http://www-cs-students.stanford.edu/~blynn/gitmagic/"
258 .Re
259 .Sh HISTORY
260 The
261 .Nm
262 manual page was originally written by
263 .An Matthew Dillon Aq dillon@FreeBSD.org
264 and first appeared
265 in
266 .Fx 5.0 ,
267 December 2002.
268 It was rewritten when
269 .Dx
270 switched to
271 .Xr git 1 .