Henrietta-cache
Description
A caching helper for Henrietta which fetches eggs from various sources.
Requirements
- srfi-1
- http-client
- matchable
- A gunzip in $PATH for extracting GZIP-files to stdout.
- A bunzip2 in $PATH for extracting BZIP2-files to stdout.
- A semi-modern tar in $PATH. It should accept the "xf -" switches to mean "extract the tar file which is offered on stdin". It should also allow extended GNU tarfiles, as some eggs include filenames longer than 64 characters. Most tar implementations do.
Documentation
This egg installs a small program called henrietta-cache which reads a file containing egg-to-URI mappings. These URIs are expected to resolve to a so-called "release-info" file, which provides further instructions on how to fetch actual releases of the egg.
These releases are downloaded into a caching directory, which can then be served by henrietta for use by chicken-install.
Henrietta-cache can be invoked as follows:
henrietta-cache [-h] [-r|-chicken-release RELEASE] [-c|-cache-dir CACHEDIR] [-e|-egg-list EGGLIST] [-k|-keep KEEPNUM] [-i|-init-file INITFILE] [-n|-no-download]
The CACHEDIR points at the directory in which to place the cached files. It defaults to "cache". It will automatically create a subdirectory for each egg in the list, under which it creates one subdirectory for each egg release. This structure is used because it is expected by henrietta, and may change in the future.
The EGGLIST points to a file containing the list of eggs to fetch. It may be either a filename or an HTTP(S) URI.
The RELEASE indicates a major CHICKEN release. This will only be used when performing requests to get the correct URI. Defaults to 5.
The INITFILE is a file which will be loaded before starting the download process. This can be used to set handlers on the hooks, as documented below.
The KEEPNUM option tells henrietta-cache to prune releases so that only the KEEPNUM latest remain.
The -no-download can be used to skip downloading newer releases. This can speed up the -keep option.
For more information about the structure of release-info files and what types of entries they can contain, see the tutorial on releasing eggs and the distributed egg repositories design document.
Hooks
- download-release-success-hook #!optional SUCCESS-HOOKparameter
This is a hook you can register to run some code whenever a full release of an egg has been successfully downloaded.
SUCCESS-HOOK is a procedure of three arguments: the major CHICKEN release (an integer), the egg name and the release version (both strings).
- download-release-error-hook #!optional ERROR-HOOKparameter
This is a hook you can register to run some code whenever a full release of an egg has failed to download.
ERROR-HOOK is a procedure of four arguments: the major CHICKEN release (an integer), the egg name, the release version and the error message on the exception that was thrown when the failure happened (the latter three are all strings).
- download-release-info-file-error-hook #!optional ERROR-HOOKparameter
This is a hook you can register to run some code whenever the download of the release-info file of an egg failed.
ERROR-HOOK is a procedure of four arguments: the major CHICKEN release (an integer), the egg name, the URI-string of the release-info file's location and the error message on the exception that was thrown when the failure happend (the latter three are all strings).
Changelog
- 1.7 - Port to CHICKEN 6
- 1.6.1 - Fix error when copying symlinks by making sure we first copy the link and then the target (thanks to Mario).
- 1.6 - Fix regression: When copying after extracting, also include dotfiles. Change default CHICKEN release to 5.
- 1.5.1 - Remove module wrapper again, this would break initfile.
- 1.5 - Add -n and -k options. Fix single-letter argument grouping. Fix CHICKEN 4 build (thanks to "dieggsy" for suggesting the new options).
- 1.4 - Avoid some warnings on OpenBSD due usage of "tmp"; copy and delete instead of moving to improve ownership handling (thanks to "n0goOi3").
- 1.3 - Fix backwards compatibility issue introduced by 1.2 which broke init scripts (fixes #1531, thanks to Mario Goulart).
- 1.2 - Add support for CHICKEN 5, drop support for CHICKEN versions older than 4.6. Add support for CHICKEN 5's distribution-files option for chicken-install (thanks to Mario Goulart for the initial patch).
- 1.1 - Use gunzip -c and bunzip2 -c instead of zcat and bzcat for compat reasons: On OS X, zcat does not accept gzipped files, and on many Linux distributions, gzcat does not exist. Reported by Jim Ursetto.
- 1.0 - Add support for major CHICKEN release under the cache dir. Hooks are incompatible now because they get an extra leading argument! The "tags" directory is no longer inserted in between the egg and version name.
- 0.4.1 - Skip over pax_global_header. Thanks to Carl Douglas and Mario Goulart for reporting this.
- 0.4 - Use tar instead of pax, as it won't accept extended GNU tar files (and ustar archives have crippling limitations on maximum file length). Thanks to Alaric Snell-Pym for pointing out this problem. Make downloads more robust against failure by downloading/extracting to a tempdir and moving only when everything is alright.
- 0.3 - Fix URI encoding bug in template replacement of location strings. Add initialisation file and hooks for error notification scripts (thanks to Moritz Heidkamp).
- 0.2.3 - Fix bug introduced in 0.2.2 that caused an extra directory level in the hierarchy under the tagname.
- 0.2.2 - Fix for moving files across filesystems
- 0.2.1 - Ensure paths are always treated as directories, fix bug with Apache CGI output from pseudo-meta-egg-info
- 0.2 - Add files-list type
- 0.1.1 - Improved error reporting. (Thanks to Felix Winkelmann)
- 0.1 - Initial release
Author
Repository
http://code.more-magic.net/henrietta-cache
License
Copyright (c) 2011-2024, Peter Bex All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. The name of the authors may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.