In Source Mage, "casting spells" means installing programs. The Grimoire contains the list of spells you can cast.

cast casts a program by cast ''spell''.

Cast does rather more than simply install a program. The process can be broken down into four main steps:

1) Prepare

  • cast prepares all the options before the compile and downloading begins. This way, user input is only needed at one stage and the system can be left alone. Spells should rarely ever need human input past this step. This step also houses dependency resolution.

2) summon

  • Depending on the settings, cast uses wget or aria2 to download the source code of the program from its web site.

3) Compile

  • By following the instructions defined in the spell and the configuration before the download step, the spell is compiled accordingly.

4) Install

  • The spell also contains instructions about where to put the compiled files once the compilation phase is over. Logs

    documenting the installed files are kept in /var/log/sorcery/install/ by default. Dispel needs this file to know what to delete.

Dependencies come in four different flavors. There are required, runtime, optional, and suggested dependencies. Required and runtime dependencies are automatically installed. Required dependencies are usually compile-time dependencies compared to runtime dependencies which could be scheduled later than the dependee itself. Optional dependencies enable new features and are compile-time dependencies. Suggested dependencies are optional runtime dependencies that should not need the spell to be recompiled to use.

A step not outlined above is the post-install step. Sometimes messages will be printed here or the need to install an example configuration file arises.

Sometimes during the prepare step, there is a message that says "spell_1 triggers a cast_self on spell_2". This happens when a spell may use static linking of another spell, and cannot use features until it is recompiled.

Sometimes a check_self will trigger. This may arise to a spell misbehaving or causing other problems to another spell. This check_self will fix the spell if there is a break.

That said, the actual casting of individual spells sometimes becomes more complicated. There are several cases in which this may happen:

Dependencies: One spell may depend on another. Fortunately, cast takes care of dependencies automatically. A prompt to cast optional dependencies is shown. Required dependencies are added automatically. The compile-time dependencies selected will be cast before the main spell. A dependency may also be marked as a runtime or suggested dependency. Runtime dependencies are required at runtime, and thus compile errors will not arise, but runtime errors can if the dependency is cast after the dependee.

Post-Install setup: Sometimes spells require post-install configuration and testing that can't be taken care of by cast. An example is Free Type2 -- after casting this spell, you will be reminded that you need to specify the font path of your X server manually, and run ttmkfdir in your True Type font directory. Because there is no agreed-upon standard location for True Type fonts in X-windows, cast cannot do these things for you. It doesn't know where you've decided to install your fonts.

Supported Spells: Sometimes you will need to recompile a spell that is a dependancy for other programs. After the spell is recast, you may be prompted to recast the spells that depend on it in order to make certain they function with the new version. This is important for programs that are statically linked against common libraries, and particularly necessary when taking care of security vulnerabilities. For example, following the discovery of a severe vulnerability in the commonly used library zlib, a sorcery update recompiled zlib, and then prompted to recompile affected programs, thereby ensuring that the vulnerability was eliminated on that box.

All in all, cast is quite simple to use, like the other Source Mage commands. There are some command-line options you can use with cast, that are discussed in the section CastOptions.

Sorcery/SorceryCommands/Cast (last edited 2009-10-04 03:12:59 by DonaldJohnson)