/var/lib/sorcery/modules/libapi

     1	#----------------------------------------
     2	##
     3	## @Synopsis Defines the Spell-Sorcery Interface
     4	## @Copyright Copyright (C) 2004 The Source Mage Team <http://www.sourcemage.org>
     5	## This library contains all sorcery functions which a spell may use.
     6	## If the function isn't listed here, it may disapear without warning.
     7	## If you use a funtion which isn't listed here, you'd better have a good reason.
     8	## Better yet, raise a bug on the topic and the needed function will probably get
     9	## added.
    10	## @NOTE This library must not contain any logic. It is simply a set of wrapper functions.
    11	##
    12	#---------------------------------------------------------------------
    13	
    14	#---------------------------------------------------------------------
    15	## @NOTE The following list and the function definition should be in
    16	## @NOTE alphabetical order. If this is not the case, please file a bug
    17	#---------------------------------------------------------------------
    18	
    19	#---------------------------------------------------------------------
    20	# functions defined in here: (in alphabetical order)
    21	#    acquire_src                    (libsummon)
    22	#    config_query                   (libmisc)
    23	#    config_query_list              (libmisc)
    24	#    config_query_option            (libmisc)
    25	#    config_query_string            (libmisc)
    26	#    conflicts                      (libgrimoire)
    27	#    default_sorcery_build          (build_api/...)
    28	#    default_sorcery_download       (libsummon)
    29	#    default_sorcery_install        (build_api/api2)   (BUILD_API==2 only)
    30	#    default_sorcery_install_extras (build_api/api2)   (BUILD_API==2 only)
    31	#    default_sorcery_post_build     (build_api/api1)   (BUILD_API==1 only)
    32	#    default_sorcery_post_install   (build_api/api2)   (BUILD_API==2 only)
    33	#    default_sorcery_transfer       (build_api/api2)   (BUILD_API==2 only)
    34	#    default_sorcery_pre_build      (build_api/common)
    35	#    default_sorcery_pre_install    (build_api/api2)   (BUILD_API==2 only)
    36	#    depends                        (libdepends)
    37	#    devoke_installwatch            (libtrack)
    38	#    download_src                   (libsummon)
    39	#    force_depends                  (libdepends)
    40	#    gather_docs                    (build_api/common)
    41	#    get_spell_provider             (libstate)
    42	#    get_source_nums                (libmisc)
    43	#    guess_compressor               (libunpack)
    44	#    handle_changed_config          (libresurrect)
    45	#    is_depends_enabled             (libstate)
    46	#    installed_version              (libgrimoire)
    47	#    install_config_file            (libresurrect)
    48	#    invoke_installwatch            (libtrack)
    49	#    list_add                       (libmisc)
    50	#    list_find                      (libmisc)
    51	#    list_remove                    (libmisc)
    52	#    message                        (libmisc)
    53	#    mk_source_dir                  (libgrimoire)
    54	#    note_config_file               (libtrack)
    55	#    on_cast                        (libtriggers)
    56	#    on_dispel                      (libtriggers)
    57	#    on_pre_cast                    (libtriggers)
    58	#    on_pre_dispel                  (libtriggers)
    59	#    optional_depends               (libdepends)
    60	#    persistent_add                 (libmisc)
    61	#    persistent_clear               (libmisc)
    62	#    persistent_load                (libmisc)
    63	#    persistent_remove              (libmisc)
    64	#    persistent_save                (libmisc)
    65	#    prepare_install                (libgrimoire)
    66	#    provider_ok                    (libstate)
    67	#    query                          (libmisc)
    68	#    query_string                   (libmisc)
    69	#    runtime_depends                (libdepends)
    70	#    rm_source_dir                  (libgrimoire)
    71	#    sedit                          (libmisc)
    72	#    sub_depends                    (libdepends)
    73	#    show_up_depends                (libdepends)
    74	#    spell_exiled                   (libstate)
    75	#    spell_held                     (libstate)
    76	#    spell_installed                (libstate)
    77	#    spell_ok                       (libstate)
    78	#    suggest_depends                (libdepends)
    79	#    track_manual                   (libtrack)
    80	#    uncompress                     (libunpack)
    81	#    unpack                         (libunpack) (deprecated)
    82	#    unpack_file                    (libunpack)
    83	#    unpack_file_simple             (libunpack)
    84	#    using_gcc                      (libgcc2)
    85	#    verify_file                    (libunpack)
    86	#
    87	# The following are implicitly defined for each spell file
    88	# (filename is first lowercased):
    89	# default_<filename>
    90	# default_section_<filename>
    91	# default_grimoire_<filename>
    92	# default_sorcery_<filename>
    93	#
    94	# It is supported to have a file at the spell, section, or grimoire level,
    95	# the more specific one overrides the less specific.
    96	# Depending on context default_<filename> calls one of the default
    97	# section, grimoire or sorcery functions. Calling it will always run the
    98	# next level up.
    99	#
   100	# The default_section_<filename> and default_grimoire_<filename> functions
   101	# first check for the filename (capitalized) in the section or grimoire.
   102	# If it doesn't exist, default_<filename> is called (which runs the next
   103	# step up).
   104	#
   105	# If the default_sorcery_<filename> function is not defined here, it is
   106	# simply "true".
   107	#
   108	# Read-only variable that might be of use to a spell:
   109	# SOURCE_CACHE, OPTS, BUILD HOST, INSTALL_ROOT
   110	#
   111	# The following can be modifies in BUILD, but nowhere else:
   112	# CFLAGS, CXXFLAGS, CPPFLAGS, CC and LDFLAGS
   113	#
   114	# The following are set when a spell is loaded, you may use them, but
   115	# not change them:
   116	# SCRIPT_DIRECTORY SECTION_DIRECTORY GRIMOIRE SPELL_DIRECTORY SECTION
   117	#
   118	# global sorcery variables you should never use in a spell:
   119	#
   120	# (do not modify or read any of these for any reason, if you feel you
   121	#  must look at one of them, talk to your local sorcery lead about getting
   122	#  some sort of accessor functionality)
   123	#
   124	# TOP_LEVEL DISPLAY PATH TMP_DIR SAFE_CAST
   125	# FAILED_LIST SUCCESS_LIST SPELL SPELLS spells MAKEFILE DEPS_ONLY
   126	# CAST_PASS download_log IW_LOG SOLO QUIET INSTALL_QUEUE
   127	# OVERRIDE_CFLAGS OVERRIDE_CXXFLAGS OVERRIDE_LDFLAGS NO_OPTIMIZATION_FLAGS
   128	# DOT_PROGRESS VOYEUR_OVERRIDE RECONFIGURE RECAST_DOWN COMPILE RECAST_UP
   129	# FORCE_DOWNLOAD SILENT FIX DEBUG SEPARATE
   130	# CAST_HASH BACK_CAST_HASH CANNOT_CAST_HASH uncommitted_hash NEW_DEPENDS
   131	# spell_depends DEPENDS_CONFIG UP_DEPENDS SPELL_CONFIG GRIMOIRE_DIR
   132	# BUILD_API VOYEUR_STDOUT VOYEUR_STDERR C_LOG C_FIFO INST_LOG MD5_LOG
   133	# INSTALLWATCHFILE INSTW_LOGFILE CAST_EXIT_STATUS
   134	#
   135	#---------------------------------------------------------------------
   136	
   137	
   138	#---------------------------------------------------------------------
   139	## @Type API
   140	## @params Number portion of SOURCE[[:digit:]], eg '', "2", "3", etc.
   141	## @See <@function var.lib.sorcery.modules.libsummon.html,real_acquire_src> for more details.
   142	##
   143	## Get a particular source, check first in $SOURCE_CACHE and respect
   144	## FORCE_DOWNLOAD. Calls download_src if the file must be downloaded.
   145	##
   146	#---------------------------------------------------------------------
   147	function acquire_src() {
   148	    debug "libapi" "$FUNCNAME - $*"
   149	    real_acquire_src "$@"
   150	}
   151	
   152	#---------------------------------------------------------------------
   153	## @See <@function var.lib.sorcery.modules.libmisc.html,real_config_query> for more details.
   154	## @param config file variable
   155	## @param question
   156	## @param default answer
   157	##
   158	## @return 0 in all cases
   159	##
   160	## Asks user for string, with default answer and timeout (like query)
   161	## Return variable is also marked as persistent
   162	## <pre>
   163	## Example:
   164	##    config_query DETAILED "Detailed questions ?" n; then
   165	##    if [ $DETAILED == y ]; then
   166	##        ....
   167	##    fi
   168	##    echo The reply for last question was: $DETAILED
   169	## </pre>
   170	##
   171	#---------------------------------------------------------------------
   172	function config_query() {
   173	    debug "libapi" "config_query - $*"
   174	    real_config_query "$@"
   175	}
   176	
   177	#---------------------------------------------------------------------
   178	## @See <@function var.lib.sorcery.modules.libmisc.html,real_config_query_list> for more details.
   179	## @param config file variable, return variable
   180	## @param question
   181	## @param elements, ...
   182	##
   183	## @return 0 in all cases
   184	##
   185	## Asks user for string, with numbered possibilities listed
   186	## Return variable is also marked as persistent
   187	## <pre>
   188	## Example:
   189	##    config_query_list COLOR "What color ?" "red" "white" "blue"
   190	##    echo Your color is $COLOR
   191	## </pre>
   192	##
   193	#---------------------------------------------------------------------
   194	function config_query_list() {
   195	    debug "libapi" "config_query_list - $*"
   196	    real_config_query_list "$@"
   197	}
   198	
   199	#---------------------------------------------------------------------
   200	## @See <@function var.lib.sorcery.modules.libmisc.html,real_config_query_option> for more details.
   201	## @param config file variable
   202	## @param question
   203	## @param default answer [y|n]
   204	## @param option_yes - can't be empty string
   205	## @param option_no - can't be empty string
   206	##
   207	## @return 0 in all cases
   208	##
   209	## Asks user for string, with default answer and timeout (like query)
   210	## The string is added to the variable
   211	## If you want to use empty string, place there dummy string and remove
   212	## it later by list_remove function. Also for one config variable, all
   213	## option_yes and option_no have to be different.
   214	## Return variable is also marked as persistent
   215	
   216	## <pre>
   217	## Example 1:
   218	##    config_query_option OPT "Use X ?" y "--with-x" "--without-x"
   219	##    config_query_option OPT "Use jpeg ?" y "--with-jpeg" "--do-not-use-jpeg"
   220	##    echo All selected options together: $OPT
   221	##
   222	## Example 2:
   223	## CONFIGURE:
   224	## config_query_option ASK "Use X11 ?" y --with-x11 EMPTY1
   225	## config_query_option ASK "Use Alsa ?" y --with-alsa EMPTY2
   226	##
   227	## BUILD:
   228	## local TEMP="$ASK"
   229	## list_remove TEMP EMPTY1 EMPTY2
   230	## ./configure $TEMP
   231	## ...
   232	## </pre>
   233	##
   234	#---------------------------------------------------------------------
   235	function config_query_option() {
   236	    debug "libapi" "config_query_option - $*"
   237	    real_config_query_option "$@"
   238	}
   239	
   240	#---------------------------------------------------------------------
   241	## @See <@function var.lib.sorcery.modules.libmisc.html,real_config_query_string> for more details.
   242	## @param config file variable, return variable
   243	## @param question
   244	## @param default answer
   245	##
   246	## @return 0 in all cases
   247	##
   248	## Asks user for string, with default answer and timeout (like query)
   249	## Return variable is also marked as persistent
   250	## <pre>
   251	## Example:
   252	##    config_query_string REAL_NAME "What is your real name ?" "nobody"
   253	##    echo Hi $REAL_NAME
   254	## </pre>
   255	##
   256	#---------------------------------------------------------------------
   257	function config_query_string() {
   258	    debug "libapi" "config_query_string - $*"
   259	    real_config_query_string "$@"
   260	}
   261	
   262	
   263	#---------------------------------------------------------------------
   264	## @param spell
   265	## @param default answer to dispel query
   266	## @Type API
   267	## @See <@function var.lib.sorcery.modules.libdepends.html,real_conflicts> for more details.
   268	## If the default answer is anything other than 'y' then 'n' is assumed.
   269	## returns the given spellname if it is installed
   270	#---------------------------------------------------------------------
   271	function conflicts() {
   272	    debug "libapi" "conflicts - $*"
   273	    real_conflicts "$@"
   274	}
   275	
   276	
   277	#---------------------------------------------------------------------
   278	## @Type API
   279	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_build">real_default_sorcery_build> for more details.
   280	## Used if no BUILD script is found for a spell
   281	## Default build for BUILD_API==1 is:
   282	## <pre>
   283	##  ./configure  --build=$BUILD        \
   284	##               --prefix=/usr         \
   285	##               --sysconfdir=/etc     \
   286	##               --localstatedir=/var  \
   287	##               $OPTS                 &&
   288	##  make                               &&
   289	##  prepare_install                    &&
   290	##  make    install
   291	## </pre>
   292	## Default build for BUILD_API==2 is:
   293	## <pre>
   294	##  ./configure  --build=$BUILD        \
   295	##               --prefix=/usr         \
   296	##               --sysconfdir=/etc     \
   297	##               --localstatedir=/var  \
   298	##               $OPTS                 &&
   299	##  make
   300	## </pre>
   301	##
   302	#---------------------------------------------------------------------
   303	function default_sorcery_build() {
   304	    debug "libapi" "default_sorcery_build - $*"
   305	    real_default_sorcery_build">real_default_sorcery_build "$@"
   306	}
   307	
   308	#---------------------------------------------------------------------
   309	## @Type API
   310	## @See <@function var.lib.sorcery.modules.libsummon.html,real_default_sorcery_download> for more details.
   311	##
   312	## Default download code, downloads each SOURCE[[:digit:]]*
   313	##
   314	#---------------------------------------------------------------------
   315	function default_sorcery_download() {
   316	    debug "libapi" "$FUNCNAME - $*"
   317	    real_default_sorcery_download "$@"
   318	}
   319	
   320	#---------------------------------------------------------------------
   321	## @Type API
   322	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_install> for more details.
   323	## Only defined for BUILD_API==2
   324	## Used if no INSTALL script is found.
   325	## Default install is:
   326	## <pre>
   327	##  make    install
   328	## </pre>
   329	##
   330	#---------------------------------------------------------------------
   331	function default_sorcery_install() {
   332	    debug "libapi" "default_sorcery_install - $*"
   333	    real_default_sorcery_install "$@"
   334	}
   335	
   336	#---------------------------------------------------------------------
   337	## @Type API
   338	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_install_extras> for more details.
   339	## Only defined for BUILD_API==2
   340	## Installs configuration files and documentation.
   341	#---------------------------------------------------------------------
   342	function default_sorcery_install_extras() {
   343	    debug "libapi" "default_sorcery_install_extras - $*"
   344	    real_default_sorcery_install_extras "$@"
   345	}
   346	
   347	#---------------------------------------------------------------------
   348	## @Type API
   349	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_post_build> for more details.
   350	## Only defined for BUILD_API==1
   351	## Installs configuration files and documentation.  Stops installwatch.
   352	## Used if no POST_BUILD script is found for a spell.
   353	## equivalent to default_sorcery_post_install in BUILD_API==2
   354	##
   355	#---------------------------------------------------------------------
   356	function default_sorcery_post_build() {
   357	    debug "libapi" "default_sorcery_post_build - $*"
   358	    real_default_sorcery_post_build "$@"
   359	}
   360	
   361	#---------------------------------------------------------------------
   362	## @Type API
   363	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_post_install> for more details.
   364	## Only defined for BUILD_API==2
   365	## Puts the spell at the root of the stage root so manipulation of the
   366	## installed files can happen
   367	#---------------------------------------------------------------------
   368	function default_sorcery_post_install() {
   369	    debug "libapi" "default_sorcery_post_install - $*"
   370	    real_default_sorcery_post_install "$@"
   371	}
   372	
   373	#---------------------------------------------------------------------
   374	## @Type API
   375	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_transfer> for more details.
   376	## Only defined for BUILD_API==2
   377	## Transfers the files from the stage area to the system. Default is
   378	## transfer_staged_spell
   379	#---------------------------------------------------------------------
   380	function default_sorcery_transfer() {
   381	    debug "libapi" "default_sorcery_transfer - $*"
   382	    real_default_sorcery_transfer "$@"
   383	}
   384	
   385	#---------------------------------------------------------------------
   386	## @Type API
   387	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_pre_build">real_default_sorcery_pre_build> for more details.
   388	## Creates the source directory and unpacks the source package into it.
   389	## Used if no PRE_BUILD script is found for a spell.
   390	#---------------------------------------------------------------------
   391	function default_sorcery_pre_build() {
   392	    debug "libapi" "default_sorcery_pre_build - $*"
   393	    real_default_sorcery_pre_build">real_default_sorcery_pre_build "$@"
   394	}
   395	
   396	#---------------------------------------------------------------------
   397	## @Type API
   398	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_default_sorcery_pre_install> for more details.
   399	## Only defined for BUILD_API==2
   400	## Used if no PRE_INSTALL script is found.
   401	## Default pre_install is:
   402	## <pre>
   403	##  prepare_install
   404	## </pre>
   405	##
   406	#---------------------------------------------------------------------
   407	function default_sorcery_pre_install() {
   408	    debug "libapi" "default_sorcery_pre_install - $*"
   409	    real_default_sorcery_pre_install "$@"
   410	}
   411	
   412	#---------------------------------------------------------------------
   413	## @Type API
   414	## @param spell/service
   415	## @param enabled options (optional)
   416	## @param description (optional)
   417	## @param grimoires (optional)
   418	## @See <@function var.lib.sorcery.modules.libdepends.html,real_depends> for more details.
   419	## Denotes that a spell requires another spell to work.
   420	#---------------------------------------------------------------------
   421	function depends() {
   422	    debug "libapi" "depends - $*"
   423	    real_depends "$@"
   424	}
   425	
   426	#---------------------------------------------------------------------
   427	## @Type API
   428	## @See <@function var.lib.sorcery.modules.libtrack.html,real_devoke_installwatch> for more details.
   429	## Stops using installwatch
   430	#---------------------------------------------------------------------
   431	function devoke_installwatch() {
   432	    debug "libapi" "devoke_installwatch - $*"
   433	    real_devoke_installwatch "$@"
   434	}
   435	
   436	#---------------------------------------------------------------------
   437	## @Type API
   438	## @See <@function var.lib.sorcery.modules.libtrack.html,real_devoke_stage_root> for more details.
   439	## Stops using stage root
   440	#---------------------------------------------------------------------
   441	function devoke_stage_root() {
   442	    debug "libapi" "devoke_stage_root - $*"
   443	    real_devoke_stage_root "$@"
   444	}
   445	
   446	#---------------------------------------------------------------------
   447	## @Type API
   448	## @params Number portion of SOURCE[[:digit:]], eg '', "2", "3", etc.
   449	## @See <@function var.lib.sorcery.modules.libsummon.html,real_download_src> for more details.
   450	##
   451	## Download a file. If the source is a file tree (eg from cvs or svn)
   452	## then if there is an existing tarball, it will be unpacked, updated and
   453	## repackaged as a tar.bz2. If the source is a simple file it will be
   454	## downloaded as usual.
   455	##
   456	#---------------------------------------------------------------------
   457	function download_src() {
   458	    debug "libapi" "$FUNCNAME - $*"
   459	    real_download_src "$@"
   460	}
   461	#---------------------------------------------------------------------
   462	## @Type API
   463	## @param spell to force depends on
   464	## Causes a dependent spell to be recast when it might not otherwise be.
   465	## This is intended to be called on an already enabled dependency. It can
   466	## be thought of as an inverse of up_trigger (although it is *not* a
   467	## trigger).
   468	## <pre>
   469	## Example 1:
   470	##    depends foo &&
   471	##    force_depends foo
   472	## Example 2:
   473	##    optional_depends foo --enable-foo --disable-foo "for foo support" &&
   474	##    if is_depends_enabled $SPELL foo; then
   475	##      force_depends foo
   476	##    fi
   477	## </pre>
   478	#---------------------------------------------------------------------
   479	function force_depends() {
   480	    debug "libapi" "$FUNCNAME - $*"
   481	    real_force_depends "$@"
   482	}
   483	
   484	#---------------------------------------------------------------------
   485	## @Type API
   486	## @See <@function var.lib.sorcery.modules.build_api.common.html,real_gather_docs> for more details.
   487	## Gathers all documentation files from source archive and installs
   488	## them as part of the spell
   489	#---------------------------------------------------------------------
   490	function gather_docs() {
   491	    debug "libapi" "gather_docs - $*"
   492	    real_gather_docs "$@"
   493	}
   494	
   495	#---------------------------------------------------------------------
   496	## @Type API
   497	## @params String to prefix on the results.
   498	## @See <@function var.lib.sorcery.modules.libmisc.html,real_get_source_nums> for more details.
   499	##
   500	## Output a list of source numbers associated with the current spell.
   501	## This is the number portion of SOURCE[[:digit:]], eg '', "2", "3", etc.
   502	## A prefix may be given and it will be prepended to each result value.
   503	##
   504	#---------------------------------------------------------------------
   505	function get_source_nums() {
   506	    debug "libapi" "$FUNCNAME - $*"
   507	    real_get_source_nums "$@"
   508	}
   509	
   510	#---------------------------------------------------------------------
   511	## @Type API
   512	## @param Spell name
   513	## @param Provider name
   514	## @param If empty get the uncommited spell info, if anything else get
   515	## info from the committed ($DEPENDS_STATUS) database. If the uncommited
   516	## db doesnt exist (maybe we're not casting) use DEPENDS_STATUS instead.
   517	##
   518	## @See <@function var.lib.sorcery.modules.libstate.html,real_get_spell_provider,> for more details.
   519	##
   520	## @return 0 if a provider could be found 1 if not
   521	## @stdout the provider name(s)
   522	#---------------------------------------------------------------------
   523	function get_spell_provider() {
   524	    debug "libapi" "get_spell_provider - $*"
   525	    real_get_spell_provider "$@"
   526	}
   527	
   528	#---------------------------------------------------------------------
   529	## @Type API
   530	## @param filename
   531	## @Stdout compressor
   532	## @See <@function var.lib.sorcery.modules.libunpack.html,real_guess_compressor> for more details.
   533	##
   534	## Guesses what program was used to compress a file
   535	## Return value is always success due to `file' workings
   536	##
   537	#---------------------------------------------------------------------
   538	function guess_compressor() {
   539	    debug "libapi" "guess_compressor - $*"
   540	    real_guess_compressor "$@"
   541	}
   542	
   543	#------------------------------------------------------------------------
   544	## @Type API
   545	## @param from          File we might want to install
   546	## @param to            File to replace
   547	## @param savetime      Backup time if necessary
   548	##
   549	## @See <@function var.lib.sorcery.modules.libresurrect.html,real_handle_changed_config> for more details.
   550	##
   551	## Present the user with the following menu
   552	## (0) trash $to and install over it
   553	## (1) backup $to to $to.$savetime, install the new file in its place
   554	## (2) leave $to in its place, copy the new file to $to.$savetime
   555	## (3) do nothing
   556	## (4) see a diff between $to and the new file
   557	## choice 2 is currently the default, someday there will be a menu to
   558	## choose what the default will be
   559	#------------------------------------------------------------------------
   560	function handle_changed_config() {
   561	    debug "libapi" "handle_changed_config - $*"
   562	    real_handle_changed_config "$@"
   563	}
   564	
   565	#---------------------------------------------------------------------
   566	## @Type API
   567	## @param spell
   568	## @param dependency
   569	## @See <@function var.lib.sorcery.modules.libstate.html,is_depends_enabled> for more details.
   570	## Returns whether or not a given dependency is enabled
   571	##
   572	#---------------------------------------------------------------------
   573	function is_depends_enabled() {
   574	    debug "libapi" "is_depends_enabled - $*"
   575	    real_is_depends_enabled "$@"
   576	}
   577	
   578	#---------------------------------------------------------------------
   579	## @Type API
   580	## @param spell
   581	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_install_version> for more details.
   582	## Returns the current version of the given spell
   583	##
   584	#---------------------------------------------------------------------
   585	function installed_version() {
   586	    debug "libapi" "installed_version - $*"
   587	    real_installed_version "$@"
   588	}
   589	
   590	#------------------------------------------------------------------------
   591	## @Type API
   592	## @param from          File we might want to install
   593	## @param to            File to replace
   594	## @param savetime      Backup time if necessary (optional, defaults to
   595	##                      $(date +'%Y%m%d%H%M')
   596	## @See <@function var.lib.sorcery.modules.libresurrect.html,real_install_config_file> for more details.
   597	## Returns the current version of the given spell
   598	#------------------------------------------------------------------------
   599	function install_config_file() {
   600	    debug "libapi" "install_config_file - $*"
   601	    real_install_config_file "$@"
   602	}
   603	
   604	#---------------------------------------------------------------------
   605	## @Type API
   606	## @See <@function var.lib.sorcery.modules.libtrack.html,real_invoke_installwatch> for more details.
   607	## Starts using installwatch
   608	#---------------------------------------------------------------------
   609	function invoke_installwatch() {
   610	    debug "libapi" "invoke_installwatch - $*"
   611	    real_invoke_installwatch "$@"
   612	}
   613	
   614	#---------------------------------------------------------------------
   615	## @Type API
   616	## @See <@function var.lib.sorcery.modules.libtrack.html,real_invoke_stage_root> for more details.
   617	## Starts using stage root
   618	#---------------------------------------------------------------------
   619	function invoke_stage_root() {
   620	    debug "libapi" "invoke_stage_root - $*"
   621	    real_invoke_stage_root "$@"
   622	}
   623	
   624	#---------------------------------------------------------------------
   625	## @param return_var
   626	## @param elements, ...
   627	## @See <@function var.lib.sorcery.modules.libmisc.html,real_list_remove> for more details.
   628	##
   629	## Removes from the list string(s). Strings are kept to be unique and
   630	## are separated by spaces
   631	## <pre>
   632	## Example:
   633	##    MY_LIST="--disable-static --enable-dynamic"
   634	##    list_remove MY_LIST "--enable-dynamic"
   635	## </pre>
   636	##
   637	#---------------------------------------------------------------------
   638	function list_remove() {
   639	    debug "libapi" "list_remove - $*"
   640	    real_list_remove "$@"
   641	}
   642	
   643	#---------------------------------------------------------------------
   644	## @param return_var
   645	## @param elements, ...
   646	## @See <@function var.lib.sorcery.modules.libmisc.html,real_list_add> for more details.
   647	##
   648	## Puts in the list string(s). Strings are kept to be unique and are
   649	## separated by spaces
   650	## <pre>
   651	## Example:
   652	##    list_add MY_LIST "--with-x"
   653	##    list_add MY_LIST "--with-jpeg" $OTHER_OPTS
   654	##    echo $MY_LIST
   655	## </pre>
   656	##
   657	#---------------------------------------------------------------------
   658	function list_add() {
   659	    debug "libapi" "list_add - $*"
   660	    real_list_add "$@"
   661	}
   662	
   663	#---------------------------------------------------------------------
   664	## @param string
   665	## @param elements, ...
   666	## @See <@function var.lib.sorcery.modules.libmisc.html,real_list_find> for more details.
   667	##
   668	## return 0 at least one element is in list
   669	## return 1 none of supplied elements is not in list
   670	##
   671	## Finds if at least one of the given elements is in the string. They
   672	## can be delimited by spaces, tabs or newlines. The search elements
   673	## must not contain any of these or they won't match. The matching is
   674	## exact, regular expressions and globbing patterns are not supported.
   675	##
   676	## Warning, this function takes a real string, not a variable name as
   677	## other list_* functions.
   678	## <pre>
   679	## Example:
   680	##    if list_find "$MY_LIST" "--with-x"; then
   681	##        ... we have to compile X components in
   682	##    fi
   683	## </pre>
   684	##
   685	#---------------------------------------------------------------------
   686	function list_find() {
   687	    debug "libapi" "list_find - $*"
   688	    real_list_find "$@"
   689	}
   690	
   691	#---------------------------------------------------------------------
   692	## @Type API
   693	## @param message to echo
   694	## @Stdout message
   695	## @See <@function var.lib.sorcery.modules.libmisc.html,real_message> for more details.
   696	## echo's the given arguments if SILENT is not set.
   697	##
   698	#---------------------------------------------------------------------
   699	function message() {
   700	    debug "libapi" "message - $*"
   701	    real_message "$@"
   702	}
   703	
   704	#---------------------------------------------------------------------
   705	## @Type API
   706	## @param directory name
   707	## @param [size]
   708	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_mk_source_dir> for more details.
   709	## Creates a tmpfs filesystem.  By default, the size is 1GB.
   710	## The caller may optionally supply a size argument.
   711	## <pre>
   712	## Example1:  Create a 2GB mount at $SOURCE_DIRECTORY
   713	##
   714	##    mk_source_dir  $SOURCE_DIRECTORY  2g
   715	##
   716	## Example2:  Create a mount at /tmp/newdir, defaults to 1GB size
   717	##
   718	##    mk_source_dir  /tmp/newdir
   719	## </pre>
   720	#---------------------------------------------------------------------
   721	function mk_source_dir() {
   722	    debug "libapi" "mk_source_dir - $*"
   723	    real_mk_source_dir "$@"
   724	}
   725	
   726	#---------------------------------------------------------------------
   727	## @Type API
   728	## @See <@function var.lib.sorcery.modules.libtrack.html,real_note_config_file> for more details.
   729	## @param spell file to check for modification
   730	##
   731	#---------------------------------------------------------------------
   732	function note_config_file() {
   733	    debug "libapi" "note_config_file - $*"
   734	    real_note_config_file "$@"
   735	}
   736	
   737	#---------------------------------------------------------------------
   738	## @Type API
   739	## @See <@function var.lib.sorcery.modules.libtriggers.html,real_on_cast> for more details.
   740	## @param spell that triggers
   741	## @param action
   742	##
   743	## Used by spells to make adding triggerse nice.
   744	##
   745	#---------------------------------------------------------------------
   746	function on_cast() {
   747	    debug "libapi" "on_cast - $*"
   748	    real_on_cast "$@"
   749	}
   750	
   751	
   752	
   753	#---------------------------------------------------------------------
   754	## @Type API
   755	## @param spell that triggers
   756	## @param action
   757	## @See <@function var.lib.sorcery.modules.libtriggers.html,real_on_dispel> for more details.
   758	##
   759	## Used by spells to make adding triggers nice.
   760	##
   761	#---------------------------------------------------------------------
   762	function on_dispel() {
   763	    debug "libapi" "on_dispel - $*"
   764	    real_on_dispel "$@"
   765	}
   766	
   767	
   768	#---------------------------------------------------------------------
   769	## @Type API
   770	## @See <@function var.lib.sorcery.modules.libtriggers.html,real_on_pre_cast> for more details.
   771	## @param spell that triggers
   772	## @param action
   773	##
   774	## Used by spells to make adding triggerse nice.
   775	##
   776	#---------------------------------------------------------------------
   777	function on_pre_cast() {
   778	    debug "libapi" "on_pre_cast - $*"
   779	    real_on_pre_cast "$@"
   780	}
   781	
   782	#---------------------------------------------------------------------
   783	## @Type API
   784	## @param spell that triggers
   785	## @param action
   786	## @See <@function var.lib.sorcery.modules.libtriggers.html,real_on_pre_dispel> for more details.
   787	##
   788	## Used by spells to make adding triggerse nice.
   789	##
   790	#---------------------------------------------------------------------
   791	function on_pre_dispel() {
   792	    debug "libapi" "on_pre_dispel - $*"
   793	    real_on_pre_dispel "$@"
   794	}
   795	
   796	#---------------------------------------------------------------------
   797	## @Type API
   798	## @param spell/service
   799	## @param enabled options (optional)
   800	## @param disabled options (optional)
   801	## @param description (optional)
   802	## @param grimoires (optional)
   803	## @See <@function var.lib.sorcery.modules.libdepends.html,real_optional_depends> for more details.
   804	## Denotes that a spell can use another spell for additional functionality.
   805	#---------------------------------------------------------------------
   806	function optional_depends() {
   807	    debug "libapi" "optional_depends - $*"
   808	    real_optional_depends "$@"
   809	}
   810	
   811	#---------------------------------------------------------------------
   812	## @param variables, ...
   813	## @See <@function var.lib.sorcery.modules.libmisc.html,real_persistent_add> for more details.
   814	##
   815	## Adds variable names to the list of persistent variables
   816	## <pre>
   817	## Example:
   818	##    persistent_add MY_VARIABLE
   819	## </pre>
   820	##
   821	#---------------------------------------------------------------------
   822	function persistent_add() {
   823	    debug "libapi" "persistent_add - $*"
   824	    real_persistent_add "$@"
   825	}
   826	
   827	#---------------------------------------------------------------------
   828	## @See <@function var.lib.sorcery.modules.libmisc.html,real_persistent_clear> for more details.
   829	## Unsets all persistent variables. Mainly usable as replacement of
   830	## persistent_save for functions which can be called by nonroot users
   831	## ( for example from 'gaze what' )
   832	## <pre>
   833	## Example:
   834	##    persistent_clear
   835	## </pre>
   836	##
   837	#---------------------------------------------------------------------
   838	function persistent_clear() {
   839	    debug "persistent_clear - $*"
   840	    real_persistent_clear "$@"
   841	}
   842	
   843	#---------------------------------------------------------------------
   844	## @See <@function var.lib.sorcery.modules.libmisc.html,real_persistent_load> for more details.
   845	## Loads persistent variables stored in file "$SPELL_CONFIG"
   846	## <pre>
   847	## Example:
   848	##    persistent_load
   849	## </pre>
   850	##
   851	#---------------------------------------------------------------------
   852	function persistent_load() {
   853	    debug "libapi" "persistent_load - $*"
   854	    real_persistent_load "$@"
   855	}
   856	
   857	#---------------------------------------------------------------------
   858	## @param variables, ...
   859	## @See <@function var.lib.sorcery.modules.libmisc.html,real_persistent_remove> for more details.
   860	##
   861	## Removes variable names from the list of persistent variables
   862	## <pre>
   863	## Example:
   864	##    persistent_remove MY_VARIABLE
   865	## </pre>
   866	##
   867	#---------------------------------------------------------------------
   868	function persistent_remove() {
   869	    debug "libapi" "persistent_remove - $*"
   870	    real_persistent_remove "$@"
   871	}
   872	
   873	#---------------------------------------------------------------------
   874	## @See <@function var.lib.sorcery.modules.libmisc.html,real_persistent_save> for more details.
   875	## Saves variables marked as persistent to file "$SPELL_CONFIG". The
   876	## File is completely overwritten. Also unsets all persistent
   877	## variables
   878	## <pre>
   879	## Example:
   880	##    persistent_save
   881	## </pre>
   882	##
   883	#---------------------------------------------------------------------
   884	function persistent_save() {
   885	    debug "libapi" "persistent_save - $*"
   886	    real_persistent_save "$@"
   887	}
   888	
   889	#---------------------------------------------------------------------
   890	## @param spell
   891	## @param variable to read
   892	## @param upvar
   893	##
   894	## finds the persistent var for a spell and sets the upvar to the value of the
   895	## variable to read
   896	## returns:
   897	##          1 if the var doesn't exist in the file
   898	##          2 if the tablet dir doesn't exist
   899	##          3 if the persistent config file doesn't exist
   900	##          4 if the EXPORTS file doesn't exist
   901	##
   902	#---------------------------------------------------------------------
   903	function persistent_read() {
   904	    debug "libapi" "persistent_read - $*"
   905	    real_persistent_read "$@"
   906	}
   907	
   908	#---------------------------------------------------------------------
   909	## @Type API
   910	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_prepare_install> for more details.
   911	## Prepares to install the spell.  Writes the boost lock file.  If the
   912	## spell is installed already, the libraries are saved with
   913	## save_libraries(), the binaries with save_binaries() and the spell is
   914	## dispelled.  Usually called from the BUILD script of a spell.
   915	##
   916	#---------------------------------------------------------------------
   917	function prepare_install() {
   918	    debug "libapi" "prepare_install - $*"
   919	    real_prepare_install "$@"
   920	}
   921	
   922	#---------------------------------------------------------------------
   923	## @Type API
   924	## @param Provider name
   925	## @See <@function var.lib.sorcery.modules.libstate.html,real_provider_ok> for more details.
   926	##
   927	## @return 0 if any provider of $1 is installed
   928	#---------------------------------------------------------------------
   929	function provider_ok() {
   930	    debug "libapi" "provider_ok - $*"
   931	    real_provider_ok "$@"
   932	}
   933	
   934	#---------------------------------------------------------------------
   935	## @Type API
   936	## @param  [directory to remove]
   937	## @Globals SOURCE_DIRECTORY
   938	## Removes the given directory or SOURCE_DIRECTORY if no argument is
   939	## given.
   940	## @See <@function var.lib.sorcery.modules.libgrimoire.html,real_rm_source_dir> for more details.
   941	##
   942	#---------------------------------------------------------------------
   943	function rm_source_dir() {
   944	    debug "libapi" "rm_source_dir - $*"
   945	    real_rm_source_dir "$@"
   946	}
   947	
   948	#---------------------------------------------------------------------
   949	## @Type API
   950	## @See <@function var.lib.sorcery.modules.libmisc.html,real_query> for more details.
   951	## @param question
   952	## @param default answer
   953	##
   954	## @return 0 on yes
   955	## @return 1 on no
   956	##
   957	## Asks the user a yes/no question.  First argument is the question to
   958	## ask, second argument is the default answer.  If a timeout occurs
   959	## before the question is answered, the given default answer is
   960	## applied.  Returns true or false based on the answer given.
   961	##
   962	#---------------------------------------------------------------------
   963	function query() {
   964	    debug "libapi" "query - $*"
   965	    real_query "$@"
   966	}
   967	
   968	#---------------------------------------------------------------------
   969	## @See <@function var.lib.sorcery.modules.libmisc.html,real_query_string> for more details.
   970	## @param return_var
   971	## @param question
   972	## @param default answer
   973	##
   974	## @return 0 user supplied answer
   975	## @return 1 default answer is used
   976	##
   977	## Asks user for string, with default answer and timeout (like query)
   978	## <pre>
   979	## Example:
   980	##    query_string YOUR_HOST "What is your hostname ?" "localhost"
   981	## </pre>
   982	##
   983	#---------------------------------------------------------------------
   984	function query_string()  {
   985	    debug "libapi" "query_string  - $*"
   986	    real_query_string "$@"
   987	}
   988	
   989	#---------------------------------------------------------------------
   990	## @Type API
   991	## @param spell/service
   992	## @param enabled options (optional)
   993	## @param description (optional)
   994	## @param grimoires (optional)
   995	## @See <@function var.lib.sorcery.modules.libdepends.html,real_depends> for more details.
   996	## Denotes that a spell requires another spell to work.
   997	#---------------------------------------------------------------------
   998	function runtime_depends() {
   999	    debug "libapi" "runtime_depends - $*"
  1000	    real_runtime_depends "$@"
  1001	}
  1002	
  1003	#---------------------------------------------------------------------
  1004	## @Type API
  1005	## @param sed command
  1006	## @param file
  1007	## @See <@function var.lib.sorcery.modules.libmisc.html,real_sedit> for more details.
  1008	##
  1009	## First argument is a sed command.  Second argument is a file.
  1010	## sedit performs the sed command on the file, modifiying the
  1011	## original file.  For example,
  1012	## <br>sedit "s/foo/bar/g" /tmp/somefile <br>
  1013	## will replace all occurances of foo with bar in /tmp/somefile.
  1014	## This function is often used in spells to make changes to source
  1015	## files before compiling.  See the sed man page for more information.
  1016	##
  1017	#---------------------------------------------------------------------
  1018	function sedit() {
  1019	    debug "libapi" "sedit - $*"
  1020	    real_sedit "$@"
  1021	}
  1022	
  1023	#---------------------------------------------------------------------
  1024	## @Type API
  1025	## @param spell name
  1026	## @param max depth
  1027	## @param fast (optional)
  1028	## @See <@function var.lib.sorcery.modules.libdepends.html,real_show_up_depends> for more details.
  1029	##
  1030	## @stdout recursively prints out the spell that depend on the specified spell
  1031	#---------------------------------------------------------------------
  1032	function show_up_depends() {
  1033	    debug "libapi" "spell_ok - $*"
  1034	    real_show_up_depends "$@"
  1035	}
  1036	
  1037	#---------------------------------------------------------------------
  1038	## @Type API
  1039	## @param spell name
  1040	## @See <@function var.lib.sorcery.modules.libstate.html,real_spell_installed> for more details.
  1041	##
  1042	## @return 0 if the given spell's status is "installed"
  1043	#---------------------------------------------------------------------
  1044	function spell_installed() {
  1045	    debug "libapi" "spell_installed - $*"
  1046	    real_spell_installed "$@"
  1047	}
  1048	
  1049	#---------------------------------------------------------------------
  1050	## @Type API
  1051	## @param spell name
  1052	## @See <@function var.lib.sorcery.modules.libstate.html,real_spell_installed> for more details.
  1053	##
  1054	## @return 0 if the given spell's status is "held"
  1055	#---------------------------------------------------------------------
  1056	function spell_held() {
  1057	    debug "libapi" "spell_held - $*"
  1058	    real_spell_held "$@"
  1059	}
  1060	
  1061	#---------------------------------------------------------------------
  1062	## @Type API
  1063	## @param spell name
  1064	## @See <@function var.lib.sorcery.modules.libstate.html,real_spell_ok> for more details.
  1065	##
  1066	## @return 0 if the given spell's status is "installed" or "held"
  1067	#---------------------------------------------------------------------
  1068	function spell_ok() {
  1069	    debug "libapi" "spell_ok - $*"
  1070	    real_spell_ok "$@"
  1071	}
  1072	
  1073	#---------------------------------------------------------------------
  1074	## @Type API
  1075	## @param spell name
  1076	## @See <@function var.lib.sorcery.modules.libstate.html,real_spell_exiled> for more details.
  1077	##
  1078	## @return 0 if the given spell's status is "exiled"
  1079	#---------------------------------------------------------------------
  1080	function spell_exiled() {
  1081	    debug "libapi" "spell_ok - $*"
  1082	    real_spell_exiled "$@"
  1083	}
  1084	
  1085	#---------------------------------------------------------------------
  1086	## @Type API
  1087	## @param spell providing the sub-depends
  1088	## @param name of sub-depends
  1089	## @See <@function var.lib.sorcery.modules.libdepends
  1090	#---------------------------------------------------------------------
  1091	function sub_depends() {
  1092	    debug "libapi" "sub_depends - $*"
  1093	    real_sub_depends "$@"
  1094	}
  1095	
  1096	#---------------------------------------------------------------------
  1097	## @Type API
  1098	## @param spell/service
  1099	## @param enabled options (optional)
  1100	## @param disabled options (optional)
  1101	## @param description (optional)
  1102	## @param grimoires (optional)
  1103	## @See <@function var.lib.sorcery.modules.libdepends.html,real_suggest_depends> for more details.
  1104	## Denotes that a spell can use another spell for additional functionality.
  1105	#---------------------------------------------------------------------
  1106	function suggest_depends() {
  1107	    debug "libapi" "suggest_depends - $*"
  1108	    real_suggest_depends "$@"
  1109	}
  1110	
  1111	#---------------------------------------------------------------------
  1112	## @Type API
  1113	## @param file to uncompress
  1114	## @See <@function var.lib.sorcery.modules.libunpack.html,real_uncompress> for more details.
  1115	##
  1116	## Given a file, uncompress runs the decompression program for that file,
  1117	## Note: zip is a special case because it doesn't work with streams.
  1118	##
  1119	#---------------------------------------------------------------------
  1120	function uncompress() {
  1121	    debug "libapi" "uncompress - $*"
  1122	    real_uncompress "$@"
  1123	}
  1124	
  1125	#---------------------------------------------------------------------
  1126	## @Type API
  1127	## @param file to unpack
  1128	## @param md5sum
  1129	## @See <@function var.lib.sorcery.modules.libunpack.html,real_unpack> for more details.
  1130	##
  1131	## Given a file, unpack runs the decompression program for that file,
  1132	## as well as untar'ing the file if appropriate and if the MD5
  1133	## matches.
  1134	## Note: zip is a special case because it doesn't work with streams.
  1135	## Note: This function is deprecated and kept for spells that still
  1136	##       use the old verification methods (MD5[0]=).
  1137	##
  1138	#---------------------------------------------------------------------
  1139	function unpack() {
  1140	    debug "libapi" "unpack - $*"
  1141	    real_unpack "$@"
  1142	}
  1143	
  1144	#---------------------------------------------------------------------
  1145	## @Type API
  1146	## @param SOURCE suffix
  1147	## @See <@function var.lib.sorcery.modules.libunpack.html,real_unpack_file> for more details.
  1148	##
  1149	## unpack_file takes the SOURCE suffix and figures out if it is supposed
  1150	## to hash or gpg check it -- then it does its dirty work and runs unpack_hash
  1151	## or unpack_gpg depending upon the circumstances.  That's the only argument it
  1152	## takes and needs: '' '2' '3', etc.  It is run in default_pre_build for the
  1153	## null argument only.  Custom unpacking still requires a custom PRE_BUILD.
  1154	##
  1155	## valid formats: vendor-provided gpg, guru-provided gpg, any
  1156	## hash-algorithm provided by gpg (currently md5, sha1, sha256, sha384,
  1157	## sha512, ripemd160
  1158	##
  1159	##           SOURCE=blah
  1160	##          SOURCE2=blah.asc
  1161	##       SOURCE_URL=http://blah.com/$SOURCE
  1162	##      SOURCE2_URL=http://blah.com/$SOURCE2
  1163	##       SOURCE_GPG=blah.gpg:$SOURCE2:UPSTREAM_KEY
  1164	##   SOURCE2_IGNORE=signature # for auditing purposes
  1165	##
  1166	##           SOURCE=blah
  1167	##       SOURCE_URL=http://blah.com/$SOURCE
  1168	##       SOURCE_GPG=swoolley.gpg:$SOURCE.asc:WORKS_FOR_ME
  1169	##
  1170	##           SOURCE=blah
  1171	##       SOURCE_URL=http://blah.com/$SOURCE
  1172	##           MD5[0]=d41d8cd98f00b204e9800998ecf8427e
  1173	##
  1174	##           SOURCE=blah
  1175	##       SOURCE_URL=http://blah.com/$SOURCE
  1176	##       SOURCE_HASH=md5:d41d8cd98f00b204e9800998ecf8427e:WORKS_FOR_ME
  1177	##
  1178	## In GPG mode:
  1179	##   Validates the verification level (the third parameter) and the
  1180	##   hash algorithm against user defined lists.
  1181	##   It finds the public key and signature using locate_spell_file,
  1182	##   Then it validates it at the beginning.
  1183	##   see unpack_gpg()
  1184	##
  1185	## In HASH mode:
  1186	##   Validates the verification level (the third parameter) and the
  1187	##   hash algorithm against user defined lists.
  1188	##   It uses gpg to calculate the hash value except for md5 and sha1, which
  1189	##   coreutils provides.
  1190	##   see unpack_hash()
  1191	##
  1192	## In IGNORE mode:
  1193	##   It checks for the following text:
  1194	##     volatile (for cvs/svn/any-other-scm)
  1195	##     unversioned (the source file changes frequently, but not a direct scm)
  1196	##     signature (for gnupg signatures)
  1197	##   as reasons for ignoring the source code validation.  Signatures
  1198	##   are silently ignored.  Everything else respects MD5SUM_DL.
  1199	##   see unpack_ignore
  1200	##
  1201	## Otherwise, it falls back to MISSING mode, see unpack_missing
  1202	## (or for now)
  1203	## Otherwise, it falls back to old uncompressed md5sum check with MD5[n].
  1204	##   see real_unpack()
  1205	##
  1206	## The default verification level is "WORKS_FOR_ME"
  1207	##
  1208	## Verification levels are, these indicate how much effort was put into
  1209	## validating the integrity of the source from the upstream vendor.
  1210	##   WORKS_FOR_ME No verification was done.
  1211	##   UPSTREAM_HASH Checked the upstream hash file
  1212	##   UPSTREAM_KEY Checked upstream (gpg) key, signature matched, but the
  1213	##                key was not validated
  1214	##   ESTABLISHED_UPSTREAM_KEY Upstream key was not validated against
  1215	##                            multiple independent sources, but has been
  1216	##                            in use for several years
  1217	##   VERIFIED_UPSTREAM_KEY Upstream key id was verified against multiple
  1218	##                         independent sources.
  1219	##   ID_CHECK_UPSTREAM_KEY Key was verified in person with a photo id check.
  1220	##
  1221	## Also if you want to include more than one signature, hash, etc, just put
  1222	## a 2, 3, 4, etc on the end of the variable like so:
  1223	##   SOURCE2_HASH2=...
  1224	##
  1225	## For cascading, currently it will still ask abort questions: a no abort
  1226	## will make it fail over all cascades; a yes abort will have it skip to
  1227	## the next cascades.  Missing binaries or other failures like that (error 200
  1228	## below) will silently fail over to the next check.  The cascade order is:
  1229	##  GPG, HASH, IGNORE, MISSING
  1230	##
  1231	## The cascade setup allows you to place a higher bit checksum earlier
  1232	## in the cascade and even if the binary doesn't work it will just print
  1233	## out an abort query which can be said no to and it will continue to
  1234	## fail over to the lower bit checksum that should be available in
  1235	## coreutils (like sha1/md5).  That's if you're not using gpg, which is
  1236	## preferred.  If multiple hashes are included of different ciphers, the
  1237	## user can abort on either that go bad, so it can be considered a
  1238	## security increase to have more than one, but only if the harder cipher
  1239	## is first in the cascade order, as the first successful hash match will
  1240	## go ahead and prompt an untarball.  It may change later, but for now we
  1241	## think the first successful match skipping the rest is least intrusive, and
  1242	## I'd need to add an interface element to let the user choose to run all
  1243	## checks on a single source.
  1244	##
  1245	#---------------------------------------------------------------------
  1246	function unpack_file() {
  1247	    debug "libapi" "unpack_file - $*"
  1248	    real_unpack_file "$@"
  1249	}
  1250	
  1251	#---------------------------------------------------------------------
  1252	## @Type API
  1253	## @params Name of a file to unpack
  1254	## @See <@function var.lib.sorcery.modules.libunpack.html,real_unpack_file_simple> for more details.
  1255	##
  1256	## Interface to unpack a file without any verification.
  1257	##
  1258	#---------------------------------------------------------------------
  1259	function unpack_file_simple() {
  1260	    debug "libapi" "$FUNCNAME - $*"
  1261	    real_unpack_file_simple "$@"
  1262	}
  1263	
  1264	#---------------------------------------------------------------------
  1265	## @Type API
  1266	## @param SOURCE suffix
  1267	## @See <@function var.lib.sorcery.modules.libunpack.html,real_verify_file> for more details.
  1268	##
  1269	## verify_file takes the SOURCE suffix and verifies the file without
  1270	## unpacking it. It does not work with the old 'MD5[0]=...' style.
  1271	## Only with the "new" SOURCEn_(GPG|HASH|IGNORE) style.
  1272	##
  1273	#---------------------------------------------------------------------
  1274	function verify_file() {
  1275	    debug "libapi" "verify_file - $*"
  1276	    real_verify_file "$@"
  1277	}
  1278	
  1279	#---------------------------------------------------------------------
  1280	## @param gcc version (digits and dots, followed by an optional +)
  1281	## @return 0 if the version of the installed gcc that will be used is equal
  1282	##             to the passed version
  1283	## @return 0 if the parameter is of the form "version+" and the version of the
  1284	##             installed gcc is at least "version"
  1285	## @return 1 otherwise
  1286	## @See <@function var.lib.sorcery.modules.libgcc.html,real_using_gcc> for more details.
  1287	##
  1288	## Checks if the system gcc version is equal to the passed version or
  1289	## when the version ends with a + marker, if it the system version is
  1290	## greater or equal to it.
  1291	## The gcc version is of the major.minor.patchlevel form, but trailing
  1292	## digits can be omitted and will default to 0 in the comparison.
  1293	##
  1294	## <pre>
  1295	## Example:
  1296	##    if using_gcc 4.3+; then # same as 4.3.0+
  1297	##      patch -p1 < $SPELL_DIRECTORY/gcc43-compilation-fixes.patch
  1298	##    elif using_gcc 4.0.0; then
  1299	##      # gcc 4.0.0 triggers a memleak when -O3 is used
  1300	##      CFLAGS=${CFLAGS/-O3/-O2}
  1301	##    fi
  1302	## </pre>
  1303	#---------------------------------------------------------------------
  1304	function using_gcc()  {
  1305	  debug "libapi" "$FUNCNAME - $*"
  1306	  real_using_gcc "$@"
  1307	}
  1308	
  1309	#---------------------------------------------------------------------
  1310	## @Type API
  1311	## @param Target of the trigger
  1312	## @param Action to execute
  1313	## @See <@function var.lib.sorcery.modules.libdepends.html,real_up_triggers> for more details.
  1314	##
  1315	## Only allowed from UP_TRIGGERS file.
  1316	## Specify that the current spell should trigger the specifed action
  1317	## on the target spell. This is a shortcut for the TRIGGERS file in the
  1318	## target spell, this lets you specify lots of triggers easily.
  1319	##
  1320	#---------------------------------------------------------------------
  1321	function up_trigger() {
  1322	  debug "libapi" "$FUNCNAME - $*"
  1323	  real_up_trigger "$@"
  1324	}
  1325	
  1326	#---------------------------------------------------------------------
  1327	## @Type API
  1328	## @params list of files to track manually
  1329	## @See <@function var.lib.sorcery.modules.libtrack.html,real_track_manual> for more details.
  1330	##
  1331	## Given a list of files it will notify installwatch of them.
  1332	## Useful for spells whose components are not dynamicly linked
  1333	## to glibc. Installwatch must be running for this to work.
  1334	#---------------------------------------------------------------------
  1335	function track_manual() {
  1336	    debug "libapi" "track_manual - $*"
  1337	    real_track_manual "$@"
  1338	}
  1339	
  1340	#---------------------------------------------------------------------
  1341	## @License
  1342	##
  1343	## This software is free software; you can redistribute it and/or modify
  1344	## it under the terms of the GNU General Public License as published by
  1345	## the Free Software Foundation; either version 2 of the License, or
  1346	## (at your option) any later version.
  1347	##
  1348	## This software is distributed in the hope that it will be useful,
  1349	## but WITHOUT ANY WARRANTY; without even the implied warranty of
  1350	## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  1351	## GNU General Public License for more details.
  1352	##
  1353	## You should have received a copy of the GNU General Public License
  1354	## along with this software; if not, write to the Free Software
  1355	## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  1356	##
  1357	#---------------------------------------------------------------------