The varnish repo apparently does not provide prebuilt packages for Varnish-4.0 on precise i386 (32bit).
Ideally this should be indicated in the instructions, but it it not mentioned. After a lot of heartbreak on figuring out how apt works, I was finally able to get it.
This is the root directory of packages for ubuntu - https://repo.varnish-cache.org/ubuntu/
All binary files are typically stored in pool. The dists folder lets apt select the appropriate package for the current distribution.
This file lists the packages available for the precise (Ubuntu 12.04 LTS) i386 (32bit) platform - https://repo.varnish-cache.org/ubuntu/dists/precise/varnish-4.0/binary-i386/Packages.gz
If you unzip the file and check out the packages file inside, it contains information only for varnish-doc. It does not contain the information for the main varnish package.
That is why apt gets only the ubuntu version.
If you check out the Packages file for the 64bit version all packages are present - http s://repo.varnish-cache.org/ubuntu/dists/precise/varnish-4.0/binary-amd64/Packages.gz Hence it should work fine on the 64bit distribution.
This leaves us with two options.
1. If one checks the pool directory - http s://repo.varnish-cache.org/ubuntu/pool/varnish-4.0/v/varnish/ one can find the files http s://repo.varnish-cache.org/ubuntu/pool/varnish-4.0/v/varnish/varnish_4.0.0-1~precise_i386.deb and http s://repo.varnish-cache.org/ubuntu/pool/varnish-4.0/v/varnish/libvarnishapi1_4.0.0-1~precise_i386.deb which are the latest versions of varnish for the 32bit platform.
One can download these files and install them manually with dpkg -i <package-name.deb>
2. One can ask the varnish repo sysadmin to recreate the Package file for i386 with the proper package list at [email protected] or [email protected].
Or in the worst case one can still get the latest version of varnish-3 by changing the line echo "deb https://repo.varnish-cache.org/ubuntu/ precise varnish-4.0" >> /etc/apt/sources.list.d/varnish-cache.list
to
echo "deb https://repo.varnish-cache.org/ubuntu/ precise varnish-3.0" >> /etc/apt/sources.list.d/varnish-cache.list