Setup local ELPA repository
Repository setup
package.el
can be used to setup a local repository, the necessary bits are in package-x.el
(require 'package-x)
(defvar local-archive
(expand-file-name "local/" user-emacs-directory)
"Location of the package archive.")
(setq package-archive-upload-base local-archive)
(add-to-list 'package-archives `("local" . ,local-archive) t)
Once this is evaluated, package-upload-file
can be used to add a package.
Create a new package
Add <package_name>-pkg.el
file containing a package description.
(define-package
"mypackage"
"version"
"Desription of mypackage."
'((dependency1 "3.1.0")
(dependency2 "2.1.4")))
Note that define-package
is marked obsolete since version 29.1. What this means exactly isn't clear as it is still required to define a package.
A package can be a single file if version information is set correctly in the file header or a .tar
archive. In case of an archive package files must be under <package_name-version>
directory, otherwise the function will fail. The function documentation doesn't explain that well, package.el
commentary section does a better job.
A tar file should be named "NAME-VERSION.tar". The tar file must unpack into a directory named after the package and version: "NAME-VERSION". It must contain a file named "PACKAGE-pkg.el" which consists of a call to define-package. It may also contain a "dir" file and the info files it references.
From a source directory this can be achieved with the following command - tar -f <pkg>.tar -c --transform 's,^\.,<pkgdir>,' .