8

I am experimenting with creating a .deb package and am unsure about the file structure of a package. Is the directory that contains control, changelog, rules, etc supposed to be named DEBIAN or debian?

I am using dpkg-deb to package it, and it seems to require DEBIAN, and I am trying to use Lintian to check it, and it isn't recognizing the changelog or copyright files. Lintian throws the errors debian-changelog-file-missing and no-copyright-file but later warns unknown-control-file changelog and unknown-control-file copyright. Looking at this page, it suggests using debian, and I rename the directory to that but it causes dpkg-deb to fail. Reading through the Debian Policy Manual, it usually uses debian in examples, but occasionally uses DEBIAN, which makes me wonder if in certain circumstances both may be needed. What is the right way to do this?

Braiam
  • 67,791
  • 32
  • 179
  • 269

2 Answers2

7

When creating the package, you have a debian directory, which contains the data needed for making the package (the control file, the rules, the changelog, etc.). dpkg-deb is not the usual way to make a package - it just offers a quick way to assemble one. You usually usedpkg-buildpackage instead.

muru
  • 197,895
  • 55
  • 485
  • 740
4

Source packages (i.e. the not-yet-compiled source tree) use a lowercase debian directory. For example, if you were using dpkg-buildpackage to compile a C program and generate the binary .deb, you would have a source tree like this:

foo-1.0/
 ├─debian/
 │  ├─changelog
 │  └─control
 ├─main.c
 ├─main.h
 └─Makefile

The uppercase DEBIAN is apparently found only in binary packages (i.e. the compiled .deb files themselves), within their 'control.tar' archive.

However, according to the dpkg documentation, this 'DEBIAN' directory is a historical leftover from very old dpkg package formats (as in pre-2000s; see man deb-old and man deb). All new .deb packages instead put the control files directly at the top level of the 'control.tar' archive:

$ tar -tf control.tar
./changelog
./control
./postinst
user1686
  • 615