Manage Debian packages with the Smart Package Manager

All the Extras

© Lead Image © Pei Ling Hoo , 123RF.com

© Lead Image © Pei Ling Hoo , 123RF.com

Author(s):

The Smart Package Manager makes everyday tasks of handling RPM and DEB packages simple but has a full set of controls for experts.

Package managers simplify the often complex processes involved in managing software on a Linux system. Some package managers operate at the command line, others use a graphical interface, and still others are web-based tools; however, most package managers are designed to work with a specific package format. That means if you migrate from a system that uses the RPM format (e.g., Fedora or RHEL) to a system that uses DEB packages (e.g., Debian or Ubuntu), you need to get used to a whole different collection of package tools … unless you get Smart.

Smart Package Manager (SmartPM) is an innovative tool that has gained fame as a package management system that lets you manage different package formats through a single interface. According to the project website, SmartPM supports both Red Hat's RPM and Debian's DEB formats, as well as the Mandriva/Mageia URPMI format. Additionally, it manages tarballs for Slackware.

This versatility means you only need to learn one package manager to work on nearly any Linux system. (Keep in mind, however, that SmartPM is not intended to let users mix and match random formats on a single system. See the box titled "Not a Magic Bridge.")

Not a Magic Bridge

Although SmartPM supports several package formats, be aware that a multipackage system presents some limitations. The Smart Package Manager project is quick to point out that it is "not a magical bridge between every distribution in the planet." They add, "Instead, this is software offering better package management for these distributions when working with their native packages. Using multiple packaging systems at the same time (like rpm and dpkg) is possible but would require packages from those systems to follow the same packaging guidelines. As this is not the case at the moment, mixing package systems is not recommended" [1].

One look at the SmartPM documentation makes it clear that this vaunted package neutrality is only part of what makes SmartPM so smart. Another important feature is smart transactions. According to the SmartPM project, "While other software tries to find a possible solution to satisfy the relations involved in some user-requested operation, and sometimes even fails to do so, SmartPM goes beyond it. In the kernel of Smart Package Manager lives an algorithm that will not only find a solution, if one is available, but will find the best solution. This is done by quickly weighting every possible solution with a pluggable policy, which redefines the term 'best' depending on the operation goal (install, remove, upgrade, etc.)" [2]. This smart transaction capability means that SmartPM might not choose the latest version of a package if it determines an older version will provide a better overall result for the system.

SmartPM also lets you assign priorities to packages or package sources, so you can give preferred formats an advantage. In SmartPM, external packages are accessed through channels. Each channel supports a specific package type (see Table 1), and you can assign priorities by channel or package name.

Table 1

SmartPM Channels

APT-DEB Repository

APT-RPM Repository

DPKG Installed Packages

Mirror Information

Red Carpet Channel

RPM Directory

RPM Header List

RPM Metadata (YUM)

RPM Installed Packages

Slackware Repository

Slackware Installed Packages

URPMI Repository

In addition to providing a universal GUI for managing Linux packages, SmartPM also has a powerful command-line interface for full control of the package management environment. In this article, I focus on using SmartPM with DEB-based distributions.

Installation

The program is available from the project website [1]. Alternatively, you can enter

sudo apt-get update
sudo apt-get install smartpm

to install the python-smartpm, smartpm-core, and smartpm packages.

Various operating modes are enabled when launching the program. The graphical user interface (GUI) can be accessed with the use of the --gui option, whereas the interactive application for the console is launched by setting the --shell flag.

This interface is similar to Apt and Aptitude. Adding the --gui option to the call tells SmartPM to change to graphics mode before running.

Graphical Mode

Because you will be installing and changing base packages, you will need administrative privileges, so start SmartPM in GUI mode with:

sudo smart --gui

Otherwise, you will get the error Unable to create channel directory.

Interface

The graphical interface includes a menu bar and a row of buttons. The overview includes the software categories, information about the packages, and matching details. At the bottom of the window you will see the status bar with the total number of available and installed packages (Figure 1).

Figure 1: Easy to use and well structured, SmartPM simplifies software package management.

The File menu has options to upgrade channels and rebuild the cache. The File | Update Channels item updates the lists of package information. An individual update is possible by choosing File | Update Selected Channels (Figure 2). So far, only SmartPM offers this function, although it has been on the wishlist of extensions [3] for Apt and Aptitude for a long time.

Figure 2: If you prefer, you can update individual software lists and save time when downloading.

The Edit menu lets you check packages for unresolved dependencies, manage repositories, select packages, and change priorities. Edit | Priorities lets you edit priorities you've already set up. Right-clicking a program and choosing Priority allows you to specify how the program evaluates sources. Figure 3 shows this for the gnome-sudoku package.

