I have developed a script that needs to download the source code of some Ubuntu packages installed. In order to do that I do the following:
- give
dpkg --get-selections
to have the list of packages installed; - for each package I do
dpkg -s <package name>
in order to grep the Version. - Once I have package name and version I simply do the following:
apt-get source <package name>=<package version>
to download the code
The problem is that this works 95% of time because there are situation in which it didn't work. Usually the problem is the version. For example, if I have:
apt-get source host=1:9.9.5.dfsg-3ubuntu0.5
apt-get source p7zip-full=9.20.1~dfsg.1-4+deb7u1build0.14.04.1
it didn't work. I need to do something like this:
apt-get source host=1:9.9.5.dfsg
apt-get source p7zip-full=9.20.1~dfsg.1-4+deb
and there are others. In general, I am unable to find a way to get a version <version>
that when I give the command:
apt-get source <package name>=<version>
it works 100% of time. Do someone of you know how to address this issue?