I am assuming that all application installed through apt-get
are open source; but for those that are available in that manner, where can I get the source code for these applications as well as update them?
I have a couple applications I use regularly that aren't being actively developed any longer and I would like to add features. Where would I go to get the rights to update these applications?
In this case specifically, I am referring to the hellanzb package
Use the command
apt-get source <package>
(don't use sudo with it) to download the source of a package.From
man apt-get
:To build a package from source, first install the build dependencies:
Then use
dpkg-buildpackage
to create a.deb
file. From APT and Dpkg Quick Reference Sheet:In a terminal,
cd
into the directory containing the package source (e.g~/code/hellanzb-0.13
) and run the following command:If the build is successful, there will be a
.deb
file located in the parentdirectory (e.g
~/code/hellanzb_0.13-6.1_all.deb
).In general, you can get the source of an installed package by following this procedure:
Enable the source repositories. Open the dashboard (top left button) and search for
sources
. That should bring up theSoftware & Updates
program, run that and make sure you have the "Source code" option selected:Open a terminal and run this command:
That will download vlc's sources to your current directory and you can view them at your leisure.
Of course, in the case of
vlc
, you can also download them directly from the videolan.org website: https://www.videolan.org/vlc/download-sources.htmlYou can use
apt-get source --compile
directly:Worked for me. The .deb winds up in the directory you ran the command from.
Minimal example with the
hello
packageAll of this and more is described at: https://www.debian.org/doc/manuals/maint-guide/build.en.html
First let's get a sample package to modify the source for:
outputs:
Now let's hack it up. Get the source:
and open:
and modify the message to:
Then do the same on the test otherwise the annoying test will start failing:
Then rebuild with:
Near the end of the output, it says:
so it created the .deb on the parent directory, how dare it. So finally we install and test the modified package:
and there you go, it outputs the new message:
Tested on Ubuntu 18.04.
Old
bzr
answerTODO: this stopped working on Ubuntu 16.04 Xenial, failing with:
bzr: ERROR: Not a branch: "bzr+ssh://bazaar.launchpad.net/+branch/ubuntu/hello/".
.bzr branch lp:ubuntu/wily/hello
works andbzr branch lp:ubuntu/xenial/hello
fails again. For some reason https://code.launchpad.net/ubuntu/+source/hello does not show Xenial: https://web.archive.org/save/https://code.launchpad.net/ubuntu/+source/helloAs mentioned at https://askubuntu.com/a/81889/52975 there is also a Ubuntu-specific approach with
bzr
.Get the latest version:
Specific version:
You can also use
pull-lp-source
:Then you'll be able to edit it:
Rebuild it:
And install it:
The Ubuntu packaging guide is a good source of information.
To get more information about a package including upstream URL and project/program contacts you can have a look at the copyright file (referenced from packages.debian.org).
When the package is included and installed on your system, you can also read the copyright file directly at
/usr/share/doc/$package_or_program_name/copyright
.See how to download Debian package's source code?.