changeset 235:85a06df23a9a r20-5b16

Import from CVS: tag r20-5b16
author cvs
date Mon, 13 Aug 2007 10:14:40 +0200
parents 946e7f6ce379
children 78d3ccccee6d
files CHANGES-beta ChangeLog lisp/ChangeLog lisp/build-report.el lisp/cus-face.el lisp/loadhist.el lisp/loadup.el lisp/make-docfile.el lisp/package-get.el lisp/package-info.el lisp/packages.el lisp/replace.el lisp/simple.el lisp/startup.el lisp/update-elc.el src/ChangeLog src/emacs.c src/fileio.c src/frame.h src/m/sparc.h version.sh
diffstat 21 files changed, 737 insertions(+), 47 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES-beta	Mon Aug 13 10:14:17 2007 +0200
+++ b/CHANGES-beta	Mon Aug 13 10:14:40 2007 +0200
@@ -1,5 +1,11 @@
 							-*- indented-text -*-
+to 20.5 beta16 "Canindé"
+-- Package interface updates
+-- Reload updated and new auto-autoloads files at startup
+-- Miscellaneous bug fixes
+
 to 20.5 beta15 "British Alpine"
+-- MS Windows menu fixes courtesy of Kirill Katsnelson
 -- autoloads are now loaded into impure storage and can be deleted at runtime
 -- loadhist.el is now dumped with XEmacs
 -- XEmacs running in place as a login shell now works
--- a/ChangeLog	Mon Aug 13 10:14:17 2007 +0200
+++ b/ChangeLog	Mon Aug 13 10:14:40 2007 +0200
@@ -1,3 +1,7 @@
+1997-01-03  SL Baur  <steve@altair.xemacs.org>
+
+	* XEmacs 20.5-beta16 is released.
+
 1997-12-30  SL Baur  <steve@altair.xemacs.org>
 
 	* XEmacs 20.5-beta15 is released.
--- a/lisp/ChangeLog	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/ChangeLog	Mon Aug 13 10:14:40 2007 +0200
@@ -1,3 +1,53 @@
+1998-01-02  Colin Rafferty  <colin@xemacs.org>
+
+	* build-report.el (build-report-delete-regexp): Added a rule for
+	the main tarball shadowing anything past it.
+
+1998-01-02  SL Baur  <steve@altair.xemacs.org>
+
+	* packages.el (package-provide): Delete a previous provide.
+
+	* package-info.el: New file.
+
+	* package-get.el: New file.
+	From Pete Ware <ware@cis.ohio-state.edu>
+	(package-get): Fix md5 computation to work with Mule.
+
+1997-12-11  Jens-Ulrik Holger Petersen  <petersen@kurims.kyoto-u.ac.jp>
+
+	* simple.el (log-message-*): Quote symbols in docstrings properly.
+
+1998-01-01  SL Baur  <steve@altair.xemacs.org>
+
+	* packages.el (packages-new-autoloads): Ignore symbolic links.
+
+	* cus-face.el (face-custom-attributes-get): Fix typo.
+	From Jens-Ulrik Holger Petersen <petersen@kurims.kyoto-u.ac.jp>
+
+1997-12-31  SL Baur  <steve@altair.xemacs.org>
+
+	* startup.el (load-init-file): Reload new or changed autoloads
+	unless inhibited.  Reload modified dumped lisp (stubbed).
+
+	* packages.el (packages-new-autoloads): New function.
+	(packages-reload-autoloads): New function.
+	(packages-reload-dumped-lisp): New (stub) function.
+
+	* loadup.el: Inhibit reloading dumped files when running temacs.
+
+	* loadhist.el (file-provides): Extend to handle variant
+	extensions.
+
+	* replace.el (query-replace): Fix typo.
+
+1997-12-30  SL Baur  <steve@altair.xemacs.org>
+
+	* make-docfile.el: list-autoloads-path has been renamed.
+	* update-elc.el: list-autoloads has been renamed.
+
+	* packages.el (packages-list-autoloads): Renamed.
+	(packages-list-autoloads-path): Ditto.
+
 1997-12-29  Colin Rafferty  <colin@xemacs.org>
 
 	* packages.el (packages-find-packages-1): Made it signal a warning 
