# &app; Manual

This manual describes version &appversion; of &app;.
Gustavo Niemeyer gustavo@niemeyer.net
404
2004-12-05
niemeyer

README - Smart Package Manager.

0.1
2008-11-11
afb

Conversion from HTML to DocBook.

0.2
2008-11-22
afb

Added new section on authentication.

0.3
2008-11-26
afb

Auto-generated command options help.

Legal Notice

This document is distributed under the terms of the GNU General Public License as published by the Free Software; either version 2 of the License, or (at your option) later version. A copy of this license can be found in Appendix A, or in the file LICENSE included with the source code of this program.

## Overview

The &app; project has the ambitious objective of creating smart and portable algorithms for solving adequately the problem of managing software upgrading and installation. This tool works in all major distributions, and will bring notable advantages over native tools currently in use (APT, APT-RPM, YUM, URPMI, etc).

Notice that this project is not a magical bridge between every distribution in the planet. 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.

From The Free On-line Dictionary of Computing:

>           smart
>                 1. <programming> Said of a program that does the {Right Thing}
>                    in a wide variety of complicated circumstances. (...)

## Features

### Modular Backends

Smart has been developed with modularity and flexibility in mind. It's completely backend-based, and package-manager-agnostic. Support is currently implemented for RPM, DPKG, Slackware and Archlinux package management systems, and porting it to new systems should be very easy. Smart is written in Python with some C code in performance-critical areas.

### Smart Transactions

That's one of the most interesting aspects of Smart Package Manager, and the one who has motivated calling it smart. Computing transactions respecting the relations involved in the package management world may become an unpleasant task when thousands of packages and relations are being considered, or even when just a few complex relations turn the most obvious choice into the unwanted one.

### Multiple Interfaces

Smart has multiple native and completely integrated interfaces:

- Command line interface, with several useful subcommands: update, install, reinstall, upgrade, remove, check, fix, download, search, and more.

- Shell interface, with command and argument completion, making it easy to perform multiple operations quickly using a local or remote terminal.

- Graphic interface, offering the friendliness of visual user interaction. It is available for the GTK+ and Qt graphic environments.

- Command line interface with graphic feedback, allowing one to integrate the power of command line with graphic environments.

Besides these interfaces, ksmarttray is also included in the smart package. It notifies users about available updates using a KDE tray icon. A similar program is also available as a panel-plugin (Xfce).

### Distribution Channels

Channels are the way Smart becomes aware about external repositories of information. Many different channel types are supported, depending on the backend and kind of information desired:

- 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

- URPMI Repository

- Slackware Repository

- Slackware Directory

- Slackware Installed Packages

- Archlinux Repository

- Archlinux Directory

- Archlinux Installed Packages

### Priority Handling

Priorities are a powerful way to easily handle integration of multiple channels and explicit user setups regarding preferred package versions.

Basically, packages with higher priorities are considered a better option to be installed in the system, even when package versions state otherwise. Priorities may be individually assigned to all packages in given channels, to all packages with given names, and to packages with given names inside given channels.

With custom priority setups, it becomes possible to avoid unwanted upgrades, force downgrades, select packages in given channels as preferential, and other kinds of interesting setups.

### Autobalancing Mirror System

Smart offers a very flexible mirror support. Mirrors are URLs that supposedly provide the same contents as are available in other URLs, named origins. There is no internal restriction on the kind of information which is mirrored. Once an origin URL is provided, and one or more mirror URLs are provided, these mirrors will be considered for any file which is going to be fetched from an URL starting with the origin URL.

Mirror precedence is dynamically computed based on the history of downloads of all mirrors available for a given origin URL (including the origin site itself). The fastest mirrors and with less errors are chosen. When errors occur, the next mirror in the queue is tried.

For instance, if a mirror `http://mirror.url/path/` is provided for the origin `ftp://origin.url/other/path/`, and a file in `ftp://origin.url/other/path/subpath/somefile` is going to be fetched, the mirror will be considered for being used, and the URL `http://mirror.url/path/subpath/somefile` will be used if the mirror is chosen. Notice that strings are compared and replaced without any pre-processing, so that it's possible to use different schemes (ftp, http, etc) in mirror entries, and even URLs ending in prefixes of directory entries.

### Downloading Mechanism

Smart has a fast parallel downloading mechanism, allowing multiple connections to be used for one or more sites. The mechanism supports:

- Resuming

- Timestamp checking

- Parallel uncompression

- Autodetection of FTP user limit

- Cached file validation

and more.

At that moment, the following schemes are natively supported:

- file

- ftp

- http

- https

- scp

Additionally, the following schemes are supported when pycurl is available:

- ftps

- telnet

- dict

- ldap

### Removable Media Support

Smart Package Manager implements builtin support for removable media (CDROMs, DVDs, etc) in most of the supported channel types. The following features are currently implemented:

- Mountpoint autodetection

- Support for multiple simultaneous media drives

- Medias may be inserted in any order

- Installed system is guaranted to maintain correct relations between media changes

- Remote removable media support using any of the supported schemes (ftp, http, scp, etc)

## Packages

Smart supports the following package manager file formats:

### RPM

RPM packages are used by e.g. Fedora and Red Hat (Enterprise) Linux.

Example: `name-version-release.noarch.rpm`

### DEB

DEB packages (DPKG) are used by e.g. Ubuntu and Debian GNU/Linux.

Example: `name_version-release_all.deb`

### Slack

Slackware packages are used by e.g. Vector Linux and Slackware Linux.

Example: `name-version-noarch-release.tgz`

### Arch

Archlinux packages are used by Arch Linux with the Pacman system.

Example: `name-version-release-i686.pkg.tar.gz`

## Channels

Smart supports the following repository formats as source channels:

### RPM

- RPM System Database (locally installed packages)

- APT repositories for .rpm

- RPM-MD (used by YUM and ZYpp)

- Red Carpet (used by Ximian/Novell)

- RPM Header List (used by RedHat and Conectiva installation CDs, probably others)

- RPM Directory (a directory with a bunch of RPMs in it, no indexing required)

- URPMI (used by Mandriva)

### DEB

- DEB System Database (locally installed packages)

- APT repositories for .deb

- DEB Directory (a directory with a bunch of DEBs in it, no indexing required)

### Slack

- Slackware installed packages database

- Slackware repositories

- Slackware directories

### Arch

- Archlinux installed packages database

- Archlinux repositories

- Archlinux directories

### Mirrors

- up2date (used by RedHat/Fedora)

- Conectiva-style mirror description formats

## Running Smart

&app; may be run in many different ways, depending on the interface in use and on the intended goal.

The following command would install the foobar package, for instance:

    smart install foobar

While the following command would install the foobar package, but with graphic output:

    smart --gui install foobar

To open the graphic interface in interactive mode, one may simply run:

    smart --gui

Similarly, the following command would open the shell interface:

    smart --shell

Extensive help is available for all commands, by using the `--help` switch:

    smart --help
    smart install --help
    smart channel --help
    ...

### Administrative privileges

Normally Smart is read-only, unless you have administrative privileges.

You can use something like sudo to temporarily gain such rights:

    sudo smart upgrade --update

Some systems require you to use su and the superuser account instead.

There is a suid program called `smart-update` bundled with Smart:

    smart-update

It allows you to update channel information without having privileges.

You need administrative privileges to install or remove packages.

### Graphic Authentication

When using the graphic interface, you need a wrapper to authenticate.

For Fedora there is a consolehelper

https://fedorahosted.org/usermode/

program called `smart-root`:

    smart-root --gui

smart-root

The &app; consolehelper (called smart-root) query window. It has a Password entry field, and buttons Cancel and OK.

For Ubuntu you can use gksu

http://www.nongnu.org/gksu/

to authenticate with your password:

    gksudo -- smart --gui

gksu/gksudo

The &app; password authentication window using gksudo. It has a Password entry field, and buttons Cancel and OK.

## Graphic Interface

Smart offers both GTK+ and Qt interfaces.

### Main Window

When you start the &app; GUI, the following window is displayed:

&app; GTK+ GUI

The &app; graphic interface for GTK+. Shows the main window with titlebar, menubar, toolbar, package list and package info. Menubar contains File, Edit, View and Help menus.

If you are using the Qt interface instead of the default GTK+, it looks more like:

&app; Qt GUI

The &app; graphic interface for Qt. Shows the main window with titlebar, menubar, toolbar, package list and package info. Menubar contains File, Edit, View and Help menus.

The two graphic user interface variants (GTK+ and Qt) offer identical features.

#### Toolbar

The toolbar contains tools for the following actions:

Update channels

  Updates the information known about the channels.

Apply marked changes

  Commits the transaction with the marked changes.

Undo last change

  Removes the last change added to the transaction.

Redo last undone change

  Restores the transaction change previously removed.

Clear all changes

  Clears all marked changes from the transaction.

Upgrade all packages

  Upgrades all packages currently installed.

Find packages

  Shows the searchbar for finding packages.

