From 7e8ab990ac2f6fea415d5405b831fc7978e669a2 Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Thu, 28 Mar 2013 19:06:25 +0000 Subject: [PATCH] docs: more work --- caf.pod | 157 +++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 150 insertions(+), 7 deletions(-) diff --git a/caf.pod b/caf.pod index 32b7e4d..dad4736 100644 --- a/caf.pod +++ b/caf.pod @@ -508,7 +508,22 @@ class or due to previous requests on the same verifier.) See L. -=item C<< $verifier_or_authreq->($data) | CGI::Auth::Flexible->>> +=item C<< CGI::Auth::Flexible::srcdump_dir_cpio($cgi,$verifier,$dumpdir,$dir,$outfn,$how,$script) >> + +Helper function for implementing the C hook. +Generates a tarball using cpio and includes it in the prepared source +code distribution. + +The arguments are mostly the same as for that hook. C<$dir> is the +root directory at which to start the archive. C<$how> is a short text +string which will be mentioned in the log. + +C<$script> is a shell script fragment which must output a +nul-separated list of filenames (e.g. the output of C). + +xxx blah blah + +=item C<< $verifier_or_authreq->($data) | CGI::Auth::Flexible-> >> Hashes the supplied data using the hash function specified by the C setting, and converts the result to a string of hex @@ -538,6 +553,10 @@ legal syntax. This should be read to mean that the %implicit_settings_hash{'some_hook'}($cgi,$authreq,@stuff) would be a legal call. (However, the settings hash is not exposed.) +When a hook's default implementation is mentioned and named, that +function won't also be described in the section on the module's +functions. + =over =head2 GENERAL SETTINGS @@ -810,7 +829,7 @@ C<< gettext(ucfirst $parameter_name) >>, a password field (with description C, and a login submit button (with description C. -Default is available as the class function C. +Default is available as the module function C. =item C($cgi,$authreq)) @@ -818,7 +837,7 @@ Default: gettext(Log in again to continue.) -Default is available as the class function C. +Default is available as the module function C. =item C($cgi,$authreq,$params)) @@ -829,7 +848,7 @@ fields, and also: -Default is available as the class function C. +Default is available as the module function C. =item C($cgi,$authreq,$title) @@ -849,7 +868,7 @@ Default: [gen_source_link_html]. -Default is available as the class function C. +Default is available as the module function C. =item C($cgi,$authreq)> @@ -857,7 +876,7 @@ Default: uses C to generate a URL for downloading the licence, and returns: GNU Affero GPL -Default is available as the class function C. +Default is available as the module function C. =item C($cgi,$authreq)> @@ -865,7 +884,7 @@ Default: uses C to generate a URL for downloading the source, and returns: Source available -Default is available as the class function C. +Default is available as the module function C. =item C @@ -897,6 +916,130 @@ Defaults to C. If this is a relative path, it is in C. +=item C + +Dump the source code (C<$srcobj='source'> or licence data +(C<$srcobj='licence'>). The default implementation checks that +C<$srcobj> has reasonable syntax and uses the files C<$srcobj.data> +and C<$srcobj.ctype> with the C hook. + +=item C + +Responds to the request by sending the contents of $datafilehandle +(which should just have been opened) and specifying a content type of +$contenttype. + +The default implmentation uses the C hook, and also calls +C<$cgi->header('-type' => $contenttype>, and is available as the +module function C. + +=item C + +Prepares the source code for download when requested. Invoked by +C, always, immediately before it returns the +just-created verifier object. + +The default implementation is the module function +C, which prepares a manifest, licence file +and source code tarball of tarballs, as follows: + +It processes each entry in the return value from C. +These are the software's include directories and any other directories +containing source code. It handles C<.> specially (see +C). + +For each entry it looks, relative to that, for the licence as a file +with a name mentioned in C. The first such +file found is considered to be the licence. It then calls the hook +C for the entry. + +The licence, a manifest file, and all the outputs generated by the +calls to C, are tarred up and compressed as a +single source tarball. + +It uses the directory named by C as its directory for +working and output files. It uses the filename patterns +C, C, C, C, +C in that directory. + +=item C($cgi,$verifier,$dumpdir,$item,\&outfn,\$needlicence,\%dirsdone)> + +Processes a single include directory or software entry, so as to +include the source code found there. Called only by the default +implementation of C. + +C<$dumpdir> is the directory for working and output files. C<$item> +is the real (no symlinks) absolute path to the item. + +C<\$needlicence> is a ref to a scalar: this scalar is undef if we have +already found the licence file; otherwise it is the filename to which +the licence should be copied. If the referent is undef on entry, +C needs to see if it finds the licence; if it +does it should copy it to the named file and then set the scalar to +undef. + +C<\%dirsdone> is a ref to the hash used by C to avoid +including a single directory more than once. If +C decides to process a directory other than +C<$item> it should check this hash with the real absolute path of the +other directoy as a key: if the hash entry is true, it has already +been done and should be skipped; otherwise the hash entry should be set. + +C<\&outfn> is a coderef which C should call each +time it wants to generate a file which should be included as part of +the source code. It should be called using one of these patterns: + $outfn->("message for log"); + $outfile = $outfn->("message for log", "extension"); +The former simply logs this message (along with the associated +C<$item>, so there is no need to mention that). The latter logs the +message but also generates and returns a filename which should then +be created and filled with some appropriate data. C<"extension"> +should be a string for the file extension, eg C<"txt">. The output +can be written directly to the named file: there is no need to +write to a temporary file and rename. + +The default implementation is the module function +C. It searches the item and its parent +directories for a vcs metadata directory (one of the names in +C); if found, it calls the C hook +(after checking and updaeing C<%dirsdone>). +Otherwise it calls the C hook. + +=item C + +Called by the default implementation of C, with +the same arguments, if it doesn't find vcs metadata. + +The default implementation is the module function C. + +If C<$item> is a directory, it uses C to prepare a +tarball of all the files under C<$item> which have the world read bit +set. Directories are not included (and their permissions are +disregarded). The contents of C are excluded. + +If it's a plain file it uses C to include the file. + +=item C + +Called by the default implementation of C, with +the same arguments, if it finds vcs metadata. The additional argument +C<$vcs> is derived from the entry of C which was +used: it's the first sequence of word characters, lowercased. + +The default implementation is the module function C. +It simply calls C with the script from the setting +C. + + + which is defined + +xxx conditions on listitems implied by srcdump_dirscan_prepare +xxx listitems enoent behaviour +The de + +xxx syntax of srcdump_excludes + + =back -- 2.30.2