We collect the deb package. Part 1

    Ubuntu repositories have a huge number of programs and libraries. On the sites of the programs themselves, quite often there are deb packages that can be downloaded and installed. However, there is still a situation where the necessary software is not in the repositories or the site cannot download the package for Ubuntu, or, finally, there is an old version in the repository, but you are not happy with the fact that it contains an annoying bug or lacks the necessary functionality.


    Do not rush to download the sources and do ./configure && make && make install. This will lead to you having a mess from libraries and software installed manually and through apt, which will become very difficult to manage. It is much better to spend more time and prepare a deb package, which you can install later using apt. The advantages of apt over manual installation are obvious.

    Suppose we are in a situation where the next version of Ubuntu or Debian has the program we need, but the current version does not have it in the repository.

    For example, I have Ubuntu 7.10 Gutsy installed on my work computer and I want to install the Guake program . It’s not in the Gutsy repositories. There is no deb package for my version of Ubuntu on the site, so you have to do it yourself.

    Go to packages.ubuntu.comand look for guake on it in the repositories for all versions of Ubuntu; I find a package for Ubuntu 8.10. The greater the difference in ubuntu versions, the greater the likelihood of unexpected problems when backporting. But let’s try, judging by the dependencies of the problems, there should not be too many problems.

    To backport or build from source, we need certain utilities. Before starting work, we will establish the minimum set that will be necessary for this. These are the packages debhelper, dh-make, devscripts, fakeroot, build-essential, automake, gnupg, lintia . I note that for bundling specific software additional compilers, dev versions of libraries, which are probably better to install when needed, will be required.

    After installing the software, we are ready to backport guake.



    1. We will prepare the directory in which we will work:
      konstantin@konstantin-desktop:~$ mkdir -p /tmp/dev/deb/guake
      konstantin@konstantin-desktop:~$ cd !!:2
      cd /tmp/dev/deb/guake
      konstantin@konstantin-desktop:/tmp/dev/deb/guake$

    2. We go to the package page and in the column on the right we find a link to the dsc-file ( guake_0.3.1-3.dsc ). Download the package source code using dget :
      dget archive.ubuntu.com/ubuntu/pool/universe/g/guake/guake_0.3.1-3.dsc
    3. As a result, we have downloaded 3 files with source codes. Unpack the team
      konstantin@konstantin-desktop:/tmp/dev/guake$ dpkg-source -x guake_0.3.1-5.dsc
      gpg: Подпись создана Пнд 01 Сен 2008 08:07:22 VLAST ключом DSA с ID DD899610
      gpg: Не могу проверить подпись: открытый ключ не найден
      dpkg-source: extracting guake in guake-0.3.1
      dpkg-source: unpacking guake_0.3.1.orig.tar.gz
      dpkg-source: applying ./guake_0.3.1-5.diff.gz

    4. Let's move to the new catalog
      konstantin@konstantin-desktop:/tmp/dev/guake$ cd guake-0.3.1/
    5. We carry out dhc -i
      konstantin@konstantin-desktop:/tmp/dev/guake/guake-0.3.1$ dch -i
    6. As a result, the editor on the file guake-0.3.1 / debian / changelog opens. The necessary template text will already be inserted there. it will remain only opposite the asterisk to enter something like

      Backported from Interpid

      guake (0.3.1-5ubuntu1) gutsy; urgency=low

      * Backported from Interpid

      -- Konstantin Mikhaylov Thu, 18 Sep 2008 15:07:30 +1100


    7. We begin the package assembly procedure. Most likely, it will not be possible to assemble the package immediately because of the lack of some libraries. And it happened to me: We see that the assembly requires autoconf, libgtk2.0-dev, intltool, python-gtk2-dev (after completion we can remove them so as not to clog the system). Install them via apt and try to build the package again. If all the packages necessary for the assembly are successfully installed, then the package will be built, including configure, the make file will be processed and the program itself will be compiled.
      konstantin@konstantin-desktop:/tmp/dev/guake/guake-0.3.1$dpkg-buildpackage -rfakeroot



      konstantin@konstantin-desktop:/tmp/dev/guake/guake-0.3.1$ dpkg-buildpackage -rfakeroot
      dpkg-buildpackage: source package is guake
      dpkg-buildpackage: source version is 0.3.1-5ubuntu1
      dpkg-buildpackage: source changed by Konstantin Mikhaylov
      dpkg-buildpackage: host architecture i386
      dpkg-buildpackage: source version without epoch 0.3.1-5ubuntu1
      dpkg-checkbuilddeps: Unmet build dependencies: autoconf libgtk2.0-dev intltool python-gtk2-dev
      dpkg-buildpackage: Build dependencies/conflicts unsatisfied; aborting.
      dpkg-buildpackage: (Use -d flag to override.)



    8. We look what happened
      konstantin@konstantin-desktop:/tmp/dev/guake/guake-0.3.1$ cd ..
      konstantin@konstantin-desktop:/tmp/dev/guake$ ls -l
      итого 702
      drwxr-xr-x 7 konstantin konstantin 984 2008-09-18 15:13 guake-0.3.1
      -rw-r--r-- 1 konstantin konstantin 2584 2008-09-18 15:04 guake_0.3.1-5.diff.gz
      -rw-r--r-- 1 konstantin konstantin 1320 2008-09-18 15:03 guake_0.3.1-5.dsc
      -rw-r--r-- 1 konstantin konstantin 2658 2008-09-18 15:12 guake_0.3.1-5ubuntu1.diff.gz
      -rw-r--r-- 1 konstantin konstantin 552 2008-09-18 15:12 guake_0.3.1-5ubuntu1.dsc
      -rw-r--r-- 1 konstantin konstantin 697 2008-09-18 15:13 guake_0.3.1-5ubuntu1_i386.changes
      -rw-r--r-- 1 konstantin konstantin 212372 2008-09-18 15:13 guake_0.3.1-5ubuntu1_i386.deb
      -rw-r--r-- 1 konstantin konstantin 481572 2008-09-18 15:04 guake_0.3.1.orig.tar.gz

    9. Install the resulting package
      konstantin@konstantin-desktop:/tmp/dev/guake$ sudo dpkg -i guake_0.3.1-5ubuntu1_i386.deb

      and use the program.


    Do I need to continue?

    Also popular now: