Is there a way to extract the source code from deb or rpm packages?

1

1

I find that this would be very useful in certain situations in which I want to install software in a different way, or change flags, or not let the software manager know the program has been installed (so it wouldn't look for updates). I know packages can be built from source codes, and this is relatively common, but I don't know about the other way around. It would also be useful for converting one type of package into another when Alien doesn't work or doesn't provide good results. I've been searching on-line but there seems to be no or few records of source code extraction from pre-built packages...

the_midget_17

Posted 2012-02-12T05:20:23.333

Reputation: 787

Answers

5

Debian and RPM packages don't contain source code, only the compiled result. However, you can fetch the source packages - SRPMS, or the Debian description, patch, and original tarball.

Those can be recompiled with whatever local modifications you want, and will more or less do what you want - though remember to adjust the version number to make it clear that your version is "later" than the distribution version.

Daniel Pittman

Posted 2012-02-12T05:20:23.333

Reputation: 3 510

So, there is no way to convert a package I already have into source code? – the_midget_17 – 2012-02-12T05:29:32.543

1Not directly; both apt and yum offer tools to download the source package by name, but you can't extract what isn't present from the binary files. – Daniel Pittman – 2012-02-12T05:32:31.057