Skip to content

Instantly share code, notes, and snippets.

@julian-klode
Last active April 15, 2024 13:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save julian-klode/968ab0e8f10115f24c0a9c1aa560d69d to your computer and use it in GitHub Desktop.
Save julian-klode/968ab0e8f10115f24c0a9c1aa560d69d to your computer and use it in GitHub Desktop.
APT UX redesign drafts

Redesigning the acquire progress

Current progress

  • One line per file that started downloading
  • Summary line with a total percentage and one or more [ ] with per-item details shopwing ID,name,downloaded/item size,%

Example:

$ apt download wesnoth-1.16-data llvm-18
Get:1 https://debian.charite.de/ubuntu noble/universe amd64 llvm-18 amd64 1:18.1.2-1ubuntu3 [25,3 MB]
Get:2 https://debian.charite.de/ubuntu noble/universe amd64 wesnoth-1.16-data all 1:1.16.11-1build3 [146 MB]
71% [2 wesnoth-1.16-data 107 MB/146 MB 73%]^C

Good parts:

  • We have a view of total progress
  • We have a view of per-item progress for some items (as many as fit), with per-item sizes

Issues:

  • The log feels a bit cluttered
  • We can only show 2-3 in-progress items, since we stuff them all in a single line
  • There is no easy visual progress in a progress bar, only percentages

Unknown

  • Do the IDs help? We could be switching mirrors later, you can still link the downloads together as a user

New progress

Goal: Multi-line display with progress bar(s)

Plan: Use about the lowest third of the terminal to display a progress, the rest will be for scroll back; we don't want to steal the whole terminal window.

First draft with multiple columns:

Downloading https://debian.charite.de/ubuntu noble/main amd64 amd64 2.7.14build2 [1.375 kB]
[... more backlog of items we have started downloading, this should be all that remains ... ]
package [███      ]                                         package [███      ]
package [███      ]                                         package [███      ]
Downloading [5 MB/s] [█████                                            ] ETA 5s

Concerns:

  • We need more data per-package presumably, they could have vastly different sizes but with only uniform progress bars it would be hard to identify what is slow vs what is large
  • Columns may limit it in how much per-item data we can display and feel a bit too cluttered
  • The presentation of the log could use more improvements
  • Updating Columns is hard to implement so it's at best a later stage to actually have columns

Alternative tree draft:

Downloading https://debian.charite.de/ubuntu noble/main amd64 amd64 2.7.14build2 [1.375 kB]
[... more backlog of items we have started downloading, this should be all that remains ... ]
Downloading ...
|-- package [5 MB/100MB] [█                                      ] 33%
|-- package [5 MB/100MB] [█                                      ] 33%
Total [5 MB/s] [█████                                            ] ETA 5s

Notes:

  • Use of a tree structure (here ASCII, final Unicode) to highlight items are part of greater whole
  • More space for progress per item
  • Different information for total progress vs per-item progress:
    • Total gives download speed and ETA
    • Item gives item size and progress so far

Installation design

Solution screen

After calculating the changes to be performed, APT needs to present the solution to the user.

General layout

The screen is organized as a series of blocks, followed by warnings and notices and finally a prompt.

BLOCK

BLOCK

W: A warning
Continue? [Y/n]

Each block is separated by an empty line, and follows one of two schemes:

  1. Title, Details, optional notes

    This block should have a short title describing what is being shown such as "Installing" or "Summary", and one or more line of details, indented by two spaces. An optional final line may contain an additional note:

     Title:
       Detail
       Detail
     Notes
    

    The notes element should be used sparingly, for example, in the autoremove note:

     No longer needed:
        package1 package3
        package2 package4
     Use 'apt autoremove' to remove no longer needed packages.
    

    The note should be a single sentence, with complete punctuation.

  2. Text blobs are short paragraphs that consist only of informational text. They may appear before or after the changes lists. An example would be the "news" inserted by the Ubuntu Pro hooks. Text blobs should be two-three lines long, and have block style formatting, with a line length of no more than 79 characters, for example:

     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]
    

    They should usually not use any formatting inside the text.