--- a/lisp/build-report.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/build-report.el	Mon Aug 13 10:14:40 2007 +0200
@@ -83,7 +83,8 @@
 
 (defcustom build-report-delete-regexp
   (list
-   "confl.*with.*auto-inlining")
+   "confl.*with.*auto-inlining"
+   (concat (regexp-quote (gethash 'blddir (config-value-hash-table))) "/lisp/[^ \t\n]+ hides "))
   "Regexp of make process output lines to delete from the report."
   :type '(repeat regexp)
   :group 'build-report)
--- a/lisp/cus-face.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/cus-face.el	Mon Aug 13 10:14:40 2007 +0200
@@ -137,7 +137,7 @@
 	    atts (cdr atts)
 	    get (nth 3 att))
       (condition-case nil
-	  ;; This may fail if w3 doesn't exists.
+	  ;; This may fail if w3 doesn't exist.
 	  (when get
 	    (let ((answer (funcall get face frame)))
 	      (unless (equal answer (funcall get 'default frame))
--- a/lisp/loadhist.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/loadhist.el	Mon Aug 13 10:14:40 2007 +0200
@@ -65,7 +65,11 @@
 
 (defun file-provides (file)
   "Return the list of features provided by FILE."
-  (let ((symbols (cdr (assoc file load-history))) (provides nil))
+  (let ((symbols (or (cdr (assoc file load-history))
+		     (cdr (assoc (file-name-sans-extension file) load-history))
+		     (cdr (assoc (concat file ".el") load-history))
+		     (cdr (assoc (concat file ".elc") load-history))))
+	(provides nil))
     (mapcar
      (function (lambda (x)
 		 (if (and (consp x) (eq (car x) 'provide))
--- a/lisp/loadup.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/loadup.el	Mon Aug 13 10:14:40 2007 +0200
@@ -185,6 +185,8 @@
   (message "\nBootstrapping from temacs...")
   (setq purify-flag nil)
   (setq inhibit-package-init t)
+  (setq inhibit-update-dumped-lisp t)
+  (setq inhibit-update-autoloads t)
   ;; Remove all args up to and including "run-temacs"
   (apply #'run-emacs-from-temacs (cdr (member "run-temacs" command-line-args)))
   ;; run-emacs-from-temacs doesn't actually return anyway.
--- a/lisp/make-docfile.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/make-docfile.el	Mon Aug 13 10:14:40 2007 +0200
@@ -1,6 +1,5 @@
 ;;; make-docfile.el --- Cache docstrings in external file
 
-
 ;; Copyright (C) 1985, 1986, 1992-1995, 1997 Free Software Foundation, Inc.
 
 ;; Author: Unknown
@@ -126,7 +125,7 @@
 		(setq processed (cons arg processed)))))
 	(setq site-load-packages (cdr site-load-packages)))))
 
-(let ((autoloads (list-autoloads-path)))
+(let ((autoloads (packages-list-autoloads-path)))
   ;; (print (concat "Autoloads: " (prin1-to-string autoloads)))
   (while autoloads
     (let ((arg (car autoloads)))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/package-get.el	Mon Aug 13 10:14:40 2007 +0200
@@ -0,0 +1,385 @@
+;;; package-get.el --- Retrieve XEmacs package
+
+;; Copyright (C) 1998 by Pete Ware
+
+;; Author: Pete Ware <ware@cis.ohio-state.edu>
+;; Keywords: internal
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: Not in FSF
+
+;;; Commentary:
+
+;; package-get -
+;;	Retrieve a package and any other required packages from an archive
+;;
+;; The idea:
+;;	A new XEmacs lisp-only release is generated with the following steps:
+;;	1. The maintainer runs some yet to be written program that
+;;	   generates all the dependency information.  This should
+;;	   determine all the require and provide statements and associate
+;;	   them with a package.
+;;	2. All the packages are then bundled into their own tar balls
+;;	   (or whatever format)
+;;	3. Maintainer automatically generates a new `package-get-base'
+;;	   data structure which contains information such as the
+;;	   package name, the file to be retrieved, an md5 checksum,
+;;	   etc (see `package-get-base').
+;;	4. The maintainer posts an announcement with the new version
+;;	   of `package-get-base'.
+;;	5. A user/system manager saves this posting and runs
+;;	   `package-get-update' which uses the previously saved list
+;;	   of packages, `package-get-here' that the user/site
+;;	   wants to determine what new versions to download and
+;;	   install.
+;;
+;;	A user/site manager can generate a new `package-get-here' structure
+;;	by using `package-get-setup' which generates a customize like
+;;	interface to the list of packages.  The buffer looks something
+;;	like:
+;;
+;;	gnus	- a mail and news reader
+;;	[]	Always install
+;;	[]	Needs updating
+;;	[]	Required by other [packages]
+;;	version: 2.0
+;;
+;;	vm	- a mail reader
+;;	[]	Always install
+;;	[]	Needs updating
+;;	[]	Required by other [packages]	
+;;
+;;	Where `[]' indicates a toggle box
+;;
+;;	- Clicking on "Always install" puts this into
+;;	  `package-get-here' list.  "Needs updating" indicates a new
+;;	  version is available.  Anything already in
+;;	  `package-get-here' has this enabled.
+;;	- "Required by other" means some other packages are going to force
+;;	  this to be installed.  Clicking on  [packages] gives a list
+;;	  of packages that require this.
+;;	
+;;	The `package-get-base' should be installed in a file in
+;;	`data-directory'.  The `package-get-here' should be installed in
+;;	site-lisp.  Both are then read at run time.
+;;
+;; TODO:
+;;	- Implement `package-get-setup'
+;;	- Actually put `package-get-base' and `package-get-here' into
+;;	  files that are read.
+;;	- Allow users to have their own packages that they want installed
+;;	  in ~/.xemacs/.
+;;	- SOMEONE needs to write the programs that generate the
+;;	  provides/requires database and makes it into a lisp data
+;;	  structure suitable for `package-get-base'
+;;	- Handle errors such as no package providing a required symbol.
+;;	- Tie this into the `require' function to download packages
+;;	  transparently.
+
+;;; Change Log
+
+;;; Code:
+
+(provide 'package-get)
+(require 'package-admin)
+
+(defvar package-get-base nil
+  "List of packages that are installed at this site.
+For each element in the alist,  car is the package name and the cdr is
+a plist containing information about the package.   Typical fields
+kept in the plist are:
+
+version		- version of this package
+provides	- list of symbols provided
+requires	- list of symbols that are required.
+		  These in turn are provided by other packages.
+filename	- name of the file.
+size		- size of the file (aka the bundled package)
+md5sum		- computed md5 checksum
+description	- What this package is for.
+type		- Whether this is a 'binary (default) or 'single file package
+
+More fields may be added as needed.  An example:
+
+'(
+ (name
+  (version \"<version 2>\"
+   file \"filename\"
+   description \"what this package is about.\"
+   provides (<list>)
+   requires (<list>)
+   size <integer-bytes>
+   md5sum \"<checksum\"
+   type single
+   )
+  (version \"<version 1>\"
+   file \"filename\"
+   description \"what this package is about.\"
+   provides (<list>)
+   requires (<list>)
+   size <integer-bytes>
+   md5sum \"<checksum\"
+   type single
+   )
+   ...
+   ))
+
+For version information, it is assumed things are listed in most
+recent to least recent -- in other words, the version names don't have to
+be lexically ordered.  It is debatable if it makes sense to have more than
+one version of a package available.")
+
+(defvar package-get-dir "/tmp"
+  "*Where to store temporary files for staging.")
+
+(defvar package-get-remote
+  '(
+    ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-20.5/packages/binary-packages")
+    ("ftp.xemacs.org" "/pub/xemacs/beta/xemacs-20.5/packages/single-file-packages")
+    ("ftp.xemacs.org" "/pub/xemacs/package"))
+  "*List of remote sites to contact for downloading packages.
+List format is '(site-name directory-on-site).  Each site is tried in
+order until the package is found.")
+
+(defvar package-get-remove-copy nil
+  "*After copying and installing a package, if this is T, then remove the
+copy.  Otherwise, keep it around.")
+
+(defun package-get-all (package version &optional fetched-packages)
+  "Fetch PACKAGE with VERSION and all other required packages.
+Uses `package-get-base' to determine just what is required and what
+package provides that functionality.  If VERSION is nil, retrieves
+latest version.  Optional argument FETCHED-PACKAGES is used to keep
+track of packages already fetched."
+  (interactive "sPackage: sVersion: ")
+  (let* ((this-package (package-get-info-version
+			(package-get-info-find-package package-get-base
+						       package) version))
+	 (this-requires (package-get-info-prop this-package 'requires))
+	 )
+    (unless (package-get-installedp package version)
+      (package-get package version))
+    (setq fetched-packages
+	  (append (package-get-info-prop this-package 'provides)
+		  fetched-packages))
+    ;; grab everything that this package requires plus recursively
+    ;; grab everything that the requires require.  Keep track
+    ;; in `fetched-packages' the list of things provided -- this
+    ;; keeps us from going into a loop
+    (while this-requires
+      (if (not (member (car this-requires) fetched-packages))
+	  (let* ((reqd-package (package-get-package-provider
+				(car this-requires)))
+		 (reqd-version (cadr reqd-package))
+		 (reqd-name (car reqd-package)))
+	    (setq fetched-packages
+		  (package-get-all reqd-name reqd-version fetched-packages)))
+	)
+      (setq this-requires (cdr this-requires)))
+      fetched-packages
+      ))
+
+(defun package-get (package &optional version conflict)
+  "Fetch PACKAGE from remote site.
+Optional arguments VERSION indicates which version to retrieve, nil
+means most recent version.  CONFLICT indicates what happens if the
+package is already installed.  Valid values for CONFLICT are:
+'always	always retrieve the package even if it is already installed
+'never	do not retrieve the package if it is installed.
+
+The value of `package-get-base' is used to determine what files should 
+be retrieved.  The value of `package-get-remote' is used to determine
+where a package should be retrieved from.  The sites are tried in
+order so one is better off listing easily reached sites first.
+
+Once the package is retrieved, its md5 checksum is computed.  If that
+sum does not match that stored in `package-get-base' for this version
+of the package, an error is signalled."
+  (interactive "xPackage List: ")
+  (let* ((this-package
+	  (package-get-info-version
+	   (package-get-info-find-package package-get-base
+					  package) version))
+	 (found nil)
+	 (search-dirs package-get-remote)
+	 (filename (package-get-info-prop this-package 'filename)))
+    (if (null this-package)
+	(error "Couldn't find package %s with version %s"
+	       package version))
+    (if (null filename)
+	(error "No filename associated with package %s, version %s"
+	       package version))
+    
+    (unless (and (eq conflict 'never)
+		 (package-get-installedp package version))
+      ;; Find the package from search list in package-get-remote
+      ;; and copy it into the staging directory.  Then validate
+      ;; the checksum.  Finally, install the package.
+      (while (and search-dirs
+		  (not (file-exists-p (package-get-staging-dir filename))))
+	(if (file-exists-p (package-get-remote-filename
+			    (car search-dirs) filename))
+	      (copy-file (package-get-remote-filename (car search-dirs) filename)
+			 (package-get-staging-dir filename))
+	  (setq search-dirs (cdr search-dirs))
+	  ))
+      (if (not (file-exists-p (package-get-staging-dir filename)))
+	  (error "Unable to find file %s" filename))
+      ;;
+      ;; Validate the md5 checksum
+      ;; Unfortunately we cannot do this in XEmacs due to Mule lossage.
+      ;;
+      (with-temp-buffer
+	(call-process "md5sum" (package-get-staging-dir filename) t)
+	(goto-char (point-min))
+	(looking-at "[a-z0-9]+")
+	(if (not (string= (buffer-substring (match-beginning 0) (match-end 0))
+			  (package-get-info-prop this-package 'md5sum)))
+	    (error "Package %s does not match md5 checksum" filename)))
+      (message "Retrieved package %s" filename) (sit-for 1)
+      (let ((status
+	     (if (eq (package-get-info-prop this-package 'type) 'single)
+		 (package-admin-add-single-file-package
+		  (package-get-staging-dir filename))
+	       (package-admin-add-binary-package
+		(package-get-staging-dir filename)))))
+	(when (not (= status 0))
+	  (message "Package failed.")
+	  (select-buffer package-admin-temp-buffer)))
+      (sit-for 2)
+      (message "Added package") (sit-for 1)
+      (setq found t))
+    (if (and found package-get-remove-copy)
+	(delete-file (package-get-staging-dir filename)))
+    ))
+
+(defun package-get-info-find-package (which name)
+  "Look in WHICH for the packaged called NAME and return all the info
+  associated with it.  See `package-get-base' for info on the format
+  returned.
+
+ To access fields returned from this, use
+`package-get-info-version' to return information about particular a
+version.  Use `package-get-info-find-prop' to find particular property 
+from a version returned by `package-get-info-version'."
+  (interactive "xPackage list: sPackage Name: ")
+  (if which
+      (if (eq (caar which) name)
+	  (cdar which)
+	(if (cdr which)
+	    (package-get-info-find-package (cdr which) name)))))
+
+(defun package-get-info-version (package version)
+  "In PACKAGE, return the plist associated with a particular VERSION of the
+  package.  PACKAGE is typically as returned by
+  `package-get-info-find-package'.  If VERSION is nil, then return the 
+  first (aka most recent) version.  Use `package-get-info-find-prop'
+  to retrieve a particular property from the value returned by this."
+  (interactive "xPackage Info: \nsVersion: ")
+  (while (and version package (not (string= (plist-get (car package) 'version) version)))
+    (setq package (cdr package)))
+  (if package (car package)))
+
+(defun package-get-info-prop (package-version property)
+  "In PACKAGE-VERSION, return the value associated with PROPERTY.
+PACKAGE-VERSION is typically returned by `package-get-info-version'
+and PROPERTY is typically (although not limited to) one of the
+following:
+
+version		- version of this package
+provides		- list of symbols provided
+requires		- list of symbols that are required.
+		  These in turn are provided by other packages.
+size		- size of the bundled package
+md5sum		- computed md5 checksum"
+  (interactive "xPackage Version: \nSProperty")
+  (plist-get package-version property))
+
+(defun package-get-info-version-prop (package-list package version property)
+  "In PACKAGE-LIST, search for PACKAGE with this VERSION and return
+  PROPERTY value."
+  (package-get-info-prop
+   (package-get-info-version
+    (package-get-info-find-package package-list package) version) property))
+
+(defun package-get-set-version-prop (package-list package version
+						  property value)
+  "A utility to make it easier to add a VALUE for a specific PROPERTY
+  in this VERSION of a specific PACKAGE kept in the PACKAGE-LIST.
+Returns the modified PACKAGE-LIST.  Any missing fields are created."
+  )
+
+(defun package-get-staging-dir (filename)
+  "Return a good place to stash FILENAME when it is retrieved.
+Use `package-get-dir' for directory to store stuff.
+Creates `package-get-dir'  it it doesn't exist."
+  (interactive "FPackage filename: ")
+  (if (not (file-exists-p package-get-dir))
+      (make-directory package-get-dir))
+  (concat 
+   (file-name-as-directory package-get-dir)
+   (file-name-nondirectory (or (nth 2 (efs-ftp-path filename)) filename))))
+       
+
+(defun package-get-remote-filename (search filename)
+  "Return FILENAME as a remote filename.
+It first checks if FILENAME already is a remote filename.  If it is
+not, then it uses the (car search) as the remote site-name and the (cadr
+search) as the remote-directory and concatenates filename.  In other
+words
+	site-name:remote-directory/filename
+"
+  (if (efs-ftp-path filename)
+      filename
+    (concat "/"
+	    (car search) ":"
+	    (file-name-as-directory (cadr search))
+	    filename)))
+
+
+(defun package-get-installedp (package version)
+  "Determine if PACKAGE with VERSION has already been installed.
+I'm not sure if I want to do this by searching directories or checking 
+some built in variables.  For now, use `locate-library'."
+  ;; Use pacakges-package-list which contains name and version
+  (if (not (floatp version))
+      (setq version (string-to-number version)))
+  (member (cons package version) packages-package-list))
+
+(defun package-get-package-provider (sym)
+  "Search for a package that provides SYM and return the name and
+  version.  Searches in `package-get-base' for SYM.   If SYM is a
+  consp, then it must match a corresponding (provide (SYM VERSION)) from 
+  the package."
+  (interactive "SSymbol: ")
+  (let ((packages package-get-base)
+	(done nil)
+	(found nil))
+    (while (and (not done) packages)
+      (let ((this-package (cdr (car packages)))) ;strip off package name
+	(while (and (not done) this-package)
+	  (if (member sym (package-get-info-prop (car this-package) 'provides))
+	      (progn (setq done t)
+		     (setq found (list (caar packages)
+				       (package-get-info-prop (car this-package) 'version))))
+	    (setq this-package (cdr this-package)))))
+      (setq packages (cdr packages)))
+    found))
+
+;;; package-get.el ends here
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/lisp/package-info.el	Mon Aug 13 10:14:40 2007 +0200
@@ -0,0 +1,89 @@
+;;; package-info.el --- Generate information about an XEmacs package
+
+;; Copyright (C) 1998 by Free Software Foundation, Inc.
+
+;; Author: SL Baur <steve@altair.xemacs.org>
+;; Keywords: internal
+
+;; This file is part of XEmacs.
+
+;; XEmacs is free software; you can redistribute it and/or modify it
+;; under the terms of the GNU General Public License as published by
+;; the Free Software Foundation; either version 2, or (at your option)
+;; any later version.
+
+;; XEmacs is distributed in the hope that it will be useful, but
+;; WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;; General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with XEmacs; see the file COPYING.  If not, write to the Free
+;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+;; 02111-1307, USA.
+
+;;; Synched up with: Not in FSF
+
+;;; Commentary:
+
+;; This file is used for building package distributions.
+
+;;; Change Log:
+
+;;; Code:
+
+(defvar package-info "package-info"
+  "File used to write out Package info")
+
+(defvar package-info-template "package-info.in"
+  "Template file for package-get info.")
+
+;; Loses with Mule
+;(defun pi-md5sum (file)
+;  (let (result)
+;    (with-temp-buffer
+;      (let ((buffer-file-coding-system-for-read 'binary))
+;	(insert-file-contents-literally file))
+;      ;; (write-file "/tmp/x.x")
+;      (setq result (md5 (current-buffer))))
+;    result))
+
+(defun pi-md5sum (file)
+  (with-temp-buffer
+    (call-process "md5sum" file t)
+    (goto-char (point-min))
+    (looking-at "[a-z0-9]+")
+    (buffer-substring (match-beginning 0) (match-end 0))))
+
+(defun pi-update-key (key value)
+  (save-excursion
+    (goto-char (point-min))
+    (let ((case-fold-search nil))
+      (when (search-forward key)
+	(replace-match value t)))))
+
+(defun batch-update-package-info ()
+  "Generate a package-info file for use by package-get.el.
+Parameters are:
+version -- Package version number
+filename -- Filename of tarball to generate info for."
+  (unless noninteractive
+    (error "`batch-update-package-info' is to be used only with -batch"))
+  (let ((version (nth 0 command-line-args-left))
+	(filename (nth 1 command-line-args-left)))
+    (find-file package-info)
+    (erase-buffer)
+    (insert-file-contents-literally package-info-template)
+    (goto-char (point-min))
+    (pi-update-key "VERSION" version)
+    (pi-update-key "MD5SUM" (format "\"%s\""
+				    (pi-md5sum filename)))
+    (pi-update-key "FILENAME" (format "\"%s\""
+				      (file-name-nondirectory filename)))
+    (pi-update-key "SIZE" (format "%d"
+				  (nth 7 (file-attributes filename))))
+    (save-buffers-kill-emacs 0)))
+
+(provide 'package-info)
+
+;;; package-info.el ends here
--- a/lisp/packages.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/packages.el	Mon Aug 13 10:14:40 2007 +0200
@@ -3,6 +3,7 @@
 ;; Copyright (C) 1997 Free Software Foundation, Inc.
 
 ;; Author: Steven L Baur <steve@altair.xemacs.org>
+;; Maintainer: Steven L Baur <steve@altair.xemacs.org>
 ;; Keywords: internal, lisp, dumped
 
 ;; This file is part of XEmacs.
@@ -55,10 +56,27 @@
 (defvar packages-package-list nil
   "database of loaded packages and version numbers")
 
-(defun package-provide (name version)
-  (if (not (assq name packages-package-list))
-      (setq packages-package-list
-	    (cons (cons name version) packages-package-list))))
+(defun package-get-key-1 (info key)
+  "Locate keyword `key' in list."
+  (cond ((null info)
+	 nil)
+	((eq (car info) key)
+	 (nth 1 info))
+	(t (package-get-key-1 (cddr info) key))))
+
+(defun package-get-key (name key)
+  "Get info `key' from package `name'."
+  (let ((info (assq name packages-package-list)))
+    (when info
+      (package-get-key-1 (cdr info) key))))
+
+(defun package-provide (name &rest attributes)
+  (let ((info (if (and attributes (floatp (car attributes)))
+		  (list :version (car attributes))
+		attributes)))
+    (remassq name packages-package-list)
+    (setq packages-package-list
+	  (cons (cons name info) packages-package-list))))
 
 (defun package-require (name version)
   (let ((pkg (assq name packages-package-list)))
@@ -140,7 +158,7 @@
       (concat str ".elc")
     str))
 
-(defun list-autoloads-path ()
+(defun packages-list-autoloads-path ()
   "List autoloads from precomputed load-path."
   (let ((path load-path)
 	autoloads)
@@ -153,7 +171,7 @@
       (setq path (cdr path)))
     autoloads))
 
-(defun list-autoloads ()
+(defun packages-list-autoloads ()
   "List autoload files in (what will be) the normal lisp search path.
 This function is used during build to find where the global symbol files so
 they can be perused for their useful information."
@@ -161,7 +179,8 @@
   ;; (print (prin1-to-string load-path))
   (if (null source-directory)
       (setq source-directory (concat (car load-path) "./")))
-  (let ((files (directory-files (file-name-as-directory source-directory) t ".*"))
+  (let ((files (directory-files (file-name-as-directory source-directory)
+				t ".*"))
 	file autolist)
     ;; (print (prin1-to-string source-directory))
     ;; (print (prin1-to-string files))
@@ -173,6 +192,59 @@
       (setq files (cdr files)))
     autolist))
 
+;; The following function cannot be called from a bare temacs
+(defun packages-new-autoloads ()
+  "Return autoloads files that have been added or modified since XEmacs dump."
+  (require 'loadhist)
+  (let ((me (concat invocation-directory invocation-name))
+	(path load-path)
+	result dir)
+    (while path
+      (setq dir (file-truename (car path)))
+      (let ((autoload-file (file-name-sans-extension (concat
+						      dir
+						      autoload-file-name))))
+	;; Check for:
+	;; 1.  An auto-autoload file that hasn't provided a feature (because
+	;;     it has been installed since XEmacs was dumped).
+	;; 2.  auto-autoload.el being newer than the executable
+	;; 3.  auto-autoload.elc being newer than the executable (the .el
+	;;     could be missing or compressed)
+	(when (or (and (null (file-provides autoload-file))
+		       (or (file-exists-p (concat autoload-file ".elc"))
+			   (file-exists-p (concat autoload-file ".el"))))
+		  (and (file-newer-than-file-p (concat autoload-file ".el") me)
+		       (setq autoload-file (concat autoload-file ".el")))
+		  (and (file-newer-than-file-p (concat autoload-file
+						       ".elc")
+					       me)
+		       (setq autoload-file (concat autoload-file ".elc"))))
+	  (push autoload-file result)))
+      (setq path (cdr path)))
+    result))
+
+;; The following function cannot be called from a bare temacs
+(defun packages-reload-autoloads ()
+  "Reload new or updated auto-autoloads files.
+This is an extremely dangerous function to call after the user-init-files
+is run.  Don't call it or you'll be sorry."
+  (let ((autoload-list (packages-new-autoloads)))
+    (while autoload-list
+      (let* ((autoload-file (car autoload-list))
+	     (feature (car-safe (file-provides autoload-file))))
+	(when feature
+	  ;; (message "(unload-feature %S)" feature)
+	  (unload-feature feature))
+	(load autoload-file))
+      (setq autoload-list (cdr autoload-list)))))
+
+;; The following function cannot be called from a bare temacs
+(defun packages-reload-dumped-lisp ()
+  "Reload new or updated dumped lisp files (with exceptions).
+This is an extremely dangerous function to call at any time."
+  ;; Nothing for the moment
+  nil)
+
 ;; The following function is called from temacs
 (defun packages-find-packages-1 (package path-only append-p user-package)
   "Search the supplied directory for associated directories.
@@ -256,7 +328,8 @@
 				  (append preloaded-file-list package-lisp)))
 			(if (fboundp 'load-gc)
 			    (setq dumped-lisp-packages
-				  (append dumped-lisp-packages package-lisp)))))))
+				  (append dumped-lisp-packages
+					  package-lisp)))))))
 
 	    (if user-package
 		(condition-case error
--- a/lisp/replace.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/replace.el	Mon Aug 13 10:14:40 2007 +0200
@@ -93,7 +93,7 @@
 	(save-excursion
 	  (narrow-to-region (point) (mark))
 	  (goto-char (point-min))
-	  (query-replace from-string to-string arg)))
+	  (perform-replace from-string to-string t nil arg)))
     (perform-replace from-string to-string t nil arg)))
 
 (defun query-replace-regexp (regexp to-string &optional arg)
--- a/lisp/simple.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/simple.el	Mon Aug 13 10:14:40 2007 +0200
@@ -3483,9 +3483,9 @@
 'log-message-filter-errors-only.")
 
 (defun log-message-filter (label message)
-  "Default value of log-message-filter-function.
-Mesages whose text matches one of the log-message-ignore-regexps
-or whose label appears in log-message-ignore-labels are not saved."
+  "Default value of `log-message-filter-function'.
+Messages whose text matches one of the `log-message-ignore-regexps'
+or whose label appears in `log-message-ignore-labels' are not saved."
   (let ((r  log-message-ignore-regexps)
 	(ok (not (memq label log-message-ignore-labels))))
     (save-match-data
@@ -3496,14 +3496,14 @@
     ok))
 
 (defun log-message-filter-errors-only (label message)
-  "For use as the log-message-filter-function.  Only logs error messages."
+  "For use as the `log-message-filter-function'.  Only logs error messages."
   (eq label 'error))
 
 (defun log-message (label message)
   "Stuff a copy of the message into the \" *Message-Log*\" buffer,
-if it satisfies the log-message-filter-function.
-
-For use on remove-message-hook."
+if it satisfies the `log-message-filter-function'.
+
+For use on `remove-message-hook'."
   (when (and (not noninteractive)
 	     (funcall log-message-filter-function label message))
     (with-current-buffer (get-buffer-create " *Message-Log*")
--- a/lisp/startup.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/startup.el	Mon Aug 13 10:14:40 2007 +0200
@@ -615,6 +615,13 @@
   (when site-start-file
     (load site-start-file t t))
 
+  ;; Disabled for now
+  (unless inhibit-update-dumped-lisp
+    (packages-reload-dumped-lisp))
+
+  (unless inhibit-update-autoloads
+    (packages-reload-autoloads))
+
   ;; Sites should not disable this.  Only individuals should disable
   ;; the startup message.
   (setq inhibit-startup-message nil)
--- a/lisp/update-elc.el	Mon Aug 13 10:14:17 2007 +0200
+++ b/lisp/update-elc.el	Mon Aug 13 10:14:40 2007 +0200
@@ -65,7 +65,7 @@
 (define-function 'defalias 'define-function)
 (require 'packages)
 
-(let ((autol (list-autoloads)))
+(let ((autol (packages-list-autoloads)))
   ;; (print (prin1-to-string autol))
   (while autol
     (let ((src (car autol)))
--- a/src/ChangeLog	Mon Aug 13 10:14:17 2007 +0200
+++ b/src/ChangeLog	Mon Aug 13 10:14:40 2007 +0200
@@ -1,3 +1,32 @@
+1998-01-02    Charles G. Waldman <cgw@pgt.com>
+
+	* frame.h:  fix erroneous FRAME_RIGHT_BORDER_START macro.
+	Corrects display glitch when toolbar is on the right.
+
+1998-01-02  Kirill M. Katsnelson  <kkm@kis.ru>
+
+	* emacs.c (make_arg_list_1): On Win32 platforms, GetModuleFileName
+	is consulted instead of argv[0] to get full path to the xemacs
+	executable.
+
+1998-01-01  SL Baur  <steve@altair.xemacs.org>
+
+	* m/sparc.h: Cleans up some warnings about unused variables in
+	getloadavg.c under Sparc/Linux.
+	From Stephen J. Turnbull <turnbull@sk.tsukuba.ac.jp>
+
+	* fileio.c (vars_of_fileio): Enable directory-sep-char always for
+	compatibility.
+
+	* emacs.c (main_1): Inhibit reloading dumped lisp when using
+	`-batch' or `-vanilla'.
+
+1997-12-31  SL Baur  <steve@altair.xemacs.org>
+
+	* emacs.c: New variables `inhibit-update-dumped-lisp' and
+	`inhibit-update-autoloads'.
+	(vars_of_emacs): Initialize them.
+
 1997-12-29  Kirill M. Katsnelson  <kkm@kis.ru>
 
 	* msw-proc.c (mswindows_enqueue_magic_event): Made extern. User by 
--- a/src/emacs.c	Mon Aug 13 10:14:17 2007 +0200
+++ b/src/emacs.c	Mon Aug 13 10:14:40 2007 +0200
@@ -58,8 +58,7 @@
 #endif
 #endif
 
-#if defined (_WIN32) && defined (DEBUG_XEMACS)
-/* For DebugBreak in asserf_failed() */
+#if defined (_WIN32)
 #include <windows.h>
 #endif
 
@@ -162,6 +161,12 @@
 /* Nonzero means don't perform package searches at startup */
 int inhibit_package_init;
 
+/* Nonzero means don't reload changed dumped lisp files at startup */
+int inhibit_update_dumped_lisp;
+
+/* Nonzero means don't reload changed or new auto-autoloads files at startup */
+int inhibit_update_autoloads;
+
 /* Save argv and argc.  */
 char **initial_argv;
 int initial_argc;
@@ -304,7 +309,20 @@
   for (i = argc - 1; i >= 0; i--)
     {
       if (i == 0 || i > skip_args)
-	result = Fcons (build_ext_string (argv [i], FORMAT_FILENAME), result);
+	{
+#ifdef _WIN32
+	  if (i == 0)
+	    {
+	      /* Do not trust to what crt0 has stuffed into argv[0] */
+	      char full_exe_path [MAX_PATH];
+	      GetModuleFileName (NULL, full_exe_path, MAX_PATH);
+	      result = Fcons (build_ext_string (full_exe_path, FORMAT_FILENAME),
+			      result);
+	    }
+	  else
+#endif
+	    result = Fcons (build_ext_string (argv [i], FORMAT_FILENAME), result);
+	}
     }
   return result;
 }
@@ -615,18 +633,29 @@
 
   /* Handle the -batch switch, which means don't do interactive display.  */
   if (argmatch (argv, argc, "-batch", "--batch", 5, NULL, &skip_args))
-    noninteractive = 1;
+    {
+      inhibit_update_autoloads = 1;
+      inhibit_update_dumped_lisp = 1;
+      noninteractive = 1;
+    }
 
   /* Partially handle -no-packages and -vanilla.  Packages are searched */
   /* prior to the rest of the command line being parsed in startup.el */
   if (argmatch (argv, argc, "-no-packages", "--no-packages",
-		6, NULL, &skip_args) ||
-      argmatch (argv, argc, "-vanilla", "--vanilla",
-		7, NULL, &skip_args))
+		6, NULL, &skip_args))
     {
       inhibit_package_init = 1;
       skip_args--;
     }
+  if (argmatch (argv, argc, "-vanilla", "--vanilla",
+		7, NULL, &skip_args))
+    {
+      inhibit_package_init = 1;
+      inhibit_update_autoloads = 1;
+      inhibit_update_dumped_lisp = 1;
+      skip_args--;
+    }
+
 
   /* Partially handle the -version and -help switches: they imply -batch,
      but are not removed from the list. */
@@ -2420,6 +2449,16 @@
 Set to non-nil when the package-path should not be searched at startup.
 */ );
 
+  DEFVAR_BOOL ("inhibit-update-dumped-lisp", &inhibit_update_dumped_lisp /*
+Set to non-nil when modified dumped lisp should not be reloaded at startup.
+*/ );
+  inhibit_update_dumped_lisp = 1;
+
+  DEFVAR_BOOL ("inhibit-update-autoloads", &inhibit_update_autoloads /*
+Set to non-nil when modified or new autoloads files should not be reloaded.
+*/ );
+  inhibit_update_autoloads = 0;
+
   DEFVAR_INT ("emacs-priority", &emacs_priority /*
 Priority for XEmacs to run at.
 This value is effective only if set before XEmacs is dumped,
--- a/src/fileio.c	Mon Aug 13 10:14:17 2007 +0200
+++ b/src/fileio.c	Mon Aug 13 10:14:40 2007 +0200
@@ -113,9 +113,6 @@
 
 Lisp_Object Qfile_name_handler_alist;
 
-#ifdef DOS_NT
-/* Until we can figure out how to deal with the functions in this file in
-   a civilized fashion, this will remain #ifdef'ed out. -slb */
 /* Syncing with FSF 19.34.6 note: although labelled as NT-specific, these
    two lisp variables are compiled in even when not defined(DOS_NT).
    Need to check if we should bracket them between #ifdef's.
@@ -125,8 +122,11 @@
 
    This needs to be initialized statically, because file name functions
    are called during initialization.  */
-Lisp_Object Vdirectory_sep_char = '/';
-
+Lisp_Object Vdirectory_sep_char;
+
+#ifdef DOS_NT
+/* Until we can figure out how to deal with the functions in this file in
+   a civilized fashion, this will remain #ifdef'ed out. -slb */
 /* For the benefit of backwards compatability with earlier versions of
    Emacs on DOS_NT, provide a way to disable the REPLACE option support
    in insert-file-contents.  */
@@ -4684,7 +4684,7 @@
 Saving the buffer normally turns auto-save back on.
 */ );
   disable_auto_save_when_buffer_shrinks = 1;
-#ifdef DOS_NT
+
   DEFVAR_LISP ("directory-sep-char", &Vdirectory_sep_char /*
     *Directory separator character for built-in functions that return file names.
 The value should be either ?/ or ?\\ (any other value is treated as ?\\).
@@ -4692,8 +4692,9 @@
 on other platforms, it is initialized so that Lisp code can find out
 what the normal separator is.
 */ );
-  Vdirectory_sep_char = '/';
-
+  Vdirectory_sep_char = make_char('/');
+
+#ifdef DOS_NT
   DEFVAR_LISP ("insert-file-contents-allow-replace", &Vinsert_file_contents_allow_replace /*
     *Allow REPLACE option of insert-file-contents to preserve markers.
 If non-nil, the REPLACE option works as described, preserving markers.
--- a/src/frame.h	Mon Aug 13 10:14:17 2007 +0200
+++ b/src/frame.h	Mon Aug 13 10:14:40 2007 +0200
@@ -545,7 +545,8 @@
 
 #define FRAME_RIGHT_BORDER_START(f)					\
   (FRAME_PIXWIDTH (f) - FRAME_BORDER_WIDTH (f) -			\
-   2 * FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f))
+   FRAME_REAL_RIGHT_TOOLBAR_WIDTH(f) -                                                           \
+   2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH (f))
 #define FRAME_RIGHT_BORDER_END(f)					\
   (FRAME_PIXWIDTH (f) - FRAME_REAL_RIGHT_TOOLBAR_WIDTH (f) -		\
    2 * FRAME_REAL_RIGHT_TOOLBAR_BORDER_WIDTH(f))
--- a/src/m/sparc.h	Mon Aug 13 10:14:17 2007 +0200
+++ b/src/m/sparc.h	Mon Aug 13 10:14:40 2007 +0200
@@ -46,6 +46,13 @@
 
 #define EXPLICIT_SIGN_EXTEND
 
+/* Mask for address bits within a memory segment */
+
+#define SEGMENT_MASK (SEGSIZ - 1)
+
+#if ! defined (__NetBSD__) && ! defined (__linux__)
+/* This really belongs in s/sun.h.  */
+
 /* Data type of load average, as read out of kmem.  */
 
 #define LOAD_AVE_TYPE long
@@ -54,13 +61,6 @@
 
 #define LOAD_AVE_CVT(x) (int) (((double) (x)) * 100.0 / FSCALE)
 
-/* Mask for address bits within a memory segment */
-
-#define SEGMENT_MASK (SEGSIZ - 1)
-
-#if ! defined (__NetBSD__) && ! defined (__linux__)
-/* This really belongs in s/sun.h.  */
-
 /* Say that the text segment of a.out includes the header;
    the header actually occupies the first few bytes of the text segment
    and is counted in hdr.a_text.  */
--- a/version.sh	Mon Aug 13 10:14:17 2007 +0200
+++ b/version.sh	Mon Aug 13 10:14:40 2007 +0200
@@ -1,5 +1,5 @@
 #!/bin/sh
 emacs_major_version=20
 emacs_minor_version=5
-emacs_beta_version=15
-xemacs_codename="British Alpine"
+emacs_beta_version=16
+xemacs_codename="Caninde"