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