KNOW-HOW Smart

The fast and sensible Smart package manager GETGET SMARTSMART The package manager is one of the central components on any system. If you have a system with unre- liable package management – such as Suse Linux 10.1 – you may want to consider the Smart alternative.

BY MARCEL HILZINGER

he true test of a package manager important focus of the Smart project -- means for adding new package and re- is how the tool resolves depen- and an important reason why the Smart pository formats. Tdencies. Smart is one of the best developers believe their tool is different. package managers around for navigating When it comes to dependencies, Smart Installation through dependency issues. The Smart does not just use the easiest and most The easiest way to install Smart is to use package manager does not depend on obvious solution but actually weighs your existing package manager, assum- any specific distribution, and it can han- every possible option using a policy- ing you have an Internet connection. dle more than ten repository formats. based priority system. In some cases, the Ubuntu users can run the sudo -get Smart comes with the smart command “best” solution may depend upon the install smartpm command to install the line tool, the Smart shell (smart -shell), goal. For instance, if you are performing package from the Universe repository. and a graphical user interface (Figure 1), an upgrade, Smart may not choose the Users with Fedora Core 5 will find Smart which you can launch by entering smart most recent version of a package if an in- in the extras repository; just type --gui. termediate version provides a better re- install smart to install. Readers with sult for the complete system. Smart algo- Suse Linux will need to add the Guru re- How Smart? rithms also consider efficiency factors, pository [2] as an installation source. The goal of the Smart project is to create choosing the combination of packages You can then install Smart with YaST. “smart and portable algorithms for solv- that leads to the fastest and most reliable The project page [1] has details on Smart ing adequately the problem of managing installation. repositories for other distributions. software upgrade and installation.” Smart can manage , RPM, and To install from the source code, you There is a reason why this description Slackware packages, and Smart supports must have the developer packages for from the the Smart developers empha- APT, YUM, and URPMI repositories. The the RPM or Deb system and a number of sizes the algorithms. Algorithms are an Smart architecture even provides a Python packages. Once you have these

48 ISSUE 73 DECEMBER 2006 WWW.LINUX - MAGAZINE.COM Smart Package Manager KNOW-HOW

line by entering smart channel --add. The box labeled “Smart Commands” gives you an example for Ubuntu 6.06. You select the required format in the dialog shown in Figure 3. This is typi- cally APT-DEB Repository for Ubuntu and RPM MetaData for Fedora Core and Suse Linux. The ability to manage YaST in- stallation sources was added in version 0.42. The RPM Installed Packages and Installed Packages entries tell Smart to parse the installed packages, and this gives the tool the ability to de- lete installed software. After opting for a format, enter the re- quired information in the Edit Channel dialog (Figure 4). As an Alias, select a short and intuitive name. You can add a more detailed description in the Name box. The Manual updates checkbox lets you specify whether Smart should parse Figure 1: The Smart GUI gives administrators a convenient search function. The URLs tab the channel when launched. If you en- additionally shows you the repository from which a package originated. able the checkbox, the tool will leave this step out for the current source. This in place, just enter make in the source party repositories, and very few lists are is useful for static package sources, such code directory to launch the build, then available. To add a new channel to the as RPM directories on CD, or for local re- become root and enter make install to GUI, select Edit | Channel | New, and positories. install the software. then opt for one of the five suggested Checking Disabled tells Smart not to After completing the install, you can methods at the next step (Figure 2). install any packages from this channel. opt to use the command line package To add a channel manually, select Pro- This is practical if you need to disable a manager, as in smart install amarok for vide Channel Information. To read the channel temporarily without removing example, or give the smart --gui com- RPM packages in a local directory, select the corresponding entry. The Removable mand to launch the front-end. The soft- the last item. The other three items read option tells Smart that the channel is lo- ware will also support combinations of existing channel information. The rest of cated on an external medium (CD/ DVD). the two. You need administrative privi- this article explains how to manually set If necessary, the package manager will leges to install or remove software. up a repository via Provide Channel In- then prompt you to insert the disk. formation. As an alternative, you can You can use the Priority value to Setting up Repositories add package sources in the command weight channels. The higher the value, Depending on your distribution and the the more likely it is that Smart will in- package provider, Smart may have a Smart Commands stall a package from this source. You can channel list that suits your needs. Chan- theoretically assign priorities between Install package smart install package nels in the Smart sense of the word are -100000 and 100000, although a two-fig- name> smart install /local/path/package any kind of package source or repository. ure value should be high enough in most name For example, the Suse packages from cases. Channels default to a priority of 0. Find package smart search package Guru [3] automatically set up channels Specify the download address in the name for Packman and Guru. Other distribu- Base URL box. An existing configuration tions do not make heavy use of third Update package list (run automatically file, such as source.list on Ubuntu/ prior to installation) smart update Debian, or yum.conf, is the best source Add channel smart channel --add of this information. Users with Fedora channel file smart channel --add Core will need to add entries such as Aliasname name="detailed description" $basearch (i386 for example). type=apt-deb distribution=dapper baseurl=http://archive.ubuntu.com/ ubuntu components="universe" Tip

Manage mirror servers smart mirror It makes sense to assign highest priori- --add ftp://mainserver.url/path http:// ties to your distributor’s official package mirror.url/path/ smart mirror --show sources, rather than choosing a third- Figure 2: Smart gives you five different Set priorities smart channel --set party provider. This avoids issues methods of integrating a new package Aliasname priority=50 caused by mixing packages. source.

WWW.LINUX - MAGAZINE.COM ISSUE 73 DECEMBER 2006 49 KNOW-HOW Smart Package Manager

If you are familiar with , you Tolerant Search should have no trouble using Smart. Clicking a box to the left of the package 01 kim:~ # apt-get install name tags the software for installation. realplay And you can click to select installed 02 Reading package list... done packages for deletion. Yellow stars tell 03 Creating dependency tree... you that updates are available for the done packages in question. Right-clicking 04 E: Couldn't find realplay drops down a menu with advanced func- package tions, such as reinstalling packages, pro- 05 tecting individual packages against up- dating (Lock this version), or setting 06 kim:~ # smart install realplay package priorities. 07 Loading cache... To install a package, click the cog- 08 Updating cache... wheel icon, select File | Execute Changes, ########### [100%] or press [Ctrl]+[C]. Smart will attempt a 09 ERROR!: 'realplay' does not parallel download of the selected pack- match a package: suggest: ages, accessing various mirrors to do so. 10 ERROR!: The tool remembers the fastest and most RealPlayer-10.0.7-10@i586 reliable mirrors and uses them by prefer- 11 Saving cache... ence for future downloads. To add a new mirror, select Edit | Mirror, select the Figure 3: Smart supports a large number of main server, and then click New. Check package instead. If Smart starts to down- package source formats. out the “Smart Commands” box to find grade packages, you can assume that out how to add mirrors. you have forgotten some priorities along The other fields depend on the se- the way. To remedy this, select Edit | lected format. The program will ask you Tips and Tricks Priorities in the GUI. for the Distribution and Components for Smart can also handle local packages. By default, Smart will delete down- Apt-Deb sources. After making changes, The smart install ~/*.rpm command in- loaded package archives after installa- make sure you quit Smart by selecting stalls all the RPM packages, as well as tion. If you would prefer to keep the ar- File | Quit. In our lab, the program some- the required channel files. in your home chives to reuse them, run the package times forgot about new channels if we directories. If you would like to convert manager at the command line, setting failed to do so. your sources.list into a Smart channel the -o remove-packages=false when you file, see the scripts at [4]. do. The downloaded packages will be Using Smart Priorities can be assigned to packages stored in /var/lib/smart/packages/, and You can press [Ctrl]+[F] or click the besides channels. This is a good way you can use them to upgrade another magnifying glass icon to enable Smart’s of preventing updates to a working Xine machine. To generally prevent Smart most important tool, the search function. configuration, for example. However, from deleting downloads, just give the By default, the program will only search you will need to think about which smart config --set remove-packages=false package names. If you would prefer to packages to assign priorities to and re- command. search against descriptions, just press member your choices, as this may If you are a KDE user, it might be the Description button. The Smart search prevent updates to important packages. worth your while to install the KSmart- function is not case-sensitive, and the If in doubt, you might prefer to use Lock tray kicker applet, which keeps you up command line version of Smart is far to date with recent developments. If more tolerant than apt-get in this re- Smart does run into difficulty at some spect. For example, smart search realpla stage, there’s an easy solution: Edit | Fix not only finds the RealPlayer package, All Problems… will make Smart even but all packages with RealPlayer in their smarter. ■ descriptions. The tool also chimes in with useful suggestions during the in- INFO stall (see the “Tolerant Search” box). [1] Smart: http:// labix. org/ smart After completing a search, Smart will [2] Guru repository: ftp:// ftp. gwdg. de/ first show you the package groups con- pub/ linux/ misc/ suser-guru/ rpm/ 10. 1/ taining the packages. If you prefer to sort the results by package source, select [3] Guru RPM page: http:// linux01. gwdg. de/ ~pbleser/ View | Tree Style | Channel, although the View | Tree Style | None might be more [4] Converting apt lists to channel files: http:// linux01. gwdg. de/ ~pbleser/ files/ efficient, as it tells Smart to just display Figure 4: Creating an channel for Suse 10.1 smart/ apt-sources-to-smart. sh the results. updates.

50 ISSUE 73 DECEMBER 2006 WWW.LINUX - MAGAZINE.COM