#### Searchbar

The searchbar allows you to find and show packages.

Automatic

  Searches through package fields automatically.

Description

  Searches the package summary and description.

#### Package List

The package list shows the current list of packages, after any filtering:

- Package

  Package status and name

- Version

  Package version and release

Version might include the machine architecture ("arch") of the package.

#### Package Info

The package info shows information about the currently selected package:

- General

- Description

- Content

- Relations

- URLs

If you have several packages selected, only the first one is shown.

### Managing Packages

#### Install

To mark a package for installation, do one of the following:

- Select the status icon of the available package

- Double-click the available package in the list

- Right-click on the package and choose Install

The Change Summary window will be shown, choose OK to confirm the transaction.

#### Remove

To mark a package for uninstallation, do one of the following:

- Select the status icon of the installed package

- Double-click the installed package in the list

- Right-click on the package and choose Remove

The Change Summary window will be shown, choose OK to confirm the transaction.

#### Apply

To apply marked changes and commit the transaction, choose Execute Changes.

#### Clear

To clear marked changes and empty the transaction, choose Clear Marked Changes.

#### Update

To update the information known about channels, choose Update Channels.

#### Upgrade

To upgrade packages currently installed in the system, choose Upgrade All.

#### Check

To check relations between all packages, choose Check All Packages.

#### Fix

To fix dependencies of installed packages, choose Fix All Problems.

### Displaying Packages

#### Filtering Packages

You can hide packages from showing in the package list:

- Hide Non-upgrades (Show Upgrades)

- Hide Installed (Show Available)

- Hide Uninstalled (Show Installed)

- Hide Unmarked (Show Marked)

- Hide Unlocked (Show Locked)

- Hide Requested (Show Automatic)

- Hide Old (Show New)

You can also filter the packages by using the .

#### Tree Style

You can choose how the package list should be grouped:

- Groups

- Channels

- Groups & Channels

- None

Choosing None shows a flat list instead of a grouped tree.

### Editing Configuration

#### Channels

Channels are used as sources of information about installed and available packages.

To view or edit the current channels, choose Edit Channels

#### Mirrors

Mirrors are URLs that provide the same contents as are available in other URLs.

To view or edit the current mirrors, choose Edit Mirrors

#### Flags

Package flags are used to tune the behavior of some algorithms when dealing with the given packages.

To view or edit the current package flags, choose Edit Flags

#### Priorities

Packages with higher priorities are considered a better option even when package versions state otherwise.

To view or edit the current package priorities, choose Edit Priorities

## Text Interface

Smart offers a command mode and a shell interface.

Usage:

`smart` command options arguments --shell

Options:

`--help`

  Show more help information and exit

`--version`

  Show program's version number and exit

`--config-file=FILE`

  Configuration file (default is <data-dir>/config)

`--data-dir=DIR`

  Data directory (default is /var/lib/smart/)

`--log-level=LEVEL`

  Set the log level to level (debug, info, warning, error)

`--gui`

  Use the default graphic interface

`--shell`

  Use the default shell interface

`--interface=NAME`

  Use the given interface

`--ignore-locks`

  Don't respect locking

`-o OPT` `--option=OPT`

  Set the option given by a name=value pair

Examples:

    smart install --help

    smart install install pkgname

    smart install --gui

    smart install --gui install pkgname

    smart install --shell

### Action Commands

#### Update

`smart` update options channelalias

This command will update the known information about the given channels. If no channels are given, all channels which are not disabled or setup for manual updates will be updated.

Options:

`--after=MIN`

  Only update if the last successful update happened before the given delay

Examples:

        smart update
        smart update mychannel
        smart update mychannel1 mychannel2

#### Install

`smart` install options package

This command will install one or more packages in the system. If a new version of an already installed package is available, it will be selected for installation.

Options:

`--stepped`

  Split operation in steps

`--urls`

  Dump needed urls and don't commit operation

`--metalink`

  Dump metalink xml and don't commit operation

`--download`

  Download packages and don't commit operation

`--explain`

  Include additional information about changes,when possible

`-y` `--yes`

  Do not ask for confirmation

`--dump`

  Dump package names and versions to stderr but don't commit operation

Examples:

        smart install pkgname
        smart install '*kgna*'
        smart install pkgname-1.0
        smart install pkgname-1.0-1
        smart install pkgname1 pkgname2
        smart install ./somepackage.file
        smart install http://some.url/some/path/somepackage.file

#### Reinstall

`smart` reinstall options package

This command will reinstall one or more packages which are already installed in the system.

Options:

`--stepped`

  Split operation in steps

`--urls`

  Dump needed urls and don't commit operation

`--metalink`

  Dump metalink xml and don't commit operation

`--download`

  Download packages and don't commit operation

`--explain`

  Include additional information about changes,when possible

`-y` `--yes`

  Do not ask for confirmation

Examples:

        smart reinstall pkgname
        smart reinstall '*kgnam*'
        smart reinstall pkgname-1.0
        smart reinstall pkgname-1.0-1
        smart reinstall pkgname1 pkgname2

#### Upgrade

`smart` upgrade options package

This command will upgrade one or more packages which are currently installed in the system. If no packages are given, all installed packages will be checked. If pkgname is prefixed by a '+', it will be installed even if it was not currently installed in the system. If pkgname is prefixed with a '-', it will be removed.

Options:

`--stepped`

  Split operation in steps

`--urls`

  Dump needed urls and don't commit operation

`--metalink`

  Dump metalink xml and don't commit operation

`--download`

  Download packages and don't commit operation

`--update`

  Update channel information before trying to upgrade

`--check`

  Just check if there are upgrades to be done

`--check-update`

  Check if there are upgrades to be done, and update the known upgrades

`--explain`

  Include additional information about changes,when possible

`-y` `--yes`

  Do not ask for confirmation

`--dump`

  Dump package names and versions to stderr but don't commit operation

Examples:

        smart upgrade
        smart upgrade pkgname
        smart upgrade '*kgnam*'
        smart upgrade pkgname-1.0
        smart upgrade pkgname-1.0-1
        smart upgrade pkgname1 pkgname2

#### Remove

`smart` remove options package

This command will remove one or more packages which are currently installed in the system.

Options:

`--stepped`

  Split operation in steps

`--urls`

  Dump needed urls and don't commit operation

`--metalink`

  Dump metalink xml and don't commit operation

`--download`

  Download packages and don't commit operation

`--explain`

  Include additional information about changes,when possible

`-y` `--yes`

  Do not ask for confirmation

`--auto`

  Use the auto-install information to remove stuff.

`--dump`

  Dump package names and versions to stderr but don't commit operation

Examples:

        smart remove pkgname
        smart remove '*kgnam*'
        smart remove pkgname-1.0
        smart remove pkgname-1.0-1
        smart remove pkgname1 pkgname2

#### Check

`smart` check options package

This command will check relations between packages. If no packages are explicitly given, all packages in the selected channels will be checked. Relations of the checked packages will only match packages inside the selected channels. Use the 'fix' command to fix broken relations of installed packages.

Options:

`--all`

  Check packages in all channels

`--installed`

  Check packages which are in at least one installed channel (default)

`--available`

  Check packages which are in at least one non-installed channel

`--channels=ALIASES`

  Check packages which are inside the given channels (comma separated aliases)

Examples:

        smart check
        smart check pkgname
        smart check '*kgna*'
        smart check pkgname-1.0
        smart check pkgname-1.0-1
        smart check pkgname1 pkgname2

#### Fix

`smart` fix options package

This command will try to fix dependencies of installed packages which are related to the given packages. Notice that the given packages may be currently installed or not. If no packages are given, all installed packages will be checked.

Options:

`--stepped`

  Split operation in steps

`--urls`

  Dump needed urls and don't commit operation

`--metalink`

  Dump metalink xml and don't commit operation

`--download`

  Download packages and don't commit operation

`--explain`

  Include additional information about changes,when possible

`-y` `--yes`

  Do not ask for confirmation

Examples:

        smart fix
        smart fix pkgname
        smart fix '*kgna*'
        smart fix pkgname-1.0
        smart fix pkgname-1.0-1
        smart fix pkgname1 pkgname2

#### Download

`smart` download options package

This command allows downloading one or more given packages.

Options:

`--target=DIR`

  Packages will be saved in given directory

`--pack`

  Pack all downloaded packages in a tarball

`--output=FILE`

  Redirect tarball output to given filename

`--urls`

  Dump needed urls and don't download packages

`--metalink`

  Dump metalink xml and don't download packages

`--from-urls`

  Download files from the given urls and/or from the given files with lists of urls

`--from-metalink`

  Download files from the given metalink file

Examples:

        smart download pkgname
        smart download '*kgna*'
        smart download pkgname-1.0
        smart download pkgname-1.0-1
        smart download pkgname1 pkgname2
        smart download pkgname --urls 2> pkgname-url.txt
        smart download pkgname --metalink 2> pkgname.metalink
        smart download --from-urls pkgname-url.txt
        smart download --from-urls http://some.url/some/path/somefile
        smart download --from-metalink pkgname.metalink

