### pmstatus example: apt-get install with APT::Status-Fd Source: https://github.com/debian/apt/blob/main/doc/progress-reporting.md Shows the output of running apt-get install with APT::Status-Fd=2, producing pmstatus messages with package name, total percentage, and action description. ```shell # ./apt-get install -o APT::Status-Fd=2 3dchess >/dev/null pmstatus:3dchess:20:Preparing 3dchess pmstatus:3dchess:40:Unpacking 3dchess pmstatus:3dchess:60:Preparing to configure 3dchess pmstatus:3dchess:80:Configuring 3dchess pmstatus:3dchess:100:Installed 3dchess ``` -------------------------------- ### APT Hook Notification Example Source: https://github.com/debian/apt/blob/main/doc/json-hooks-protocol.md Example of a hook notification for the install.pre method, showing package details and versions. ```json { "jsonrpc": "2.0", "method": "org.debian.apt.hooks.install.pre", "params": { "command": "purge", "search-terms": [ "petname-", "lxd+" ], "packages": [ { "id": 1500, "name": "ebtables", "architecture": "amd64", "mode": "install", "automatic": 1, "versions": { "candidate": { "id": 376, "version": "2.0.10.4-3.5ubuntu2", "architecture": "amd64", "pin": 990 }, "install": { "id": 376, "version": "2.0.10.4-3.5ubuntu2", "architecture": "amd64", "pin": 990 } } } ] } } ``` -------------------------------- ### APT Hook Response Example Source: https://github.com/debian/apt/blob/main/doc/json-hooks-protocol.md Example of a response to the hello notification, indicating the supported protocol version. ```json {"jsonrpc":"2.0","id":0,"result":{"version":"0.1"}} ``` -------------------------------- ### APT Hello Notification Example Source: https://github.com/debian/apt/blob/main/doc/json-hooks-protocol.md Example of the initial hello notification sent by APT when a client connects, containing the protocol version and options. ```json {"jsonrpc":"2.0","method":"org.debian.apt.hooks.hello","id":0,"params":{"versions":["0.1", "0.2"], "options": [{"name": "APT::Architecture", "value": "amd64"}]}} ``` -------------------------------- ### Install library and headers Source: https://github.com/debian/apt/blob/main/apt-pkg/CMakeLists.txt Installs the apt-pkg shared library, header files, and pkg-config file. Also calls flatify on the headers. ```cmake install(TARGETS apt-pkg LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/apt-pkg) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/apt-pkg.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) flatify(${PROJECT_BINARY_DIR}/include/apt-pkg/ "${headers}") ``` -------------------------------- ### Text blob example with changes and summary Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of a text blob before and after the changes lists, with a summary and prompt. ```text This is an informational blob with no information that appears before the list of changes. It contains a lot of text saying stuff. Installing: package Installing dependencies: dependency This is an important blob with important information that appears after the list of changes. It contains a lot of text saying stuff. Summary: Upgrading: 0, Installing: 23, Removing: 0, Not Upgrading: 1 Download size: 6,947 kB Space needed: 44.7 MB / 16.8 GB available Continue? [Y/n] ``` -------------------------------- ### General layout example Source: https://github.com/debian/apt/blob/main/doc/design/install.md Shows the general layout of the solution screen with blocks, a warning, and a prompt. ```text BLOCK BLOCK W: A warning Continue? [Y/n] ``` -------------------------------- ### Package list -V format example Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of the -V format showing one package per line with version information. ```text name (version) name (old version => new version) ``` -------------------------------- ### Package list multiple lines example Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of the standard columnar package list format when packages span multiple lines. ```text package1 shortname3 otherpackage5 longpackagename2 short4 yetanotherpackage6 ``` -------------------------------- ### Classic layout example Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of the classic 'wall of text' package list format, available with --no-list-columns. ```text package1 longpackagename2 shortname3 short4 otherpackage5 yetanotherpackage6 ``` -------------------------------- ### Package list single line example Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of the standard columnar package list format when packages fit on a single line. ```text package1 longpackagename2 shortname3 ``` -------------------------------- ### Solution summary output Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of the solution summary output showing package change counts, download size, and space changes. ```text Summary: Upgrading: 0, Installing: 23, Removing: 0, Not Upgrading: 1 Download size: 6,947 kB Space needed: 44.7 MB / 16.8 GB available ``` -------------------------------- ### JSON representation of APT configuration tree Source: https://github.com/debian/apt/blob/main/doc/json-hooks-protocol.md Example showing how a configuration option like 'APT::Architectures' with a nested list is represented as a JSON array of name/value pairs. ```json [ {"name": "APT::Architectures", "value": "unused"}, {"name": "APT::Architectures::first", "amd64"}, {"name": "APT::Architectures::", ""} ] ``` -------------------------------- ### CMake build configuration for apt-ftparchive Source: https://github.com/debian/apt/blob/main/ftparchive/CMakeLists.txt Sets include directories, globs all .cc files as sources, defines the apt-ftparchive executable, links against apt-pkg, apt-private, and Berkeley libraries, and installs the binary to CMAKE_INSTALL_BINDIR. ```CMake include_directories(${BERKELEY_INCLUDE_DIRS}) # Definition of the C++ files used to build the program - note that this # is expanded at CMake time, so you have to rerun cmake if you add or remove # a file (you can just run cmake . in the build directory) file(GLOB_RECURSE source "*.cc") add_executable(apt-ftparchive ${source}) # Link the executables against the libraries target_include_directories(apt-ftparchive PRIVATE ${BERKELEY_INCLUDE_DIRS}) target_link_libraries(apt-ftparchive apt-pkg apt-private ${BERKELEY_LIBRARIES}) # Install the executables install(TARGETS apt-ftparchive RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ``` -------------------------------- ### dlstatus example: download progress messages Source: https://github.com/debian/apt/blob/main/doc/progress-reporting.md Shows the format of dlstatus messages, including the number of already downloaded packages, total percentage, and action description. ```text dlstatus:1:9.05654:Downloading file 1 of 3 (4m40s remaining) dlstatus:1:9.46357:Downloading file 1 of 3 (4m39s remaining) dlstatus:1:9.61022:Downloading file 1 of 3 (4m38s remaining) ``` -------------------------------- ### Acquire::IndexTargets::deb::Packages configuration stanza Source: https://github.com/debian/apt/blob/main/doc/acquire-additional-files.md Example configuration stanza that instructs the Acquire system to download Packages files. It uses the deb type, defines MetaKey, ShortDescription, Description, flatMetaKey, flatDescription, and Optional properties. This is the default configuration for Packages files. ```apt.conf Acquire::IndexTargets::deb::Packages { MetaKey "$(COMPONENT)/binary-$(ARCHITECTURE)/Packages"; ShortDescription "Packages"; Description "$(RELEASE)/$(COMPONENT) $(ARCHITECTURE) Packages"; flatMetaKey "Packages"; flatDescription "$(RELEASE) Packages"; Optional "no"; }; ``` -------------------------------- ### Build apt-private shared library with CMake Source: https://github.com/debian/apt/blob/main/apt-private/CMakeLists.txt CMake configuration for building the apt-private shared library. Sets version variables, globs source files, creates the library, links against apt-pkg, sets SONAME and hidden visibility, installs the library without a namelink, and flattens headers into the build include directory. ```cmake set(MAJOR 0.0) set(MINOR 0) file(GLOB_RECURSE library "*.cc") file(GLOB_RECURSE headers "*.h") add_library(apt-private SHARED ${library}) target_link_libraries(apt-private PUBLIC apt-pkg) set_target_properties(apt-private PROPERTIES VERSION ${MAJOR}.${MINOR}) set_target_properties(apt-private PROPERTIES SOVERSION ${MAJOR}) set_target_properties(apt-private PROPERTIES CXX_VISIBILITY_PRESET hidden) add_version_script(apt-private) install(TARGETS apt-private LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} NAMELINK_SKIP) flatify(${PROJECT_BINARY_DIR}/include/apt-private/ "${headers}") ``` -------------------------------- ### Autoremove note example Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of the autoremove note block, showing the note text. ```text No longer needed: package1 package3 package2 package4 Use 'apt autoremove' to remove no longer needed packages. ``` -------------------------------- ### APT Acquire::IndexTargets stanzas for Translation-* and Sources files Source: https://github.com/debian/apt/blob/main/doc/acquire-additional-files.md APT configuration stanzas for Translation-* and Sources index targets. Shows how to define MetaKey, ShortDescription, Description, flatMetaKey, flatDescription, and Optional properties for deb::Translations and deb-src::Sources targets. ```apt Acquire::IndexTargets { deb::Translations { MetaKey "$(COMPONENT)/i18n/Translation-$(LANGUAGE)"; ShortDescription "Translation-$(LANGUAGE)"; Description "$(RELEASE)/$(COMPONENT) Translation-$(LANGUAGE)"; flatMetaKey "$(LANGUAGE)"; flatDescription "$(RELEASE) Translation-$(LANGUAGE)"; }; deb-src::Sources { MetaKey "$(COMPONENT)/source/Sources"; ShortDescription "Sources"; Description "$(RELEASE)/$(COMPONENT) Sources"; flatMetaKey "Sources"; flatDescription "$(RELEASE) Sources"; Optional "no"; }; }; ``` -------------------------------- ### Configure pkg-config and version script files Source: https://github.com/debian/apt/blob/main/apt-pkg/CMakeLists.txt Configures apt-pkg.pc.in and versionscript.in using configure_file with @ONLY substitution. ```cmake configure_file(apt-pkg.pc.in ${CMAKE_CURRENT_BINARY_DIR}/apt-pkg.pc @ONLY) configure_file(versionscript.in ${CMAKE_CURRENT_BINARY_DIR}/versionscript @ONLY) ``` -------------------------------- ### Run APT integration tests Source: https://github.com/debian/apt/wiki/APT-Wiki Execute the integration test suite. Options include -q for quiet, -qq for very quiet, and -j X for parallel jobs. ```bash $ ./test/integration/run-tests ``` -------------------------------- ### Continue anyway prompt with default no Source: https://github.com/debian/apt/blob/main/doc/design/install.md Prompt shown when the default answer is 'no', for example when warnings were displayed. ```text Continue anyway? [y/N] ``` -------------------------------- ### Space needed with /boot partition Source: https://github.com/debian/apt/blob/main/doc/design/install.md Space change display when kernels are installed and a separate /boot partition exists. ```text Space needed: 44.7 MB / 16.8 GB available └─ in /boot: 110 MB / 533 MB available ``` -------------------------------- ### Block scheme with title, details, and notes Source: https://github.com/debian/apt/blob/main/doc/design/install.md Example of a block with a title, indented details, and an optional notes line. ```text Title: Detail Detail Notes ``` -------------------------------- ### Build APT with Ninja Source: https://github.com/debian/apt/wiki/APT-Wiki Use the Ninja generator by passing -G Ninja to cmake, then build with ninja instead of make. ```bash cmake -G Ninja ``` ```bash ninja ``` -------------------------------- ### media-change example: prompt for disc insertion Source: https://github.com/debian/apt/blob/main/doc/progress-reporting.md Shows the format of a media-change message, including the medium label, drive, and human-readable prompt. ```text media-change: Ubuntu 5.10 _Breezy Badger_ - Alpha i386 (20050830):/cdrom/:Please insert the disc labeled: 'Ubuntu 5.10 _Breezy Badger_ - Alpha i386 (20050830)' in the drive '/cdrom/' and press enter. ``` -------------------------------- ### pmerror example: error message format Source: https://github.com/debian/apt/blob/main/doc/progress-reporting.md Shows the format of a pmerror message, including the deb path, total percentage, and error string. ```text pmerror: /var/cache/apt/archives/krecipes_0.8.1-0ubuntu1_i386.deb : 75% : trying to overwrite `/usr/share/doc/kde/HTML/en/krecipes/krectip.png', which is also in package krecipes-data ```