Contents
- General
- Usage
- Can I use Smart with APT/YUM/URPMI/whatever?
- Which interfaces does it support?
- I am using YUM, and I want to use my repositories with Smart, but "YUM" does not appear to be a valid channel format. What do I do?
- I want to install a new kernel package, but Smart says it is going to "upgrade" my old kernel packages. I don't want them removed, what should I do?
- What does the little yellow star mean?
- How do I add mirrors? How does Smart choose which mirror to use?
- Several channels provide an identically-named package. Which of the packages does Smart use? Can I change that?
- Can I lock a package so that Smart will never touch them?
- Where does Smart save its settings?
- I have a package on my disk. Can I use Smart to install it?
- I have a package on a remote URL. Can I use Smart to install it?
- How do I create a chroot environment using Smart?
- How do I keep the downloaded files after installation?
- Annoyances
- Known issues
- Packaging Smart
General
What is Smart?
Smart is a meta-package manager in the spirit of APT, YUM, URPMI and others. It can manage RPM, DEB and Slackware packages and provides a clean architecture to add new package and repository formats (called channels in Smart).
What sets Smart apart is a dependency-solving algorithm that outperforms other package managers, a clean architecture, wide support for package and repository formats, and great mirror-management. Check the features page for more information.
The official page is hosted at http://smartpm.org/.
Smart is released under the GNU GPL.
Does Smart's wide support for packaging systems mean I can install .rpm packages on my Debian system? Or .deb packages on my RPM-based system?
Short answer: no.
Long answer: no, unless you have the non-native package system installed in the same machine. Even then, that doesn't mean it would be a good idea.
Smart is not meant as an universal wrapper around different package formats. It does support RPM, DEB and Slackware packages on a single system, but won't permit relationships among different package managers. While cross-packaging system dependencies could be enabled easily, the packaging policies simply do not exist today.
This is not at all different from what you can already do. In fact, Debian has been shipping the RPM package manager for a few years now. "Possible" does not equal "good idea", and everybody should stick to their native package format.
What repository formats does Smart support?
Smart supports the following repository formats as source channels:
RPM repositories
- RPM System Database (locally installed packages)
- APT repositories for .rpm
- RPM-MD (used by YUM)
- 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 repositories
- DEB System Database (locally installed packages)
- APT repositories for .deb
- DEB Directory (a directory with a bunch of DEBs in it, no indexing required)
Slackware
- Slackware installed packages database
- Slackware repositories
Mirrors
- up2date (used by RedHat/Fedora)
- Conectiva-style mirror description formats
Why is it called Smart?
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. (...)
See the next question.
Why is Smart better than APT/YUM/URPMI/etc?
Smart supports several repository formats, including those used by APT, YUM and URPMI.
Smart has an easily-extensible, clean architecture. It is written in Python with some C code in performance-critical areas.
Smart has the smartest algorithm of all package managers. It can handle inconsistent states, downgrade packages when necessary and do better dependency-checking. See the README for some situations where Smart outperforms APT's and YUM's dependency-checking systems.
Smart is able to handle broken systems: if you have unsatisfied dependencies, Smart won't force you to fix the problem unless it is absolutely necessary to perform the operation you are requesting. Of course, if you really want Smart to fix the problem, you could run smart fix or choose "Fix all problems" in the GUI.
How stable is Smart?
It does work pretty good, and has been used either in testing and production environments on many Mandriva, Debian, Fedora Core and Slackware systems. Even though it should mostly work just fine, some features have been more tested than others, and it is possible that important bugs still remain in the code.
Usage
Can I use Smart with APT/YUM/URPMI/whatever?
Yes. Smart is a meta-package manager like APT, YUM and URPMI, meaning it runs over RPM, DPKG or pkgtool. You can run Smart alongside other meta-package managers. Trying out Smart should be very safe.
Which interfaces does it support?
Smart supports a command-line user interface similar to APT, a GUI (using GTK) and an interactive shell. You can also "mix" the interfaces. For example:
# smart --gui install kdegames
Will give graphical feedback to a command-line action.
Like everything else in Smart, interfaces are modular, so it should be very easy to add your own.
I am using YUM, and I want to use my repositories with Smart, but "YUM" does not appear to be a valid channel format. What do I do?
YUM uses a repository format called RPM-MetaData (rpm-md). Smart expects the same Base URL as your baseurl settings in /etc/yum.conf or /etc/yum.conf.d/*. If your baseurl has macros such as $basearch or $releasever you must use whatever values make sense for you instead, such as "i386" and "3".
Smart does not support old-style YUM repositories, only the newer XML-based RPM-MD format.
I want to install a new kernel package, but Smart says it is going to "upgrade" my old kernel packages. I don't want them removed, what should I do?
This question is irrelevant if you are not using RPM. DPKG and pkgtool do not support different versions of a package installed on a single system.
If you installed Smart on a supported distro, "kernel" should be one of the packages marked with a "multi-version" tag. You can check this by running this:
$ smart flag --show multi-version multi-version kernel kernel-doc kernel-smp
Or through Edit->Flags in the GUI, where you can also add your own multi-version packages. (or using smart flag --set multi-version <package> in the command line)
When you install a new kernel, Smart may display a dialog saying the new package "upgrades" your old packages. But unless those packages have as their icon they won't be removed. Installation of new multi-version packages does not imply the previous packages will be removed, even if they satisfy the requirements for an "upgrade" operation.
What does the little yellow star mean?
The yellow star means the package has changed since the last time you updated its channel. You can use View->Hide old to view only what changed since the last update.
How do I add mirrors? How does Smart choose which mirror to use?
In the GUI, go to Edit->Mirrors, click "New" and set your Origin URL and Mirror URL. Most likely you will be using whatever it is that you used as Base URLs for your repositories as Origin URLs. You may add as many Mirror URLs to an Origin URL as you wish, and you shouldn't worry too much about slow mirrors and mirrors going out of date. Smart automatically handles bad/inefficient mirrors and avoids them in the future.
Smart also supports downloading mirror information from Conectiva and up2date. In this case, you need to add a mirror channel. Go to Edit->Channels, click "New", the "Provide channel information", then pick either "Mirror information" for Conectiva-style mirror URLs or "Mirror information (up2date format)" if you want up2date-style mirror URLs.
up2date mirror URLs may be acquired from /etc/sysconfig/rhn/sources. The entries that begin with "yum-mirror" point to up2date mirror files. If you are using Fedora you probably already have a mirror channel configured by default.
Please notice that mirror channels will not show up in Edit->Mirrors in the GUI, only in Edit->Channels.
Several channels provide an identically-named package. Which of the packages does Smart use? Can I change that?
All channels are created equal. Smart will attempt to upgrade to the newest package. If you wish to override that, you may assign priorities to channels and packages. To configure your channel priorities, go to Edit->Channels, pick a channel, click "Properties" and set a value in "Priority". Or you can use the CLI equivalent:
# smart channel --set <mychannel> priority=10
Highest numbers imply higher priority.
If you want more granularity, you can define priorities for individual packages in individual channels. To do that, right-click the package and select "Priority". This setting overrides channel priorities. Also, on the CLI you can:
# smart priority --set <packagename> <mychannel> 10 # smart priority --set <otherpackage> <otherchannel> -- -20
As you can see, it's possible to use negative priorities, given that they should be preceded by '--' (two dashes), otherwise they will be interpreted as command line options. Negative priorities are no different than positive ones, they it's just a matter of taste to use them or not.
If you are familiar with packaging, think of Priorities as user-defined "epochs".
While priorities are powerful, they are also dangerous. A channel with higher priority will always have precedence over other channels, including your local package database. It is easy to get in a situation where your system has to downgrade packages because a remote, out-of-date channel has higher priority than your installed packages. If all you want to do is be sure that your vendor's packages are preferred over third-party packages, it may be easier and safer to lower the third-party channel to a priority below zero (zero being the default) rather than increasing other priorities.
(In fact, priorities are more complicated than this, and in some situations Smart may choose a package in a channel with a lower priority. Priorities influence the weight each possible transaction is given, so it does make a difference whether a priority is set to -1, -5 or -100. The exact way this works is, for now, undocumented.)
Can I lock a package so that Smart will never touch them?
Sure. Right-click them in the GUI and choose "Lock this version" or "Lock all versions", as you wish. Or use smart flag --set lock <package>. Notice that you may lock even packages that are not currently installed. In this case, Smart will never install the locked package.
Where does Smart save its settings?
Unlike most Unix utilities, not in a plain-text file. Even so, you can configure Smart fully through the command line.
I have a package on my disk. Can I use Smart to install it?
Yes. Use:
# smart install foo-1.1-1.i386.rpm
Smart will even download dependencies from remote channels if necessary, which is nifty.
The filename must end with a well-known package extension for this to work.
(There's no documented situation of that working with Slackware packages)
I have a package on a remote URL. Can I use Smart to install it?
Sure, just use something like:
# smart install http://some.url/some/path/foo-1.1-1.i386.rpm
How do I create a chroot environment using Smart?
You simply need to use -o rpm-root=/path/to/chroot and install the basic packages that would make your chrooted environment work.
# smart -o rpm-root=/path/to/chroot install <packages> smart
It's adivisely that you install Smart itself on first run, so you can continue installing other packages from inside your chroot environment.
The base packages can vary from one distribution to another. Here are some examples:
- Suse 10.0 - coreutils (installs bash, libattr, bzip, libgcc, coreutils, libselinux, cracklib, libstdc++, db, libzio, filesystem, ncurses, glibc, pam, info, readline, libacl, zlib)
How do I keep the downloaded files after installation?
You can do this once by using smart -o remove-packages=false <insall|upgrade> , or set this as a permanent option using smart config --set remove-packages=false . The files are kept on /var/lib/smart/packages .
Annoyances
Why smart loads/updates/saves the cache all the time? What is this cache anyway?
The package cache is used to speed up the in-memory representation of packages and package relations.
Every time Smart detects any change in a registered channel, the cache needs to be rebuilt. For that, it simply reads the repository information already downloaded (and stored on /var/lib/smart/channels) and the local package database (i.e. rpm or deb), gather necessary information, arrange them on an easily retrivable way, and save on a new /var/lib/smar/cache file. Nothing is downloaded during this operation, it just reads the available information.
You can disable if with smart -o disk-cache=no, but remember that it will require more disk activity to calculate what needs to be done.
As an alternative you can use Smart in shell mode with smart --shell, which will load and write the cache just once (start/end), but it still needs to update some info on the cache after each package operation.
Why is Smart so slow to me, but not on my friend's computer?
This is a problem specially on low-end systems (less memory/cpu).
The first thing to notice is that the package cache may need lots of memory if you have many packages installed or if your channels provide too much info. Using less channels, reducing the number of mirrors, or using smaller indexes (like the synthesis.hdlist.cz on Mandriva) may reduce memory usage, and probably give you a little more speed.
Second, Smart uses the Psyco JIT for Python, that aims to make apps run faster. It should improve Smart speed in most systems, and internal benchmarks proved that. But there's a documented problem: "Drawbacks: Psyco currently uses a lot of memory". There are some specific cases where the problem that makes Smart slow resides on the memory consumption, not the optimizations. Disabling it, could make smart run a little faster because it could avoid memory swapping. If want to try it, run smart -o psyco=0, and if you want to make it permanent, do smart config --set psyco=0.
I can't stop Smart with CTRL+C! Why?
It's another known bug with Psyco: The compiled machine code does not include the regular polling done by Python, meaning that a KeyboardInterrupt will not be detected before execution comes back to the regular Python interpreter. Your program cannot be interrupted if caught into an infinite Psyco-compiled loop. (This could be fixed if requested.).
This means that you can't stop Smart with CTRL+C when it's working with the cache or downloading/installing packages. If you really need to stop it at that point, you can CTRL+Z and kill -15 it. There's no documented case of odd things happening after that, but do it at your own risk.
On the other hand, if you are running Smart on stepped mode, CTRL+C will work just after a set of packages have been downloaded or installed.
Known issues
Smart dies with "Assertion failed" on Fedora Core 4
This issue has been repeatedly reported. The error message looks like this:
# smart --gui python2.4: Objects/stringobject.c:105: PyString_FromString: Assertion `str != ((void *)0)' failed. Aborted
It happens due to an old "libexpat" version under /usr/X11R6/lib which doesn't provide some of the constants needed by the "pyexpat" Python module initializer, making XML_ErrorString() return a NULL when it shouldn't.
To fix the problem, edit /etc/ld.so.conf, put /usr/lib on top of it and run ldconfig. That will help Python load a newer version of "libexpat" which should work.
Reference: tracker issue11
Packaging Smart
I want to package Smart for my favorite distribution, what should I do?
If your RPM version is 4.3, you probably want to include a patched rpmmodule.so (the Python RPM module) that makes readHeaderFromFD() available for Python applications. This patch is not strictly necessary and Smart will work just fine without it, though Smart will warn the user the first three times it is run about increased memory usage. This only really affects channel formats that use large header lists: installation CDs, APT-RPM and URPMI.
If your RPM version is 4.2 or older, you should be aware that RPM versions previous to 4.3 need a bugfix, available in the Smart source in contrib/patches/rpm4.2.2-python.patch. If this is your case you should almost certainly ship a patched rpmmodule.so with your Smart package, at least until your distribution has picked up the fix. The patch for RPM 4.2 includes the readHeaderFromFD() patch. As an alternative, you can compile the module under contrib/rpmhelper (running ./setup.py install compiles and install it under /usr/lib/pythonX.X/site-packages).
You may want to check the Fedora Core RPM package as a guide.
What's the deal with that distro.py file?
distro.py is a distribution-dependent Python file that is executed every time Smart is run. Since Smart supports several underlying packaging systems, you should at the very least have it configure your own distribution's native package system as a channel the first time it is run, and maybe even your distribution's main and update channels. If you don't have rpm or rpm2cpio handy, grab a sample distro.py file here.
The distro.py file can do pretty much anything. For example, you could use iface.ask*() to request the user's interactive input. But try to keep things as simple as possible.
Each channel has different options. Run smart channel --help to list know channel types, then smart channel --help-type <channel> to list all available options.
How do I convert a sources.list from APT into Smart channel info?
Smart is able to do synchronize channels from APT automatically. To enable that, run the following command:
smart config --set sync-apt-sources=yes
You can also try a script called aptosmart. The site is in german, but the script is in english, and it's pretty simple to use. (This is a contributed 3rd party script, not related to Smart development).
There is also another one coded by Pascal Blesser.