Ubuntu: Building debian package - How do dependencies work?



Question:

I'm in the process of building a debian package. The goal is to package up a directory into a .deb that will have 2 dependencies that are other packages I created.

When installing the .deb package, I see the errors regarding missing dependencies which is great, but it still dumps the directory and contents even though it's missing dependencies.

My question is if this is appropriate behavior? I do not want the directory created and populated if there are missing dependencies. Any help would be appreciated!

Thanks!

output.

dpkg -i hdf5.deb  Selecting previously unselected package hdf5.  (Reading database ... 305222 files and directories currently installed.)  Unpacking hdf5 (from hdf5.deb) ...  dpkg: dependency problems prevent configuration of hdf5:   hdf5 depends on szip (>= 2.9); however:    Package szip is not installed.    dpkg: error processing hdf5 (--install):   dependency problems - leaving unconfigured  Errors were encountered while processing:   hdf5  


Solution:1

Your problem is that you're installing a package you built, which has dependencies which you haven't yet installed, using dpkg. While dpkg will install package, it does not resolve dependencies and install missing packages for you. You'll need to install them with apt to pull from archives, or if you have a .deb of the package you need, you'll need to install it first, or at the same time as your new package, using dpkg.

What you are describing is a Depends which the resulting binary package has, not a Build-Depends which the source package would need to build. Placing all of the binary package runtime dependencies inside the Build-Depends in your control file, is a good way to prevent building a package without them installed. It's also good practice to enumerate all of the dependencies you have, rather than relying on dependencies being satisfied by other packages you depend on requiring them as well, to prevent breaking if the dependency gets dropped from the other package you also need.


Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »