1. Обзор инструментов Debian для сопровождающего

Данный раздел содержит краткий обзор доступных сопровождающим инструментов. Приведённая ниже информация ни в коем мере не является полной или окончательной, она представляет собой лишь руководство по некоторым более популярным утилитам.

Инструменты сопровождающего Debian предназначены для облегчения работы разработчиком и освобождения их времени для решения критических задач. Как говорит Ларри Уолл, существует более одного способа сделать это.

Some people prefer to use high-level package maintenance tools and some do not. Debian is officially agnostic on this issue; any tool that gets the job done is fine. Therefore, this section is not meant to stipulate to anyone which tools they should use or how they should go about their duties of maintainership. Nor is it meant to endorse any particular tool to the exclusion of a competing tool.

Most of the descriptions of these packages come from the actual package descriptions themselves. Further information can be found in the package documentation itself. You can also see more info with the command apt-cache show package-name.

1.1. Базовые инструменты

Следующие инструменты весьма нужны любому сопровождающими.

1.1.1. dpkg-dev

dpkg-dev содержит инструменты (включая dpkg-source), необходимые для распаковки, сборки и загрузки пакетов Debian с исходным кодом. Эти утилиты предоставляют базовую, низкоуровневую функциональность, необходимую для создания пакетов и для манипуляции ими; как таковые, эти утилиты являются необходимыми любому сопровождающему Debian.

1.1.2. debconf

debconf предоставляет единообразный интерфейс для интерактивной настройки пакетов. Его пользовательских интерфейс независим, что позволяет конечным пользователям настраивать пакеты при помощи текстового интерфейса, интерфейса HTML, либо диалогового интерфейса. Новые варианты интерфейса могут быть добавлены в виде модулей.

Документацию для этого пакета вы можете найти в пакете debconf-doc.

Many feel that this system should be used for all packages that require interactive configuration; see Управление настройкой с помощью debconf. debconf is not currently required by Debian Policy, but that may change in the future.

1.1.3. fakeroot

fakeroot имитирует привилегии суперпользователя. Это позволяет вам собирать пакеты без привилегий суперпользователя (обычно пакеты хотят установить файлы, владельцем которых является суперпользователь). Если у вас установлен fakeroot, dpkg-buildpackage будет автоматически использовать его.

1.2. Инструменты для проверки пакетов на предмет ошибок и соответствия стандартам

According to the Free On-line Dictionary of Computing (FOLDOC), lint is: "A Unix C language processor which carries out more thorough checks on the code than is usual with C compilers." Package lint tools help package maintainers by automatically finding common problems and policy violations in their packages.

1.2.1. lintian

lintian анализирует пакеты Debian и выдаёт информацию об ошибках и нарушениях Политики. Он содержит автоматические проверки множества аспектов Политики Debian, а также некоторые проверки на наличие распространённых ошибок.

Периодически вам следует получить наиболее свежую версию lintian из нестабильного выпуска и проверять все ваши пакеты. Заметьте, что опция -i предоставляет подробное объяснение того, что означает каждая ошибка или предупреждение, на каком пункте Политики они основываются, а иногда и то, как вы можете исправить проблему.

Для получения дополнительной информации о том, как и когда использовать Lintian, обратитесь к Тестирование пакета.

Также вы можете посмотреть обзор всех проблем, о которых было сообщено Lintian для ваших пакетов, по адресу https://lintian.debian.org/. Эти отчёты содержат наиболее свежий вывод lintian для всего разрабатываемого выпуска (нестабильного выпуска).

1.2.2. lintian-brush

lintian-brush contains a set of scripts that can automatically fix more than 80 common lintian issues in Debian packages.

It comes with a wrapper script that invokes the scripts, updates the changelog (if desired) and commits each change to version control.

1.2.3. piuparts

piuparts is the .deb package installation, upgrading, and removal testing tool.

piuparts tests that .deb packages handle installation, upgrading, and removal correctly. It does this by creating a minimal Debian installation in a chroot, and installing, upgrading, and removing packages in that environment, and comparing the state of the directory tree before and after. piuparts reports any files that have been added, removed, or modified during this process.

piuparts is meant as a quality assurance tool for people who create .deb packages to test them before they upload them to the Debian archive.

1.2.4. debdiff

debdiff (из пакета devscripts, devscripts) сравнивает списки файлов и управляющие файлы двух пакетов. Это простая проверка на наличие регрессий, поскольку она позволяет вам заметить, что число двоичных пакетов изменилось с момента последней загрузки, либо если что-то было изменено в управляющем файле. Конечно, некоторые изменения, о которых сообщает эта утилита, не являются чем-то плохим, но она может помочь вам предотвратить различные случайные проблемы.

