How to check if dependency already installed?

Need help with C, C++, perl, python, etc?

How to check if dependency already installed?

Postby thamarok » 2006-10-31 12:55

Hello!

I am working on a Debian .deb package parser and I would like to know how can I check if the user has already a dependency installed.

Let's take an example:
My program processes program.deb.
program.deb depends on gtk2.0-dev and gcc-4.0
How can I know if the user has these dependencies already installed?
Please note that I should not know these, but my program, so there has to be a command which my program will understand.

I can make linux system calls from my application and I can make c function calls, like getuid() etc..

Thanks!
thamarok
 

Postby ajdlinux » 2006-10-31 20:21

Use libapt-pkg or python-apt or similar.
Jabber: xmpp:ajdlinux@jabber.org.au
Spammers, email this: ajdspambucket@exemail.com.au
ajdlinux
 
Posts: 2480
Joined: 2006-04-23 09:37
Location: Port Macquarie, NSW, Australia

Postby plugwash » 2006-10-31 21:50

all the info is in /var/lib/dpkg/status in plain text
plugwash
 
Posts: 2508
Joined: 2006-09-17 01:10

Postby ajdlinux » 2006-11-03 20:22

Parsing /var/lib/dpkg/status is really intensive as it's usually more than a few megs. You should use the APT libraries to check it up, especially because if you use shell commands you will find that it may break in the future.
Jabber: xmpp:ajdlinux@jabber.org.au
Spammers, email this: ajdspambucket@exemail.com.au
ajdlinux
 
Posts: 2480
Joined: 2006-04-23 09:37
Location: Port Macquarie, NSW, Australia

Postby thamarok » 2006-11-03 21:07

ajdlinux wrote:Parsing /var/lib/dpkg/status is really intensive as it's usually more than a few megs. You should use the APT libraries to check it up, especially because if you use shell commands you will find that it may break in the future.


Yes.. you are right. Right now I got a new problem with ALSA when I did a apt-get dist-upgrade and I got it working after re-installing :wink:
If I can find some more documentation on the APT libs I could make a quick snippet which does the parsing.

Thanks!
thamarok
 


Return to Programming

Who is online

Users browsing this forum: No registered users and 4 guests

fashionable