dpkg commands in C
Pregunta
How do I use dpkg commands in C? What headers/commands are available?
I tried a web search, but it mostly displays manpages for dpkg, and I don't see the said manpage mention anything C-related.
Solución
Unfortunately for you, dpkg provides a much better api for Perl or Ruby than for C. The package you want is libdpkg-dev, which provides the static library libdpkg.a. However, be warned that this library is volatile and intended for internal use only by the dpkg binary. Use at your own risk ;)
Otros consejos
Look at the package page, fetch the sources and see what you can extract:
http://packages.debian.org/source/sid/dpkg
The source package created several binary packages, including libdpkg. But you may also want to look at apt and its sources / library as there are other binaries built against it whereas libdpkg-dev has few/none:
edd@max:~$ apt-cache rdepends libdpkg-dev
libdpkg-dev
Reverse Depends:
libdpkg-dev:i386
edd@max:~$ apt-cache rdepends libapt-
libapt-inst1.3 libapt-inst1.4 libapt-pkg4.11 libapt-pkg4.12 \
libapt-pkg-dev libapt-pkg-doc libapt-pkg-perl
edd@max:~$ apt-cache rdepends libapt-pkg4.12
libapt-pkg4.12
Reverse Depends:
libapt-pkg4.12:i386
libapt-pkg4.12:i386
libapt-pkg-dev
libapt-inst1.4
apt-utils
apt-transport-https
apt
libapt-pkg4.12:i386
libapt-pkg4.12:i386
synaptic
ruby-debian
postgresql-9.1-debversion
packagekit-backend-aptcc
ovaldi
libopenscap1
debian-xcontrol
aptsh
apt-watch-backend
apt-transport-debtorrent
apt-move
adept
qapt-deb-installer
python3-apt-dbg
python3-apt
python-apt-dbg
python-apt
libqapt1
libqapt-runtime
libept1.4.12
libapt-pkg-perl
libapt-pkg-dev
libapt-inst1.4
aptitude
apt-utils
apt-transport-https
apt
edd@max:~$