#### Clean

`smart` clean options

This command cleans the package cache. You can use it to delete old unused files that were left behind because of an incomplete transaction.

### Query Commands

#### Search

`smart` search expression

This command allows searching for the given expressions in the name, summary, and description of known packages.

Options:

`--installed`

  Consider only installed packages

`--newest`

  Consider only the newest package

`--dupes`

  Consider only installed packages that are duplicated

`--leaves`

  Consider only installed packages not required by others

`--orphans`

  Consider only installed packages not in other channels

`--provides=DEP`

  Show only packages providing the given dependency

`--requires=DEP`

  Show only packages requiring the given dependency

`--conflicts=DEP`

  Show only packages conflicting with the given dependency

`--upgrades=DEP`

  Show only packages upgrading the given dependency

`--name=STR`

  Show only packages which match given name

`--group=STR`

  Show only packages which match given group

`--channel=STR`

  Show only packages from the given channel

`--summary=STR`

  Show only packages which match given summary

`--description=STR`

  Show only packages which match given description

`--path=STR`

  Show only packages which include the given path in the available meta information

`--url=STR`

  Show only packages which include the given reference url in the available meta information

`--hide-version`

  Hide package version

`--show-summary`

  Show package summaries

`--show-provides`

  Show provides for the given packages

`--show-requires`

  Show requires for the given packages

`--show-prerequires`

  Show requires selecting only pre-dependencies

`--show-upgrades`

  Show upgrades for the given packages

`--show-conflicts`

  Show conflicts for the given packages

`--show-providedby`

  Show packages providing dependencies

`--show-requiredby`

  Show packages requiring provided information

`--show-upgradedby`

  Show packages upgrading provided information

`--show-conflictedby`

  Show packages conflicting with provided information

`--show-priority`

  Show package priority

`--show-channels`

  Show channels that include this package

`--show-all`

  Enable all --show-* options

`--show-format=TMPL`

  Show using string template

`--format=FMT`

  Change output format

`--output=FILE`

  Redirect output to given filename

Examples:

        smart search ldap
        smart search kernel module
        smart search rpm 'package manager'
        smart search pkgname
        smart search 'pkgn*e'

#### Query

`smart` query options package

This command allows querying the known packages in many different ways. Check also the 'search' command.

Options:

`--installed`

  Consider only installed packages

`--newest`

  Consider only the newest package

`--dupes`

  Consider only installed packages that are duplicated

`--leaves`

  Consider only installed packages not required by others

`--orphans`

  Consider only installed packages not in other channels

`--provides=DEP`

  Show only packages providing the given dependency

`--requires=DEP`

  Show only packages requiring the given dependency

`--conflicts=DEP`

  Show only packages conflicting with the given dependency

`--upgrades=DEP`

  Show only packages upgrading the given dependency

`--name=STR`

  Show only packages which match given name

`--group=STR`

  Show only packages which match given group

`--channel=STR`

  Show only packages from the given channel

`--summary=STR`

  Show only packages which match given summary

`--description=STR`

  Show only packages which match given description

`--path=STR`

  Show only packages which include the given path in the available meta information

`--url=STR`

  Show only packages which include the given reference url in the available meta information

`--hide-version`

  Hide package version

`--show-summary`

  Show package summaries

`--show-provides`

  Show provides for the given packages

`--show-requires`

  Show requires for the given packages

`--show-prerequires`

  Show requires selecting only pre-dependencies

`--show-upgrades`

  Show upgrades for the given packages

`--show-conflicts`

  Show conflicts for the given packages

`--show-providedby`

  Show packages providing dependencies

`--show-requiredby`

  Show packages requiring provided information

`--show-upgradedby`

  Show packages upgrading provided information

`--show-conflictedby`

  Show packages conflicting with provided information

`--show-priority`

  Show package priority

`--show-channels`

  Show channels that include this package

`--show-all`

  Enable all --show-* options

`--show-format=TMPL`

  Show using string template

`--format=FMT`

  Change output format

`--output=FILE`

  Redirect output to given filename

Examples:

        smart query pkgname
        smart query '*kgnam*'
        smart query pkgname-1.0
        smart query pkgname --show-requires
        smart query --requires libpkg.so --show-providedby
        smart query --installed
        smart query --summary ldap
        smart query --show-format='Name: $name	Version: $version
        '

#### Newer

`smart` newer

This command shows packages that have available upgrades.

