branch: elpa-admin commit de021761b5074dc878764915ecab699871887692 Author: Stefan Monnier <monn...@iro.umontreal.ca> Commit: Stefan Monnier <monn...@iro.umontreal.ca>
* elpa-admin.el: Use :lisp-dir in default value of :main-file and :renames (elpaa--main-file, elpaa--make-one-tarball): Use `:lisp-dir`. --- README | 41 +++++++++++++++++++++++------------------ elpa-admin.el | 9 +++++++-- 2 files changed, 30 insertions(+), 20 deletions(-) diff --git a/README b/README index d8d1a76..a00717e 100644 --- a/README +++ b/README @@ -61,24 +61,16 @@ It can be a single file name or a list of file names. Specifies the branch to follow in the upstream Git repository, in case it should be different from the default branch. +** =:lisp-dir= +Subdirectory in which the main ELisp found are found. +Defaults to the top-level directory. + ** =:main-file FILE= Gives the name of the main file of the package, i.e. the file in which the metadata can be found in the form of pseudo-headers like "Version:". It needs to be an ELisp file formatted following the proper conventions. -This is normally the file [PKG].el, but in some rare circumstances, -the file is named differently, typically because it is placed in -a subdirectory. - -** =:version-map MAP= -A list of elements of the form (ORIG-VERSION REMAPPED-VERSION REVISION). -This allows replacing the ORIG-VERSION from the [PKG].el file -with REMAPPED-VERSION (e.g. because the ORIG-VERSION is not a valid -version number, is missing, or because we want to create a new package -from the same code version). -It also makes it possible to specify which REVISION corresponds to -this ORIG-VERSION (or REMAPPED-VERSION if non-nil) to override -the default heuristic which uses the last revision that modified the -"Version:" header. +This is normally the file [PKG].el in the LISP-DIR, but in some rare +circumstances the file is named differently. ** =:release-branch BRANCH= The upstream BRANCH from which releases are cut. This is only used @@ -94,6 +86,8 @@ Names of files or directories that should not be included in the tarballs. Mapping from the source layout to the layout used in the tarball. RENAMES is a list of element (FROM TO) where FROM should terminate with =/= if it's a directory. +If =:lisp-dir= is set, then that directory is renamed to =""= without +having to specify it here. ** =:readme FILE= Name of the file to use as the description of the package. By default @@ -111,10 +105,6 @@ Name of the documentation file for the package. It can be either an Info file, a Texinfo file, or an Org file. FILE can also be a list of those. -** =:lisp-dir= -Subdirectory in which the main ELisp found are found. -Defaults to the top-level directory. - ** =:make TARGET= Indicates that we should run ~make TARGET~ in order to build some files. This is run before processing =:doc=, so it can be used to generate @@ -122,6 +112,21 @@ the Info and Texinfo file from some other format. TARGET can also be a list, in which case each target should be an actual file name (rather than a "phony target"). +** =:shell-command COMMAND= +If running =make= is not good enough, this lets you run the shell COMMAND +to build (or modify, rename, delete, younameit) some of the files. + +** =:version-map MAP= +A list of elements of the form (ORIG-VERSION REMAPPED-VERSION REVISION). +This allows replacing the ORIG-VERSION from the [PKG].el file +with REMAPPED-VERSION (e.g. because the ORIG-VERSION is not a valid +version number, is missing, or because we want to create a new package +from the same code version). +It also makes it possible to specify which REVISION corresponds to +this ORIG-VERSION (or REMAPPED-VERSION if non-nil) to override +the default heuristic which uses the last revision that modified the +"Version:" header. + * Make targets ** =all-in-place= diff --git a/elpa-admin.el b/elpa-admin.el index e56e4a7..2de8e95 100644 --- a/elpa-admin.el +++ b/elpa-admin.el @@ -152,7 +152,8 @@ Delete backup files also." (defun elpaa--main-file (pkg-spec) (or (elpaa--spec-get pkg-spec :main-file) - (concat (car pkg-spec) ".el"))) + (let ((ldir (elpaa--spec-get pkg-spec :lisp-dir))) + (concat (if ldir (file-name-as-directory ldir)) (car pkg-spec) ".el")))) (defun elpaa--get-release-revision (dir pkg-spec &optional vers version-map) "Get the REVISION that corresponds to current release. @@ -338,6 +339,7 @@ Return non-nil if a new tarball was created." (elpaignore (expand-file-name ".elpaignore" dir)) (ignores (elpaa--spec-get pkg-spec :ignored-files)) (renames (elpaa--spec-get pkg-spec :renames)) + (ldir (elpaa--spec-get pkg-spec :lisp-dir)) (re (concat "\\`" (regexp-quote pkgname) "-\\([0-9].*\\)\\.\\(tar\\|el\\)\\(\\.[a-z]*z\\)?\\'")) (oldtarballs @@ -347,6 +349,8 @@ Return non-nil if a new tarball was created." (string-match re file) (cons (match-string 1 file) file)) (directory-files destdir nil re))))) + (when ldir + (cl-pushnew (list (file-name-as-directory ldir) "") renames)) (when revision-function (elpaa--select-revision dir pkg-spec (funcall revision-function))) (elpaa--copyright-check pkg-spec) @@ -366,7 +370,8 @@ Return non-nil if a new tarball was created." (mapcar (lambda (i) (format "--exclude=packages/%s/%s" pkgname i)) ignores)) ((file-readable-p elpaignore) `("-X" ,elpaignore))) - ,@(mapcar (lambda (r) (elpaa--make-tar-transform pkgname r)) renames) + ,@(mapcar (lambda (r) (elpaa--make-tar-transform pkgname r)) + renames) "--transform" ,(format "s|^packages/%s|%s-%s|" pkgname pkgname vers) "-chf" ,tarball