Order of blocks; standard set of blocks

Generally speaking blocks, should be ordered by increasing importance, and context relevance. For example, while Suggested packages are less important then the packages being installed, they are Suggested by the packages being installed, so printing them first is awkward.

The standard blocks and their order are:

  1. 'No longer needed' - list of packages that can be autoremoved, and a note how to do so
  2. 'Upgrading' - list of packages being upgraded
  3. 'Installing' - a list of packages being installed manually
  4. 'Installing dependencies' - a list of packages being installed automatically
  5. 'Recommended packages' - a list of Recommends that did not get installed
  6. 'Suggested packages' - a list of Suggests that did not get installed (Suggests are not installed by default)
  7. 'Not upgrading yet' - a list of packages not yet upgraded due to phasing
  8. 'Not upgrading' - a list of packages not being upgraded due to dependency issues
  9. 'DOWNGRADING' - a list of packages being downgraded, with emphasis as it is unsupported.
  10. 'REMOVING' - a list of packages being removed, with emphasis as removals are dangerous
  11. 'REMOVING Essential packages:' - a list of Essential packages being removed and a note that it is dangerous.
  12. 'Summary' - contains a summary of the changes to be performed

Note that blocks that describe an action are given as a progressive verb, whereas non-action blocks have a non-verb title.

Package list layouts

Package lists can be rendered in one of three formats:

  1. The standard format is a columnar view following ls(1), top to bottom, left to right, showing only the package names. If the packages fit in a single line, they are rendered as such.

    Example of multiple lines:

     package1         shortname3 otherpackage5
     longpackagename2 short4     yetanotherpackage6
    

    Example for a single line

     package1 longpackagename2 shortname3
    
  2. The -V format presents one package per line with additional version information, in one of the following forms:

     name (version)
     name (old version => new version)
    
  3. The classic layout ("wall of text") is a left to right, top to bottom list that wraps around, with package names separated by spaces:

     package1 longpackagename2 shortname3
     short4 otherpackage5 yetanotherpackage6
    

    This is available in the --no-list-columns option.

Colors and Highlighting of package lists

A solution is essentially a diff to be applied to your system, so we highlight packages being added as green, and packages being removed as red. There are a couple more cases of changes calculated, though:

Packages that are being suggested: They are not installed by default, but you can install them to enhance the functionality of the packages being installed. We do not want to specifically highlight those, as it's informational only. What may be interesting is visually distinguishing Suggests that are not even available in your configured sources, as that is allowed (e.g. main packages Suggest multiverse, but multiverse is disabled).

Recommends that could not be installed: They are similar to Suggests, but normally installed by default, so seeing this section is a bit unexpected. We do not believe they warrant further highlighting, as the section appearing is more than enough.

Upgrades do not change the set of packages installed, but merely their versions, so from the "present the solution as a diff" approach, it is awkward to present them as green. However, green is also associated with "good" and upgrades are a normal thing for packages to do, so highlighting them green is not entirely wrong.

Not highlighting upgrades would make them look similar to non-change lists, like Suggests and Recommends that failed to install, which would be confusing to the user because it is making some change.

Downgrades are the opposite of upgrades, but importantly they are unsupported, we do not ever test them. It makes sense to highlight their unsupportedness, hence we mark them yellow.

Emphasis in the absence of colors and styles

The headings for removals and downgrades are in upper case to emphasise their danger.

The solution summary

The summary contains a line with package change counts per category, followed by the download size, following by any space changes.

Summary:
  Upgrading: 0, Installing: 23, Removing: 0, Not Upgrading: 1
  Download size: 6,947 kB
  Space needed: 44.7 MB / 16.8 GB available

