Difference between revisions of "Debian package source"

From Lazarus wiki
Jump to navigationJump to search
(→‎watch: format)
(→‎source/format: metadata)
Line 171: Line 171:
 
At the moment of this writing, it is:
 
At the moment of this writing, it is:
 
  3.0 (quilt)
 
  3.0 (quilt)
 +
 +
==== upstream/metadata ====
 +
 +
For a project on GitHub, that would be:
 +
Bug-Database: https://github.com/myorg/myproject/issues
 +
Bug-Submit: https://github.com/myorg/myproject/issues/new
 +
Repository: https://github.com/myorg/myproject.git
 +
Repository-Browse: https://github.com/myorg/myproject
 +
 +
You may need to change those path according to the tools you are using.

Revision as of 16:29, 1 November 2020

One a Debian upstream is ready, it is possible to make a package source from it. This is the role of the maintainer.

Requesting help

You can request one with an RFP bug: https://wiki.debian.org/RFP

It will be useful to the maintainer to know about the dependencies necessary to compile a Lazarus project:

  • fpc, lcl, lazarus for all projects
  • libqt5pas-dev if the project uses Qt5

debian directory

If 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:

debian
  ├─ changelog        # changes with previous version
  ├─ control          # description of Debian packages
  ├─ copyright        # copyright information of the source code
  ├─ rules            # build script
  ├─ watch            # file to check for latest version
  ├─ source
  │   └─ format       # format of this package source
  └─ upstream
      └─ metadata     # upstream repository information

changelog

The first changelog of your program should be something like (spaces are important):

myproject (1.0-1) unstable; urgency=medium

  * Initial release. (Closes: #ITP_NUMBER)

 -- Firstname Lastname <email@server.com>  Sun, 1 Nov 2020 15:01:00 +0100

Of 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.

You 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

control

This 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 .deb files.

Source: myproject
Section: graphics
Priority: optional
Maintainer: Firstname Lastname <email@server.com>
Build-Depends: fpc, lcl, lazarus, libqt5pas-dev, debhelper-compat (= 13)
Rules-Requires-Root: no
Standards-Version: 4.5.0
Homepage: https://mywebsite/myproject
Vcs-Git: https://github.com/myorg/myproject.git
Vcs-Browser: https://github.com/myorg/myproject

Package: myproject
Architecture: any
Depends: ${misc:Depends}, ${shlibs:Depends}
Conflicts: myoldproject
Description: Short description
 More details, blablabla

Here 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.

Note 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.

copyright

Basically 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. The first part of the file looks like this:

Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: mypackage
Upstream-Contact: Firstname Lastname <email@server.com>
Source: https://github.com/myorg/myproject

Files: *
Copyright: 2011-2020 Firstname Lastname <email@server.com>
License: GPL-3+

Files: debian/*
Copyright: 2011-2020 Maintainer <email@server.com>
License: GPL-3+

Files: custompackage1/*
Copyright: 2012 Author <mail@server.com>
License: LGPL-2+

Then the file contains a new line and the description of the licenses:

License: LGPL-2
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published
 by the Free Software Foundation; version 2.
 .
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU Lesser General Public License for more details.
 .
 You should have received a copy of the GNU Lesser General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 .
 On Debian systems, the full text of the GNU Lesser General Public
 License version 2 can be found in the file
 '/usr/share/common-licenses/LGPL-2'.

License: LGPL-2+
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU Lesser General Public License as published
 by the Free Software Foundation; either version 2 of the License, or
 (at your option) any later version. 
 .
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU Lesser General Public License for more details.
 .
 You should have received a copy of the GNU Lesser General Public License
 along with this program; if not, write to the Free Software Foundation,
 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 .
 On Debian systems, the full text of the GNU Lesser General Public
 License version 2 can be found in the file
 '/usr/share/common-licenses/LGPL-2'.

License: GPL-3+
 This program is free software; you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation; either version 3 of the License, or
 (at your option) any later version. 
 .
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 GNU General Public License for more details.
 .
 You should have received a copy of the GNU General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 .
 On Debian systems, the full text of the GNU General Public
 License 

Make sure you look for all mention of copyright in the source code (using grep or search in files).

See documentation: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

rules

The rules file contains build instructions. If you are building a simple package, it will be the following:

#!/usr/bin/make -f

# see FEATURE AREAS in dpkg-buildflags(1)
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@ --no-parallel

The --no-parallel flag is needed to avoid potential problems with parallel builds.

watch

The watch file explains how to check for latest version. For example, on GitHub, that would be:

version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/myproject-$1\.tar\.gz/ \
  https://github.com/myorg/myproject/tags .*/v?(\d\S+)\.tar\.gz

The version 4 is the for the file format, not your program. You need to change the myorg and myproject to your actual project.

See documentation: https://wiki.debian.org/debian/watch

source/format

At the moment of this writing, it is:

3.0 (quilt)

upstream/metadata

For a project on GitHub, that would be:

Bug-Database: https://github.com/myorg/myproject/issues
Bug-Submit: https://github.com/myorg/myproject/issues/new
Repository: https://github.com/myorg/myproject.git
Repository-Browse: https://github.com/myorg/myproject

You may need to change those path according to the tools you are using.