Saturday, May 18, 2024
44
rated 0 times [  44] [ 0]  / answers: 1 / hits: 8057  / 2 Years ago, wed, july 27, 2022, 10:06:34

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 mutter and mutter-common packages.



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).


More From » package-management

 Answers
4

You're confusing built binary packages with the underlying source code/package that the packages were built from.



The packages you're referring to are all built from the same source code/package, mutter. You can find that easily by going to packages.ubuntu.com, searching the package you're looking at, and then refer to the "Source package" it refers to. Which in this case is mutter:




enter image description here




From there, however, we can check the Launchpad page for Mutter's source package and see that it builds a multitude of binary packages (built compiled source code, etc. for installation):




enter image description here




These descriptions describe what each package contains/installs. Focusing on the 4 packages you indicated, and using these descriptions:




  • gir1.2-mutter-4 - GObject introspection data for Mutter (used by gir and GObject as libraries/data for Mutter and GObject interaction)

  • libmutter-4-0 - The underlying library for the Mutter window manager. (Used for plugin development, development and compiling Mutter integrations, etc. usually)

  • mutter - the actual Mutter Window Manager that uses GNOME's Window Manager Library (which is why GObject is needed)

  • mutter-common - Shared Files for Mutter - usually default configuration options or items which are common to all the packages built from the source package.



What you're seeing in your package list are the built packages which originate from the same source code - each package is different items being installed after build/compile time and are used differently for different things. You can see what's in the packages themselves by downloading the individual packages and then accessing them with p7zip or the in-built Archive Manager in Ubuntu and see the differences of what each package contains that way. This said, they all originate from the same source code - they just contain different items that're being installed to the system.


[#4772] Thursday, July 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
untroo

Total Points: 3
Total Questions: 110
Total Answers: 95

Location: Palestine
Member since Thu, Oct 28, 2021
3 Years ago
;