Creating a debian package
Here’s where I messed up
The idea was to wrap up all the work done till rosnode part and package it into
a debian file , so that the end user can install it with just a single command.
The idea is super cool , but here’s what the problem is , I have no prior knowledge
on how to package things , have installed things using dpkg
but never have built
any package using it. As I had no prior knowledge on this part , I did the most
obvious thing that anyone else in my place would have done….. I googled it .
And tried out the first things that were mentioned in stackoverflow , and
hurrah , it didn’t work . Though I was succesfull in creating a debian package
using CPack
, it was not doing anything much other than installing the files
that were mentioned in the CMAKE
file , and I realised this very soon
(sarcasm. took quite sometime). After realising spending enough time on internet
and trying out quite a few blogs , I decided to read the tutorials and documentation
from the debian site itself . And it was the best thing to do , wish started it a
lot earlier, but then , better late then never. Here comes the learning curve ,
I did not understand even 20% of what the tutorials were speaking of, but everytime
I read it the meaning changed , things started to make sense now ,and I was understanding
what was being said. Nice but I did not have much time.
So heres how it works , in super simple words to build a super simple package :
- Download the source code. Also have the compressed version of it in the same parent directory.
- Run
debmake
command inside the source code directory. This will create a directory nameddebian
, which has all the files that needs to edited before proceeding further. - After editing the
debian/control
anddebian/rules
, all we need to do is rundebuild
. If everything goes buttery smooth, you will have a.deb
file waiting for you in the same parent directory as that of the source code . There are alot of things to talk about , but for now we will concentrate oncontrol
andrules
file. These are the files that you need to take care , which when done, everything else gets to their places automatically.
control
file will have all the information regarding the package , like it’s dependencies, maintainer’s name,contact info ,patches, type,priority , description,etc.
rules
file on the other hand will have the information on how to build and install the debian package. We can customize it accordingly to suit our needs.
In general for projects that usesCMake
as their build system : - mkdir obj-x86_64-linux-gnu
- cd obj-x86_64-linux-gnu
- cmake ..
- make
- make install
is the usual way of building the project and if the
rules
files are not tampered it usesdh_auto_install
command to build the debian package, which follows roughly the same outline as mentioned above. I have tried it with a simple hello world program and have succesfully created debian package for the same. But when
tried with DetectionSuite themake
command was failing due to some reason.
The above error was popping up when I was trying to run debuild
, but was able
to compile succesfully when was using cmake
and make
directly. So this is where
my project halted for now. Hopefully will soon be able to figure out why the above
error is popping up while running dh_auto_install and not when compiled directly.