From 86b68d73bc55560faeaa4c2bf1e32d83251ecee8 Mon Sep 17 00:00:00 2001 From: erana Date: Wed, 18 Jan 2012 01:45:51 +0900 Subject: [PATCH] SPAN - question 1-20 --- scsh/SPAN/SPAN.scm | 171 +++++++++++++++++++++++++++++++++++++++++++-- scsh/SPAN/load.scm | 124 +++++++++++++++++++++++++++++++- 2 files changed, 287 insertions(+), 8 deletions(-) diff --git a/scsh/SPAN/SPAN.scm b/scsh/SPAN/SPAN.scm index 15d9dc6..787fc37 100644 --- a/scsh/SPAN/SPAN.scm +++ b/scsh/SPAN/SPAN.scm @@ -26,11 +26,6 @@ ;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -(define SPAN-shell-droptext-1 -"The following questions are intended to help you with the -configuration. The CPAN module needs a directory of its own to cache -important index files and maybe keep a temporary mirror of CPAN files. -This may be a site-wide or a personal directory." (define (SPAN-question~ droptext question answer defaultchoice procedure) (let ((s "")) @@ -52,3 +47,169 @@ This may be a site-wide or a personal directory." (else (SPAN-question~ droptext question answer defaultchoice))) (procedure answer))) +(define SPAN-shell-droptext-1 + "The following questions are intended to help you with the +configuration. The SPAN module needs a directory of its own to cache +important index files and maybe keep a temporary mirror of SPAN files. +This may be a site-wide or a personal directory.") + +(define SPAN-shell-droptext-2 + "Unless you are accessing the CPAN on your filesystem via a file: URL, +CPAN.pm needs to keep the source files it downloads somewhere. Please +supply a directory where the downloaded files are to be kept.") + +(define SPAN-shell-droptext-3 + "") + +(define SPAN-shell-droptext-4 + "Normally CPAN.pm keeps config variables in memory and changes need to +be saved in a separate 'o conf commit' command to make them permanent +between sessions. If you set the 'auto_commit' option to true, changes +to a config variable are always automatically committed to disk.") + +(define SPAN-shell-droptext-5 +"CPAN.pm can limit the size of the disk area for keeping the build +directories with all the intermediate files.") + +(define SPAN-shell-droptext-6 + "The CPAN indexes are usually rebuilt once or twice per hour, but the +typical CPAN mirror mirrors only once or twice per day. Depending on +the quality of your mirror and your desire to be on the bleeding edge, +you may want to set the following value to more or less than one day +(which is the default). It determines after how many days CPAN.pm +downloads new indexes.") + +(define SPAN-shell-droptext-7 + "By default, each time the CPAN module is started, cache scanning is +performed to keep the cache size in sync. To prevent this, answer +'never'.") + +(define SPAN-shell-droptext-8 + "To considerably speed up the initial CPAN shell startup, it is +possible to use Storable to create a cache of metadata. If Storable is +not available, the normal index mechanism will be used. + +Note: this mechanism is not used when use_sqlite is on and SQLLite is +running.") + +(define SPAN-shell-droptext-9 + "The CPAN module can detect when a module which you are trying to build +depends on prerequisites. If this happens, it can build the +prerequisites for you automatically ('follow'), ask you for +confirmation ('ask'), or just ignore them ('ignore'). Please set your +policy to one of the three values.") + +;; (define SPAN-shell-droptext-10 ;;FIXME +;; "Every Makefile.PL is run by perl in a separate process. Likewise we +;; run 'make' and 'make install' in separate processes. If you have +;; any parameters (e.g. PREFIX, UNINST or the like) you want to +;; pass to the calls, please specify them here. + +;; If you don't understand this question, just press ENTER. + +;; Typical frequently used settings: + +;; PREFIX=~/perl # non-root users (please see manual for more hints) + +;; +;; Parameters for the 'perl Makefile.PL' command? [] ") + + +;; (define SPAN-shell-droptext-11 ;;FIXME +;; "Typical frequently used settings: + +;; PREFIX=~/perl # non-root users (please see manual for more hints) + +;; +;; Parameters for the 'perl Makefile.PL' command? [] + +;; Parameters for the 'make' command? Typical frequently used setting: + +;; -j3 # dual processor system (on GNU make) + +;; +;; Your choice: [] ") + + +;; (define SPAN-shell-droptext-12 ;;FIXME +;; "Parameters for the 'make install' command? +;; Typical frequently used setting: + +;; UNINST=1 # to always uninstall potentially conflicting files + +;; +;; Your choice: []" + +;; (define SPAN-shell-droptext-13 ;;FIXME +;; "A Build.PL is run by perl in a separate process. Likewise we run +;; './Build' and './Build install' in separate processes. If you have any +;; parameters you want to pass to the calls, please specify them here. + +;; Typical frequently used settings: + +;; --install_base /home/xxx # different installation directory + +;; +;; Parameters for the 'perl Build.PL' command? [] ") + +;; (define SPAN-shell-droptext-14 ;;FIXME +;; "Parameters for the './Build' command? Setting might be: + +;; --extra_linker_flags -L/usr/foo/lib # non-standard library location + +;; +;; Your choice: [] ") + +;; (define SPAN-shell-droptext-15 ;;FIXME +;; "Do you want to use a different command for './Build install'? Sudo +;; users will probably prefer: + +;; su root -c ./Build +;; or +;; sudo ./Build +;; or +;; /path1/to/sudo -u admin_account ./Build + +;; ") + +;; (define SPAN-shell-droptext-16 ;;FIXME +;; "Parameters for the './Build install' command? Typical frequently used +;; setting: + +;; --uninst 1 # uninstall conflicting files + +;; +;; Your choice: [] ") + +;; (define SPAN-shell-droptext-17 ;;FIXME +;; "If you're accessing the net via proxies, you can specify them in the +;; CPAN configuration or via environment variables. The variable in +;; the $CPAN::Config takes precedence. + +;; +;; Your ftp_proxy? []") + +;; (define SPAN-shell-droptext-18 ;;FIXME +;; " +;; Your http_proxy? []") + +;; (define SPAN-shell-droptext-19 ;;FIXME +;; " +;; Your no_proxy? []") + +(define SPAN-shell-droptext-20 +"CPAN needs access to at least one CPAN mirror. + +As you did not allow me to connect to the internet you need to supply +a valid CPAN URL now. +") + +(define SPAN-shell-droptext-21 + "Enter another URL or RETURN to quit: []") + +(define SPAN-shell-droptext-22 + "Please remember to call 'o conf commit' to make the config permanent! + + +cpan shell -- CPAN exploration and modules installation (v1.9402) +Enter 'h' for help.") \ No newline at end of file diff --git a/scsh/SPAN/load.scm b/scsh/SPAN/load.scm index 6418c31..755fb03 100644 --- a/scsh/SPAN/load.scm +++ b/scsh/SPAN/load.scm @@ -27,12 +27,130 @@ ;;; THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. (load "SPAN.scm") + +;; initialization + +;; question 1 + +(define SPAN-build-and-cache-dir (string-append (getenv "HOME") "/.span")) +(define SPAN-download-target-dir (string-append (getenv "HOME") "/.span")) ;;prototype (define (SPAN-question~ droptext question answer defaultchoice) (SPAN-question~ SPAN-shell-droptext-1 "SPAN build and cache directory" "" - (string-append (getenv "HOME") "/.span") + SPAN-build-and-cache-dir (lambda (answer) (let ((dir (create-directory answer))) - (file-directory? answer) - ))) + (if (file-directory? dir) + (set! SPAN-build-and-cache-dir answer) + #f)))) + +(define SPAN-download-target-dir (string-append SPAN-build-and-cache-dir "/" "sources") +(SPAN-question~ SPAN-shell-droptext-2 + "Download target directory" + "" + SPAN-download-target-dir + (lambda (answer) + (let ((dir (create-directory answer))) + (if (file-directory? answer) + (set! SPAN-download-target-dir answer) + #f)))) + +(define SPAN-build-dir (string-append SPAN-build-and-cache-dir "/" "build") +(SPAN-question~ SPAN-shell-droptext-3 + "Directory where the build process takes place?" + "" + SPAN-download-target-dir + (lambda (answer) + (let ((dir (create-directory answer))) + (if (file-directory? answer) + (set! SPAN-build-dir answer) + #f)))) + +(define SPAN-config "no") +(SPAN-question~ SPAN-shell-droptext-4 + "Always commit changes to config variables to disk?" + "" + SPAN-config + (lambda (answer) + (set! SPAN-config answer) + #f)) + +(define SPAN-build-Mb 100) +(SPAN-question~ SPAN-shell-droptext-5 + "Cache size for build directory (in MB)?" + "" + SPAN-build-Mb + (lambda (answer) + (set! SPAN-build-Mb answer) + #f)) + +(define SPAN-expire 1) +(SPAN-question~ SPAN-shell-droptext-6 + "Let the index expire after how many days?" + "" + SPAN-expire + (lambda (answer) + (set! SPAN-expire answer) + #f)) + +(define SPAN-scan-cache "atstart") +(SPAN-question~ SPAN-shell-droptext-7 + "Perform cache scanning (atstart or never)?" + "" + SPAN-scan-cache + (lambda (answer) + (set! SPAN-scan-cache answer) + #f)) + +(define SPAN-cache-metadata "yes") +(SPAN-question~ SPAN-shell-droptext-8 + "Cache metadata (yes/no)?" + "" + SPAN-cache-metadata + (lambda (answer) + (set! SPAN-cache-metadata answer) + #f)) + +(define SPAN-policy-building "ask") +(SPAN-question~ SPAN-shell-droptext-9 + "Policy on building prerequisites (follow, ask or ignore)? [ask]" + "" + SPAN-policy-building + (lambda (answer) + (set! SPAN-policy-building answer) + #f)) + +;; question 10 is under dev +;; question 11 is under dev +;; question 12 is under dev +;; question 13 is under dev + +;; ... until 20 + +(define SPAN-mirror-url "ask") +(SPAN-question~ SPAN-shell-droptext-20 + "Please enter the URL of your CPAN mirror " + "" + SPAN-mirror-url + (lambda (answer) + (set! SPAN-mirror-url answer) + #f)) + +(define SPAN-mirror-url-2 "") +(SPAN-question~ SPAN-shell-droptext-21 + "Enter another URL or RETURN to quit: [] " + "" + SPAN-mirror-url-2 + (lambda (answer) + (set! SPAN-mirror-url-2 answer) + #f)) + +(display SPAN-shell-droptext-22) +(do ((s (read)(read)) + ((and (symbol? s) + (string<=? (symbol->string s)(string #\return))) + 0) + #t)) + +(display "Signing off - rest is under dev")) \ No newline at end of file