diff --git a/.travis.yml b/.travis.yml index b52bfa4..184a110 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,8 @@ language: c sudo: false env: global: - - PATH=~/.local/bin/:~/.roswell/bin:~/.linuxbrew/bin:$PATH - - ROSWELL_BRANCH=master + - PATH=~/.roswell/bin:~/.linuxbrew/bin:$PATH + - ROSWELL_BRANCH=$TRAVIS_BRANCH - ROSWELL_INSTALL_DIR=$HOME/.roswell matrix: - METHOD=brew @@ -92,7 +92,7 @@ script: - if [ "$METHOD" = "brew" ] || [ "$METHOD" = "ci" ]; then run-prove roswell-test.asd 2>&1 ; fi - if [ "$METHOD" = "ci" ]; then ros -q run && [`ros -q run 2>&1` == ""]; fi - if [ "$METHOD" = "ci" ] && [ "$LISP" = "sbcl-bin" ]; then [`ros -e "(ros:ignore-shebang)" -e '(loop for x in (directory "src/lisp/*.ros") do (load x))' 2>&1` == ""]; fi - - if [ x$TRAVIS_TAG != x ] && [ $METHOD = debian ]; then ros ./scripts/debian.ros; fi + - if [ x$TRAVIS_TAG != x ] && [ $METHOD = debian ]; then ros install prove;ros ./scripts/debian.ros; fi after_success: - if [ "$METHOD" = "documents" ] || [ $METHOD = brew ]; then git config user.email "auto@example.com"; fi diff --git a/debian/rules b/debian/rules index 7482e81..91d88c4 100755 --- a/debian/rules +++ b/debian/rules @@ -12,4 +12,4 @@ override_dh_autoreconf: dh_autoreconf %: - dh "$@" --with=autoreconf + dh $@ --with autoreconf,bash-completion diff --git a/scripts/debian.ros b/scripts/debian.ros index a5e9c92..4ea28c6 100755 --- a/scripts/debian.ros +++ b/scripts/debian.ros @@ -40,8 +40,8 @@ exec ros -Q -L sbcl-bin -- $0 "$@" (when (= status 200) (loop :with seq := (make-array 4096 :element-type '(unsigned-byte 8)) :for read := (read-sequence seq in) - :until (= read 0) - :do (write-sequence seq out :end read))) + :until (= read 0) + :do (write-sequence seq out :end read))) (when in (close in)))) (format t "done ~%")))) @@ -80,6 +80,8 @@ exec ros -Q -L sbcl-bin -- $0 "$@" (directory (merge-pathnames "*.*" output))))))) (uiop/run-program:run-program (format nil "cp -r ~A../ChangeLog ~Adebian/changelog" *pwd* path)) + (uiop/run-program:run-program + (format nil "cp -r ~Acompletions/ros-completion.bash ~Adebian/roswell.bash-completion" *pwd* path)) path)) (defun dpkg-buildpackage (path) diff --git a/scripts/wxs.ros b/scripts/wxs.ros index d3f7d74..17acb83 100755 --- a/scripts/wxs.ros +++ b/scripts/wxs.ros @@ -34,8 +34,8 @@ exec ros -L sbcl-bin -Q -- $0 "$@" (defun xml-1.0 (pathname sexp) (with-open-file (xml pathname :direction :output :if-exists :supersede :external-format :ascii) - (format xml "~%") - (print-xml sexp xml))) + (format xml "~%") + (print-xml sexp xml))) (defun application-name () "Roswell") @@ -55,15 +55,15 @@ exec ros -L sbcl-bin -Q -- $0 "$@" into an acceptable form for WIX (up to four dot-separated numbers)." (with-output-to-string (output) (loop repeat 4 - with position = 0 - for separator = "" then "." - for next-digit = (position-if #'digit-char-p horrible-thing - :start position) - while next-digit - do (multiple-value-bind (number end) - (parse-integer horrible-thing :start next-digit :junk-allowed t) - (format output "~A~D" separator number) - (setf position end))))) + with position = 0 + for separator = "" then "." + for next-digit = (position-if #'digit-char-p horrible-thing + :start position) + while next-digit + do (multiple-value-bind (number end) + (parse-integer horrible-thing :start next-digit :junk-allowed t) + (format output "~A~D" separator number) + (setf position end))))) ;;;; GUID generation ;;;; @@ -142,17 +142,17 @@ exec ros -L sbcl-bin -Q -- $0 "$@" (defun collect-1-component (root type) `("Directory" ("Name" ,(car (last (pathname-directory root))) - "Id" ,(directory-id root)) - ("Component" ("Id" ,(component-id root type) - "Guid" ,(make-guid) - "DiskId" 1 - #+x86-64 "Win64" #+x86-64 "yes") - ,@(loop for file in (directory - (make-pathname :name :wild :type :wild :defaults root)) - when (or (pathname-name file) (pathname-type file)) - collect `("File" ("Name" ,(file-namestring file) - "Id" ,(file-id file) - "Source" ,(enough-namestring file))))))) + "Id" ,(directory-id root)) + ("Component" ("Id" ,(component-id root type) + "Guid" ,(make-guid) + "DiskId" 1 + #+x86-64 "Win64" #+x86-64 "yes") + ,@(loop for file in (directory + (make-pathname :name :wild :type :wild :defaults root)) + when (or (pathname-name file) (pathname-type file)) + collect `("File" ("Name" ,(file-namestring file) + "Id" ,(file-id file) + "Source" ,(enough-namestring file))))))) (defun directory-empty-p (dir) (null (directory (make-pathname :name :wild :type :wild :defaults dir)))) @@ -160,24 +160,24 @@ exec ros -L sbcl-bin -Q -- $0 "$@" (defun collect-components (root type) (append (unless (directory-empty-p root) (list (collect-1-component root type))) (loop for directory in - (directory - (merge-pathnames (make-pathname - :directory '(:relative :wild) - :name nil :type nil) - root)) - unless (member (car (last (pathname-directory directory))) - *ignored-directories* :test #'equal) - append (collect-components directory "Contrib")))) + (directory + (merge-pathnames (make-pathname + :directory '(:relative :wild) + :name nil :type nil) + root)) + unless (member (car (last (pathname-directory directory))) + *ignored-directories* :test #'equal) + append (collect-components directory "Contrib")))) (defun collect-contrib-components () (collect-components "../src/lisp/" "Contrib")) (defun make-extension (type mime) `("Extension" ("Id" ,type "ContentType" ,mime) - ("Verb" ("Id" ,(format nil "load_~A" type) - "Argument" "--core \"[#sbcl.core]\" --load \"%1\"" - "Command" "Load with SBCL" - "Target" "[#sbcl.exe]")))) + ("Verb" ("Id" ,(format nil "load_~A" type) + "Argument" "--core \"[#sbcl.core]\" --load \"%1\"" + "Command" "Load with SBCL" + "Target" "[#sbcl.exe]")))) (defun write-wxs (pathname) ;; both :INVERT and :PRESERVE could be used here, but this seemed @@ -185,129 +185,129 @@ exec ros -L sbcl-bin -Q -- $0 "$@" (xml-1.0 pathname `("Wix" ("xmlns" "http://schemas.microsoft.com/wix/2006/wi") - ("Product" ("Id" "*" - "Name" ,(application-name/version+machine-type) - "Version" ,(version-digits) - "Manufacturer" ,(manufacturer-name) - "UpgradeCode" ,(upgrade-code) - "Language" 1033) - ("Package" ("Id" "*" - "Manufacturer" ,(manufacturer-name) - "InstallerVersion" 200 - "Compressed" "yes" - #+x86-64 "Platform" #+x86-64 "x64" - "InstallScope" "perMachine")) - ("Media" ("Id" 1 - "Cabinet" "roswell.cab" - "EmbedCab" "yes")) - ("Property" ("Id" "PREVIOUSVERSIONSINSTALLED" - "Secure" "yes")) - ("Upgrade" ("Id" ,(upgrade-code)) - ("UpgradeVersion" ("Minimum" "1.0.0" - "Maximum" "99.0.0" - "Property" "PREVIOUSVERSIONSINSTALLED" - "IncludeMinimum" "yes" - "IncludeMaximum" "no"))) - ("InstallExecuteSequence" () - ("RemoveExistingProducts" ("After" "InstallInitialize"))) - ("Directory" ("Id" "TARGETDIR" - "Name" "SourceDir") - ("Directory" ("Id" "ProgramMenuFolder") - ("Directory" ("Id" "ProgramMenuDir" - "Name" ,(application-name/version+machine-type)) - ("Component" ("Id" "ProgramMenuDir" - "Guid" ,(make-guid)) - ("RemoveFolder" ("Id" "ProgramMenuDir" - "On" "uninstall")) - ("RegistryValue" ("Root" "HKCU" - "Key" "Software\\[Manufacturer]\\[ProductName]" - "Type" "string" - "Value" "" - "KeyPath" "yes"))))) - ("Directory" ("Id" #-x86-64 "ProgramFilesFolder" #+x86-64 "ProgramFiles64Folder" - "Name" "PFiles") - ("Directory" ("Id" "BaseFolder" - "Name" ,(application-name)) - ("Directory" ("Id" "VersionFolder" - "Name" ,(ros:version)) - ("Directory" ("Id" "INSTALLDIR") - #+nil("Component" ("Id" "SBCL_SetHOME" - "Guid" ,(make-guid) - "DiskId" 1 - #+x86-64 "Win64" #+x86-64 "yes") - ("CreateFolder") - ("Environment" ("Id" "Env_SBCL_HOME" - "System" "yes" - "Action" "set" - "Name" "SBCL_HOME" - "Part" "all" - "Value" "[INSTALLDIR]"))) + ("Product" ("Id" "*" + "Name" ,(application-name/version+machine-type) + "Version" ,(version-digits) + "Manufacturer" ,(manufacturer-name) + "UpgradeCode" ,(upgrade-code) + "Language" 1033) + ("Package" ("Id" "*" + "Manufacturer" ,(manufacturer-name) + "InstallerVersion" 200 + "Compressed" "yes" + #+x86-64 "Platform" #+x86-64 "x64" + "InstallScope" "perMachine")) + ("Media" ("Id" 1 + "Cabinet" "roswell.cab" + "EmbedCab" "yes")) + ("Property" ("Id" "PREVIOUSVERSIONSINSTALLED" + "Secure" "yes")) + ("Upgrade" ("Id" ,(upgrade-code)) + ("UpgradeVersion" ("Minimum" "1.0.0" + "Maximum" "99.0.0" + "Property" "PREVIOUSVERSIONSINSTALLED" + "IncludeMinimum" "yes" + "IncludeMaximum" "no"))) + ("InstallExecuteSequence" () + ("RemoveExistingProducts" ("After" "InstallInitialize"))) + ("Directory" ("Id" "TARGETDIR" + "Name" "SourceDir") + ("Directory" ("Id" "ProgramMenuFolder") + ("Directory" ("Id" "ProgramMenuDir" + "Name" ,(application-name/version+machine-type)) + ("Component" ("Id" "ProgramMenuDir" + "Guid" ,(make-guid)) + ("RemoveFolder" ("Id" "ProgramMenuDir" + "On" "uninstall")) + ("RegistryValue" ("Root" "HKCU" + "Key" "Software\\[Manufacturer]\\[ProductName]" + "Type" "string" + "Value" "" + "KeyPath" "yes"))))) + ("Directory" ("Id" #-x86-64 "ProgramFilesFolder" #+x86-64 "ProgramFiles64Folder" + "Name" "PFiles") + ("Directory" ("Id" "BaseFolder" + "Name" ,(application-name)) + ("Directory" ("Id" "VersionFolder" + "Name" ,(ros:version)) + ("Directory" ("Id" "INSTALLDIR") + #+nil("Component" ("Id" "SBCL_SetHOME" + "Guid" ,(make-guid) + "DiskId" 1 + #+x86-64 "Win64" #+x86-64 "yes") + ("CreateFolder") + ("Environment" ("Id" "Env_SBCL_HOME" + "System" "yes" + "Action" "set" + "Name" "SBCL_HOME" + "Part" "all" + "Value" "[INSTALLDIR]"))) - ("Component" ("Id" "ROSWELL_SetPATH" - "Guid" ,(make-guid) - "DiskId" 1 - #+x86-64 "Win64" #+x86-64 "yes") - ("CreateFolder") - ("Environment" ("Id" "Env_PATH" - "System" "yes" - "Action" "set" - "Name" "PATH" - "Part" "last" - "Value" "[INSTALLDIR]"))) - ("Component" ("Id" "ROSWELL_Base" - "Guid" ,(make-guid) - "DiskId" 1 - #+x86-64 "Win64" #+x86-64 "yes") - ;; If we want to associate files with Roswell, this - ;; is how it's done -- but doing this by default - ;; and without asking the user for permission Is - ;; Bad. Before this is enabled we need to figure out - ;; how to make WiX ask for permission for this... - ;; ,(make-extension "fasl" "application/x-lisp-fasl") - ;; ,(make-extension "lisp" "text/x-lisp-source") - #+nil("File" ("Name" "sbcl.core" - "Source" "sbcl.core")) - ("File" ("Name" "ros.exe" - "Source" "../src/ros.exe" - "KeyPath" "yes") - ("Shortcut" ("Id" "Roswell.lnk" - "Advertise" "yes" - "Name" ,(application-name/version+machine-type) - "Directory" "ProgramMenuDir" - "Arguments" "run")))) - ,@(collect-contrib-components)))))) - ("Feature" ("Id" "Minimal" - "Title" "Roswell Executable" - "ConfigurableDirectory" "INSTALLDIR" - "Level" 1) - ("ComponentRef" ("Id" "ROSWELL_Base")) - ("ComponentRef" ("Id" "ProgramMenuDir")) - ("Feature" ("Id" "Contrib" "Level" 1 "Title" "Contributed Modules") - ,@(ref-all-components)) - ("Feature" ("Id" "SetPath" "Level" 1 "Title" "Set Environment Variable: PATH") - ("ComponentRef" ("Id" "ROSWELL_SetPATH"))) - ;; SetHome is still enabled by default (level 1), because SBCL - ;; does not yet support running without SBCL_HOME: - #+nil("Feature" ("Id" "SetHome" "Level" 1 "Title" "Set Environment Variable: SBCL_HOME") - ("ComponentRef" ("Id" "SBCL_SetHOME")))) - ("WixVariable" ("Id" "WixUILicenseRtf" - "Value" "License.rtf")) - ("Property" ("Id" "WIXUI_INSTALLDIR" "Value" "INSTALLDIR")) - ("UIRef" ("Id" "WixUI_FeatureTree")))))) + ("Component" ("Id" "ROSWELL_SetPATH" + "Guid" ,(make-guid) + "DiskId" 1 + #+x86-64 "Win64" #+x86-64 "yes") + ("CreateFolder") + ("Environment" ("Id" "Env_PATH" + "System" "yes" + "Action" "set" + "Name" "PATH" + "Part" "last" + "Value" "[INSTALLDIR]"))) + ("Component" ("Id" "ROSWELL_Base" + "Guid" ,(make-guid) + "DiskId" 1 + #+x86-64 "Win64" #+x86-64 "yes") + ;; If we want to associate files with Roswell, this + ;; is how it's done -- but doing this by default + ;; and without asking the user for permission Is + ;; Bad. Before this is enabled we need to figure out + ;; how to make WiX ask for permission for this... + ;; ,(make-extension "fasl" "application/x-lisp-fasl") + ;; ,(make-extension "lisp" "text/x-lisp-source") + #+nil("File" ("Name" "sbcl.core" + "Source" "sbcl.core")) + ("File" ("Name" "ros.exe" + "Source" "../src/ros.exe" + "KeyPath" "yes") + ("Shortcut" ("Id" "Roswell.lnk" + "Advertise" "yes" + "Name" ,(application-name/version+machine-type) + "Directory" "ProgramMenuDir" + "Arguments" "run")))) + ,@(collect-contrib-components)))))) + ("Feature" ("Id" "Minimal" + "Title" "Roswell Executable" + "ConfigurableDirectory" "INSTALLDIR" + "Level" 1) + ("ComponentRef" ("Id" "ROSWELL_Base")) + ("ComponentRef" ("Id" "ProgramMenuDir")) + ("Feature" ("Id" "Contrib" "Level" 1 "Title" "Contributed Modules") + ,@(ref-all-components)) + ("Feature" ("Id" "SetPath" "Level" 1 "Title" "Set Environment Variable: PATH") + ("ComponentRef" ("Id" "ROSWELL_SetPATH"))) + ;; SetHome is still enabled by default (level 1), because SBCL + ;; does not yet support running without SBCL_HOME: + #+nil("Feature" ("Id" "SetHome" "Level" 1 "Title" "Set Environment Variable: SBCL_HOME") + ("ComponentRef" ("Id" "SBCL_SetHOME")))) + ("WixVariable" ("Id" "WixUILicenseRtf" + "Value" "License.rtf")) + ("Property" ("Id" "WIXUI_INSTALLDIR" "Value" "INSTALLDIR")) + ("UIRef" ("Id" "WixUI_FeatureTree")))))) (defun read-text (pathname) (let ((pars (list nil))) (with-open-file (f pathname :external-format :ascii) (loop for line = (read-line f nil) - for text = (string-trim '(#\Space #\Tab) line) - while line - when (plusp (length text)) - do (setf (car pars) - (if (car pars) - (concatenate 'string (car pars) " " text) - text)) - else - do (push nil pars))) + for text = (string-trim '(#\Space #\Tab) line) + while line + when (plusp (length text)) + do (setf (car pars) + (if (car pars) + (concatenate 'string (car pars) " " text) + text)) + else + do (push nil pars))) (nreverse pars))) (defun write-rtf (pars pathname) @@ -323,10 +323,10 @@ exec ros -L sbcl-bin -Q -- $0 "$@" {\\fonttbl\\f0\\fswiss Helvetica;}~ \\fs20~ ~{~A\\par\\par ~}}" ; each par used to end with - ; ~%, but resulting Rtf looks - ; strange (WinXP, WiX 3.0.x, - ; ?) - pars))) + ; ~%, but resulting Rtf looks + ; strange (WinXP, WiX 3.0.x, + ; ?) + pars))) (defun main (&rest argv) (declare (ignorable argv)) diff --git a/src/archive.c b/src/archive.c index 93059e1..98a8334 100644 --- a/src/archive.c +++ b/src/archive.c @@ -1,27 +1,9 @@ /* -*- tab-width : 2 -*- */ #include "opt.h" -int extract(const char *filename, int do_extract, int flags,const char* outputpath) { - char* str=NULL; - int len=strlen(filename),ret=-1; - char* type="gzip"; /*for gz*/ - if(len>4) { - int i,c; - for(c=0,i=len;filename[i]!='.' && c<5;--i,++c) { - if(filename[i]=='b'||filename[i]=='B') { - type="bzip2"; - break; - }else if(filename[i]=='x'||filename[i]=='X'){ - type="xz"; - break; - }else if(filename[i]=='7') { - type="7za"; - break; - } - } - } - cond_printf(1,"extracttype=%s\n",type); -#ifndef HAVE_WINDOWS_H +char* extract_command_str(int flags,const char *filename,int do_extract,const char* outputpath,char* type) { + char* str; + #ifndef HAVE_WINDOWS_H if(strcmp(type,"gzip")==0 || strcmp(type,"bzip2")==0 || strcmp(type,"xz")==0) { str=cat(type," -dc ",filename," | tar -",do_extract?"x":"t", flags?"p":"","f - -C ",outputpath,NULL); @@ -48,6 +30,30 @@ int extract(const char *filename, int do_extract, int flags,const char* outputpa } s(outputpath2),s(filename2),s(_homedir),s(_uname),s(_uname_m); #endif + return str; +} + +int extract(const char *filename, int do_extract, int flags,const char* outputpath) { + char* str=NULL; + int len=strlen(filename),ret=-1; + char* type="gzip"; /*for gz*/ + if(len>4) { + int i,c; + for(c=0,i=len;filename[i]!='.' && c<5;--i,++c) { + if(filename[i]=='b'||filename[i]=='B') { + type="bzip2"; + break; + }else if(filename[i]=='x'||filename[i]=='X'){ + type="xz"; + break; + }else if(filename[i]=='7') { + type="7za"; + break; + } + } + } + cond_printf(1,"extracttype=%s\n",type); + str=extract_command_str(flags,filename,do_extract,outputpath,type); cond_printf(1,"extractcmd=%s\n",str); if(str) { ret=System(str); diff --git a/src/util.h b/src/util.h index dc6809e..008cc95 100644 --- a/src/util.h +++ b/src/util.h @@ -20,12 +20,16 @@ #include #include #include +#define SLASH "/" +#define EXE_EXTENTION "" #else #include #include #include #include typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); +#define SLASH "\\" +#define EXE_EXTENTION ".exe" #endif #ifdef HAVE_CURL_CURL_H #include @@ -45,18 +49,6 @@ struct Cons { LVal next; }; -#ifdef HAVE_WINDOWS_H -#define SLASH "\\" -#else -#define SLASH "/" -#endif - -#ifdef HAVE_WINDOWS_H -#define EXE_EXTENTION ".exe" -#else -#define EXE_EXTENTION "" -#endif - #ifdef __APPLE__ #ifndef st_mtime #define st_mtime st_mtimespec.tv_sec