Sign in Join
Wiki copytemporary

Debian package source: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

OldNewLine
11Once a [[Debian upstream]] is ready, it is possible to make a source package from it. This is the role of the maintainer.
22
33### Requesting help
44
55You can request that someone would make the source package with an RFP bug: <https://wiki.debian.org/RFP>
66
77It will be useful to the maintainer to know about the dependencies necessary to compile a Lazarus project:
88
99- `fpc, lcl, lazarus` for all projects
1010- `libqt5pas-dev` if the project uses Qt5
1111
1212Though in practice, it is likely that you will have to make the package source yourself. Debian provides a number of tools to build and test a source package, as well as documentation on the process (see Further reading below).
1313
1414### debian directory
1515
1616If you will do the role of the maintainer, or if you would like to check required dependencies, you will need to add the `debian` folder (in lowercase). Here is the minimal structure:
1717
18-`debian`\
19-`  ├─ changelog        # changes with previous version`\
20-`  ├─ control          # description of Debian packages`\
21-`  ├─ copyright        # copyright information of the source code`\
22-`  ├─ rules            # build script`\
23-`  ├─ watch            # file to check for latest version`\
24-`  ├─ source`\
25-`  │   └─ format       # format of this package source`\
26-`  └─ upstream`\
27-`      └─ metadata     # upstream repository information`
18+```text
19+debian
20+ ├─ changelog # changes with previous version
21+ ├─ control # description of Debian packages
22+ ├─ copyright # copyright information of the source code
23+ ├─ rules # build script
24+ ├─ watch # file to check for latest version
25+ ├─ source
26+ │ └─ format # format of this package source
27+ └─ upstream
28+ └─ metadata # upstream repository information
29+```
2830
2931#### changelog
3032
3133The first changelog of your program should be something like (spaces are important):
3234
33-`myproject (1.0-1) unstable; urgency=medium`\
35+```text
36+myproject (1.0-1) unstable; urgency=medium
3437
35-`  * Initial release. (Closes: #ITP_NUMBER)`\
38+ * Initial release. (Closes: #ITP_NUMBER)
3639
37-` -- Firstname Lastname <email@server.com>  Sun, 1 Nov 2020 15:01:00 +0100`
40+ -- Firstname Lastname <email@server.com> Sun, 1 Nov 2020 15:01:00 +0100
41+```
3842
3943Of course you need to specify *myproject*, *ITP_NUMBER*, *Firstname*, *Lastname*, email and date. The version of the upstream program here is supposed to be 1.0 but it can be otherwise. The "-1" specifies the version of the package source as there a may be newer version of the package source but based on the same upstream version, in order to fix bugs for example.
4044
4145You may not have an ITP number yet, as it is a number you will get when you make the request for your package to be added to Debian. If you would like to be the maintainer, here is an example of e-mail to send. In this case the ITP number is 972503: <https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=972503>
4246
4347#### control
4448
4549This file gives all the information on the Debian packages, what is needed to build it, etc. This format is a bit different from the one found inside the [[Debian package structure|.deb files]].
4650
47-`Source: myproject`\
48-`Section: graphics`\
49-`Priority: optional`\
50-`Maintainer: Firstname Lastname <email@server.com>`\
51-`Build-Depends: fpc, lcl, lazarus, libqt5pas-dev, debhelper-compat (= 13)`\
52-`Rules-Requires-Root: no`\
53-`Standards-Version: 4.5.0`\
54-`Homepage: `[`https://mywebsite/myproject`](https://mywebsite/myproject)\
55-`Vcs-Git: `[`https://github.com/myorg/myproject.git`](https://github.com/myorg/myproject.git)\
56-`Vcs-Browser: `[`https://github.com/myorg/myproject`](https://github.com/myorg/myproject)\
51+```text
52+Source: myproject
53+Section: graphics
54+Priority: optional
55+Maintainer: Firstname Lastname <email@server.com>
56+Build-Depends: fpc, lcl, lazarus, libqt5pas-dev, debhelper-compat (= 13)
57+Rules-Requires-Root: no
58+Standards-Version: 4.5.0
59+Homepage: https://mywebsite/myproject
60+Vcs-Git: https://github.com/myorg/myproject.git
61+Vcs-Browser: https://github.com/myorg/myproject
5762
58-`Package: myproject`\
59-`Architecture: any`\
60-`Depends: ${misc:Depends}, ${shlibs:Depends}`\
61-`Conflicts: myoldproject`\
62-`Description: Short description`\
63-` More details, blablabla`
63+Package: myproject
64+Architecture: any
65+Depends: ${misc:Depends}, ${shlibs:Depends}
66+Conflicts: myoldproject
67+Description: Short description
68+ More details, blablabla
69+```
6470
6571Here we suppose it is a graphics application using qt5 and with its repository on GitHub. If the project does not use qt5, you can remove the build-dependency `libqt5pas-dev`.
6672
6773Note that the empty line is important. It introduces one package and there can be multiple packages in one package source, for example one for each widgetset and one common package.
6874
6975#### copyright
7076
7177Basically a copyright file contains a reference to all copyrights in the source code, as well as a global copyright for the package and for the debian folder. If you include custom packages in your upstream (that are statically linked), you need to specify the copyright for them as well. The first part of the file looks like this:
7278
73-`Format: `[`https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/`](https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/)\
74-`Upstream-Name: mypackage`\
75-`Upstream-Contact: Firstname Lastname <email@server.com>`\
76-`Source: `[`https://github.com/myorg/myproject`](https://github.com/myorg/myproject)\
79+```text
80+Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
81+Upstream-Name: mypackage
82+Upstream-Contact: Firstname Lastname <email@server.com>
83+Source: https://github.com/myorg/myproject
7784
78-`Files: *`\
79-`Copyright: 2011-2020 Firstname Lastname <email@server.com>`\
80-`License: GPL-3+`\
85+Files: *
86+Copyright: 2011-2020 Firstname Lastname <email@server.com>
87+License: GPL-3+
8188
82-`Files: debian/*`\
83-`Copyright: 2011-2020 Maintainer <email@server.com>`\
84-`License: GPL-3+`\
89+Files: debian/*
90+Copyright: 2011-2020 Maintainer <email@server.com>
91+License: GPL-3+
8592
86-`Files: custompackage1/*`\
87-`Copyright: 2012 Author <mail@server.com>`\
88-`License: LGPL-2+`
93+Files: custompackage1/*
94+Copyright: 2012 Author <mail@server.com>
95+License: LGPL-2+
96+```
8997
9098Then the file contains an empty line and the description of the licenses. Those descriptions are also separated by empty lines.
9199
92100Make sure you look for all mention of copyright in the source code (using grep or search in files). Even if the code is opensource, it is better to provide the full name of the person that created the files in the first place and the year. This can be needed for legal purposes as writing the copyright statement in a digital file counts as declaring the copyright. It is valid up to 70 years after the death of the copyright owner. This is based on the American legislation though other legislations may apply as well. For example, in French legislation, there is no need to declare a copyright, just being identified as the author is sufficient.
93101
94102File format documentation: <https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/>
95103
96104Complete list of licenses: <https://spdx.org/licenses/> and <https://spdx.org/licenses/exceptions-index.html>
97105
98106##### LGPL-2
99107
100108This is the license for libraries that can be used with commercial projects. With Lazarus, you need to add the linking exception, but it is not part of the SPDX list, so I would add it in the license description (second paragraph).
101109
102-`License: LGPL-2`\
103-` This program is free software; you can redistribute it and/or modify`\
104-` it under the terms of the GNU Lesser General Public License as published`\
105-` by the Free Software Foundation; version 2, with the following modification:`\
106-` .`\
107-` As a special exception, the copyright holders of this library give you`\
108-` permission to link this library with independent modules to produce an`\
109-` executable, regardless of the license terms of these independent modules,`\
110-` and to copy and distribute the resulting executable under terms of your choice,`\
111-` provided that you also meet, for each linked independent module, the terms`\
112-` and conditions of the license of that module. An independent module is a`\
113-` module which is not derived from or based on this library. If you modify this`\
114-` library, you may extend this exception to your version of the library, but`\
115-` you are not obligated to do so. If you do not wish to do so, delete this`\
116-` exception statement from your version.`\
117-` .`\
118-` This program is distributed in the hope that it will be useful,`\
119-` but WITHOUT ANY WARRANTY; without even the implied warranty of`\
120-` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the`\
121-` GNU Lesser General Public License for more details.`\
122-` .`\
123-` You should have received a copy of the GNU Lesser General Public License`\
124-` along with this program; if not, write to the Free Software Foundation,`\
125-` Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.`\
126-` .`\
127-` On Debian systems, the full text of the GNU Lesser General Public`\
128-` License version 2 can be found in the file`\
129-` '/usr/share/common-licenses/LGPL-2'.`
110+``` pascal
111+License: LGPL-2
112+ This program is free software; you can redistribute it and/or modify
113+ it under the terms of the GNU Lesser General Public License as published
114+ by the Free Software Foundation; version 2, with the following modification:
115+ .
116+ As a special exception, the copyright holders of this library give you
117+ permission to link this library with independent modules to produce an
118+ executable, regardless of the license terms of these independent modules,
119+ and to copy and distribute the resulting executable under terms of your choice,
120+ provided that you also meet, for each linked independent module, the terms
121+ and conditions of the license of that module. An independent module is a
122+ module which is not derived from or based on this library. If you modify this
123+ library, you may extend this exception to your version of the library, but
124+ you are not obligated to do so. If you do not wish to do so, delete this
125+ exception statement from your version.
126+ .
127+ This program is distributed in the hope that it will be useful,
128+ but WITHOUT ANY WARRANTY; without even the implied warranty of
129+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
130+ GNU Lesser General Public License for more details.
131+ .
132+ You should have received a copy of the GNU Lesser General Public License
133+ along with this program; if not, write to the Free Software Foundation,
134+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
135+ .
136+ On Debian systems, the full text of the GNU Lesser General Public
137+ License version 2 can be found in the file
138+ '/usr/share/common-licenses/LGPL-2'.
139+```
130140
131141##### LGPL-2+
132142
133143Same as above, but not limited to version 2.
134144
135-`License: LGPL-2+`\
136-` This program is free software; you can redistribute it and/or modify`\
137-` it under the terms of the GNU Lesser General Public License as published`\
138-` by the Free Software Foundation; either version 2 of the License, or`\
139-` (at your option) any later version, with the following modification:`\
140-` .`\
141-` As a special exception, the copyright holders of this library give you`\
142-` permission to link this library with independent modules to produce an`\
143-` executable, regardless of the license terms of these independent modules,`\
144-` and to copy and distribute the resulting executable under terms of your choice,`\
145-` provided that you also meet, for each linked independent module, the terms`\
146-` and conditions of the license of that module. An independent module is a`\
147-` module which is not derived from or based on this library. If you modify this`\
148-` library, you may extend this exception to your version of the library, but`\
149-` you are not obligated to do so. If you do not wish to do so, delete this`\
150-` exception statement from your version.`\
151-` .`\
152-` This program is distributed in the hope that it will be useful,`\
153-` but WITHOUT ANY WARRANTY; without even the implied warranty of`\
154-` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the`\
155-` GNU Lesser General Public License for more details.`\
156-` .`\
157-` You should have received a copy of the GNU Lesser General Public License`\
158-` along with this program; if not, write to the Free Software Foundation,`\
159-` Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.`\
160-` .`\
161-` On Debian systems, the full text of the GNU Lesser General Public`\
162-` License version 2 can be found in the file`\
163-` '/usr/share/common-licenses/LGPL-2'.`
145+``` pascal
146+License: LGPL-2+
147+ This program is free software; you can redistribute it and/or modify
148+ it under the terms of the GNU Lesser General Public License as published
149+ by the Free Software Foundation; either version 2 of the License, or
150+ (at your option) any later version, with the following modification:
151+ .
152+ As a special exception, the copyright holders of this library give you
153+ permission to link this library with independent modules to produce an
154+ executable, regardless of the license terms of these independent modules,
155+ and to copy and distribute the resulting executable under terms of your choice,
156+ provided that you also meet, for each linked independent module, the terms
157+ and conditions of the license of that module. An independent module is a
158+ module which is not derived from or based on this library. If you modify this
159+ library, you may extend this exception to your version of the library, but
160+ you are not obligated to do so. If you do not wish to do so, delete this
161+ exception statement from your version.
162+ .
163+ This program is distributed in the hope that it will be useful,
164+ but WITHOUT ANY WARRANTY; without even the implied warranty of
165+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
166+ GNU Lesser General Public License for more details.
167+ .
168+ You should have received a copy of the GNU Lesser General Public License
169+ along with this program; if not, write to the Free Software Foundation,
170+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
171+ .
172+ On Debian systems, the full text of the GNU Lesser General Public
173+ License version 2 can be found in the file
174+ '/usr/share/common-licenses/LGPL-2'.
175+```
164176
165177##### LGPL-3-linking-exception
166178
167179The version 3 has a specific name when there is the linking exception.
168180
169-`License: LGPL-3-linking-exception`\
170-` This program is free software; you can redistribute it and/or modify`\
171-` it under the terms of the GNU Lesser General Public License as published`\
172-` by the Free Software Foundation; version 3, with the following modification:`\
173-` .`\
174-` As a special exception, the copyright holders of this library give you`\
175-` permission to link this library with independent modules to produce an`\
176-` executable, regardless of the license terms of these independent modules,`\
177-` and to copy and distribute the resulting executable under terms of your choice,`\
178-` provided that you also meet, for each linked independent module, the terms`\
179-` and conditions of the license of that module. An independent module is a`\
180-` module which is not derived from or based on this library. If you modify this`\
181-` library, you may extend this exception to your version of the library, but`\
182-` you are not obligated to do so. If you do not wish to do so, delete this`\
183-` exception statement from your version.`\
184-` .`\
185-` This program is distributed in the hope that it will be useful,`\
186-` but WITHOUT ANY WARRANTY; without even the implied warranty of`\
187-` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the`\
188-` GNU Lesser General Public License for more details.`\
189-` .`\
190-` You should have received a copy of the GNU Lesser General Public License`\
191-` along with this program; if not, write to the Free Software Foundation,`\
192-` Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.`\
193-` .`\
194-` On Debian systems, the full text of the GNU Lesser General Public`\
195-` License version 3 can be found in the file`\
196-` '/usr/share/common-licenses/LGPL-3'.`
181+``` pascal
182+License: LGPL-3-linking-exception
183+ This program is free software; you can redistribute it and/or modify
184+ it under the terms of the GNU Lesser General Public License as published
185+ by the Free Software Foundation; version 3, with the following modification:
186+ .
187+ As a special exception, the copyright holders of this library give you
188+ permission to link this library with independent modules to produce an
189+ executable, regardless of the license terms of these independent modules,
190+ and to copy and distribute the resulting executable under terms of your choice,
191+ provided that you also meet, for each linked independent module, the terms
192+ and conditions of the license of that module. An independent module is a
193+ module which is not derived from or based on this library. If you modify this
194+ library, you may extend this exception to your version of the library, but
195+ you are not obligated to do so. If you do not wish to do so, delete this
196+ exception statement from your version.
197+ .
198+ This program is distributed in the hope that it will be useful,
199+ but WITHOUT ANY WARRANTY; without even the implied warranty of
200+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
201+ GNU Lesser General Public License for more details.
202+ .
203+ You should have received a copy of the GNU Lesser General Public License
204+ along with this program; if not, write to the Free Software Foundation,
205+ Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
206+ .
207+ On Debian systems, the full text of the GNU Lesser General Public
208+ License version 3 can be found in the file
209+ '/usr/share/common-licenses/LGPL-3'.
210+```
197211
198212##### GPL-3+
199213
200214This is the recommended license when possible.
201215
202-`License: GPL-3+`\
203-` This program is free software; you can redistribute it and/or modify`\
204-` it under the terms of the GNU General Public License as published by`\
205-` the Free Software Foundation; either version 3 of the License, or`\
206-` (at your option) any later version. `\
207-` .`\
208-` This program is distributed in the hope that it will be useful,`\
209-` but WITHOUT ANY WARRANTY; without even the implied warranty of`\
210-` MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the`\
211-` GNU General Public License for more details.`\
212-` .`\
213-` You should have received a copy of the GNU General Public License along`\
214-` with this program; if not, write to the Free Software Foundation, Inc.,`\
215-` 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.`\
216-` .`\
217-` On Debian systems, the full text of the GNU General Public`\
218-` License version 3 can be found in the file`\
219-` '/usr/share/common-licenses/GPL-3'.`
216+``` pascal
217+License: GPL-3+
218+ This program is free software; you can redistribute it and/or modify
219+ it under the terms of the GNU General Public License as published by
220+ the Free Software Foundation; either version 3 of the License, or
221+ (at your option) any later version.
222+ .
223+ This program is distributed in the hope that it will be useful,
224+ but WITHOUT ANY WARRANTY; without even the implied warranty of
225+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
226+ GNU General Public License for more details.
227+ .
228+ You should have received a copy of the GNU General Public License along
229+ with this program; if not, write to the Free Software Foundation, Inc.,
230+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
231+ .
232+ On Debian systems, the full text of the GNU General Public
233+ License version 3 can be found in the file
234+ '/usr/share/common-licenses/GPL-3'.
235+```
220236
221237#### rules
222238
223239The `rules` file contains build instructions. If you are building a simple package, it will be the following:
224240
225-`#!/usr/bin/make -f`\
241+```text
242+#!/usr/bin/make -f
226243
227-`# see FEATURE AREAS in dpkg-buildflags(1)`\
228-`export DEB_BUILD_MAINT_OPTIONS = hardening=+all`\
244+# see FEATURE AREAS in dpkg-buildflags(1)
245+export DEB_BUILD_MAINT_OPTIONS = hardening=+all
229246
230-`%:`\
231-`   dh $@ --no-parallel`
247+%:
248+ dh $@ --no-parallel
249+```
232250
233251The `--no-parallel` flag is needed to avoid potential problems with parallel builds.
234252
235253#### watch
236254
237255The `watch` file explains how to check for latest version. For example, on GitHub, that would be:
238256
239-`version=4`\
240-`opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/myproject-$1\.tar\.gz/ \`\
241-`  `[`https://github.com/myorg/myproject/tags`](https://github.com/myorg/myproject/tags)` .*/v?(\d\S+)\.tar\.gz`
257+```text
258+version=4
259+opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/myproject-$1\.tar\.gz/ \
260+ https://github.com/myorg/myproject/tags .*/v?(\d\S+)\.tar\.gz
261+```
242262
243263The version 4 is the for the file format, not your program. You need to change the *myorg* and *myproject* to your actual project.
244264
245265See documentation: <https://wiki.debian.org/debian/watch>
246266
247267#### source/format
248268
249269At the moment of this writing, it is:
250270
251-`3.0 (quilt)`
271+```text
272+3.0 (quilt)
273+```
252274
253275#### upstream/metadata
254276
255277For a project on GitHub, that would be:
256278
257-`Bug-Database: `[`https://github.com/myorg/myproject/issues`](https://github.com/myorg/myproject/issues)\
258-`Bug-Submit: `[`https://github.com/myorg/myproject/issues/new`](https://github.com/myorg/myproject/issues/new)\
259-`Repository: `[`https://github.com/myorg/myproject.git`](https://github.com/myorg/myproject.git)\
260-`Repository-Browse: `[`https://github.com/myorg/myproject`](https://github.com/myorg/myproject)
279+```text
280+Bug-Database: https://github.com/myorg/myproject/issues
281+Bug-Submit: https://github.com/myorg/myproject/issues/new
282+Repository: https://github.com/myorg/myproject.git
283+Repository-Browse: https://github.com/myorg/myproject
284+```
261285
262286You may need to change those path according to the tools you are using.
263287
264288### Further reading
265289
266290- <https://wiki.debian.org/BuildingTutorial>
267291- <https://www.debian.org/doc/manuals/maint-guide/first.en.html>
268292- <https://lintian.debian.org/tags.html> and <https://lintian.debian.org/sources/fpc>
269293
270294---
271295*From the Free Pascal wiki, page "Debian package source", as it stood on 2022-01-22 after a change by Kai Burghardt, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*

Back to history