4957
Comment: formating changes
|
4993
add pt_BR link in translation header
|
Deletions are marked like this. | Additions are marked like this. |
Line 3: | Line 3: |
~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[it/SourcePackage|Italiano]] - [[sv/SourcePackage|Svenska]] -~ | ~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: English - [[it/SourcePackage|Italiano]] - [[pt_BR/SourcePackage|Português (Brasil)]] - [[sv/SourcePackage|Svenska]] -~ |
Line 10: | Line 10: |
'''Source packages''' provide you with all of the necessary files to compile or otherwise, build the desired piece of software. | '''Source packages''' provide you with all of the necessary files to compile or otherwise, build the desired piece of software. |
Line 15: | Line 15: |
* A tarball, with any changes made to upstream source, plus all the files created for the Debian package. | * A tarball, with any changes made to upstream source, plus all the files created for the Debian package. |
Line 39: | Line 39: |
Sources are normally '''not''' installed. You can only install them if you know the package name. | Sources are normally '''not''' installed. You can only install them if you know the package name. |
Line 43: | Line 43: |
On [[http://www.debian.org/distrib/packages]], there is a search engine which will go to : http://packages.debian.org/src:<name> . | On [[http://www.debian.org/distrib/packages]], there is a search engine which will go to : http://packages.debian.org/src:<name> . |
Line 45: | Line 45: |
A source package could generate many .[[deb|debs]]. To know the source package name, see the '''Source:''' field in the output of | A source package could generate many .[[deb|debs]]. To know the source package name, see the '''Source:''' field in the output of |
Line 49: | Line 49: |
}}} | }}} |
Line 57: | Line 57: |
One way to obtain source packages is with | One way to obtain source packages is with |
Line 69: | Line 69: |
A source package is downloaded in the current directory and is not installed (it will not appear in the installed package list), so you need not be ''[[root]]'' to use {{{apt-get source}}}. | A source package is downloaded in the current directory and is not installed (it will not appear in the installed package list), so you need not be ''[[root]]'' to use {{{apt-get source}}}. |
Line 81: | Line 81: |
To automatically build the DebianPackage after download, you can also use | To automatically build the DebianPackage after download, you can also use |
Line 85: | Line 85: |
}}} | }}} |
Translation(s): English - Italiano - ?Português (Brasil) - Svenska
Presentation
The definition of a source package
Source packages provide you with all of the necessary files to compile or otherwise, build the desired piece of software.
It consists, in its simplest form, of three files:
The upstream tarball with .tar.gz ending
A description file with .dsc ending. It contains the name of the package, both, in its filename as well as content (after the Source: keyword).
- A tarball, with any changes made to upstream source, plus all the files created for the Debian package.
This has a .debian.tar.gz (source format : 3.0)
or a .diff.gz ending (source format : 1.0)
Why looking at a source package ?
If you want to study packaging, or a specific DebianPackage.
If you want to know which compile-time options are enabled for a specific package (DebianPackageConfiguration).
Why bother with source package if there is a binary package ?
Some build systems (e.g. cmake) and ad-hoc scripts provide a convenient way to produce Binary packages (i.e. .deb files for Debian, .rpm for RedHat, etc) in a uniform fashion. Although such approach sounds appealing at first, it is not only insufficient for upload into Debian proper, where source package is required, but might be inferior.
Binary-only distribution
does not even provide a unified way to obtain the sources of a corresponding software (as it is now with "apt-get source package")
makes it difficult (if not impossible at all) for a user/contributor to rebuild .deb package due to lack of standardization in build procedures and description of build-dependencies. It is often mitigated by upstream authors with detailed descriptions in README, but instructions would vary from package to package. They are not guarantee to be complete; thus altogether making rebuilding not straightforward and fragile. So it is of no surprise why Debian policy demands source packages with standardized build procedures -- Debian needs to rebuild architecture-agnostic software for all (>12) supported platforms.
- manually composes "Depends:" for a generated .deb and those quite often would not be correct across Debian suites/releases, thus complicating installation procedures. Quick and dirty solution is often to build statically thus losing benefits of modularity in Debian, making the software less robust and secure.
How to Download a source package
Sources are normally not installed. You can only install them if you know the package name.
How to find the name of the source package
On http://www.debian.org/distrib/packages, there is a search engine which will go to : http://packages.debian.org/src:<name> .
A source package could generate many .debs. To know the source package name, see the Source: field in the output of
apt-cache show package_name
Sometimes the SOURCE: field is not present, then you can check using:
apt-cache showsrc package_name
With apt-get source
One way to obtain source packages is with
apt-get source <package name>
You need a deb-src entry in your /etc/apt/sources.list file, like :
deb-src http://http.us.debian.org/debian unstable main
A source package is downloaded in the current directory and is not installed (it will not appear in the installed package list), so you need not be root to use apt-get source.
From debian.org
You can do a manual download from http://www.debian.org/distrib/packages.
When you are on the page of the package, choose a distribution, and you will have a link to the three files which make the source package.
Working with a source package
How to build the Debian package
You need root privileges or fakeroot to build the .deb. To automatically build the DebianPackage after download, you can also use
apt-get --build source package_name
If you want to make optimized packages from source to your machine in order to possibly get faster operation, install and use apt-build (which in order uses apt-get source -b ...)
How to extract the source files
Assuming the files of the source package are present in the same directory, to unpack a source package, you can typically use :
dpkg-source -x .../path/to/package_name.dsc
All the files will be unpacked into a directory : package-version.