Examples:

        smart newer

#### Info

`smart` info options package

This command will show information about the given packages.

Options:

`--urls`

  Show urls

`--paths`

  Show path list

`--changelog`

  Show change log

Examples:

        smart info pkgname
        smart info pkgname-1.0
        smart info pkgname --urls --paths

#### Stats

`smart` stats

This command will show some statistics.

Examples:

        smart stats

### Setup Commands

#### Config

`smart` config options

This command allows changing the internal configuration representation arbitrarily. This is supposed to be used by advanced users only, and is generally not needed.

Options:

`--set`

  Set given key=value options

`--show`

  Show given options

`--yaml`

  Show given options in yaml format

`--remove`

  Remove given options

`--force`

  Ignore problems

Examples:

        smart config --set someoption.suboption=10
        smart config --remove someoption
        smart config --show someoption
        smart config --show

#### Channel

`smart` channel options

This command allows one to manipulate channels. Channels are used as sources of information about installed and available packages. Depending on the channel type, a different backend is used to handle interactions with the operating system and extraction of information from the given channel. The following channel types are available: apt-deb - APT-DEB Repository apt-rpm - APT-RPM Repository arch-dir - Archlinux Directory arch-site - Archlinux Repository arch-sys - Archlinux Installed Packages deb-dir - DEB Directory deb-sys - DPKG Installed Packages mirrors - Mirror Information red-carpet - Red Carpet Channel rpm-dir - RPM Directory rpm-hdl - RPM Header List rpm-md - RPM MetaData rpm-sys - RPM Installed Packages slack-dir - Slackware Directory slack-site - Slackware Repository slack-sys - Slackware Installed Packages up2date-mirrors - Mirror Information (up2date format) urpmi - URPMI Repository yast2 - YaST2 Repository Use --help-type <type> for more information.

Options:

`--add`

  Argument is an alias and one or more key=value pairs defining a channel, or a filename/url pointing to a channel description in the same format used by --show, or a directory path where autodetection will be tried

`--set`

  Argument is an alias, and one or more key=value pairs modifying a channel

`--remove`

  Arguments are channel aliases to be removed

`--remove-all`

  Remove all existent channels

`--show`

  Show channels with given aliases, or all channels if no arguments were given

`--yaml`

  Show given channels in yaml format

`--edit`

  Edit channels in editor set by $editor

`--enable`

  Enable channels with given aliases

`--disable`

  Disable channels with given aliases

`-y` `--yes`

  Execute without asking

`--help-type=TYPE`

  Show further information about given type

Examples:

        smart channel --help-type apt-rpm
        smart channel --add mydb type=rpm-sys name="RPM Database"
        smart channel --add mychannel type=apt-rpm name="Some repository" \
                          baseurl=http://somewhere.com/pub/repos components=extra
        smart channel --set mychannel priority=-100
        smart channel --disable mychannel
        smart channel --remove mychannel
        smart channel --show
        smart channel --show mychannel > mychannel.txt
        smart channel --add ./mychannel.txt
        smart channel --add http://some.url/mychannel.txt
        smart channel --add /mnt/cdrom

#### Priority

`smart` priority options

This command allows changing the priority of given packages. Packages with higher priorities are considered a better option even when package versions state otherwise. Using priorities one may avoid unwanted upgrades, force downgrades, select packages in given channels as preferential, and other kinds of interesting setups. When a package has no explicit priority, the channel priority is used. The channel priority may be changed using the 'channel' command, and defaults to 0 when not set. Notice that negatives priorities must be preceded by '--' in the command line, otherwise they'll be interpreted as command line options.

Options:

`--set`

  Set priority

`--remove`

  Unset priority

`--show`

  Show priorities

`--yaml`

  Show priorities in yaml format

`--force`

  Ignore problems

Examples:

        smart priority --set pkgname 100
        smart priority --set pkgname mychannel -- -200
        smart priority --remove pkgname
        smart priority --remove pkgname mychannel
        smart priority --show
        smart priority --show pkgname

#### Mirror

`smart` mirror options

This command allows one to manipulate mirrors. Mirrors are URLs that supposedly provide the same contents as are available in other URLs, named origins in this help text. There is no internal restriction on the kind of information which is mirrored. Once an origin URL is provided, and one or more mirror URLs are provided, these mirrors will be considered for any file which is going to be fetched from an URL starting with the origin URL. Whether the mirror will be chosen or not will depend on the history of downloads from this mirror and from other mirrors for the same URL, since mirrors are automatically balanced so that the fastest mirror and with less errors is chosen. When errors occur, the next mirror is tried. For instance, if a mirror "http://mirror.url/path/" is provided for the origin "ftp://origin.url/other/path/", and a file in "ftp://origin.url/other/path/subpath/somefile" is going to be fetched, the mirror will be considered for being used, and the URL "http://mirror.url/path/subpath/somefile" will be used if the mirror is chosen. Notice that strings are compared and replaced without any pre-processing, so that it's possible to use URLs ending in prefixes of directory entries.

