The following commands can be used to generate dependency graph for a debian package:
# Get relationship between packages (.dot)
$ debtree --no-conflicts --no-provides --with-suggests --max-depth=1 mariadb-galera-server-5.5 > mariadb-galera-server-5.5.dot
# Generate the image
$ dot -T png -o mariadb-galera-server-5.5.png mariadb-galera-server-5.5.dot
I recently had to test some of my locally generated MariaDB debian packages. So, created a local repository of generated packages and added it to sources.list file. However, since these packages required some other packages stored on a mirror, I had to add the mirror to the sources.list file as well. Since, this mirror also contained the packages that I intended to test, now when I try to install the packages, APT would always pick/prefer the ones stored on the mirror. How to solve this? How to make APT prefer the local packages instead? Lets start by taking a peek into the sources.list file:
# remote repo
deb http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu precise main
# local repo
deb file:///home/nirbhay/project/repo/maria/testing/debian/5.5/debs binary/
$ sudo apt-cache policy mariadb-galera-server
500 file:/home/nirbhay/project/repo/maria/testing/debian/5.5/debs/ binary/ Packages
500 http://mirror.jmu.edu/pub/mariadb/repo/5.5/ubuntu/ precise/main i386 Packages
The following tips can help you fix this problem :
If remote and local packages have the same version (as in my case), place one that you want to be preferred higher in sources.list file.
APT prefers authenticated repository over unauthenticated. So, as against the above case, even if the local repository is placed over the remote, APT will prefer remote one if its authenticated and the local repository is not. In that case, –allow-unauthenticated can be used to make local packages take precedence.
In case local and remote packages have different versions, APT would always prefer the package with higher version. However, this rule can be eased by apt-pinning, where a higher priority is assigned to a particular repository. For example, local repository can be pinned with higher priority (or precedence in APT’s context) by adding a file under /etc/apt/preferences.d with .pref extension and the following content :
Pin: origin ""
This has been explained really well in this thread.
Lastly, do not forget to run “apt-get update” for changes to take effect.