Linux package source code

How do I get and modify the source code of packages installed through apt-get?

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

6 Answers 6

Use the command apt-get source (don’t use sudo with it) to download the source of a package.

 source source causes apt-get to fetch source packages. APT will examine the available packages to decide which source package to fetch. It will then find and download into the current directory the newest available version of that source package while respect the default release, set with the option APT::Default-Release, the -t option or per package with the pkg/release syntax, if possible. Source packages are tracked separately from binary packages via deb-src type lines in the sources.list(5) file. This means that you will need to add such a line for each repository you want to get sources from. If you don't do this you will properly get another (newer, older or none) source version than the one you have installed or could install. If the --compile option is specified then the package will be compiled to a binary .deb using dpkg-buildpackage, if --download-only is specified then the source package will not be unpacked. A specific source version can be retrieved by postfixing the source name with an equals and then the version to fetch, similar to the mechanism used for the package files. This enables exact matching of the source package name and version, implicitly enabling the APT::Get::Only-Source option. Note that source packages are not tracked like binary packages, they exist only in the current directory and are similar to downloading source tar balls. 

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:

dpkg-buildpackage Builds a Debian package from a Debian source tree. You must be in the main directory of the source tree for this to work. Sample usage:

 dpkg-buildpackage -rfakeroot -uc -b 

Where -rfakeroot instructs it to use the fakeroot program to simulate root privileges (for ownership purposes), -uc stands for «Don’t cryptographically sign the changelog», and -b stands for «Build the binary package only»

In a terminal, cd into the directory containing the package source (e.g ~/code/hellanzb-0.13 ) and run the following command:

dpkg-buildpackage -rfakeroot -uc -b 

If the build is successful, there will be a .deb file located in the parent
directory (e.g ~/code/hellanzb_0.13-6.1_all.deb ).

Источник

How to download a Debian package’s source code?

Downloading source code from Debian repositories is as simple as running apt-get source . It will put 3 files in your current directory, .dsc that describes package, .orig.tar.gz that contains unmodified sources, and .diff.gz that contains Debian-specific changes. But if you get error E: Unable to find a source package for , then you might not have the source code repository specified, so go to /etc/apt/sources.list (or some file in /etc/apt/sources.list.d/ that contains your Debian repository), find a string like:

deb ftp://ftp.debian.org/debian wheezy main contrib non-free 
deb-src ftp://ftp.debian.org/debian wheezy main contrib non-free 

Update package index files with sudo apt-get update and try again. See also:

A second possibility is to download the source code from upstream directly instead of downloading it from Debian repositories. This has the advantage that if you not only want to read the source code but might like to change something you can directly commit and submit it to upstream (assuming it is not a Debian patch).

Читайте также:  Nvidia cuda linux driver install

You can usually find out the upstream source code repository URL in the file /usr/share/doc/$package_or_program_name/copyright .

$ head /usr/share/doc/git/copyright Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Contact: git@vger.kernel.org Source: https://www.kernel.org/pub/software/scm/git/ Files: * Copyright: © 2005-2014, Linus Torvalds and others. License: GPL-2 Files: xdiff/* Copyright: © 2003-2009, Davide Libenzi, Johannes E. Schindelin 

This file is also referenced from packages.debian.org (search for «Copyright File»).

Источник

Where can I find the source code of Ubuntu?

I would like to know where to find the source code of Ubuntu. I’d like to see how far it is «open source».

Despite being «open» there are things called binary blobs in the kernel as far as I’m aware. It’s open, but not decipherable in some places.

5 Answers 5

apt-get source linux-source-3.2.0 
sudo apt-get build-dep $package 
sudo apt-get build-dep abiword apt-get source abiword 

The source code for every package in the main and universe archives is in Launchpad, or you can get it by enabling Sources in the Software Properties dialog, and then doing apt-get source $packagename in a terminal, after refreshing the package information.

Source code for packages in the partner repositories is not generally available, as they are mostly not open source applications. This is true for some items available in the Software Center as well.

Software in linux distributions is organized into packages. Each package either contains user facing software like Firefox, or libraries like libasound2 which is required by firefox. If you install Firefox, the apt system will figure out what prerequisite packages exist, will download and install them. Now, these packages are generally distributed as binary files that have already been compiled for a given processor architecture, but the exact source used to compile that version of a package is available via apt-get source firefox .

Читайте также:  Линукс команда графической оболочки

The vast majority of things in Ubuntu’s repositories of packages are open source. But Ubuntu does have a list of approved proprietary software. While this software doesn’t satisfy the freedom goals of Ubuntu, they are greatly desired by the community, and provide a lot of value. Examples of this are Skype or Sun Java (now removed). These packages are not listed on the Ubuntu packages site.

You can download the complete source code ISOs from the Ubuntu download servers:

  1. http://cdimage.ubuntu.com/releases//release/source/ for currently-supported releases. For example, http://cdimage.ubuntu.com/releases/12.04/release/source/ for 12.04.
  2. http://old-releases.ubuntu.com/releases//release/source/ for obsolete/EOL releases. For example, http://old-releases.ubuntu.com/releases/12.10/source/ for 12.10. However, source ISOs seem to be available only for 12.10 onwards.

Источник

Оцените статью
Adblock
detector