Figure 3: Priorities let you determine which sources SmartPM considers in retrieving software.

The Views menu lets you filter the display in the package selection list; for example, you can filter for non-upgradable, unlocked, or installed packages. Selecting Views | Tree Style lets you toggle between sorting by categories, package sources, or package groups.

The Help menu takes you to information about the program version and an overview of the icons used by SmartPM to indicate the status of a package. Important menu items are also implemented as buttons, such as correcting recent changes and updating all installed packages.

The text you enter in the search box on the right acts as a filter for the package list. Right-clicking the magnifying glass reveals two choices: Automatic and Description. Automatic searches file names for the text entered, whereas Description searches the package descriptions for the entered text. Figure 1 shows entries in which the smartpm string occurs in the package name.

After selecting a package from the list, SmartPM shows you more details at the bottom of the window. In addition to general information, such as the status, priority, group, size, package source, and URL, you will find the description and the list of files that the package includes (Content).

The Changelog tab provides information on development, and you can see other packages on which the program depends or that are recommended for the program (Relations).

Command Line

More actions are available through the command-line interface. The syntax and function of the options in many cases match those of the Debian apt, apt-get, aptitude [4], and apt-cache tools. The developers have also added several useful options to SmartPM (Table 2). The general command form is:

Table 2

Command-Line SmartPM

Command

Option

Action

smart update

 

Update all package sources

smart update <source>

 

Update a specific package source

smart install <package>

 

Install a package

 

--download

Download but do not install

smart reinstall <package>

 

Install a package again

smart remove <package>

 

Delete a package

smart update <package>

 

Apply security patches

smart upgrade <package>

 

Install a newer version of a package

 

--check

Check for an update

 

--check-update

Check and update, if a new package exists

smart check

 

Validate dependencies

smart fix

 

Repair dependencies by retroactively installing or removing packages

smart clean

 

Clean the cache

smart search <package>

 

Find a package

 

--installed

List installed packages

smart query <package>

 

Query local and repository databases

 

--help

List the many query options

smart info <package>

 

Output detailed package information

smart

--shell

Enter interactive mode

smart <command> <options> <package>

The --help option listed under smart query can also be used with other commands to list options and a few usage examples.

Curiously, the smart remove <package> tool is missing an option in the style of Aptitude's --purge, which completely removes the configuration files. Queries about installed packages and source packages showed inconsistencies in the form of erroneous output. For example, the smart search --installed <package> command should only list installed <package> components, but in reality, it does far more (Figure 4).

Figure 4: The search for gimp returns more matches than expected.

Interactive

SmartPM's interactive interface is in many ways similar to the Apt shell [5]. In a terminal, users can run special commands such as install, remove, reinstall, update, upgrade, check, and fix. Their functions are consistent with the options discussed previously. One exception is ls, which lets you conveniently browse through the list of packages.

To enter interactive mode, type

sudo smart --shell

in the terminal. It is important to note that the software only initially performs individual operations on the cache. To implement the changes on the system, you need to issue the commit command. For example, Figure 5 shows the complete process of removing the mc package.

Figure 5: SmartPM only changes the package buffer first. You need to commit the operation for the software to implement the changes.

A complete list of all the other commands can be obtained by typing help. To exit shell mode, type either EOF, exit, or quit. SmartPM remembers the commands you type but not the scheduled operations. Thus, it behaves differently from Aptitude, which has a memory feature.

Conclusions

SmartPM is a good thing: On one hand, it offers all the features you need in everyday package management in a compact GUI. The GUI impresses with a well-planned design; it is stable and intuitive. Like PackageKit, the program attempts to provide a unified front end for various systems. This makes maintenance of various distributions easier.

On the other hand, SmartPM combines a variety of functions that you will probably know from the Apt group of tools in its shell interface. This mode is perfect for anyone who wants to leverage the full power of the package management functions.

A few small errors came to light in the command line: Not all of the options seemed to work properly. All told, however, the software left a very positive impression.

Infos

  1. SmartPM: http://labix.org/smart
  2. SmartPM features: http://labix.org/smart/features
  3. Feature request for updating branches of package lists: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=68025
  4. "Apt-get vs. Aptitude" by Frank Hofmann and Axel Beckert, Ubuntu User, No. 18, pg. 44
  5. Apt shell: http://manpages.ubuntu.com/manpages/hardy/man1/aptsh.1.html

The Author

Frank Hofmann (http://www.efho.de) studied computer science at the Technical University of Chemnitz, Germany. He is currently working with Berlin's Büro 2.0, an open source expert network, as a service provider specializing in printing and pre-press. He is a co-founder of the training company Wizards of FOSS. Since 2008 he has also coordinated the regional meeting of the Berlin-Brandenburg region Linux user group.