📜 ⬆️ ⬇️

We collect deb-package. Part 1

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


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

Suppose we are in a situation where in the next version of Ubuntu or Debian there is a program we need, and in the current version it is not in the repository.
')
For example, I have Ubuntu 7.10 Gutsy installed on my computer and I want to install Guake . In the Gutsy repositories it is not. There is no deb-package site for my version of Ubuntu, so you have to do it yourself.

Go to the packages.ubuntu.com website and look for guake in it in the repositories for all versions of Ubuntu; I discover a package for Ubuntu 8.10. The greater the difference in the versions of ubunt, the greater the likelihood of obtaining unexpected problems during backporting. But let's try, judging by the dependencies of the problems should not be too much.

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

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



  1. Prepare a 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. Go to the package page and in the column on the right find the link to the dsc file ( guake_0.3.1-3.dsc ). Downloading package source code with 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 command
    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. Go to the new directory
    konstantin@konstantin-desktop:/tmp/dev/guake$ cd guake-0.3.1/
  5. Execute dhc -i
    konstantin@konstantin-desktop:/tmp/dev/guake/guake-0.3.1$ dch -i
  6. This will open the editor on the guake-0.3.1 / debian / changelog file. There will already be inserted the necessary template text. it will be just opposite the asterisk to write something like

    Backported from Interpid

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

    * Backported from Interpid

    -- Konstantin Mikhaylov <konstantin@konstantin-desktop> Thu, 18 Sep 2008 15:07:30 +1100


  7. Begin the package building procedure
    konstantin@konstantin-desktop:/tmp/dev/guake/guake-0.3.1$dpkg-buildpackage -rfakeroot


    Most likely, it will not be possible to assemble the package immediately because of the absence of some libraries. It happened to me:
    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 <konstantin@konstantin-desktop>
    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.)


    We see that the build requires autoconf, libgtk2.0-dev, intltool, python-gtk2-dev (after completion we can remove them so as not to clutter up the system). Install them through apt and try again to build the package. If all the packages necessary for the build are successfully installed, the build will start, including configure, the makefile will be processed and the program itself will be compiled.
  8. 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 received package
    konstantin@konstantin-desktop:/tmp/dev/guake$ sudo dpkg -i guake_0.3.1-5ubuntu1_i386.deb

    and use the program.


Do I need a sequel?

Source: https://habr.com/ru/post/40183/


All Articles