Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How *.dsc files are related to *.deb and source code files

Without packaging system we have (A) source code, which can be translated/compiled to (B) binary code.

In case of debian/ubuntu packages we have (1) source code, (2) source package - dsc file and (3) binary package - deb file. How is it that (2) source package related to (1) and (3)? Why do we need it? And, the most important question: what is the workflow generating (2) and (3) from (1)?

like image 378
Tomek Wyderka Avatar asked Nov 22 '12 06:11

Tomek Wyderka


People also ask

What is a .DSC file?

A DSC file is a settings file used by WPS Office (previously known as Kingsoft Office), an office suite which includes the Writer, Spreadsheets, and Presentation applications. It stores the settings for the Design Science Equation Editor, which includes the window size, interface style, and zoom magnification.

What is a .DSC file Ubuntu?

A . dsc file is a file related to the packages created, and the relevant related files of, a Debian Source Package (which is just the type of package - it's ultimately a package for Ubuntu and not Debian itself), which is what is uploaded to the builders for the repositories.

What is a Debian DSC file?

dsc (Debian Source Control) file is a short text file containing an RFC 2822 header (just like the control file studied in Section 5.2. 1, “Description: the control File”) which describes the source package and indicates which other files are part thereof. It is signed by its maintainer, which guarantees authenticity.

What is a Debian source package?

A Debian source package contains the source material used to construct one or more binary packages. A source package consists of a . dsc file (see Debian source control files – . dsc), one or more compressed tar files, and possibly other files depending on the type and format of source package.


2 Answers

The workflow usually goes approximately like this:

  1. Someone not affiliated with Debian writes some source code and posts it as a package on the web, for example, splint-3.1.2.tar.gz
  2. Someone at Debian downloads the source code, and writes

    1. A set of patch files to make the source build on Debian and conform to Debian guidelines. Run

      curl -s 'http://archive.ubuntu.com/ubuntu/pool/universe/s/splint/splint_3.1.2.dfsg1-2.diff.gz' | gunzip -dc | less
      

      to see this for the example package.

    2. A textual metadata file describing the package—this is the .dsc file and debian/control file. “DSC” is an acronym for Debian Source Control.
  3. Binary .deb packages are built for each architecture from the original upstream source code with the Debian-specific patches applied. Here is one such file. The Debian Binary Package Building HOWTO explains the format of these files and how to inspect them.

The .dsc file is not used for build logic, it is more for metadata. However many tools along the way require it. For example, the Build-Depends: field is used to install required build dependencies.

like image 168
andrewdotn Avatar answered Sep 28 '22 03:09

andrewdotn


It's actually much more complicated than that. The idea behind Debian packages is that they contain all the information needed to buld a page. Usually, the source is modified to include a debian directory that includes a control file describing the dependencies of that package and other packages that it interacts with (e.g, breaks, replaces, provides virtual package). A rules file explains how to build and install the package. There are also descriptions of how to package since a single source package can become many binary packages (e.g., foo-utils, libfoo0, libfoo-dev). debuild actually reads this information, does the compilation, and produces the binary packages. A subtlety: if foo uses libbar-dev, I may not actually know/care what version of the libbar binary package I use. pbuilder runs debuild in a clean environment so there is no chance of compiling against things you have not explicitly specified.

Consult the Debian New Maintainers' Guide for details.

like image 20
apmasell Avatar answered Sep 28 '22 03:09

apmasell