Changeset 9509


Ignore:
Timestamp:
May 16, 2008, 1:16:12 AM (11 years ago)
Author:
mikel
Message:

more figuring out how to implement svn self-update (see comments in ide-self-update.lisp for plan)

Location:
trunk/source/cocoa-ide
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/ide-self-update.lisp

    r9480 r9509  
    1515;;; see the cvs/svn code in update-ccl in compile-ccl.lisp
    1616
    17 ;;; How to self-update the IDE from the svn repo
     17;;; use GUI::FIND-CCL-DIRECTORY to find the effective CCL directory
     18;;; (it gracefully handles the case where we are running from an
     19;;; app bundle, as well as the case where we are not)
     20
     21;;; How to self-update the IDE from the svn or cvs repo
    1822;;; 1. Find the ccl directory that corresponds to the running image
    19 ;;; 2. find the .svn directory
    20 ;;; 3. read the .svn/entries file to determine whether we need to
    21 ;;;    authenticate
    22 ;;; 4. make sure we have auth tokens if we need them
    23 ;;; 5. record the svn version before we start (so we can roll back
    24 ;;;    if things go horribly wrong)
    25 ;;; 6. run svn status to check for potential merge conflicts before starting
    26 ;;;    the update
    27 ;;; 7. construct the svn command:
    28 ;;;    a. cd to the proper CCL directory
    29 ;;;    b. run svn update
    30 ;;; 8. check the outcome of the update:
    31 ;;;    a. if okay, run queue a full-rebuild, and a rebuild of the IDE
    32 ;;;       (need to make some infrastructure for queuing these activities
    33 ;;;        and running them on next launch)
    34 ;;;    b. if not okay, warn the user, and offer to roll back to the
    35 ;;;       previously-recorded version (need to make some infrastructure for
    36 ;;;       running a rollback)
    37 
    38 ;;; LISP-COMMAND-PATHNAME
    39 ;;; ---------------------
    40 ;;; returns the pathname of the running Lisp kernel binary
    41 ;;; (pathname-directory (lisp-command-pathname)) should give the CCL
    42 ;;; directory for that lisp
    43 
    44 (defun lisp-command-pathname ()
    45   (pathname (car ccl::*command-line-argument-list*)))
    46 
    47 (defun effective-ccl-directory ()
    48     (make-pathname :directory (pathname-directory (lisp-command-pathname))))
    49 
    50 ;;; LISP-SUBVERSION-DATA-PATHNAME
    51 ;;; ---------------------
    52 ;;; returns the pathname of the subversion metadata for the running
    53 ;;; Lisp. This function infers where the Subversion data should be; it
    54 ;;; does not check to see whether it's really there
    55 
    56 ;;; TODO: there is a good chance this path will be of a form like this:
    57 ;;; #P"/usr/local/ccl/trunk/darwinx8664/ccl/Clozure CL.app/Contents/MacOS/dx86cl64"
    58 ;;; need a way to be sure we find the proper CCL directory for the app bundle
    59 
    60 (defun lisp-subversion-data-pathname ()
    61   (merge-pathnames ".svn/"
    62                    (make-pathname :directory (pathname-directory (ccl::lisp-command-pathname)))))
     23;;; 2. determine whether this is an svn or cvs checkout
     24;;; 3. SVN:
     25;;;   a. find the .svn directory
     26;;;   b. run svn info to get the svn URL
     27;;;   c. determine from the URL whether we need to authenticate
     28;;;   d. get auth tokens if we need them
     29;;;   d. record the svn revision before we start (so we can roll back
     30;;;      if things go horribly wrong)
     31;;;   e. run svn status to check for potential merge conflicts before starting
     32;;;      the update
     33;;;   f. construct the svn command:
     34;;;       i. cd to the proper CCL directory
     35;;;      ii. run svn update
     36;;;   g. run the svn command with external-process-status.
     37;;;   h.  check the status of the external command for success or failure:
     38;;;      i. if okay, queue a full-rebuild, and a rebuild of the IDE
     39;;;         (need to make some infrastructure for queuing these activities
     40;;;         and running them on next launch, or immediately in an external process)
     41;;;     ii. if not okay, warn the user, and offer to roll back to the
     42;;;         previously-recorded version (need to make some infrastructure for
     43;;;         running a rollback)
     44;;; TODO: make a cvs version if needed
    6345
    6446;;; VALIDATE-SVN-DATA-PATHNAME p
  • trunk/source/cocoa-ide/start.lisp

    r7804 r9509  
    44
    55(if (< #&NSAppKitVersionNumber 824)
    6   (error "This application requires features introduced in OSX 10.4."))
     6    (error "This application requires features introduced in OSX 10.4."))
    77
    88(def-cocoa-default *ccl-directory* :string "" nil #'(lambda (old new)
    9                                                       (when (equal new "") (setq new nil))
    10                                                       (unless (and new (equal old new))
    11                                                         (init-interfaces-root)
    12                                                         (ccl::replace-base-translation "ccl:"
    13                                                                                        (or new (find-ccl-directory))))))
     9                                                      (when (equal new "") (setq new nil))
     10                                                      (unless (and new (equal old new))
     11                                                        (init-interfaces-root)
     12                                                        (ccl::replace-base-translation "ccl:"
     13                                                                                       (or new (find-ccl-directory))))))
    1414
    1515;; If there are interfaces inside the bundle, use those rather than the ones
     
    1818(defun init-interfaces-root ()
    1919  (let* ((subpath (ccl::cdb-subdirectory-path))
    20         (path (pathname-directory (ccl::ccl-directory))))
     20        (path (pathname-directory (ccl::ccl-directory))))
    2121    (when (and *standalone-cocoa-ide*
    22                (equalp (last path 2) '("Contents" "MacOS")))
     22               (equalp (last path 2) '("Contents" "MacOS")))
    2323      (setq path (butlast path))
    2424      (when (or (probe-file (make-pathname :directory (append path subpath)))
    25                 (probe-file (make-pathname :directory (append (setq path `(,@path "Resources")) subpath))))
    26         (setq ccl::*interfaces-root* (make-pathname :directory path))))))
     25                (probe-file (make-pathname :directory (append (setq path `(,@path "Resources")) subpath))))
     26        (setq ccl::*interfaces-root* (make-pathname :directory path))))))
    2727
    2828(defun find-ccl-directory ()
    2929  (let* ((path (ccl::ccl-directory))
    30         (dir (pathname-directory path)))
     30        (dir (pathname-directory path)))
    3131    (if (equalp (last dir 2) '("Contents" "MacOS"))
    32         (make-pathname :directory (butlast dir 3))
    33         path)))
     32        (make-pathname :directory (butlast dir 3))
     33        path)))
    3434
    3535(defmethod ccl::ui-object-do-operation ((o ns:ns-application)
    36                                         operation
    37                                         &rest args)
     36                                        operation
     37                                        &rest args)
    3838  (declare (ignore operation args))
    3939  ;; Do nothing.  Would it be better to warn and/or log this ?
     
    4141
    4242(defmethod ccl::ui-object-do-operation ((o ns:ns-application)
    43                                         (operation (eql :note-current-package))
    44                                         &rest args)
     43                                        (operation (eql :note-current-package))
     44                                        &rest args)
    4545  (ui-object-note-package o (car args)))
    4646
    4747(defmethod ccl::ui-object-do-operation ((o ns:ns-application)
    48                                         (operation (eql :eval-selection))
    49                                         &rest args)
     48                                        (operation (eql :eval-selection))
     49                                        &rest args)
    5050  (ui-object-eval-selection o (car args)))
    5151
    5252(defmethod ccl::ui-object-do-operation ((o ns:ns-application)
    53                                    (operation (eql :enter-backtrace-context))
    54                                    &rest args)
     53                                        (operation (eql :enter-backtrace-context))
     54                                        &rest args)
    5555  (ui-object-enter-backtrace-context o (car args)))
    5656
    5757(defmethod ccl::ui-object-do-operation ((o ns:ns-application)
    58                                    (operation (eql :exit-backtrace-context))
    59                                    &rest args)
     58                                        (operation (eql :exit-backtrace-context))
     59                                        &rest args)
    6060  (ui-object-exit-backtrace-context o (car args)))
    6161
     
    6565
    6666(defclass cocoa-application (application)
    67     ())
     67  ())
    6868
    6969;; Is this defined on application (rather than cocoa-application) for a reason?
     
    9191
    9292
    93   ;;; The saved image will be an instance of COCOA-APPLICATION (mostly
    94   ;;; so that it'll ignore its argument list.)  When it starts up, it'll
    95   ;;; run the Cocoa event loop in the cocoa event process.
    96   ;;; If you use an init file ("home:ccl-init"), it'll be loaded
    97   ;;; in an environment in which *STANDARD-INPUT* always generates EOF
    98   ;;; and where output and error streams are directed to the OSX console
    99   ;;; (see below).  If that causes problems, you may want to suppress
    100   ;;; the loading of your init file (via an :INIT-FILE nil arg to
    101   ;;; the call to SAVE-APPLICATION, below.)
     93;;; The saved image will be an instance of COCOA-APPLICATION (mostly
     94;;; so that it'll ignore its argument list.)  When it starts up, it'll
     95;;; run the Cocoa event loop in the cocoa event process.
     96;;; If you use an init file ("home:ccl-init"), it'll be loaded
     97;;; in an environment in which *STANDARD-INPUT* always generates EOF
     98;;; and where output and error streams are directed to the OSX console
     99;;; (see below).  If that causes problems, you may want to suppress
     100;;; the loading of your init file (via an :INIT-FILE nil arg to
     101;;; the call to SAVE-APPLICATION, below.)
    102102
    103103(defun build-ide (bundle-path)
     
    118118       (ccl::db-objc-classes d)
    119119       (lambda (name)
    120         (let* ((class (ccl::lookup-objc-class name nil)))
    121            (unless (ccl::objc-class-id  class) (push name missing))))))
     120        (let* ((class (ccl::lookup-objc-class name nil)))
     121           (unless (ccl::objc-class-id  class) (push name missing))))))
    122122    (when missing
    123123      (break "ObjC classes ~{~&~a~} are declared but not defined." missing)))
     
    126126
    127127  (let ((image-file (make-pathname :name (ccl::standard-kernel-name) :type nil :version nil
    128                                    :defaults (merge-pathnames ";Contents;MacOS;" bundle-path))))
     128                                   :defaults (merge-pathnames ";Contents;MacOS;" bundle-path))))
    129129    (format *error-output* "~2%Saving application to ~a~2%" (truename bundle-path))
    130130    (force-output *error-output*)
    131131    (ensure-directories-exist image-file)
    132132    (save-application image-file
    133                       :prepend-kernel t
    134                       :application-class 'cocoa-application)))
     133                      :prepend-kernel t
     134                      :application-class 'cocoa-application)))
    135135
    136136;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Note: See TracChangeset for help on using the changeset viewer.