Space changes are listed as one of the following:

  1. The space needed is known, but we can't figure out available space:

    Space needed: 44.7 MB
    
  2. Space needed and available space in the /usr partition

    Space needed: 44.7 MB / 16.8 GB available
    
  3. Space needed and available space, with kernels being installed and a separate /boot:

    Space needed: 44.7 MB / 16.8 GB available
    └─ in /boot:  110 MB / 533 MB available
    
  4. Freed space inverts the order of words vs "Space needed" to make the difference more striking:

    Freed space: 44.7 MB
    

Prompting

The final prompt asks the user if they want to continue by prompting either

Continue? [Y/n]

with the default being 'yes' (as indicated by the upper case character), or

Continue anyway? [y/N]

with a default of 'no', for example, in the case warnings were shown.

Showing and listing packages

APT provides several commands to show and list packages. These either take package name or description substrings (for search) as an input, and all of them should accept patterns.

All these commands should automatically output to a pager if connected to a tty such that users can easily scroll back and forth, similar to how git log works.

The show command

The show command presents teh details about the given packages in a deb822 format.

Package: apt
Version: 2.7.14build2
Priority: important
Build-Essential: yes
Section: admin
Origin: Ubuntu
Maintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>
Original-Maintainer: APT Development Team <deity@lists.debian.org>
Bugs: https://bugs.launchpad.net/ubuntu/+filebug
Installed-Size: 4.201 kB
Provides: apt-transport-https (= 2.7.14build2)
Depends: base-passwd (>= 3.6.1) | adduser, gpgv, libapt-pkg6.0t64 (>= 2.7.14build2), ubuntu-keyring, libc6 (>= 2.38), libgcc-s1 (>= 3.3.1), libgnutls30t64 (>= 3.8.1), libseccomp2 (>= 2.4.2), libstdc++6 (>= 13.1), libsystemd0
Recommends: ca-certificates
Suggests: apt-doc, aptitude | synaptic | wajig, dpkg-dev (>= 1.17.2), gnupg | gnupg2 | gnupg1, powermgmt-base
Conflicts: apt-verify, libnettle8 (<< 3.9.1-2.2~)
Breaks: apt-transport-https (<< 1.5~alpha4~), apt-utils (<< 1.3~exp2~), aptitude (<< 0.8.10)
Replaces: apt-transport-https (<< 1.5~alpha4~), apt-utils (<< 1.3~exp2~)
Task: cloud-minimal, minimal, server-minimal
Download-Size: 1.375 kB
APT-Manual-Installed: yes
APT-Sources: https://debian.charite.de/ubuntu noble/main amd64 Packages
Description: commandline package manager
 This package provides commandline tools for searching and
 managing as well as querying information about packages
 as a low-level access to all features of the libapt-pkg library.
 .
 These include:
  * apt-get for retrieval of packages and information about them
    from authenticated sources and for installation, upgrade and
    removal of packages together with their dependencies
  * apt-cache for querying available information about installed
    as well as installable packages
  * apt-cdrom to use removable media as a source for packages
  * apt-config as an interface to the configuration settings
  * apt-key as an interface to manage authentication keys

The following changes are performed on the raw record in the Packages file:

  • Field names are rendered in bold text.
  • The package name in the Package is highlighted green. This is the only use of color.
  • The Size field is renamed Download-Size.
  • The Download-Size and Installed-Size fields are rewritten with human-readable sizes.
  • Some fields are omitted and other fields are inserted.

This output is machine-readable, and may be preferable to use as an interface compared to the 'list' command for scripting purposes in combination with the dctrl-tools tools.

The list command

The list command provides a single line per package/version in the form

package/codename,codename,... version architecture [flags]

where flags could be installed or local or both, separated by comma. It's main use is identifying which packages match a certain pattern, i.e. to quickly see all installed packages by running apt list ?installed.

The package name should be highlighted green.

The search command

The search command searches the description of packages and provides similar output to the list command, just with the short description added. Each result is separated by a blank line:

package/codename,codename,... version architecture [flags]
  short description

package/codename,codename,... version architecture [flags]
  short description

It is used to search for packages based on a description.

The policy command

The policy command shows how the version to install is being selected, or if no query is specified shows the pins configured in preferences files.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment