SBdocs - SlackBuilder Tutorials - package_manager

Last updated:

The Package Manager


SlackBuilder's package manager differs form others by its uniq approach. At it's core its designed to be scriptable. Instead of one command that does everything. Much like slackware's original philosophy it splits up the various tasks into separate commands.

This separation allows for more flexability and extensibility. Each new command is built upon the others. Speed of development is greatly increased. And in fact the whole of the SlackBuilder tools are built with this methodology. Check out the About for a quick overview of the tools.

Basically any project requiring package manipulation can utilize the package-manager tools to accomplish the task without needing to reinvent the wheel every time. Just write a small script and taylor it to any job necessary.

What's in It

The package that supplies the package manager is pkg-tools and is comprised of but not limited to the following commands.....

Command Description
pkg-info Responsible for updating the package database and returning information about packages
comparepkg A search tool that returns available and installed packaged that match argument
getpkg installs or upgrades one or more packages no questions asked, does not check for dependencies but will verify if the package needs to be installed/upgraded or is up-to-date
getpkgs takes no arguments. installs packages from a Source and one or more pkgslists.pkgs file assigned to it. no questions asked. does not check for dependencies
pkg-get takes one package as an argument. installs package and its dependencies recursively. -- interactive
pkg-u A shortcut of 'pkg-info -u'. Downloads new PACKAGES.TXT files and rebuilds sqlite database
pkg-update looks for new packages available on the servers and runs 'pkg-u' if TRUE
pkg-upgrade checks the whole system for new packages and upgrades them. -- interactive
pkg-updater a pygtk3 gui app used to install upgradable packages
pkg-rm takes one package as an argument and checks for dependencies to be removed along with the package. will not remove dependencies if required by another package. -- interactive
rmpkg a package-manager savy alternative to removepkg. Can take multiple arguments...Does not check for dependencies
dlpkg will download a package to current directory or will mirror the source directory structure locally or if a directory argument is supplied will download to that
ldeps looks for and returns if found a list of recursive dependencies for a package
rdeps looks for and returns if found a list of recursive reverse dependencies for a package
pkg-blacklist used to manage package blacklists
pkg-priority manages package priorities, can filter SRC LOCATION VERSION -- interactive with the -i option
pkg-applet a system tray program that notifies when upgrades are available and allows you to upgrade with 'pkg-updater'
Pkg-applet Usage: Pkg-applet [start/stop] ... a command to start and stop 'pkg-applet'

Note: The above is not an exhaustive list. But represent the most useful on a daily basis. Many of the commands shipped with pkg-tools are meant for scripting or for testing purposes and are used in programs from other packages.

Installing

The best way to use the pkg-tools is in concert with all of the SlackBuilder tools, since that is what it was designed for. And the best way to do that is to install the distribution. Go here for information on installing.

On Other Distributions

You do not however have to install SlackBuilder in order to use pkg-tools or any of the other tools. If you just want to try it out and are already using slackware or some other slackware based distribution (ie: Salix, Vectorlinux, etc...) you can just install it on your system and it should work. It won't interfere with any other package manager you may be using (slapt-get, slackpkg, etc...).

Installing with slapt-get

slapt-get is probably the easiest alternative way to install pkg-tools. As you may already know slapt-get will install a package along with all its dependencies. So you can just add the source URL to your slapt-get.rc file...

SOURCE=http://linuxoutpost.com/SBuilder/repos/Slackbuilder-noarch-all:CUSTOM

Installing individual packages

If you don't have nor want slapt-get you can use whatever you like just be sure to install the following packages for pkg-tools to work. They are located in the slackerson/ sub directory of the SOURCE example above.

yad
slackerson-profile
xxd
sb-apps
slackerson-utils
pkg-tools

Note: For convenience these packages have been put into a single tar file and published on the download page with instructions. Also yad is being phased out in favor of pygtk3 solutions in sb-apps. And normaly xxd is provided by slackware's vim package but Slackbuilder does not install it by default. So it has been repackaged on it's own as it is required by the SuSessions command in sb-apps.

Configuring the Source file

From a terminal run the command...

pkg-info

If no source file exists then /etc/pkg-tools/RC will be written using a template ( /etc/pkg-tools/RC-tpl ) for the host architecture and the package database will be updated. Right now there is only x86 (i686) and x86_64 architectures supported. It should work on slackwarearm but there there are no accompanying sources provided. Arm sources can be added manually if need be.

Here is what a typical RC file looks like for x86_64...

HTTP:mirrors.kernel.org/slackware/slackware64-14.2
HTTP:slackonly.com/pub/packages/14.2-x86_64
HTTP:linuxoutpost.com/repos/Slackbuilder-x86_64-14.2
HTTP:linuxoutpost.com/repos/Slackbuilder-noarch-14.2

HTTP is the protocol in use here. DIR is for a local directory. RSYNC is for rsync repositories.

Adding Repositories

You can add any slackware third party repositories you wish. Just keep in mind that the order is important. The priority is ranked from first to last. The last having the highest priority. So you'll probably want to put your own repository at the end.

WARNING !! ( Not all repositories are compatible ). Adding Salix Os, Vectorlinux or some other slackware derivative although allowable can be dangerous. Those distributions repackage slackware's official packages with large depenency requirements. If using pkg-rm to remove a package from your non Salix system for example you will end up removing all your offical slackware packages that are listed as dependencies in the Salix package. Using pkg-tools on a Salix system with Salix repositories would be perfectly ok though.

After any source change it goes without saying that you must update the database just like all other package managers. You accomplished this by running .....

pkg-info -u

Or the shortcut...

pkg-u

Or now the more efficient...

pkg-update

Comment in the Forum.

© 2015 - 2018  -   SlackBuilder  -   All Rights Reserved.

By: Lance Peterson -- Slackerson