This page is no longer maintained — Please continue to the home page at www.scala-lang.org

Scala Bazaar System

The Scala Bazaar System, sbaz for short, is a packaging system developed to automate the task of mainaining a Scala installation. The program allows you to easily upgrade your installation as soon as a new version is available. You can also contribute your own packages, and make them easily available to other sbaz users.

The lifecycle of a Scala installation

Every Scala installation is a pre-configured sbaz managed directory. For this tutorial, we assume scala> to be the directory of your Scala installation. The command scala> bin/sbaz is your interface to the Scala bazaar.

The basic Scala installation consists of sbaz, the Scala compiler, the Scala library and the Scala classfile decoder scalap. The list of installed packages can be obtained with

  scala> bin/sbaz installed
  base/1.9
  sbaz/2.7.0-final
  sbaz-setup/2.7.0-final
  scala/2.7.0-final
  scala-devel/2.7.0-final
  scala-library/2.7.0-final
  scalap/2.7.0-final
  7 packages installed

The packages base and scala do not provide any functionality, but only manage dependency requirements in a scala installation.

Typically, after downloading a Scala distribution, you might want to install some additional tools and documentation. The command sbaz available shows you a list of available sbaz packages:

  scala> bin/sbaz available
  [...]
  scala-devel-docs (2.7.0-final)
  scala-documentation (2.7.0-final, 2.6.1-final, 2.6.0-final, ...)
  [...]
  scala-tool-support (2.7.0-final, 2.6.1-final, 2.6.0-final, ...)
  [...]
  45 package names
  276 total packages

So let's install three developer packages (scala-devel-docs contains the Scala API, scala-documentation contains the PDF documentation, and scala-tool-support contains tool support files for various text editors).

  scala> bin/sbaz install scala-devel-docs
  planning to install: scala-devel-docs/2.7.0-final
  Installing...
  scala> bin/sbaz install scala-documentation
  [...]

Now you can start working with scala. After some time, new releases of the Scala distribution or other packages you installed will appear. You can update the list of available packages with sbaz update, and install a new version of a single package with sbaz install package-name.

To upgrade your entire sbaz installation, call sbaz upgrade. Read the next section to learn how to deal with Scala release candidates.

Universes in sbaz

The repositories that contain sbaz packages are called sbaz universes(1). Every sbaz installation always has one active universe, from which packages can be downloaded. The LAMP maintans two sbaz universes:

The following command prints the active universe:

  scala> bin/sbaz showuniverse
  SimpleUniverse "scala-dev" (http://scala-webapps.epfl.ch/sbaz/scala-dev)

Suppose you want to upgrade your installation to the latest release candidate. You first need to switch to the lamp-rcuniverse which contains RC releases:

  scala> bin/sbaz setuniverse misc/sbaz/descriptors/lamp-rc
Universe established.

  scala> bin/sbaz showuniverse
  SimpleUniverse "lamp-rc" (http://scala-webapps.epfl.ch/sbaz/lamp-rc)

The two files misc/sbaz/descriptors/lamp-rc and misc/sbaz/descriptors/scala-dev, called universe descriptors, are included in all Scala distributions (starting with 2.7.1.final. In the meantime, they are also available here).

The setuniverse command also updates the list of available packages (to update the package descriptions without changing the universe, you can call sbaz update). Now simply upgrade all you installed packages with sbaz upgrade.

  scala> bin/sbaz available
  scala (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scala-android (2.7.0-RC3, 2.7.0-RC2, 2.7.0-RC1, ...)
  scala-cldc (2.7.0-RC3, 2.7.0-RC2, 2.7.0-RC1, ...)
  scala-devel (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scala-devel-docs (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scala-documentation (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scala-library (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scala-msil (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scala-test (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scala-tool-support (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  scalap (2.7.1.RC2, 2.7.1.RC1, 2.7.0-RC3, ...)
  12 package names
  73 total packages

  scala> bin/sbaz upgrade
  Refreshing list of available packages...
  Planning to install scala/2.7.1.RC2...
  Planning to install scala-devel/2.7.1.RC2...
  Planning to install scala-devel-docs/2.7.1.RC2...
  Planning to install scala-library/2.7.1.RC2...
  Planning to install scalap/2.7.1.RC2...
  Installing...

  scala> bin/scala
  Welcome to Scala version 2.7.1.RC2 (Java HotSpot(TM) Client VM, Java 1.5.0_13).
  Type in expressions to have them evaluated.
  Type :help for more information.

  scala>

If you now want to install an sbaz package that is not available in the lamp-rc universe, but only in the main one (scala-dev), you can simply change again the universe and install the package. This will not affect the RC version of Scala that you've just installed.

  scala> bin/sbaz setuniverse misc/sbaz/descriptors/scala-dev
Universe established.

  scala> bin/sbaz install junit
  planning to install: junit/3.8.1.1

  Installing...

To install the next stable (final) release of the Scala distribution itself, you also need to change the universe back to scala-dev, since only RC's are published in lamp-rc.

More Information


(1) See this enjoyable post on the scala-user mailing list about some confusion regarding sbaz universes.

 

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland