xref: /dflybsd-src/share/man/man7/development.7 (revision c8e8a2e595a8fc2b86b5ba3cfd32c77f35281c8c)
1984263bcSMatthew Dillon.\"
2a63d9f6fSSascha Wildner.\" Copyright (c) 2008
3a63d9f6fSSascha Wildner.\"	The DragonFly Project.  All rights reserved.
4a63d9f6fSSascha Wildner.\"
5a63d9f6fSSascha Wildner.\" Redistribution and use in source and binary forms, with or without
6a63d9f6fSSascha Wildner.\" modification, are permitted provided that the following conditions
7a63d9f6fSSascha Wildner.\" are met:
8a63d9f6fSSascha Wildner.\"
9a63d9f6fSSascha Wildner.\" 1. Redistributions of source code must retain the above copyright
10a63d9f6fSSascha Wildner.\"    notice, this list of conditions and the following disclaimer.
11a63d9f6fSSascha Wildner.\" 2. Redistributions in binary form must reproduce the above copyright
12a63d9f6fSSascha Wildner.\"    notice, this list of conditions and the following disclaimer in
13a63d9f6fSSascha Wildner.\"    the documentation and/or other materials provided with the
14a63d9f6fSSascha Wildner.\"    distribution.
15a63d9f6fSSascha Wildner.\" 3. Neither the name of The DragonFly Project nor the names of its
16a63d9f6fSSascha Wildner.\"    contributors may be used to endorse or promote products derived
17a63d9f6fSSascha Wildner.\"    from this software without specific, prior written permission.
18a63d9f6fSSascha Wildner.\"
19a63d9f6fSSascha Wildner.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20a63d9f6fSSascha Wildner.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21a63d9f6fSSascha Wildner.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22a63d9f6fSSascha Wildner.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE
23a63d9f6fSSascha Wildner.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24a63d9f6fSSascha Wildner.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
25a63d9f6fSSascha Wildner.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26a63d9f6fSSascha Wildner.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
27a63d9f6fSSascha Wildner.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28a63d9f6fSSascha Wildner.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
29a63d9f6fSSascha Wildner.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30a63d9f6fSSascha Wildner.\" SUCH DAMAGE.
31a63d9f6fSSascha Wildner.\"
32354a411aSSascha Wildner.Dd April 2, 2013
33984263bcSMatthew Dillon.Dt DEVELOPMENT 7
34984263bcSMatthew Dillon.Os
35984263bcSMatthew Dillon.Sh NAME
36984263bcSMatthew Dillon.Nm development
37a63d9f6fSSascha Wildner.Nd quick starter for development with the DragonFly codebase
38984263bcSMatthew Dillon.Sh DESCRIPTION
398c1a5cc4SThomas Nikolajsen.Dx
40a63d9f6fSSascha Wildneruses the
41a63d9f6fSSascha Wildner.Xr git 1
42a63d9f6fSSascha Wildnerdistributed revision control system.
43a63d9f6fSSascha WildnerIf it is not already on the system, it needs to be installed via
44*c8e8a2e5SSascha Wildner.Xr dports 7
45*c8e8a2e5SSascha Wildner.Pa ( devel/git ) .
4695b3720cSHiten Pandya.Pp
4795b3720cSHiten PandyaThe
48a63d9f6fSSascha Wildner.Sx EXAMPLES
49a63d9f6fSSascha Wildnersection gives initial information to get going with development on
50a63d9f6fSSascha Wildner.Dx .
51a63d9f6fSSascha WildnerPlease refer to the
52a63d9f6fSSascha Wildner.Xr git 1
53a63d9f6fSSascha Wildnermanual pages and other related documents for further information on git's
54a63d9f6fSSascha Wildnercapabilities and how to use them.
55e827a42cSSascha WildnerThe
56e827a42cSSascha Wildner.Sx SEE ALSO
57e827a42cSSascha Wildnersection below has some links.
5895b3720cSHiten Pandya.Pp
59a63d9f6fSSascha WildnerFor information on how to build the
60a63d9f6fSSascha Wildner.Dx
61a63d9f6fSSascha Wildnersystem from source code, see
62a63d9f6fSSascha Wildner.Xr build 7 .
6361da8008SSascha WildnerFor information on how to build the LiveCD, LiveDVD or thumb drive image, see
64a63d9f6fSSascha Wildner.Xr release 7 .
652fb40d7cSSascha Wildner.Pp
662fb40d7cSSascha WildnerFor a specification of
672fb40d7cSSascha Wildner.Dx Ap s
682fb40d7cSSascha Wildnerpreferred source code style, refer to
692fb40d7cSSascha Wildner.Xr style 9 .
702fb40d7cSSascha WildnerAn
712fb40d7cSSascha Wildner.Xr emacs 1
722fb40d7cSSascha Wildnerfunction to switch C-mode to this style (more or less) can be found in
732fb40d7cSSascha Wildner.Pa /usr/share/misc/dragonfly.el .
74354a411aSSascha WildnerFor
75354a411aSSascha Wildner.Xr vim 1
76354a411aSSascha Wildnerusers, a
77354a411aSSascha Wildner.Pa /usr/share/misc/dragonfly.vim
78354a411aSSascha Wildneris available.
79a63d9f6fSSascha Wildner.Sh EXAMPLES
80a63d9f6fSSascha WildnerA fresh copy of the repository can be cloned anywhere.
81a63d9f6fSSascha WildnerNote that the directory to clone into
82a63d9f6fSSascha Wildner.Pa ( /usr/src
83a63d9f6fSSascha Wildnerin the following example) must not exist, so all previous work in this
84a63d9f6fSSascha Wildnerdirectory has to be saved and the directory be removed prior to cloning.
8561da8008SSascha WildnerAlso note that while the main repository is on
8661da8008SSascha Wildner.Pa crater ,
8761da8008SSascha Wildnerit is recommended that one of the
8861da8008SSascha Wildner.Dx
8961da8008SSascha Wildnermirrors be used instead.
90a63d9f6fSSascha Wildner.Pp
91e2dbfa0bSThomas NikolajsenSimple setup and updating of local repository is done using
92e2dbfa0bSThomas Nikolajsen.Pa /usr/Makefile :
93e2dbfa0bSThomas Nikolajsen.Bd -literal -offset 4n
94e2dbfa0bSThomas Nikolajsencd /usr
95e2dbfa0bSThomas Nikolajsenmake help		# get help
96eed39b8dSSascha Wildnermake src-checkout	# initial setup
97eed39b8dSSascha Wildnermake src-update
98e2dbfa0bSThomas Nikolajsen.Ed
99e2dbfa0bSThomas Nikolajsen.Pp
100e2dbfa0bSThomas NikolajsenSomewhat finer control can be achieved using
101e2dbfa0bSThomas Nikolajsen.Xr git 1
10261da8008SSascha Wildnerdirectly.
103a63d9f6fSSascha WildnerTo clone the repository and check out the master branch (this will take
104a63d9f6fSSascha Wildnersome time):
10595b3720cSHiten Pandya.Bd -literal -offset 4n
106a63d9f6fSSascha Wildnercd /usr
107a63d9f6fSSascha Wildnergit clone -o crater git://crater.dragonflybsd.org/dragonfly.git src
108a63d9f6fSSascha Wildnercd src
10995b3720cSHiten Pandya.Ed
11095b3720cSHiten Pandya.Pp
111a63d9f6fSSascha WildnerThe repository can be held up to date by pulling frequently (to set up a
112a63d9f6fSSascha Wildner.Xr cron 8
113a63d9f6fSSascha Wildnerjob,
114a63d9f6fSSascha Wildner.Xr git 1 Ap s
115a63d9f6fSSascha Wildner.Fl Fl git-dir
116a63d9f6fSSascha Wildneroption can be used):
117984263bcSMatthew Dillon.Bd -literal -offset 4n
118984263bcSMatthew Dilloncd /usr/src
119a63d9f6fSSascha Wildnergit pull
120984263bcSMatthew Dillon.Ed
121984263bcSMatthew Dillon.Pp
122a63d9f6fSSascha WildnerIt is not recommended to work directly in the master branch.
123a63d9f6fSSascha WildnerTo create and checkout a working branch:
124a63d9f6fSSascha Wildner.Bd -literal -offset 4n
125a63d9f6fSSascha Wildnergit checkout -b work
126a63d9f6fSSascha Wildner.Ed
127984263bcSMatthew Dillon.Pp
128a63d9f6fSSascha WildnerTo create and checkout a branch of the
129a63d9f6fSSascha Wildner.Dx 2.0
130a63d9f6fSSascha Wildnerrelease (called
131a63d9f6fSSascha Wildner.Sy rel2_0 ) :
132a63d9f6fSSascha Wildner.Bd -literal -offset 4n
133a63d9f6fSSascha Wildnergit checkout -b rel2_0 crater/DragonFly_RELEASE_2_0
134a63d9f6fSSascha Wildner.Ed
135a63d9f6fSSascha Wildner.Pp
136a63d9f6fSSascha WildnerBranches can be deleted just as easy:
137a63d9f6fSSascha Wildner.Bd -literal -offset 4n
138a63d9f6fSSascha Wildnergit branch -d work
139a63d9f6fSSascha Wildner.Ed
140a63d9f6fSSascha Wildner.Pp
141a63d9f6fSSascha WildnerAfter changes have been made to a branch, they can be committed:
142a63d9f6fSSascha Wildner.Bd -literal -offset 4n
143a63d9f6fSSascha Wildnergit commit -a
144a63d9f6fSSascha Wildner.Ed
145a63d9f6fSSascha Wildner.Pp
146a63d9f6fSSascha Wildner.Xr git-commit 1 Ap s
147a63d9f6fSSascha Wildner.Fl m
148a63d9f6fSSascha Wildnerand
149a63d9f6fSSascha Wildner.Fl F
150a63d9f6fSSascha Wildneroptions can be used to specify a commit message on the command line or read
151a63d9f6fSSascha Wildnerit from a file, respectively.
152a63d9f6fSSascha Wildner.Pp
153a63d9f6fSSascha WildnerFinally, branches can be merged with the (updated) master by using
154a63d9f6fSSascha Wildner.Cm rebase :
155a63d9f6fSSascha Wildner.Bd -literal -offset 4n
156a63d9f6fSSascha Wildnergit checkout master
157a63d9f6fSSascha Wildnergit pull
158a63d9f6fSSascha Wildnergit checkout work
159a63d9f6fSSascha Wildnergit rebase master
160a63d9f6fSSascha Wildner.Ed
161c6d6bc19SSimon Schubert.Sh VENDOR IMPORTS
162c6d6bc19SSimon SchubertWhen importing vendor sources, make sure that you don't import
163c6d6bc19SSimon Schuberttoo many unnecessary sources.
164bb60e660SSascha WildnerEspecially test suites that are not used by the
165bb60e660SSascha Wildner.Dx
166bb60e660SSascha Wildnerbuild are good candidates for being stripped away.
167c6d6bc19SSimon SchubertThese instructions assume that you have already extracted
168c6d6bc19SSimon Schubertthe source package into its final directory and that they are
169c6d6bc19SSimon Schuberttrimmed appropriately.
170c6d6bc19SSimon Schubert.Pp
171c6d6bc19SSimon Schubert.Em \&Do not change the vendor sources before importing them
172c6d6bc19SSimon Schuberton the vendor branch!
173c6d6bc19SSimon SchubertNecessary changes to the vendor sources can be applied to
174c6d6bc19SSimon Schubert.Pa master
175c6d6bc19SSimon Schubertafter the import.
176c6d6bc19SSimon Schubert.Pp
177c6d6bc19SSimon SchubertFor the following commands, we will import the imaginary package
178c6d6bc19SSimon Schubert.Nm foo-2.3
179c6d6bc19SSimon Schubertinto
180c6d6bc19SSimon Schubert.Pa /usr/src/contrib/foo .
181c6d6bc19SSimon SchubertIf this is the first import of
182c6d6bc19SSimon Schubert.Nm foo ,
183c6d6bc19SSimon Schubertyou will have to choose the name of the vendor branch.
184c6d6bc19SSimon SchubertCustomarily, this will be
185c6d6bc19SSimon Schubert.Pa vendor/FOO .
186c6d6bc19SSimon SchubertHowever, if you intend to maintain multiple vendor sources for the
187c6d6bc19SSimon Schubertsame package
188c6d6bc19SSimon Schubert.Em concurrently ,
189c6d6bc19SSimon Schubertyou should choose a branch name which includes part of the version,
190c6d6bc19SSimon Schuberti.e.\&
191c6d6bc19SSimon Schubert.Pa vendor/FOO2 .
192c6d6bc19SSimon Schubert.Pp
193c6d6bc19SSimon SchubertAs a first step, we trick git to work on the vendor branch instead of on
194c6d6bc19SSimon Schubert.Pa master .
195c6d6bc19SSimon SchubertBe careful, since after issuing this command all your commits will go to the
196c6d6bc19SSimon Schubertvendor branch, but you will commit
197c6d6bc19SSimon Schubert.Em the whole working tree
198c6d6bc19SSimon Schubertand not just the vendor sources!
199c6d6bc19SSimon SchubertThus you have to specify the exact directory for
200c6d6bc19SSimon Schubert.Li git commit .
201c6d6bc19SSimon SchubertIn order to commit, you will have to add the new sources first.
2022c0b4c7eSSimon 'corecode' Schubert.Pp
2032c0b4c7eSSimon 'corecode' SchubertIf the vendor branch already exists, make sure that you have a local vendor
2042c0b4c7eSSimon 'corecode' Schubertbranch which is up to date.
2052c0b4c7eSSimon 'corecode' SchubertTo this end, run:
2062c0b4c7eSSimon 'corecode' Schubert.Bd -literal -offset 4n
2072c0b4c7eSSimon 'corecode' Schubertgit update-ref refs/heads/vendor/FOO origin/vendor/FOO
2082c0b4c7eSSimon 'corecode' Schubert.Ed
2092c0b4c7eSSimon 'corecode' Schubert.Pp
2102c0b4c7eSSimon 'corecode' SchubertThe next commands perform the actual import.
211c6d6bc19SSimon Schubert.Bd -literal -offset 4n
212c6d6bc19SSimon Schubertgit symbolic-ref HEAD refs/heads/vendor/FOO
213c6d6bc19SSimon Schubertgit add contrib/foo
214c6d6bc19SSimon Schubertgit commit -m "Import foo-2.3" contrib/foo
215c6d6bc19SSimon Schubert.Ed
216c6d6bc19SSimon Schubert.Pp
217c6d6bc19SSimon SchubertWith these commands we have imported the vendor sources on their own branch.
218c6d6bc19SSimon SchubertIn the next step, we merge the vendor branch into master.
219c6d6bc19SSimon Schubert.Bd -literal -offset 4n
220c6d6bc19SSimon Schubertgit checkout master
221c6d6bc19SSimon Schubertgit merge vendor/FOO
222c6d6bc19SSimon Schubert.Ed
223c6d6bc19SSimon Schubert.Pp
224c6d6bc19SSimon SchubertNow you are free to change the sources in contrib/foo, since you are
225c6d6bc19SSimon Schubertback on the
226c6d6bc19SSimon Schubert.Pa master
227c6d6bc19SSimon Schubertbranch.
228c6d6bc19SSimon SchubertThe first thing to do is to add
229c6d6bc19SSimon Schubert.Pa README.DRAGONFLY
230c6d6bc19SSimon Schubertand
231c6d6bc19SSimon Schubert.Pa README.DELETED .
232c6d6bc19SSimon SchubertThe former documents how the imported sources can be obtained, including
233c6d6bc19SSimon Schuberta checksum of the tarball.
2341f7cd2b1SMatthias SchmidtThe latter lists all files and directories that have been removed from the
235c6d6bc19SSimon Schubertsource package.
236c6d6bc19SSimon SchubertYou should use the
237c6d6bc19SSimon Schubert.Pa /usr/src/tools/tools/genreadmedeleted/genreadmedeleted
238c6d6bc19SSimon Schubertshell script to generate this file.
239c6d6bc19SSimon SchubertCommit the
240c6d6bc19SSimon Schubert.Pa README Ns s
241c6d6bc19SSimon Schubertfirst, then commit your local changes to the sources:
242c6d6bc19SSimon Schubert.Bd -literal -offset 4n
243c6d6bc19SSimon Schubertgit add contrib/foo/README.D*
244c6d6bc19SSimon Schubertgit commit -m "foo: add our READMEs"
245c6d6bc19SSimon Schubert.Ed
246c6d6bc19SSimon Schubert.Pp
247c6d6bc19SSimon SchubertFinally, push master and the vendor branch to crater:
248c6d6bc19SSimon Schubert.Bd -literal -offset 4n
249c6d6bc19SSimon Schubertgit push crater master vendor/FOO
250c6d6bc19SSimon Schubert.Ed
251984263bcSMatthew Dillon.Sh SEE ALSO
252*c8e8a2e5SSascha Wildner.Xr git 1 Pq Pa devel/git ,
253984263bcSMatthew Dillon.Xr build 7 ,
25471bdc883SThomas Nikolajsen.Xr committer 7 ,
255a63d9f6fSSascha Wildner.Xr release 7
256e827a42cSSascha Wildner.Rs
257a4d7a8cbSSascha Wildner.%T "Documentation on git's page"
258a4d7a8cbSSascha Wildner.%O "http://git-scm.com/documentation"
259e827a42cSSascha Wildner.Re
260e827a42cSSascha Wildner.Rs
261e827a42cSSascha Wildner.%T "Git Magic"
262e827a42cSSascha Wildner.%O "http://www-cs-students.stanford.edu/~blynn/gitmagic/"
263e827a42cSSascha Wildner.Re
264984263bcSMatthew Dillon.Sh HISTORY
265984263bcSMatthew DillonThe
266984263bcSMatthew Dillon.Nm
267984263bcSMatthew Dillonmanual page was originally written by
268984263bcSMatthew Dillon.An Matthew Dillon Aq dillon@FreeBSD.org
269984263bcSMatthew Dillonand first appeared
270984263bcSMatthew Dillonin
271984263bcSMatthew Dillon.Fx 5.0 ,
272984263bcSMatthew DillonDecember 2002.
273a63d9f6fSSascha WildnerIt was rewritten when
274a63d9f6fSSascha Wildner.Dx
275a63d9f6fSSascha Wildnerswitched to
276a63d9f6fSSascha Wildner.Xr git 1 .
277