building deb packages

Asked by GioEnas

Hi everybody , I developed an application for nautical astronomic position with codelite and I would like to share with the community if can be useful, the application is unstable and I'm still testing for bugs.
I ported to Windows XP and Vista and works properly and I did a tar.gz with source code for linux environment and looks good.
By the way I'm an amateur and a beginner and I did this for hobby so maybe my question sounds trivial.
The problem that puzzled me and made me frustrated after a lot of readings and studying started when I attempted to build a debian package, I actually succeeded to build one but it installs the executable in /usr/bin
and the data in /usr/share/doc/packagename , the problem is that I have to read and write data to my data files and they cannot be in the system root. Ok, I can make it work pasting my executable and data files in my own directory in $(home), but how can this be done by default? can I chose a directory where the deb installer will put all my binary and data? I tried to work it out, trying to change /debian/rules Makefiles etc but nothing now I need some help if someone is interested, I will send all the documentation.
Best regards

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
mycae
Solved:
Last query:
Last reply:
Revision history for this message
Jason Odoom (jasonodoom) said :
#1

You can Publish your App by following the instructions here: http://developer.ubuntu.com/publish/ More info on creating Apps can also b found on the site also.

Revision history for this message
mycae (mycae) said :
#2

>You can Publish your App by following the instructions here
That page is still under construction, and to be fair, is misleading. Packages in ubuntu are copied from the debian archive, and should be published there if they are applicable to a wider audience (ubuntu is not the only debian derivative).

>The problem is that I have to read and write data to my data files and they cannot be in the system root
Normally, what you would do is alter your program such that you create a hidden folder in the user's home somewhere, such as ".nameofyourapp"; then copy all the data you need to modify from the default location /usr/share/nameofyourapp to your user's home dir. (you probably should only install documentation to /usr/share/doc -- users can delete this to free up space ; this should not break your app).

When your program starts you have to check for the existence of this hidden folder, and then if it exists, you know you have already done the copying, and don't need it again, and can just work off the data in your home folder. The idea is that you should keep as small a program footprint as possible, by sharing resources among the various system users in an intelligent fashion. Also, it should not be possible for one user to alter another user's data without administrator privileges.

You should try to isolate in your program what actually needs to be modified; for example configuration files probably do, but raw data files should be invariant, including things like program icons, ephemeris data etc etc.

Without seeing the full package, it is hard to comment specifically. Do you have a repository somewhere (e.g. sourceforge, any online version control system (VCS), or a publicly accessible home server?) that you can share, this would make commenting on the nature of your package easier.

Revision history for this message
GioEnas (gio-enas) said :
#3

Thanks for answering
What you saying seems to be a good advise
>Normally, what you would do is alter your program such that you create a hidden folder in the user's home >somewhere, such as ".nameofyourapp"; then copy all the data you need to modify from the default location >/usr/share/nameofyourapp to your user's home dir. (you probably should only install documentation to >/usr/share/doc -- users can delete this to free up space ; this should not break your app).

I will try to follow your suggestion, it will take some days, I'll let you know.
I'm still puzzled why packaging is so complicated, I been trying to follow a lot of tutorials but always I encountered some problem, the last 'yesterday', pbuilder stopped because couldn't read source code , had problem reading comment c style symbols "/*..........*/".
I think we should make some efforts developing a standard installer like those used by Windows that work easily
I suggest this challenge to the developer community, I'm not so expert but I know there are genius among you.
Thanks again

Revision history for this message
Best mycae (mycae) said :
#4

>pbuilder stopped because couldn't read source code , had problem reading comment c style >symbols "/*..........*/".

Pbuilder does not interpret your source code -- it merely provides a "clean" environment to do compilation; likely it was calling a program which subsequently failed.

Yes, Debian package building is hard; its more "evolved" than engineered, and thus has annoying vestigial and fragile bits -- notably in-tree building (debian package does not operate directly on tarball, as IMHO it should). RPM packaging is much easier this regard.

I would hesitate to use windows installers as a guide -- this is usually "easier" because of two things

1) They do many things incorrectly (static libs are a big gotcha)
2) They use registry keys to cheat and hard code in values which often do not need to be hard-coded
3) they automatically run everything as an administrator because windows' security model is nightmarish (but then again, AppArmour/SELinux "policy based" methods are just as painful).
4) Often multi-user environments are mishandled.
5) There is no distribution checking
6) There is no package security
7) There is no dependency management; this must be handled manually by the packager, e.g. static libs. I cannot count the number of times that someone has eff-ed up building a windows installer because they compiled against something dynamically, which I don't have on my system, or this has caused "DLL Hell" or other dependency hell due to versioning problems (looking at you .NET).

Revision history for this message
GioEnas (gio-enas) said :
#5

Hi, I followed your suggestion
>Normally, what you would do is alter your program such that you create a hidden folder in the user's home >somewhere, such as ".nameofyourapp"; .........
I tried it and it works, now I could build my deb package and now my app works nearly good, but I have still a little problem that I couldn't solve.
The problem is that the deb package installs the data that my program needs to read in /usr/share/doc/mydir/data.gz
with the extension .gz and some data is lost when the app reads those files.
There must be a way to store those files not compressed but I just can't work it out.
do you have any suggestion?
Thanks

Revision history for this message
GioEnas (gio-enas) said :
#6

OK , finally I managed to build my deb package and it works fine.
Thanks to the suggestions, now next step, how can I share my app with the community ?
Of course is an unstable version and needs to be supervised.
Is there a standard way to deliver?
Thanks for answering