I recently learned how easy it is to get the source code for any given package using
apt-get source so that I can get the source code, make changes and install my own modified version of any package. This is great!
Until today I was assuming that each package would have its own source code, and that different packages would have different source code.
However, now I just discovered that different packages can have identical source code. Here follows an example of that:
The following 4 packages seem to have identical source code:
gir1.2-mutter-4 libmutter-4-0 mutter mutter-common
All four of them are installed on my Ubuntu 19.04 computer. Doing
apt-get source gir1.2-mutter-4 gives exactly the same result as
apt-get source libmutter-4-0, and also for the
Here is how I checked it:
mkdir a cd a apt-get source gir1.2-mutter-4 cd .. mkdir b cd b apt-get source libmutter-4-0 cd .. diff -r a b
The recursive diff on the last line above gives no output, showing that the directories have identical contents.
Now to my question: How can different packages have identical source code?
Assuming that this is intended and not some kind of error, what is the difference between the packages and how can I see that difference?
Could it be that the packages are different in the way the source code is configured and compiled, e.g. different parts of the code are included in the different packages? If so, where can I find information about how to configure each package?
Edit: forgot to add that if you want to test this, to make
apt-get source work properly you may first need to enable it using
software-properties-gtk as described here: https://askubuntu.com/a/857433/874649
Edit 2: thanks for the excellent answers! I also found this helpful https://askubuntu.com/a/246721/874649 -- about the
apt-get build-dep and
dpkg-buildpackage commands that are very useful. After modifying source code for a source package,
dpkg-buildpackage -us -uc can be used to build new .deb file(s) that can be used to install the modified program(s).