Wiki Table of Contents

Backporting for beginners

[In process]

This document represents material first composed abd posted in 2009 by Mepis user Brooko, now updated for use in antiX and MX Linux.

Environment and Preconfiguration
Make sure you have gone through the Package building guide and install the applications from the Software (Essential) section. You only need to do this once.

Repositories
The repos I have enabled (in my sources list) are:
deb ftp://ftp.mepis.com/mepis/ mepis-8.0 main
deb ftp://ftp.nz.debian.org/debian/ lenny main contrib non-free
deb http://security.debian.org/ lenny/updates main contrib non-free
deb http://volatile.debian.org/debian-volatile/ lenny/volatile main contrib non-free
deb http://main.mepis-deb.org/mepiscr/repo/ mepis8cr main non-free
[color=”Red”]No multimedia, no squeeze or sid, no Test repo.[/color]

Getting the package
The package we’ve chosen is Icedove. The latest version is 2.0.0.22. The place to look for it is packages.debian.org. Here’s a result of searching for the package. Generally I avoid experimental unless there is no other choice. Current package in lenny is 2.0.0.19-1 The version in sid is 2.0.0.22-1 which is what we want. So clicking on the link takes us to the sid page. The links for the downloads we want are on the right hand side of the page. The 3 files we need to download are:
[icedove_2.0.0.22-1.dsc]
[icedove_2.0.0.22.orig.tar.gz]
[icedove_2.0.0.22-1.diff.gz]
I’ve created a folder in my new build environment – called ‘build’, so I’ve downloaded them all there.

  1. The easiest way to start this is to open konqueror in the directory we have the packages (eg our [color=”Green”]/build[/color] directory). In the konqueror window, press F4, and it will open a konsole already in that diretory. Neat huh?
  2. At the command prompt, dpkg-source -x nameofdscfile. If you just go dpkg-source -x and hit <tab> it should automatically fill in for you ([color=”Navy”]hint make sure there is a space after the -x before you hit tab[/color]). This will give us the command
    Quote:
    dpkg-source -x icedove_2.0.0.22-1.dsc

    Go ahead and press <Enter>. It will give some info about signatures etc – and then it extracts the source archive, unpacks it, and applies the diff file. So in your konqueror window, you’ll see a new directory [color=”#008000″]/icedove-2.0.0.22[/color]
    The reason the dsc file and diff file are important is that as well as unpacking the source, they’ve also applied a preconfigured debian folder which is where the magic happens for the debianisation.

  3. Our next step in konsole is to change to the new directory. Go cd icedove-2.0.0.22/ or hit cd <space> <tab> which will autofill the directory name. Hit enter. You should now be in directory [color=”#008000″]/build/icedove-2.0.0.22[/color]
  4. Now we have to alter the debian changelog. To do this we’ll use nano in konsole. You may not even know what nano is, but don’t worry. The command to do this is simply –
    dch -i <enter> ([color=”Navy”]that’s i as in igloo[/color])

    Ok – see pics for before and after shots of editing. I move around with my arrow keys, and I can delete and backspace. This is debian’s changelog and is very important – especially for the repo.

    Where the asterisk is, I want to write what I am changing with this package. So for the repo I add:
    New upstream release
    – repackaged For Mepis 8
    – added lzma compression
    ([color=”Navy”]Comment – you can skip this line for your own private builds[/color])

    In the top line, I need to change
    icedove (2.0.0.22-2) unstable; urgency=low
    to
    icedove (2.0.0.22-1mlrepo1) mepis; urgency=low

    You’ll note that it already filled in my name and email for the repo – it got this info from the preconfiguration step earlier.

    The reason for the change to the top line is the actual version is 2.0.0.22-1. The command dch -i increments the version by one in preparation for a new release. As we are only backporting, we want to keep the same version – but I have to add mlrepo1 to signify a community repo build and the release ‘mepis‘ as that is what is used in our repository.

    To save the file, I now hit <ctrl> X, and I am prompted to save, so I hit “Y” and enter – this overwrites the original file with the updated version (keeps same name).
    Before
    Image
    After
    Image

  1. Now I’m back with a command prompt – so I want to change to the debian folder, edit the control file, save it, then return back to this directory again. We’ll do it with this one command:
    cd debian && kwrite control && cd ..

    The control file opens in kwrite. This gives me a chance to change dependencies, alter settings etc. All we really want to do is change a couple of names. So the section 4th and 5th lines down, I want to change from:

    Quote:
    Maintainer: Ubuntu Mozilla Team <ubuntu-mozillateam@lists.ubuntu.com>
    Uploaders: Alexander Sack <asac@debian.org>, Michael Casadevall <sonicmctails@gmail.com>, Fabien Tassin <fta@ubuntu.com>

    to:

    Quote:
    Maintainer: Paul Brooks <maintainer@mepiscommunity.org>
    XSBC-Original-Maintainer: Ubuntu Mozilla Team <ubuntu-mozillateam@lists.ubuntu.com>
    Uploaders: Alexander Sack <asac@debian.org>, Michael Casadevall <sonicmctails@gmail.com>, Fabien Tassin <fta@ubuntu.com>

    This simply keeps the records straight and will also show in synaptic when our package is actually installed. You would obviously use your own name!

    I don’t change anything else in this file unless I absolutely have to (ie unless I know what I am doing). I won’t elaborate any more with this exercise – it is after all a basic guide.

    Save the file and close kwrite.
     

  2. The next bit you can skip – but it’s important for our maintainers. Icedove is a hefty package when completed, so we want to make it as small as possible to save you bandwidth when downloading. We know Mepis ships with lzma already enabled, so we’ll use it to compress these debs during the build. To do this (with this package), I’m going to change to the debian directory again and edit the rules file.
    cd debian && kwrite rules && cd ..
    Iceweasel uses the CDBS (common debian system build) rules, so to add compression, I add the line
    DEB_DH_BUILDDEB_ARGS := — -Z lzma

    Just for ref – here’s where I added it. The section
     

    Quote:
    DEBIAN_MOZ_UPSTREAM_APPLICATION := thunderbird

    # These are used for cross-compiling and for saving the configure script

    becomes
     

    Quote:
    DEBIAN_MOZ_UPSTREAM_APPLICATION := thunderbird

    DEB_DH_BUILDDEB_ARGS := — -Z lzma

    # These are used for cross-compiling and for saving the configure script

    Save and close the file.
     

  3. Now we need to change user to root and install the build dependencies
    su
    <your password>

    (Hint the last part of your prompt should now look like this [color=”Green”]/build/icedove-2.0.0.22][/color][color=”Red”]#[/color])

    We want to use an application called pbuilder. The command as root is:
    /usr/lib/pbuilder/pbuilder-satisfydepends

    It will download and install all the build dependencies required to build the package. To do this it refers to the control file, creates a dummy package, and then downloads and installs all the required build packages – but makes them dependencies of the newly created pbuilder-satisfydepends-dummy.

    After it finishes downloading and installing the dependencies, your last 3 lines should look something like this:

    Quote:
    Current status: 0 broken [-1].
    -> Finished parsing the build-deps
    root[/home/brooko/build/icedove-2.0.0.22]#

    ([color=”Navy”]Hint: if you got an error at this stage, then the build dependencies could not be satisfied, and you may need to backport other packages first to meet the requirements. For Icedove, this should not be an issue[/color]).

    Now we have to switch back to user again, so we simply type
    exit

  4. Now to compile the app and build the packages. The last part of your command prompt should read:
    [color=”Green”]build/icedove-2.0.0.22]$[/color]
    Our next command is
    dpkg-buildpackage -rfakeroot -us -uc -sa

    This is going to create a fakeroot environment, compile and build the packages. The -us means don’t sign the source package (you can omit this if you have a gpg key and want to sign). The -uc means don’t sign the changes file (you can omit this if you use a gpg key and want to sign). The -sa signifies that we want to build full source files with the build (required for our repository – not for a personal backport).

    Go ahead and run the command. Now depending on the speed of your processor, you can go and make a cup of tea about now, and let the compile and build run.
     

  5. At the end of the compile, you should have something like the following:
    Quote:
    dpkg-genchanges: including full source code in upload
    dpkg-buildpackage: full upload (original source is included)
    brooko[~/Build/build/icedove-2.0.0.22]$
  6. Once it has finished, if you look in your /build directory, you should now have (if you built with full source):
    Congratulations, you’ve built your first backport.

    ([color=”Navy”]Note – if I now open synaptic, I can see a package called pbuilder-satisfydepends-dummy installed. If I uninstall that, after the install has completed, I can then remove all the obsolete build dependencies (after removing it, the actual dependencies appear as autoremovable[/color]).
     

    • Directory – icedove-2.0.0.22 (the compile directory – you can delete this)
    • file – icedove_2.0.0.22-1.diff.gz
    • file – icedove_2.0.0.22-1.dsc
    • file – icedove_2.0.0.22-1mlrepo1.diff.gz
    • file – icedove_2.0.0.22-1mlrepo1.dsc
    • file – icedove_2.0.0.22-1mlrepo1_i386.changes
    • file – icedove_2.0.0.22-1mlrepo1_i386.deb
    • file – icedove_2.0.0.22.orig.tar.gz
    • file – icedove-dbg_2.0.0.22-1mlrepo1_i386.deb
    • file – icedove-dev_2.0.0.22-1mlrepo1_i386.deb
    • file – icedove-gnome-support_2.0.0.22-1mlrepo1_i386.deb
  7. NOTE – FOR THE REPO only ….
    My next step now is to copy the:
    icedove_2.0.0.22-1mlrepo1.dsc
    icedove_2.0.0.22-1mlrepo1.diff.gz
    icedove_2.0.0.22.orig.tar.gz
    to my 64bit environment’s build. With the 64bit, I expand the package with
    dpkg-source -x icedove_2.0.0.22-1mlrepo1.dsc ([color=”Navy”]note the change in the naming – that’s because the diff and dsc includes my changes now from the build we’ve just done[/color]). This time I don’t need to alter the changelog, or the control file, or the rules file. it’s all already done. All I have to do is change to the icedove directory
    cd icedove-2.0.0.22/
    change to root and install the dependencies
    su
    <your password>

    /usr/lib/pbuilder/pbuilder-satisfydepends

    change back to user
    exit

    Now build – but this time I don’t want the source files, or any shared files, so my command is:
    dpkg-buildpackage -rfakeroot -us -uc -B
    All I will get this time is the 64b deb files and the amd64 changes file.


v. 20150908

Leave a Comment

Do NOT follow this link or you will be banned from the site!