Вы можете запустить её, указав два двоичных пакета:

debdiff package_1-1_arch.deb package_2-1_arch.deb

Или даже два файла changes:

debdiff package_1-1_arch.changes package_2-1_arch.changes

Дополнительную информацию см. в debdiff 1.

1.2.5. diffoscope

diffoscope provides in-depth comparison of files, archives, and directories.

diffoscope will try to get to the bottom of what makes files or directories different. It will recursively unpack archives of many kinds and transform various binary formats into more human readable form to compare them.

Originally developed to compare two .deb files or two changes files nowadays it can compare two tarballs, ISO images, or PDF just as easily and supports a huge variety of filetypes.

The differences can be shown in a text or HTML report or as JSON output.

1.2.6. duck

duck, the Debian Url ChecKer, processes several fields in the debian/control, debian/upstream, debian/copyright, debian/patches/* and systemd.unit files and checks if URLs, VCS links and email address domains found therein are valid.

1.2.7. adequate

adequate checks packages installed on the system and reports bugs and policy violations.

The following checks are currently implemented:

  • broken symlinks

  • missing copyright file

  • obsolete conffiles

  • Python modules not byte-compiled

  • /bin and /sbin binaries requiring /usr/lib libraries

  • missing libraries, undefined symbols, symbol size mismatches

  • license conflicts

  • program name collisions

  • missing alternatives

  • missing binfmt interpreters and detectors

  • missing pkg-config dependencies

1.2.8. i18nspector

i18nspector is a tool for checking translation templates (POT), message catalogues (PO) and compiled message catalogues (MO) files for common problems.

1.2.9. cme

cme is a tool from the libconfig-model-dpkg-perl package is an editor for dpkg source files with validation. Check the package description to see what it can do.

1.2.10. licensecheck

licensecheck attempts to determine the license that applies to each file passed to it, by searching the start of the file for text belonging to various licenses.

1.2.11. blhc

blhc is a tool which checks build logs for missing hardening flags.

1.3. Помощники для debian/rules

Инструменты сборки пакетов делают написание файла debian/rules значительно проще. Дополнительную информацию о том, почему желательно или не желательно использовать их, см. в Сценарии-помощники.

1.3.1. debhelper

debhelper is a collection of programs that can be used in debian/rules to automate common tasks related to building binary Debian packages. debhelper includes programs to install various files into your package, compress files, fix file permissions, and integrate your package with the Debian menu system.

Unlike some approaches, debhelper is broken into several small, simple commands, which act in a consistent manner. As such, it allows more fine-grained control than some of the other debian/rules tools.

Имеется ряд небольших дополнительных пакетов debhelper, которые слишком мелки, чтобы описывать их здесь. Вы можете посмотреть список этих программ, выполнив apt-cache search ^dh-.

When choosing a debhelper compatibility level for your package, you should choose the highest compatibility level that is supported in the most recent stable release. Only use a higher compatibility level if you need specific features that are provided by that compatibility level that are not available in earlier levels.

In the past the compatibility level was defined in debian/compat, however nowadays it is much better to not use that but rather to use a versioned build-dependency like debhelper-compat (=12).

1.3.2. dh-make

The dh-make package contains dh_make, a program that creates a skeleton of files necessary to build a Debian package out of a source tree. As the name suggests, dh_make is a rewrite of debmake, and its template files use dh_* programs from debhelper.

Хотя файлы rules, порождаемые dh_make, вообще-то являются достаточной основой для создания рабочего пакета, они всё равно представляют собой лишь основу: на сопровождающем всё ещё лежит груз задачи по тонкой настройке порождённых файлов и сборке пакета, целиком соответствующего Политике и работающего.

1.3.3. equivs

equivs представляет собой ещё один пакет для создания пакетов. Часто он предлагается для локального использования, если вам нужно сделать пакет просто для удовлетворения зависимостей. Также он иногда используется при создании „метапакетов“, это пакеты, чья цель состоит лишь в том, чтобы зависеть от других пакетов.

1.4. Сборщики пакетов

The following packages help with the package building process, general driving of dpkg-buildpackage, as well as handling supporting tasks.

1.4.1. git-buildpackage

git-buildpackage предоставляет возможность введения или импорта пакетов Debian с исходным кодом в репозиторий Git, сборки пакета Debian из репозитория Git, а также помогает в интеграции изменений из основной ветки разработки в этот репозиторий.

Эти утилиты предоставляют инфраструктуру для облегчения использования Git сопровождающими Debian. Это позволяет хранить отдельные ветки Git пакета для стабильного, нестабильного и возможно экспериментального выпусков, а также иметь все другие преимущества системы контроля версий.

1.4.2. debootstrap

Пакет debootstrap и соответствующий сценарий позволяют вам произвести начальную установку базовой системы Debian в любую часть файловой системы. Под базовой системой мы подразумеваем минимальное число пакетов, необходимых для работы и установки остальной системы.

Иметь подобную систему весьма полезно. Например, вы можете сделать chroot в эту систему и проверить ваши сборочные зависимости. Либо вы можете проверить то, как ведут себя ваши пакеты при установке на базовую систему. Сборщики chroot используют этот пакет; см. об этом ниже.

1.4.3. pbuilder

pbuilder constructs a chrooted system, and builds a package inside the chroot. It is very useful to check that a package's build dependencies are correct, and to be sure that unnecessary and wrong build dependencies will not exist in the resulting package.

A related package is cowbuilder, which speeds up the build process using a COW filesystem on any standard Linux filesystem.

1.4.4. sbuild

sbuild представляет собой другой автоматизированный сборщик. Он также может использовать окружения chroot. Он может использоваться как отдельно, так и как часть сетевого, распределённого окружения. В последнем случае он является частью системы, используемой теми, кто занимается переносом, для сборки двоичных пакетов для всех доступных архитектур. Дополнительную информацию см. в wanna-build, систему в действии можно посмотреть по адресу https://buildd.debian.org/.

1.5. ПО для загрузки пакетов

Следующие пакеты помогут автоматизировать или упростить процесс загрузки пакетов в официальный архив.

1.5.1. dupload

dupload is a package and a script to automatically upload Debian packages to the Debian archive, to log the upload, and to optionally send mail about the upload of a package. It supports various kinds of hooks to extend its functionality, and can be configured for new upload locations or methods, although by default it provides various hooks performing checks and comes configured with all Debian upload locations.

1.5.2. dput

The dput package and script do much the same thing as dupload, but in a different way. Out of the box it supports to run dinstall in dry-run mode after the upload.

1.5.3. dcut

Сценарий dcut (часть пакета dput, dput) помогает удалять файлы из каталога загрузки на ftp.

1.6. Автоматизация сопровождения пакетов

Следующие инструменты помогают автоматизировать различные задачи по сопровождению пакетов от добавления записей в журнал изменений или строк подписи и поиска ошибок в Emacs до использования наиболее свежего и исключительно официального файла config.sub.

1.6.1. devscripts

devscripts is a package containing wrappers and tools that are very helpful for maintaining your Debian packages. Example scripts include debchange (or its alias, dch), which manipulates your debian/changelog file from the command-line, and debuild, which is a wrapper around dpkg-buildpackage. The bts utility is also very helpful to update the state of bug reports on the command line. uscan can be used to watch for new upstream versions of your packages (see https://wiki.debian.org/debian/watch for more info on that). suspicious-source outputs a list of files which are not common source files.

Полный список доступных сценариев см. в руководстве devscripts 1.

1.6.2. reportbug

reportbug is a tool designed to make the reporting of bugs in Debian and derived distributions relatively painless. Its features include:

  • Integration with mutt and mh/nmh mail readers.

  • Access to outstanding bug reports to make it easier to identify whether problems have already been reported.

  • Automatic checking for newer versions of packages.

reportbug is designed to be used on systems with an installed mail transport agent; however, you can edit the configuration file and send reports using any available mail server.

This package also includes the querybts script for browsing the Debian bug tracking system.

1.6.3. autotools-dev

autotools-dev contains best practices for people who maintain packages that use autoconf and/or automake. Also contains canonical config.sub and config.guess files, which are known to work on all Debian ports.

1.6.4. dpkg-repack

dpkg-repack creates a Debian package file out of a package that has already been installed. If any changes have been made to the package while it was unpacked (e.g., files in /etc were modified), the new package will inherit the changes.

This utility can make it easy to copy packages from one computer to another, or to recreate packages that are installed on your system but no longer available elsewhere, or to save the current state of a package before you upgrade it.

1.6.5. alien

alien преобразует пакеты между различными форматами пакетов, включая пакеты Debian, RPM (RedHat), LSB (Linux Standard Base), Solaris, и Slackware.

1.6.6. dpkg-dev-el

dpkg-dev-el is an Emacs lisp package that provides assistance when editing some of the files in the debian directory of your package. For instance, there are handy functions for listing a package's current bugs, and for finalizing the latest entry in a debian/changelog file.

1.6.7. dpkg-depcheck

dpkg-depcheck (из пакета devscripts, devscripts) запускает команду в окружении strace для определения всех пакетов, которые используются вызванной командой.

Для пакетов Debian это весьма полезно, если вам необходимо сформировать строку Build-Depends для вашего нового пакета: запуск процесса сборки через dpkg-depcheck предоставит вам приблизительный список сборочных зависимостей. Например:

dpkg-depcheck -b debian/rules build

dpkg-depcheck также может использоваться для проверки зависимостей времени исполнения, особенно в том случае, если ваш пакет использует exec 2 для запуска других программ.

Дополнительную информацию см. в dpkg-depcheck 1.

1.7. Инструменты для переноса

Следующие инструменты полезны для занимающихся переносом и кросс-компиляцией.

1.7.1. dpkg-cross

dpkg-cross является инструментом для установки библиотек и заголовочных файлов для перекрёстной компиляции схожим с dpkg способом. Более того, функциональность dpkg-buildpackage и dpkg-shlibdeps была улучшена в плане поддержки перекрёстной компиляции.

1.8. Документация и информацию

Следующие пакеты предоставляют информацию для сопровождающих, либо помогают им в сборке документации.

1.8.1. debian-policy

The debian-policy package contains the Debian Policy Manual and related documents, which are:

  • Debian Policy Manual

  • Filesystem Hierarchy Standard (FHS)

  • Debian Menu sub-policy

  • Debian Perl sub-policy

  • Debian configuration management specification

  • Machine-readable debian/copyright specification

  • Autopkgtest - automatic as-installed package testing

  • Authoritative list of virtual package names

  • Policy checklist for upgrading your packages

The Debian Policy Manual the policy relating to packages and details of the packaging mechanism. It covers everything from required gcc options to the way the maintainer scripts (postinst etc.) work, package sections and priorities, etc.

Also useful is the file /usr/share/doc/debian-policy/upgrading-checklist.txt.gz, which lists changes between versions of policy.

1.8.2. doc-debian

doc-debian contains lots of useful Debian-specific documentation:

  • Debian Linux Manifesto

  • Constitution for the Debian Project

  • Debian Social Contract

  • Debian Free Software Guidelines

  • Debian Bug Tracking System documentation

  • Introduction to the Debian mailing lists

1.8.3. developers-reference

The developers-reference package contains the document you are reading right now, the Debian Developer's Reference, a set of guidelines and best practices which has been established by and for the community of Debian developers.

1.8.4. maint-guide

The maint-guide package contains the Debian New Maintainers' Guide.

This document tries to describe the building of a Debian package to ordinary Debian users and prospective developers. It uses fairly non-technical language, and it's well covered with working examples.

1.8.5. packaging-tutorial

This tutorial is an introduction to Debian packaging. It teaches prospective developers how to modify existing packages, how to create their own packages, and how to interact with the Debian community.

In addition to the main tutorial, it includes three practical sessions on modifying the grep package, and packaging the gnujump game and a Java library.

1.8.6. how-can-i-help

how-can-i-help shows opportunities for contributing to Debian. how-can-i-help hooks into APT to list opportunities for contributions to Debian (orphaned packages, bugs tagged 'newcomer') for packages installed locally, after each APT invocation. It can also be invoked directly, and then lists all opportunities for contribution (not just the new ones).

1.8.7. docbook-xml

docbook-xml предоставляет DocBook XML DTD, который обычно используется для подготовки документации по Debian (как более старая документация debiandoc SGML DTD). Например, данное руководство написано в DocBook XML.

Пакет docbook-xsl предоставляет файлы XSL для сборки и форматирования стиля исходных файлов в различные форматы вывода. Для того, чтобы использовать стили XSL, вам потребуется процессор XSLT, такой как xsltproc. Документация для стилей может быть найдена в пакетах docbook-xsl-doc-*.

Чтобы создать PDF из FO, вам потребуется процессор FO, такой как xmlroff или fop. Другим инструментом для создания PDF из DocBook XML является dblatex.

1.8.8. debiandoc-sgml

debiandoc-sgml provides the DebianDoc SGML DTD, which has been commonly used for Debian documentation, but is now deprecated (docbook-xml or python3-sphinx should be used instead).

1.8.9. debian-keyring

Contains the public OpenPGP keys of Debian Developers and Maintainers. See Сопровождение вашего открытого ключа and the package documentation for more information.

1.8.10. debian-el

debian-el предоставляет режим Emacs для просмотра двоичных пакетов Debian. Это позволяет вам исследовать пакет без его распаковки.