# Linux – Fail to re-build package with debuild

builddebianlinuxrebuildthunar

In order to build the package 'thunar' in debian-wheezy I did the following steps:

sudo apt-get build-dep thunar
sudo apt-get source thunar
cd thunar-1.2.3/debian
sudo debuild -uc -us


Till here everything works fine. Some .dep packages are produced which i can install via dpkg.

Now I would like to modify the source-code and run the build again … however I am not even able to just clean + rebuild. I tried the following:

sudo debuild clean
sudo debuild -uc -us


Already the clean-command warns me that the deletion for many files was ignored. Than many local changes are recognized and I am suggested to use 'dpkg-source –commit' to integrate these changes … actually I did not touch anything yet.
Even if I follow the suggestion, I get the following error at the end of the build:

....
make: *** [binary] Fehler 2
dpkg-buildpackage: Fehler: Fehler-Exitstatus von fakeroot debian/rules binary war 2
debuild: fatal error at line 1357:
dpkg-buildpackage -rfakeroot -D -us -uc failed


I as well tried to execute the single steps as normal user, not as sudo … however in that case even the first 'debuild -uc -us' fails.

Did I do something wrong ? How you would trigger a build + rebuild ? Or maybe is it a problem of the package 'thunar' ?

• Ok, after reading some more tutorials, I figured out how at least a modification + build of it can be done. I first tried this official debian tutorial, which seems to be too old ( dpatch does not work as described ) Than I took a try for this 3rd party tutorial which uses quilt to build the patch and debuild for building the package. It seems to work better.

I am now able to build a patch for the package thunar and install it ... here the needed steps:

# get some packages, needed to do a build from source
sudo apt-get install quilt build-essential fakeroot devscripts

# get the needed build dependencies of thunar
sudo apt-get build-dep thunar

# get the sources of thunar (no sudo!)
apt-get source thunar

# enter the sources
cd thunar-1.2.3

# define a patch dir for quilt
export QUILT_PATCHES=debian/patches

# apply all available thunar patches
quilt push -a

# add my own patch ( increase the trailing number in the name ! )
quilt new 03_myTestPatch.patch

# add files which you are going to modify

# modify file ( I just added a comment in my first try, nano is the editor of my choice)
# if your editor creates temporary files( e.g. main.c~), make sure to remove them when you finished editing
nano thunar/main.c

# refresh the patch and de-apply all available patches
quilt refresh
quilt pop -a

# Add some info into the changelog ( attention, this will make use of your default console-editor, which could be vi )
dch -n

# build the package ( your patch will be applied )
debuild -uc -us

# install the package ( version/CPU is OS/system-specific )
sudo dpkg -i ../thunar_1.2.3-4.1_amd64.deb


.. well I am able to build and test patches now .. however, I still have no idea how to re-build the binaries:

debuild clean
debuild -uc -us


--> I get the same errors like mentioned above .. clean seems not to be able to remove all files which need to be removed. It seems like this really is a thunar-specific problem.

EDIT: Now I know whats wrong. A single folder is somehow missing during the re-build. For now I fixed things by using a script and triggering things by hand instead of using the automated 'debuild':

#! /bin/bash
cd thunar-1.2.3
fakeroot debian/rules clean
fakeroot debian/rules build
mkdir debian/tmp/usr/share/gtk-doc
fakeroot debian/rules binary