The computer they prefer!
DoudouLinuxThe computer they prefer!
The site's languages [ar] [cs] [de] [en] [es] [fa] [fr] [it] [ms] [nl] [pt] [pt_br] [ro] [ru] [sr] [sr@latin] [th] [uk] [vi] [zh]
All the versions of this article: [English] [русский]
Some applications are using tons of data files, which then leads to very large Debian packages that use a lot of disk space. We have identified two ways to reduce the required disk space: resampling files or removing some of them. The second alternatives supposes that we are able to split a package into small sub-packages. As we are about to see, this is not that complicated :).
The first step of course is to fetch the source code of the package from Debian repositories. To do this, there is a very convenient command apt-get source [1]. As a Debian source package is made of several source files, it is better to create a directory per application:
$ mkdir <pkgname> $ cd <pkgname> $ apt-get source <pkgname>
This will fetch the source package then build the source code of the application patched by Debian developers. The source code directory should be named <pkgname>-<version>, where version is usually x.x or x.x.x, for example 3.2 or 5.2.4.
Splitting a Debian package is not complicated. First of all, you need to locate the path of package data files. You can either open the binary Debian package (this is a compressed archive file), or build the Debian package from within its source code directory:
$ cd <pkgname>-<version> $ dpkg-buildpackage
This will create a directory in the directory debian/ which will contains all the files of the binary package. The name of this directory is usually <pkgname>.
Now you can start to split the package. The principle is very simple, in the directory debian/:
Details are given in the following paragraphs.
The files <pkgname>-<part>.install contain the full paths of files or directories to be copied into the sub-package, one per line. For example, the main TBO package contains in its file tbo.install:
/usr/bin /usr/share/tbo/icons /usr/share/tbo/ui
while the common data package tbo-common-data.install contains:
/usr/share/applications /usr/share/pixmaps /usr/share/locale /usr/share/tbo/tutorial.pdf /usr/share/tbo/tut.tbo /usr/share/tbo/icon.png
The control file sets package information such as dependencies, target architecture or description. Several information block need to be added to match the .install files (one block per file). Of course dependencies may need to be adjusted differently per sub-package. For example for TBO, the first four package information blocks are:
Package: tbo Architecture: any Depends: ${shlibs:Depends}, libgtk2.0-0, ${misc:Depends}, tbo-common-data, tbo-data-doodle-bubble Recommends: tbo-data-accesories, tbo-data-arcadia, tbo-data-bubble, tbo-data-political, tbo-data-tbo Suggests: tbo-data-dgm, tbo-data-doodle1, tbo-data-facilware, tbo-data-guadalinex, tbo-data-linuxhispano, tbo data-southpark Description: Intuitive GNOME comic creator TBO is a simple and easy drag and drop comic creator. It uses a libray of SVG draws as input to make the comic frames. . This package provides the core program without SVG libraries. Libraries are installed by the packages named tbo-data-doodle-*. Package: tbo-data-doodle-all Architecture: all Depends: tbo, tbo-data-accesories, tbo-data-arcadia, tbo-data-bubble, tbo-data-political, tbo-data-tbo, tbo-data-dgm, tbo-data-doodle1, tbo-data-facilware, tbo-data-guadalinex, tbo-data-linuxhispano, tbo-data-southpark Description: Intuitive GNOME comic creator TBO is a simple and easy drag and drop comic creator. It uses a libray of SVG draws as input to make the comic frames. . This package is a meta package that will install all the TBO SVG libraries. Package: tbo-common-data Architecture: all Depends: tbo Description: Intuitive GNOME comic creator TBO is a simple and easy drag and drop comic creator. It uses a libray of SVG draws as input to make the comic frames. . This package provides the common data of the program, without any SVG libraries. Libraries are installed by the packages named tbo-data-doodle-*. Package: tbo-data-doodle-accesories Architecture: all Depends: tbo Description: Intuitive GNOME comic creator TBO is a simple and easy drag and drop comic creator. It uses a libray of SVG draws as input to make the comic frames. . This package provides the SVG library subset named accesories.
This file summarizes the changes of the packages and defines its version number. It is better to change the version number as soon as anything is modified. The convention for DoudouLinux is to append doudouN, where N is a number, to the official package version. For example the package plymouth 0.8.3-20 would become plymouth 0.8.3-20doudou1. This is done by adding this kind of information to changelog:
tbo (0.98~git20110321-0doudou2) unstable; urgency=low * Split package into core and data sets. -- Bob Author <bob.author@doudoulinux.org> Sat, 19 Nov 2011 17:24:12 +0100
You will have to write the correct summary of your changes, as well as to set your real name and email ;).
Rebuilding a Debian binary package is quite simple, the commands were indicated above:
$ cd <pkgname>-<version> $ dpkg-buildpackage
Note that this will build both source and binary packages. A source package is a file *.dsc which contains references to one or two other files. These files are the original source code of the application, a file *.orig.tar.gz, and the eventual Debian patches that were applied to the original source code.
[1] You need to have declared source repositories in your file @/etc/apt-/sources.list@. These repositories start with deb-src in this file.
Copyright © DoudouLinux.org team - All texts from this site are published under the license Creative Commons BY-SA