Get package sources and repository link
for latest version:
apt-get download --print-uris package | cut -d' ' -f1
for specific version
apt-get download --print-uris package=version | cut -d' ' -f1
apt-cache policy package
displays which versions can be installed from which repositories.
bash$ apt-cache policy dpkg
dpkg:
Installed: 1.16.1.2ubuntu7.1
Candidate: 1.16.1.2ubuntu7.1
Version table:
*** 1.16.1.2ubuntu7.1 0
500 http://fi.archive.ubuntu.com/ubuntu/ precise-updates/main amd64 Packages
500 http://mirrors.nic.funet.fi/ubuntu/ precise-updates/main amd64 Packages
100 /var/lib/dpkg/status
1.16.1.2ubuntu7 0
500 http://fi.archive.ubuntu.com/ubuntu/ precise/main amd64 Packages
To get the source:
Check that you have a deb-src
line in /etc/apt/sources.list
.
As root, run apt-get build-dep package
.
As normal user, run apt-get source package
.
To get the URL, go to
http://packages.debian.org/source/sourcepackage
.
Then you get a list of the different versions in the supported archives.
If the source package name differs from the binary, it's in the package description, 2nd line it seems.
grep -A1 binpackagename /var/lib/apt/*Packages |grep Source
should do the trick.