Debian
- GNU/Linux distribution
- 1st major distro developed “openly in the spirit of GNU”
- Non-commercial, built collaboratively by over 1,000 volunteers
- Amateur in the best sense: done for the love of it
- 3 main features:
-
Quality Freedom Independence culture of technical excellence
We release when it’s readydevs and users bound by the Social Contract
Promoting the culture of Free Software since 1993no (single) company babysitting Debian
And open decision-making process (do-ocracy + democracy)
Debian packages
- .deb files (binary packages)
- A very powerful and convenient way to distribute software to users
- One of the two most common package formats (with RPM)
- Universal:
- 30,000 binary packages in Debian
→ most of the available free software is packaged in Debian! - For 12 ports (architectures), including 2 non-Linux (Hurd; KFreeBSD)
- Also used by 120 Debian derivative distributions
- 30,000 binary packages in Debian
The Deb package format
- .deb file: an ar archive
- $ ar tv wget_1 .12 -2.1 _i386 . deb
rw -r –r — 0/0 4 Sep 5 15:43 2010 debian – binary
rw -r –r — 0/0 2403 Sep 5 15:43 2010 control . tar . gz
rw -r –r — 0/0 751613 Sep 5 15:43 2010 data . tar . gz - debian-binary: version of the deb file format, “2.0\n”
- control.tar.gz: metadata about the package
control, md5sums, (pre|post)(rm|inst), triggers, shlibs, . . . - data.tar.gz: data files of the package
- $ ar tv wget_1 .12 -2.1 _i386 . deb
- You could create your .deb files manually
http://tldp.org/HOWTO/html_single/Debian-Binary-Package-Building-HOWTO/ - But most people don’t do it that way
Prerequisites
- A Debian (or Ubuntu) system (with root access)
- Some packages:
- build-essential: has dependencies on the packages that will be
assumed to be available on the developer’s machine (no need to
specify them in the Build-Depends: control field of your package)- includes a dependency on dpkg-dev, which contains basic
Debian-specific tools to create packages
- includes a dependency on dpkg-dev, which contains basic
- devscripts: contains many useful scripts for Debian maintainers
- build-essential: has dependencies on the packages that will be
- Many other tools will also be mentioned later, such as debhelper, cdbs, quilt,
pbuilder, sbuild, lintian, svn-buildpackage, git-buildpackage, . . .
Install them when you need them.
Example: rebuilding dash
- Install packages needed to build dash, and devscripts
sudo apt-get build-dep dash
(requires deb-src lines in /etc/apt/sources.list)
sudo apt-get install –no-install-recommends devscripts
fakeroot - 2 Create a working directory, and get in it:
mkdir /tmp/debian-tutorial ; cd /tmp/debian-tutorial - Grab the dash source package
apt-get source dash
(This needs you to have deb-src lines in your /etc/apt/sources.list) - Build the package
cd dash-*
debuild -us -uc (-us -uc disables signing the package with GPG) - Check that it worked
I There are some new .deb files in the parent directory - Look at the debian/ directory
I That’s where the packaging work is done
Source packages
- One source package can generate several binary packages
e.g. the libtar source generates the libtar0 and libtar-dev binary packages - Two kinds of packages: (if unsure, use non-native)
I Native packages: normally for Debian specific software (dpkg, apt)
I Non-native packages: software developed outside Debian - Main file: .dsc (meta-data)
- Other files depending on the version of the source format
I 1.0 or 3.0 (native): package_version.tar.gz
I 1.0 (non-native):
I pkg_ver.orig.tar.gz: upstream source
I pkg_debver.diff.gz: patch to add Debian-specific changes
I 3.0 (quilt):
I pkg_ver.orig.tar.gz: upstream source
I pkg_debver.debian.tar.gz: tarball with the Debian changes
Creating a basic source package
- Download the upstream source
(upstream source = the one from the software’s original developers) - Rename to _.orig.tar.gz (example: simgrid_3.6.orig.tar.gz)
- Untar it
- Rename the directory to – (example: simgrid-3.6)
- cd – && dh_make (from the dh-make package)
- There are some alternatives to dh_make for specific sets of packages:
dh-make-perl, dh-make-php, . . . - debian/ directory created, with a lot of files in it
Files in Debian
All the packaging work should be made by modifying files in debian/
- Main files:
I control – meta-data about the package (dependencies, etc.)
I rules – specifies how to build the package
I copyright – copyright information for the package
I changelog – history of the Debian package - Other files:
I compat
I watch
I dh_install* targets
*.dirs, *.docs, *.manpages, . . .
I maintainer scripts
*.postinst, *.prerm, . . .
I source/format
I patches/ – if you need to modify the upstream sources - Several files use a format based on RFC 822 (mail headers)
0 Comments