xref: /dflybsd-src/share/man/man7/development.7 (revision 92db1a3519a8f1d9fdc18e31b3a02d9a64598a06)
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.\"
3273b18b18SAaron LI.Dd March 3, 2020
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
44c8e8a2e5SSascha Wildner.Xr dports 7
45c8e8a2e5SSascha 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
9164fc8f06SAaron LISimple setup of the local repository is done using
92e2dbfa0bSThomas Nikolajsen.Pa /usr/Makefile :
93e2dbfa0bSThomas Nikolajsen.Bd -literal -offset 4n
94e2dbfa0bSThomas Nikolajsencd /usr
9564fc8f06SAaron LImake help		# get brief help
9664fc8f06SAaron LImake src-create		# create the source repository
97e2dbfa0bSThomas Nikolajsen.Ed
98e2dbfa0bSThomas Nikolajsen.Pp
99e2dbfa0bSThomas NikolajsenSomewhat finer control can be achieved using
100e2dbfa0bSThomas Nikolajsen.Xr git 1
10161da8008SSascha Wildnerdirectly.
102a63d9f6fSSascha WildnerTo clone the repository and check out the master branch (this will take
103a63d9f6fSSascha Wildnersome time):
10495b3720cSHiten Pandya.Bd -literal -offset 4n
105a63d9f6fSSascha Wildnercd /usr
106a63d9f6fSSascha Wildnergit clone -o crater git://crater.dragonflybsd.org/dragonfly.git src
107a63d9f6fSSascha Wildnercd src
10895b3720cSHiten Pandya.Ed
10995b3720cSHiten Pandya.Pp
110a63d9f6fSSascha WildnerThe repository can be held up to date by pulling frequently (to set up a
111a63d9f6fSSascha Wildner.Xr cron 8
112a63d9f6fSSascha Wildnerjob,
113a63d9f6fSSascha Wildner.Xr git 1 Ap s
114a63d9f6fSSascha Wildner.Fl Fl git-dir
115a63d9f6fSSascha Wildneroption can be used):
116984263bcSMatthew Dillon.Bd -literal -offset 4n
117984263bcSMatthew Dilloncd /usr/src
118a63d9f6fSSascha Wildnergit pull
119984263bcSMatthew Dillon.Ed
120984263bcSMatthew Dillon.Pp
121a63d9f6fSSascha WildnerIt is not recommended to work directly in the master branch.
122a63d9f6fSSascha WildnerTo create and checkout a working branch:
123a63d9f6fSSascha Wildner.Bd -literal -offset 4n
124a63d9f6fSSascha Wildnergit checkout -b work
125a63d9f6fSSascha Wildner.Ed
126984263bcSMatthew Dillon.Pp
127a63d9f6fSSascha WildnerTo create and checkout a branch of the
128a63d9f6fSSascha Wildner.Dx 2.0
129a63d9f6fSSascha Wildnerrelease (called
130a63d9f6fSSascha Wildner.Sy rel2_0 ) :
131a63d9f6fSSascha Wildner.Bd -literal -offset 4n
132a63d9f6fSSascha Wildnergit checkout -b rel2_0 crater/DragonFly_RELEASE_2_0
133a63d9f6fSSascha Wildner.Ed
134a63d9f6fSSascha Wildner.Pp
135a63d9f6fSSascha WildnerBranches can be deleted just as easy:
136a63d9f6fSSascha Wildner.Bd -literal -offset 4n
137a63d9f6fSSascha Wildnergit branch -d work
138a63d9f6fSSascha Wildner.Ed
139a63d9f6fSSascha Wildner.Pp
140a63d9f6fSSascha WildnerAfter changes have been made to a branch, they can be committed:
141a63d9f6fSSascha Wildner.Bd -literal -offset 4n
142a63d9f6fSSascha Wildnergit commit -a
143a63d9f6fSSascha Wildner.Ed
144a63d9f6fSSascha Wildner.Pp
145a63d9f6fSSascha Wildner.Xr git-commit 1 Ap s
146a63d9f6fSSascha Wildner.Fl m
147a63d9f6fSSascha Wildnerand
148a63d9f6fSSascha Wildner.Fl F
149a63d9f6fSSascha Wildneroptions can be used to specify a commit message on the command line or read
150a63d9f6fSSascha Wildnerit from a file, respectively.
151a63d9f6fSSascha Wildner.Pp
152a63d9f6fSSascha WildnerFinally, branches can be merged with the (updated) master by using
153a63d9f6fSSascha Wildner.Cm rebase :
154a63d9f6fSSascha Wildner.Bd -literal -offset 4n
155a63d9f6fSSascha Wildnergit checkout master
156a63d9f6fSSascha Wildnergit pull
157a63d9f6fSSascha Wildnergit checkout work
158a63d9f6fSSascha Wildnergit rebase master
159a63d9f6fSSascha Wildner.Ed
160c6d6bc19SSimon Schubert.Sh VENDOR IMPORTS
161c6d6bc19SSimon SchubertWhen importing vendor sources, make sure that you don't import
162c6d6bc19SSimon Schuberttoo many unnecessary sources.
163bb60e660SSascha WildnerEspecially test suites that are not used by the
164bb60e660SSascha Wildner.Dx
165bb60e660SSascha Wildnerbuild are good candidates for being stripped away.
166c6d6bc19SSimon SchubertThese instructions assume that you have already extracted
16773b18b18SAaron LIthe source package into its final directory and trimmed the source
16873b18b18SAaron LIfiles appropriately.
169c6d6bc19SSimon Schubert.Pp
170c6d6bc19SSimon Schubert.Em \&Do not change the vendor sources before importing them
171c6d6bc19SSimon Schuberton the vendor branch!
17273b18b18SAaron LINecessary changes to the vendor sources should be applied to the
173c6d6bc19SSimon Schubert.Pa master
17473b18b18SAaron LIbranch after the import.
175c6d6bc19SSimon Schubert.Pp
17673b18b18SAaron LIFor the following example, we will import the imaginary package
177c6d6bc19SSimon Schubert.Nm foo-2.3
178c6d6bc19SSimon Schubertinto
17973b18b18SAaron LI.Pa contrib/foo .
180c6d6bc19SSimon SchubertIf this is the first import of
181c6d6bc19SSimon Schubert.Nm foo ,
182c6d6bc19SSimon Schubertyou will have to choose the name of the vendor branch.
183c6d6bc19SSimon SchubertCustomarily, this will be
184c6d6bc19SSimon Schubert.Pa vendor/FOO .
185c6d6bc19SSimon SchubertHowever, if you intend to maintain multiple vendor sources for the
186c6d6bc19SSimon Schubertsame package
187c6d6bc19SSimon Schubert.Em concurrently ,
18873b18b18SAaron LIyou should choose a branch name that includes part of the version, e.g.,
189c6d6bc19SSimon Schubert.Pa vendor/FOO2 .
190c6d6bc19SSimon Schubert.Pp
19173b18b18SAaron LIFirst, we need to create an orphan branch (i.e., a new branch with no
19273b18b18SAaron LIhistory) as the vendor branch:
1932c0b4c7eSSimon 'corecode' Schubert.Bd -literal -offset 4n
19473b18b18SAaron LIgit checkout --orphan vendor/FOO
1952c0b4c7eSSimon 'corecode' Schubert.Ed
1962c0b4c7eSSimon 'corecode' Schubert.Pp
19773b18b18SAaron LIThen we remove the previous content because the vendor branch will only
19873b18b18SAaron LIcontain the vendor sources to be imported:
199c6d6bc19SSimon Schubert.Bd -literal -offset 4n
20073b18b18SAaron LIgit rm -rf .
20173b18b18SAaron LI.Ed
20273b18b18SAaron LI.Pp
20373b18b18SAaron LINext, move the prepared vendor sources to the destination, i.e.,
20473b18b18SAaron LI.Pa contrib/foo .
20573b18b18SAaron LIThen we perform the import:
20673b18b18SAaron LI.Bd -literal -offset 4n
207c6d6bc19SSimon Schubertgit add contrib/foo
20873b18b18SAaron LIgit commit -m "Import foo-2.3 on the vendor branch"
209c6d6bc19SSimon Schubert.Ed
210c6d6bc19SSimon Schubert.Pp
21173b18b18SAaron LINext, we merge the vendor branch into
21273b18b18SAaron LI.Pa master :
213c6d6bc19SSimon Schubert.Bd -literal -offset 4n
214c6d6bc19SSimon Schubertgit checkout master
21573b18b18SAaron LIgit merge --allow-unrelated-histories vendor/FOO
216c6d6bc19SSimon Schubert.Ed
217c6d6bc19SSimon Schubert.Pp
21873b18b18SAaron LINow you are free to change the sources in
21973b18b18SAaron LI.Pa contrib/foo ,
22073b18b18SAaron LIsince you are back to the
221c6d6bc19SSimon Schubert.Pa master
222c6d6bc19SSimon Schubertbranch.
223c6d6bc19SSimon SchubertThe first thing to do is to add
224c6d6bc19SSimon Schubert.Pa README.DRAGONFLY
225c6d6bc19SSimon Schubertand
226c6d6bc19SSimon Schubert.Pa README.DELETED .
227c6d6bc19SSimon SchubertThe former documents how the imported sources can be obtained, including
22873b18b18SAaron LIbasic information (e.g., version, date, checksum) of the source package.
2291f7cd2b1SMatthias SchmidtThe latter lists all files and directories that have been removed from the
230c6d6bc19SSimon Schubertsource package.
231c6d6bc19SSimon SchubertYou should use the
232c6d6bc19SSimon Schubert.Pa /usr/src/tools/tools/genreadmedeleted/genreadmedeleted
233c6d6bc19SSimon Schubertshell script to generate this file.
234c6d6bc19SSimon SchubertCommit the
235c6d6bc19SSimon Schubert.Pa README Ns s
23673b18b18SAaron LIfirst:
237c6d6bc19SSimon Schubert.Bd -literal -offset 4n
238c6d6bc19SSimon Schubertgit add contrib/foo/README.D*
239c6d6bc19SSimon Schubertgit commit -m "foo: add our READMEs"
240c6d6bc19SSimon Schubert.Ed
241c6d6bc19SSimon Schubert.Pp
24273b18b18SAaron LIAnd then commit your local changes to the sources.
24373b18b18SAaron LIFinally, push
24473b18b18SAaron LI.Pa master
24573b18b18SAaron LIand the vendor branch to the upstream:
246c6d6bc19SSimon Schubert.Bd -literal -offset 4n
247c6d6bc19SSimon Schubertgit push crater master vendor/FOO
248c6d6bc19SSimon Schubert.Ed
249984263bcSMatthew Dillon.Sh SEE ALSO
250c8e8a2e5SSascha Wildner.Xr git 1 Pq Pa devel/git ,
251984263bcSMatthew Dillon.Xr build 7 ,
25271bdc883SThomas Nikolajsen.Xr committer 7 ,
253a63d9f6fSSascha Wildner.Xr release 7
254e827a42cSSascha Wildner.Rs
255a4d7a8cbSSascha Wildner.%T "Documentation on git's page"
256*92db1a35SSascha Wildner.%U "http://git-scm.com/documentation"
257e827a42cSSascha Wildner.Re
258e827a42cSSascha Wildner.Rs
259e827a42cSSascha Wildner.%T "Git Magic"
260*92db1a35SSascha Wildner.%U "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
266c616d378SFranco Fichtner.An Matthew Dillon Aq Mt 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