Script Index


/var/lib/sorcery/modules/libtablet

tablet layout version 0:
layout 0 is anything unversioned with all its problems, if a
tablet like this is seen it should be updated to version 1,
the defects that exist are enumerated below, future tablet
versions will not require this as they will be more fully
documented and formal accessor functions will deal with interfacing
with them
tablet layout version 1:
$TABLET_PATH/$SPELL//
build_api
depends
grimoire_name
grimoire/
logs/[install,md5sum,compile] (links to real files)
roots (all important FOO_ROOT values)
section/
section_name
sources (the sources and urls used)
spell/
spell_config
spell_config.p
status (installed or held)
tb_version (tablet version)
updated (value of $UPDATED)
patchlevel (value of $PATCHLEVEL) (optional,
defaults to 0)
security_patch (value of $SECURITY_PATCH)
(optional, defaults to 0, name still undecided upon)
updated (value of $UPDATED)
version (value of $VERSION)
cache symlink to cache archive
known defects pre tablet version 1 (and the functions that fix them) :
no version file : tablet_0_repair_version
no updated file : tablet_0_repair_updated
spell//, should be spell/
tablet_0_repair_spell DONE
no tb_version : tablet_0_repair (bumps to version 1)
Terminology:
"the tablet" the directory $TABLET_PATH and everything in it
"tablet chapter" A spell's directory within the tablet eg:
$TABLET_PATH/$SPELL/...
"tablet page" A specific instance of a spell in a chapter eg:
$TABLET_PATH/$SPELL//...
this is sometimes called a tablet dir, but I'm trying to phase that out
Accessors Routines (thus far):
tablet_get_spell_file
tablet_get_section_file
tablet_get_grimoire_file
tablet_get_build_api
tablet_get_version
tablet_get_updated
tablet_get_patchlevel
tablet_get_security_patch
tablet_get_depends
tablet_get_sub_depends
tablet_get_rsub_depends
tablet_get_status
tablet_get_sources
tablet_get_spell_filter
tablet_get_section_filter
tablet_get_grimoire_filter
tablet_load_roots
tablet_unload_roots
tablet_get_tb_version
tablet_get_spell_name_from_path
Cleanse routines:
tablet_cleanse_tablet : Fix the whole tablet
tablet_cleanse_chapter : Fix a chapter
tablet_coalesce_files : hardlink identical files to save space
tablet_fix_duplicates
determine if a tablet points back at itself through the install log

Synopsis

Functions for dealing with tablet


function tablet_get_section_name()

Parameters:

Description

return section name from tablet


function tablet_get_roots()

Parameters:

Description

get path to roots


function tablet_get_spell_name_from_path()

Parameters:

stdout

spell name

Description

determine the spell associated with a tablet path tablet paths are $TABLET_PATH// dirname of that is $TABLET_PATH/ basename of that is


function tablet_get_path()

Parameters:

Returns:

stdout

path to unique tablet directory

Description

setup a unique tablet directory


function tablet_find_spell_dir()

Parameters:

global

TABLET_IGNORE if set means that there isnt a tablet for this and somewhere up the stack knows this
TABLET_SPELL_DIR if set, is the value of the tablet for this spell, because somewhere up the stack it was just created (so dont bother looking for it)

Description

the idea for the two globals is to simplify the layers in-between and skip searching when it isn't necessary


function tablet_find_resurrect_dir()

Parameters:

Description

quicker dirtier version of above without special checks since the tablet in a cache tarball has nothing to do with the installed system


function tablet_install_spell_files()

Parameters:

globals

everything that comes with a spell...


function tablet_set_spell()

Parameters:

Description

this is to set a spell based on whats in the installed grimoire possibly for re-casting, not sure what else... Note that this function does not use the tablet_get accessors for efficiency.


function tablet_import_repair_files()

Parameters:

Description

Import repair files for all tablet pages


function tablet_import_repair_files_page()

Parameters:

Description

Import repair files for a specific tablet page, expects caller to have spell_lookup_hash setup for a spell lookup, and nullglob set.


function tablet_check_repair_file()

Parameters:

Description

Private subroutine for tablet_import_repair_files_page, do not call from anywhere else.


function tablet_create_version_cache()

Parameters:

Description

Creates a version cache like the one of scribe reindex-version, but from the data found in the tablet


function tablet_check_version_cache()

Parameters:

Description

Checks for existance and on failure creates the tablet version cache


function tablet_cleanse_tablet()

Parameters:


function tablet_cleanse_chapter()

Parameters:


function tablet_fix_duplicates()

Parameters:


function tablet_is_spell_version_installed()

Parameters:

Description

check if the tablet represents a spell version thats installed


function tablet_does_tablet_point_to_itself()

Parameters:

Description

check if a tablets install log includes itself


function tablet_coalesce_files()

Parameters:

globals

$TABLET_PATH

stdout

none

Description

Intended to be used by cleanse, this routine finds identical files in $TABLET_PATH and hardlinks identical files together in order to save space. This is done on the assumption that 1) tablet files are treated as read only, and 2) anyone using the tablet for write operations (they shouldnt be) will break the hardlinks


function tablet_0_repair()

Parameters:

Description

Fix the various known defects with an un-versioned tablet and stuff a version of 1 in it.


function tablet_0_repair_spell()

Parameters:

Description

tablet may have either $tb_dir/spell/DETAILS or $tb_dir/spell//DETAILS the first is correct, the second is not, correct the problem if it exists


function tablet_0_repair_version()

Parameters:

Description

Repair the "updated" file as it wasnt created for all pre-versioned tablets. Source the spell, echo $VERSION into a file named version


function tablet_0_repair_updated()

Parameters:

Description

Repair the "updated" file as it wasnt created for all pre-versioned tablets. Source the spell, echo $UPDATED into a file named updated