Options:

`--show`

  Show current mirrors

`--yaml`

  Show current mirrors in yaml format

`--add`

  Add to the given origin url the given mirror url, provided either in pairs, or in a given file/url in the format used by --show

`--remove`

  Remove from the given origin url the given mirror url, provided either in pairs, or in a given file/url in the format used by --show

`--remove-all`

  Remove all mirrors for the given origin urls

`--sync=FILE`

  Synchronize mirrors from the given file/url, so that origins in the given file will have exactly the specified mirrors

`--edit`

  Edit mirrors in editor set by $editor

`--clear-history`

  Clear history for the given origins/mirrors, or for all mirrors

`--show-penalities`

  Show current penalities for origins/mirrors, based on the history information

Examples:

        smart mirror --show
        smart mirror --add ftp://origin.url/some/path/ http://mirror.url/path/
        smart mirror --remove ftp://origin.url/some/path/ http://mirror.url/path/
        smart mirror --add http://some.url/path/to/mirrors.txt
        smart mirror --sync http://some.url/path/to/mirrors.txt
        smart mirror --clear-history ftp://origin.url/some/path/
        smart mirror --clear-history ftp://mirror.url/path/
        smart mirror --clear-history

#### Flag

`smart` flag options

This command allows one to set, remove, and show package flags. Package flags are used to tune the behavior of some algorithms when dealing with the given packages. Currently known flags are: lock - Flagged packages will not be removed, if they are currently installed, nor installed, if they are currently available. new - Flagged packages were considered new packages in the repository when the last update was done. This flag is automatically manipulated by the system. auto - Flagged packages were automatically installed to satisfy dependencies. This flag is automatically manipulated by the system. multi-version - Flagged packages may have more than one version installed in the system at the same time (backend dependent).

Options:

`--set`

  Set flags given in pairs of flag name/target, where targets may use just the package name, or the package name, relation, and version, such as: lock 'python > 1.0'

`--remove`

  Remove flags given in pairs of flag name/target, where targets may use just the package name, or the package name, relation, and version, such as: lock 'python > 1.0'

`--show`

  Show packages with the flags given as arguments or all flags if no argument was given

`--yaml`

  Show given flags in yaml format

`--force`

  Ignore problems

Examples:

        smart flag --show
        smart flag --show new
        smart flag --set lock pkgname
        smart flag --remove lock pkgname
        smart flag --set lock 'pkgname >= 1.0'
        smart flag --remove lock 'pkgname >= 1.0'

### Shell Interface

The &app; Shell Mode is an interactive text interface:

    smart> help

You can add package commands to a transaction, and then commit all marked package changes at once. It also helps with cache management by only updating when necessary to do so instead of for every command.

Shell Commands:

#### Check

`check` options pkgname

The check command verifies relations between packages, and accepts the same options available in the command line interface .

#### Commit

`commit`

The commit command applies marked changes in the system.

#### Download

`download` pkgname

The download command fetches the given packages to the local filesystem.

#### Exit

`exit`

The exit/quit/EOF command returns to the system.

#### Fix

`fix` pkgname

The fix command verifies relations of given packages and marks the necessary changes for fixing them.

Options:

`--explain`

  Include additional information about changes, when possible

#### Flag

`flag` options

The flag command allows configuring, removing and verifying package flags, and accepts the same options available in the command line interface .

#### Info

`info` pkgname

The info command shows information about packages.

#### Install

`install` pkgname

The install command marks packages for installation.

Options:

`--explain`

  Include additional information about changes, when possible

#### Keep

`keep` pkgname

The keep command unmarks currently marked packages.

Options:

`--explain`

  Include additional information about changes, when possible

#### Ls

`ls` options string

The ls command lists packages by name. Wildcards are accepted.

Options:

`-l`

  List only installed packages

`-n`

  List only new packages

`-v`

  Show versions

`-s`

  Show summaries

#### Query

`query` options pkgname

The query command allows querying package information, and accepts the same options available in the command line interface .

#### Quit

`quit`

The exit/quit/EOF command returns to the system.

#### Redo

