Script Index


/var/lib/sorcery/modules/libsummon

This just wraps up calls to run_details, get_spell_files_and_urls and download_files. Along with doing the logging and other stuff. This is mainly to reduce duplication of code between cast and summon and to make it so cast doesn't have to actually run the summon script.

Contributors

Andrew Stitt

Synopsis

Internal api for summoning/printing spell file information. Mainly for use by cast and summon, who both need to "summon".


function summon_spell()

Parameters:

Returns:

Description

1 if any of them failed. As the name would imply, summon a spell given its name. The spell is sourced in a subshell and thus no variable leakage will occur to the caller (although the function could be effected by leakage from other places). This function will take care of locking out other processes from downloading the same spell. Also takes care of making entries in the activity log


function get_spell_files_and_urls()

Parameters:

Stdout

multiple lines, one per SOURCE/SOURCEx as "SOURCE SOURCE_URL[0] SOURCE_URL[1]"

Description

Helper routine to dump out the files and urls for a spell given that the caller has run run_details.


function real_default_sorcery_download()

Parameters:

Description

Call acquire_src for each SOURCEx_URL


function real_acquire_src()

Parameters:

Description

Acquire the source. Check locally unless options insist on not doing so.


function is_downloaded()

Parameters:

Returns:

Description

Checks if the download target is already downloaded, Inspects $FORCE_DOWNLOAD and ${FORCE_DOWNLOAD[$srcnum]} if either are set then downloading is forced, a local copy of the file is ignored.


function real_download_src()

Parameters:

Description

Expands $SOURCEx, $SOURCEx_URL[*] and $SOURCEx_HINTS then calls download_src_args with them.


function download_src_args()

Parameters:

Description

Download the resource, handles file and tree discrepencies, if a tree is downloaded it is repackaged as the specified file for later use. Only tar.bz2 files are acceptable caches for repackaged trees


function download_src_sub()

Parameters:

Description

Download the resource, first try a leapforward url, then the given urls and finally the fallbacks.


function download_from_leapforward()

Parameters:

Description

Download the specified resource from the leapforward url if one is given.


function download_from_fallback()

Parameters:

Description

Attempt to get the resource from the fallback urls, try each one in a random order.


function unpack_for_update()

Parameters:

Description

Make a guess as to whether or not the resource being downloaded will be a file or a tree if it is a tree and the cached source exists then unpack it in the current directory so it may be updated


function source_sanity()

Parameters:

Returns:

Stdout

error message if file fails the check

Description

Perform rudimentary source sanity checks on summoned files. Currently only checks that files are not zero sized or html 404 notices. Some sites, notably sourceforge, break http by having missing files do a 30X redirect to a 404 html file which when downloaded has a 200 (OK) status. Other sites do 30X redirect to the new location of the requested file, which then successfully downloads (which is the correct thing to do). We catch that here rather than wait for file verification to catch it.