`redo`

The redo command reapplies undone changes.

#### Reinstall

`reinstall` pkgname

The reinstall command marks packages for reinstallation.

Options:

`--explain`

  Include additional information about changes, when possible

#### Remove

`remove` pkgname

The remove command marks packages for being removed.

Options:

`--explain`

  Include additional information about changes, when possible

#### Search

`search` string

The search command allows searching for packages.

#### Shell

`shell` cmd !cmd

The shell command offers execution of system commands.

#### Stats

`stats`

The stats command shows some statistics.

#### Status

`status`

The status command shows currently marked changes.

#### Undo

`undo`

The undo command reverts marked changes.

#### Update

`update` alias

The update command will update channel information.

#### Upgrade

`upgrade` pkgname

The upgrade command marks packages for upgrading.

Options:

`--explain`

  Include additional information about changes, when possible

## Building Smart

### Installing

Smart uses regular Distutils installation:

    python setup.py install

Or you can use the supplied `Makefile`:

    make
    sudo make install

To run all tests in the integrated test suite:

    make test

### Dependencies

#### Core

Smart is written in Python, with some core modules rewritten as C extensions for memory savings and performance gains. With that in mind, the core system of Smart depends on Python 2.3 or higher, and a C compiler to build the extensions.

#### Graphic Interface

The "gtk" graphic interface depends on pygtk 2.4 or higher.

The "qt" graphic interface depends on pyqt 3.3 up (not 4.x).

#### RPM backend

The RPM backend depends on the Python rpm module of RPM 4.4 or higher, due to a limitation which was present in previous versions of the `ts.dbMatch()` method, and the availability of the `readHeaderFromFD()` function.

In the `contrib/patches/` subdirectory there are patches for previous RPM versions including the missing functionality. There are also pre-packaged binary versions which include the patched module without requiring changes in other tools.

#### DEB backend

There are no extra dependencies besides DPKG itself.

#### Slackware backend

There are no extra dependencies besides the packaging scripts `installpkg`, `upgradepkg` and `removepkg`.

#### Archlinux backend

There are no extra dependencies besides the packaging script `pacman`.

## Credits

This is the credit section, where people and institutions that have somehow contributed to the project are mentioned.

Conectiva, Inc.:

  Funded the creation of Smart, and its development up to August of 2005.

Canonical Ltd.:

  Funded Smart development up to November of 2009.

Unity Linux.:

  Smart development and deployment support.

Wanderlei Cavassin:

  Conectiva's research & development coordinator, who belived the project was viable and encouraged the author to work on it.

Ednilson Miura & Herton Ronaldo Krzesinski:

  Conectiva employees, helped setting up many distributions for tests whenever necessary.

Andreas Hasenack:

  Conectiva employee, helped as being the first brave pre-alpha tester, and contributed with many ideas, discussions, etc.

Arnaldo Carvalho de Melo:

  Conectiva board member, helped with the "channel of mirrors" idea and by encouraging the author to build a generic channel information method.

Others @ Conectiva:

  Many other people in Conectiva helped with ideas and alpha-testing in general during the pre-release period of Smart development.

Guilerme Manika & Ruda Moura:

  Ancient Conectiva employees, now board members of the Haxent company, helped by testing Smart extensively in Fedora, reporting many bugs and suggesting changes. They have also created the Smart FAQ.

APT-RPM & Debian:

  Experience on packaging and ideas for a better framework were developed while the author of Smart worked as the APT-RPM maintainer.

Jeff Johnson:

  Contributed as being the RPM maintainer itself, and in many, and in many discussions regarding packaging theory in general.

Seth Vidal:

  YUM author, and member of the Duke University, contributed to Smart with the development of the XML MetaData repository format and discussions about it.

Michael Vogt:

  Currently the maintainer of the Synaptic project, used to co-maintain it with the author of Smart. Many of his ideas ended up being adopted in Smart as a consequence.

Sebastian Heinlein:

  Author of the package icons for Synaptic, that were mercilessly stolen to be used in Smart's graphic interface.

TaQ/PiterPunk at #slackware-br:

  These guys helped Smart development by explaining details of Slackware practices regarding packaging.

Matt Zimmerman:

  Debian/Ubuntu developer and co-maintainer of the APT software, helped by shining some light regarding details of the DPKG pre-depends ordering expectations.

Mauricio Teixeira:

  FAQ maintenance, YaST2 channel maintainer, "tracker cleaner", general suggestions and code contributions

Jonathan Rocker:

  Documentation help.

&legal;
Smart Package Manager