Merge pull request #1 from milkypostman/master

Merge from milkypostman/master
This commit is contained in:
Greg Chapple 2014-02-25 14:10:29 +00:00
commit cff6c00a7c
376 changed files with 1192 additions and 598 deletions

3
.gitignore vendored
View file

@ -4,6 +4,7 @@
/epkgs
**.elc
.#*
/.cask
/html/archive.json
/html/recipes.json
/html/download_counts.json
@ -11,3 +12,5 @@
/html/updates.rss
/elpa
/html/build-status.json
/download_log.json.gz
/.ecukes-failing-scenarios

2
Cask
View file

@ -1,7 +1,5 @@
(source "melpa" "http://melpa.milkbox.net/packages/")
(package-file "melpa.el")
(development
(depends-on "ecukes")
(depends-on "espuds"))

View file

@ -3,27 +3,24 @@ PKGDIR := ./packages
RCPDIR := ./recipes
HTMLDIR := ./html
WORKDIR := ./working
WEBROOT := $$HOME/www
EMACS ?= emacs
EVAL := $(EMACS)
SLEEP ?= 0
SANDBOX := ./sandbox
## Check for needing to initialize CL-LIB from ELPA
NEED_CL-LIB := $(shell $(EMACS) --no-site-file --batch --eval '(prin1 (version< emacs-version "24.3"))')
ifeq ($(NEED_CL-LIB), t)
EVAL := $(EVAL) --eval "(package-initialize)"
EMACS := $(EMACS) --eval "(package-initialize)"
endif
EVAL := $(EVAL) --no-site-file --batch -l package-build.el --eval
EVAL := $(EMACS) --no-site-file --batch -l package-build.el --eval
TIMEOUT := $(shell which timeout && echo "-k 60 600")
all: build json index
all: packages packages/archive-contents json index
## General rules
build:
@echo " • Building $$(ls -1 $(RCPDIR) | wc -l) recipes ..."
$(EVAL) "(package-build-all)"
html: index
index: json
@echo " • Building html index ..."
@ -43,8 +40,28 @@ clean-json:
@echo " • Removing json files ..."
-rm -vf html/archive.json html/recipes.json
clean: clean-working clean-packages clean-json
clean-sandbox:
@echo " • Removing sandbox files ..."
if [ -d '$(SANDBOX)' ]; then \
rm -rfv '$(SANDBOX)/elpa'; \
rmdir '$(SANDBOX)'; \
fi
sync:
rsync -avz --delete $(PKGDIR) $(HTMLDIR)/* $(WEBROOT)/
chmod -R go+rx $(WEBROOT)/packages/*
clean: clean-working clean-packages clean-json clean-sandbox
packages: $(RCPDIR)/*
packages/archive-contents: packages/*.entry
@echo " • Updating $@ ..."
$(EVAL) '(package-build-dump-archive-contents)'
cleanup:
$(EVAL) '(package-build-cleanup)'
## Json rules
html/archive.json: packages/archive-contents
@ -66,11 +83,23 @@ $(RCPDIR)/.dirstamp: .FORCE
$(RCPDIR)/%: .FORCE
@echo " • Building recipe $(@F) ..."
$(EVAL) "(package-build-archive '$(@F))"
- $(TIMEOUT) $(EVAL) "(package-build-archive '$(@F))"
@echo " ✓ Wrote $$(ls -lsh $(PKGDIR)/$(@F)-*) "
@echo " Sleeping for $(SLEEP) ..."
sleep $(SLEEP)
@echo
.PHONY: clean build index html json
## Sandbox
sandbox:
@echo " • Building sandbox ..."
mkdir -p $(SANDBOX)
$(EMACS) -Q \
--eval '(setq user-emacs-directory "$(SANDBOX)")' \
-l package \
--eval "(add-to-list 'package-archives '(\"melpa\" . \"http://melpa.milkbox.net/packages/\") t)" \
--eval "(add-to-list 'package-archives '(\"sandbox\" . \"$(shell pwd)/$(PKGDIR)/\") t)"
.PHONY: clean build index html json sandbox
.FORCE:

View file

@ -23,7 +23,6 @@ details.
* [Recipe Format](#recipe-format)
* [Build Scripts](#build-scripts)
* [API](#api)
* [MELPA Package](#melpa-package)
* [About](#about)
@ -195,12 +194,16 @@ the `git`, `bzr`, `hg`, `darcs`, `svn` and `cvs` fetchers.*
`github-user/repo-name`. *required for the `github` fetcher*.
- `:commit`
specifies the commit or branch of the git repo to checkout. The value
specifies the commit of the git repo to checkout. The value
will be passed to `git reset` in a repo where `upstream` is the
original repository. Can therefore be either a sha, if pointing at a
specific commit, or a branch (prefixed with "origin/"). Only used by
specific commit, or a full ref prefixed with "origin/". Only used by
the `git` and `github` fetchers.
- `:branch`
specifies the branch of the git repo to use. This is like `:commit`, but
it adds the "origin/" prefix automatically.
- `:module`
specifies the module of a CVS repository to check out. Defaults to to
`package-name`. Only used with `:fetcher cvs`, and otherwise ignored.
@ -269,7 +272,6 @@ files specified explicitly.
### Example: Multiple Files in Multiple Directories
There are special cases when we need
There are special cases where creation of the package comes from many
different sub-directories in the repository and the destination
sub-directories need to be explicitly set.
@ -433,58 +435,6 @@ This can be configured using the `package-build-archive-dir` variable.
Repositories are checked out to the `working/` directory by default.
This can be configured using the `package-build-working-dir` variable.
## MELPA Package
The `melpa.el` package---available in MELPA--allows creating a
whitelist or blacklist of packages for a specific repository. This
allows for disabling all packages from a specific repository and only
enabling certain packages, or simply blacklist a certain subset of packages.
### Configuring
By default there are two variables that can be customized to specify
which packages will be enabled (whitelist packages only) or excluded
(blacklist of packages)
- `package-archive-enable-alist` : Optional Alist of enabled packages
used by `package-filter`. The format is (ARCHIVE . PACKAGE ...),
where ARCHIVE is a string matching an archive name in
`package-archives`, PACKAGE is a symbol of a package in ARCHIVE to
enable. If no ARCHIVE exists in the alist, all packages are
enabled.
If no ARCHIVE exists in the alist, all packages are enabled.
<!-- extra padding??? -->
- `package-archive-exclude-alist` : Alist of packages excluded by
`package-filter`. The format is (ARCHIVE . PACKAGE ...), where
ARCHIVE is a string matching an archive name in
`package-archives`, PACKAGE is a symbol of a package in that
archive to exclude. Any specified package is excluded regardless
of the value of `package-archive-enable-alist`
If a particular ARCHIVE has an entry in
`package-archive-enable-alist` then only packages
### Manual Installation
You can install the package manually by pasting this into your `*scratch*` buffer and evaluating it.
(progn
(switch-to-buffer
(url-retrieve-synchronously
"https://raw.github.com/milkypostman/melpa/master/melpa.el"))
(package-install-from-buffer (package-buffer-info) 'single))
## About
*MELPA* is *Milkypostman's ELPA* or *Milkypostman's Experimental Lisp

19
etc/logrotate Normal file
View file

@ -0,0 +1,19 @@
/home/melpa/log/melpa*.log {
daily
create 0640 melpa melpa
compress
dateext
missingok
missingok
notifempty
rotate 36500
sharedscripts
prerotate
if [ -d /etc/logrotate.d/httpd-prerotate ]; then \
run-parts /etc/logrotate.d/httpd-prerotate; \
fi; \
endscript
postrotate
[ ! -f /home/melpa/var/run/nginx.pid ] || kill -USR1 `cat /home/melpa/var/run/nginx.pid`
endscript
}

93
etc/nginx Normal file
View file

@ -0,0 +1,93 @@
worker_processes 4;
pid /home/melpa/var/run/nginx.pid;
# error_log /dev/null crit;
daemon off;
events {
worker_connections 768;
# multi_accept on;
}
http {
##
# Basic Settings
##
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
server_tokens off;
# server_names_hash_bucket_size 64;
server_name_in_redirect off;
charset utf-8;
include /etc/nginx/mime.types;
default_type application/octet-stream;
##
# Logging Settings
##
access_log /home/melpa/log/melpa.access.log combined;
error_log /home/melpa/log/melpa.error.log info;
set_real_ip_from 127.0.0.1;
real_ip_header X-Forwarded-For;
##
# Gzip Settings
##
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
server {
server_name melpa.milkbox.net;
server_tokens off;
server_name_in_redirect off;
root /home/melpa/www;
listen 1337;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /var/www/nginx-default;
}
}
}

View file

@ -7,21 +7,3 @@ Feature: Initialization
Given set travis-archive-alist to archive alist
Then travis-archive-alist should be empty
Scenario: add to archive alist
Given add "test1" to archive alist
Then archive alist should be ("test1")
Given add "test2" to archive alist
Then archive alist should be ("test2" "test1")
Scenario: remove from archive alist
Given add "test1" to archive alist
Given remove "test2" from archive alist
Then archive alist should be ("test1")
Given add "test2" to archive alist
Then archive alist should be ("test2" "test1")
Given remove "test1" from archive alist
Then archive alist should be ("test2")

View file

@ -7,6 +7,7 @@
// TODO Google Analytics http://stackoverflow.com/questions/10713708/tracking-google-analytics-page-views-with-angular-js
// TODO D3 visualisation for deps
// TODO Fix json encoding of versions
// TODO Link to specific github branch
// TODO Show recent github events on package pages where applicable
// TODO Voting / starring

109
melpa.el
View file

@ -1,109 +0,0 @@
;;; melpa.el --- special handling for the MELPA repository
;;
;; Copyright 2012 Donald Ephraim Curtis
;;
;; Author: Donald Ephraim Curtis <dcurtis@milkbox.net>
;; URL: https://github.com/milkypostman/melpa
;; Version: 0.3
;;
;;
;; Credits:
;; Steve Purcell
;;
;;
;; Installation:
;;
;; (progn
;; (switch-to-buffer
;; (url-retrieve-synchronously
;; "https://raw.github.com/milkypostman/melpa/master/melpa.el"))
;; (package-install-from-buffer (package-buffer-info) 'single))
;;
;;
;;
;; Code goes here
;;
;;;###autoload
(defcustom package-archive-enable-alist nil
"Optional Alist of enabled packages used by `package-filter'.
The format is (ARCHIVE . PACKAGE ...), where ARCHIVE is a string
matching an archive name in `package-archives', PACKAGE is a
symbol of a package in ARCHIVE to enable.
If no ARCHIVE exists in the alist, all packages are enabled."
:group 'package
:type '(alist :key-type string :value-type (repeat symbol)))
;;;###autoload
(defcustom package-archive-exclude-alist nil
"Alist of packages excluded by `package-filter'.
The format is (ARCHIVE . PACKAGE ...), where ARCHIVE is a string
matching an archive name in `package-archives', PACKAGE is a
symbol of a package in that archive to exclude.
Any specified package is excluded regardless of the value of
`package-archive-enable-alist'"
:group 'package
:type '(alist :key-type string :value-type (repeat symbol)))
;;;###autoload
(defcustom package-filter-function 'package-filter
"Optional predicate function used to internally
filter packages used by package.el.
Return nil to filter a function from the list.
The function is called with the arguments PACKAGE VERSION ARCHIVE, where
PACKAGE is a symbol, VERSION is a vector as produced by `version-to-list', and
ARCHIVE is the string name of the package archive."
:group 'package
:type 'function)
;;;###autoload
(defadvice package-compute-transaction
(before
package-compute-transaction-reverse (package-list requirements)
activate compile)
"reverse the requirements"
(setq requirements (reverse requirements)))
;;;###autoload
(defadvice package--add-to-archive-contents
(around package-filter-add-to-archive-contents (package archive)
activate compile)
"Add filtering of available packages using `package-filter-function',
if non-nil."
(when (and package-filter-function
(funcall package-filter-function
(car package)
(package-desc-vers (cdr package))
archive))
ad-do-it))
;;;###autoload
(defun package-filter (package version archive)
"Check package against enabled and excluded list for the `archive'.
Filter packages not in the associated list for `archive' in
`package-archive-enable-alist'.
Filter packages in the associated list for `archive' in
`package-archive-exclude-alist'."
(let ((enable-rules (cdr (assoc archive package-archive-enable-alist)))
(exclude-rules (cdr (assoc archive package-archive-exclude-alist))))
(and (not (memq package exclude-rules))
(or (not enable-rules)
(memq package enable-rules)))))
(provide 'melpa)
;;; melpa.el ends here

View file

@ -1,28 +0,0 @@
#!/bin/sh
:;exec emacs --script "$0" "$@"
(defun difference (left right)
"compare two lists"
(let ((caleft (car left))
(caright (car right)))
(cond
((not left) right)
((not right) left)
((string< caleft caright)
(cons caleft (difference (cdr left) right)))
((string< caright caleft)
(cons caright (difference left (cdr right))))
(t (difference (cdr left) (cdr right))))))
(defun stripstuff (fn)
"strip the date and extension"
(string-match "\\\(.*\\\)-[0-9]+\.\\\(el$\\\|tar$\\\)" fn)
(match-string 1 fn))
(mapc 'message
(difference
(sort (directory-files "recipes/" nil "[^.].*") 'string<)
(sort (mapcar 'stripstuff (directory-files "packages/" nil "[^.].*\\\(el$\\\|tar$\\\)")) 'string<)))

View file

@ -1,7 +1,7 @@
;;; package-build.el --- Tools for assembling a package archive
;; Copyright (C) 2011-2013 Donald Ephraim Curtis <dcurtis@milkbox.net>
;; Copyright (C) 2012-2013 Steve Purcell <steve@sanityinc.com>
;; Copyright (C) 2012-2014 Steve Purcell <steve@sanityinc.com>
;; Copyright (C) 2009 Phil Hagelberg <technomancy@gmail.com>
;; Author: Donald Ephraim Curtis <dcurtis@milkbox.net>
@ -63,13 +63,15 @@
:group 'package-build
:type 'string)
(defvar package-build-verbose t
"When non-nil, `package-build' feels free to print information about its progress.")
;;; Internal Variables
(defvar pb/recipe-alist nil
"Internal list of package build specs.
Do not use this directly. Use `package-build-recipe-alist'
Do not use this directly. Use `package-build-recipe-alist'
function.")
(defvar pb/recipe-alist-initialized nil
@ -78,18 +80,23 @@ function.")
(defvar pb/archive-alist nil
"Internal list of already-built packages, in the standard package.el format.
Do not use this directly. Use `package-build-archive-alist'
Do not use this directly. Use `package-build-archive-alist'
function for access to this function")
(defvar pb/archive-alist-initialized nil
"Determines if pb/archive-alist has been initialized.")
(defconst pb/default-files-spec '("*.el" "*.el.in" "dir"
"*.info" "*.texi" "*.texinfo"
"doc/*.info" "doc/*.texi" "doc/*.texinfo"
(:exclude "tests.el" "*-test.el" "*-tests.el"))
(defconst package-build-default-files-spec
'("*.el" "*.el.in" "dir"
"*.info" "*.texi" "*.texinfo"
"doc/dir" "doc/*.info" "doc/*.texi" "doc/*.texinfo"
(:exclude ".dir-locals.el" "tests.el" "*-test.el" "*-tests.el"))
"Default value for :files attribute in recipes.")
(defun pb/message (format-string &rest args)
"Log a message using FORMAT-STRING and ARGS as per `message'."
(when package-build-verbose
(apply 'message format-string args)))
(defun pb/slurp-file (file-name)
"Return the contents of FILE-NAME as a string, or nil if no such file exists."
@ -140,15 +147,17 @@ function for access to this function")
(defun pb/run-process (dir command &rest args)
"In DIR (or `default-directory' if unset) run COMMAND with ARGS.
Output is written to the current buffer."
(let* ((default-directory (or dir default-directory))
(let* ((default-directory (file-name-as-directory (or dir default-directory)))
(have-timeout (executable-find "timeout"))
(argv (if have-timeout
(append (list "timeout" "-k" "30" "1800" command) args)
(append (list "timeout" "-k" "60" "600" command) args)
(cons command args))))
(unless (file-directory-p default-directory)
(error "Can't run process in non-existent directory: %s" default-directory))
(let ((exit-code (apply 'process-file (car argv) nil (current-buffer) t (cdr argv))))
(unless (zerop exit-code)
(error "Command '%s' exited with non-zero status %d"
argv exit-code)))))
(error "Command '%s' exited with non-zero status %d: %s"
argv exit-code (buffer-string))))))
(defun pb/run-process-match (regex dir prog &rest args)
"Find match for REGEX when - in DIR, or `default-directory' if unset - we run PROG with ARGS."
@ -158,25 +167,27 @@ Output is written to the current buffer."
(re-search-forward regex)
(match-string-no-properties 1)))
(defun pb/checkout (name config cwd)
"Check out source for package NAME with CONFIG under working dir CWD.
In turn, this function uses the :fetcher option in the config to
(defun package-build-checkout (package-name config working-dir)
"Check out source for PACKAGE-NAME with CONFIG under WORKING-DIR.
In turn, this function uses the :fetcher option in the CONFIG to
choose a source-specific fetcher function, which it calls with
the same arguments."
the same arguments.
Returns a last-modification timestamp for the :files listed in
CONFIG, if any, or `package-build-default-files-spec' otherwise."
(let ((repo-type (plist-get config :fetcher)))
(message "Fetcher: %s" repo-type)
(pb/message "Fetcher: %s" repo-type)
(unless (eq 'wiki repo-type)
(message "Source: %s\n" (or (plist-get config :repo) (plist-get config :url))))
(pb/message "Source: %s\n" (or (plist-get config :repo) (plist-get config :url))))
(funcall (intern (format "pb/checkout-%s" repo-type))
name config cwd)))
package-name config (file-name-as-directory working-dir))))
(defvar pb/last-wiki-fetch-time 0
"The time at which an emacswiki URL was last requested.
This is used to avoid exceeding the rate limit of 1 request per 2
seconds; the server cuts off after 10 requests in 20 seconds.")
(defvar pb/wiki-min-request-interval 2
(defvar pb/wiki-min-request-interval 3
"The shortest permissible interval between successive requests for Emacswiki URLs.")
(defmacro pb/with-wiki-rate-limit (&rest body)
@ -187,7 +198,7 @@ seconds; the server cuts off after 10 requests in 20 seconds.")
(,elapsed (- ,now pb/last-wiki-fetch-time)))
(when (< ,elapsed pb/wiki-min-request-interval)
(let ((wait (- pb/wiki-min-request-interval ,elapsed)))
(message "Waiting %.2f secs before hitting Emacswiki again" wait)
(pb/message "Waiting %.2f secs before hitting Emacswiki again" wait)
(sleep-for wait)))
(unwind-protect
(progn ,@body)
@ -217,12 +228,15 @@ seconds; the server cuts off after 10 requests in 20 seconds.")
(string-equal new-content-hash prev-content-hash))
;; File has not changed, so return old timestamp
(progn
(message "%s is unchanged" filename)
(pb/message "%s is unchanged" filename)
(cdr stamp-info))
(message "%s has changed - checking mod time" filename)
(pb/message "%s has changed - checking mod time" filename)
(let ((new-timestamp
(with-current-buffer (pb/with-wiki-rate-limit
(url-retrieve-synchronously wiki-url))
(unless (= 200 url-http-response-status)
(error "HTTP error %s fetching %s" url-http-response-status wiki-url))
(goto-char (point-max))
(pb/find-parse-time
"Last edited \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\} [A-Z]\\{3\\}\\)"
url-http-end-of-headers))))
@ -254,7 +268,7 @@ seconds; the server cuts off after 10 requests in 20 seconds.")
(pb/run-process dir "darcs" "pull"))
(t
(when (file-exists-p dir)
(delete-directory dir t nil))
(delete-directory dir t))
(pb/princ-checkout repo dir)
(pb/run-process nil "darcs" "get" repo dir)))
(apply 'pb/run-process dir "darcs" "changes" "--max-count" "1"
@ -274,11 +288,11 @@ seconds; the server cuts off after 10 requests in 20 seconds.")
(defun pb/princ-exists (dir)
"Print a message that the contents of DIR will be updated."
(message "Updating %s" dir))
(pb/message "Updating %s" dir))
(defun pb/princ-checkout (repo dir)
"Print a message that REPO will be checked out into DIR."
(message "Cloning %s to %s" repo dir))
(pb/message "Cloning %s to %s" repo dir))
(defun pb/checkout-svn (name config dir)
"Check package NAME with config CONFIG out of svn into DIR."
@ -292,12 +306,12 @@ seconds; the server cuts off after 10 requests in 20 seconds.")
(pb/run-process dir "svn" "up"))
(t
(when (file-exists-p dir)
(delete-directory dir t nil))
(delete-directory dir t))
(pb/princ-checkout repo dir)
(pb/run-process nil "svn" "checkout" repo dir)))
(apply 'pb/run-process dir "svn" "info"
(pb/expand-source-file-list dir config))
(or (pb/find-parse-time-latest "Last Changed Date: \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)" bound)
(or (pb/find-parse-time-latest "Last Changed Date: \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)" bound)
(error "No valid timestamps found!")))))
(defun pb/cvs-repo (dir)
@ -322,7 +336,7 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
(pb/run-process dir "cvs" "update" "-dP"))
(t
(when (file-exists-p dir)
(delete-directory dir t nil))
(delete-directory dir t))
(pb/princ-checkout (format "%s from %s" repo root) dir)
;; CVS insists on relative paths as target directory for checkout (for
;; whatever reason), and puts "CVS" directories into every subdirectory
@ -337,7 +351,7 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
"-d" target-dir repo))))
(apply 'pb/run-process dir "cvs" "log"
(pb/expand-source-file-list dir config))
(or (pb/find-parse-time-latest "date: \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\} [+-][0-9]\\{2\\}[0-9]\\{2\\}\\)" bound)
(or (pb/find-parse-time-latest "date: \\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)" bound)
(pb/find-parse-time-latest "date: \\([0-9]\\{4\\}/[0-9]\\{2\\}/[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\);" bound)
(error "No valid timestamps found!"))
)))
@ -357,7 +371,10 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
(defun pb/checkout-git (name config dir)
"Check package NAME with config CONFIG out of git into DIR."
(let ((repo (plist-get config :url))
(commit (plist-get config :commit)))
(commit (or (plist-get config :commit)
(let ((branch (plist-get config :branch)))
(when branch
(concat "origin/" branch))))))
(with-current-buffer (get-buffer-create "*package-build-checkout*")
(goto-char (point-max))
(cond
@ -367,15 +384,16 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
(pb/run-process dir "git" "remote" "update"))
(t
(when (file-exists-p dir)
(delete-directory dir t nil))
(delete-directory dir t))
(pb/princ-checkout repo dir)
(pb/run-process nil "git" "clone" repo dir)))
(pb/run-process dir "git" "reset" "--hard"
(or commit (concat "origin/" (pb/git-head-branch dir))))
(apply 'pb/run-process dir "git" "log" "-n1" "--pretty=format:'\%ci'"
(pb/run-process dir "git" "submodule" "update" "--init" "--recursive")
(apply 'pb/run-process dir "git" "log" "--first-parent" "-n1" "--pretty=format:'\%ci'"
(pb/expand-source-file-list dir config))
(pb/find-parse-time
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)"))))
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)"))))
(defun pb/checkout-github (name config dir)
"Check package NAME with config CONFIG out of github into DIR."
@ -402,13 +420,13 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
(pb/run-process dir "bzr" "merge"))
(t
(when (file-exists-p dir)
(delete-directory dir t nil))
(delete-directory dir t))
(pb/princ-checkout repo dir)
(pb/run-process nil "bzr" "branch" repo dir)))
(apply 'pb/run-process dir "bzr" "log" "-l1"
(pb/expand-source-file-list dir config))
(pb/find-parse-time
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)"))))
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)"))))
(defun pb/hg-repo (dir)
"Get the current hg repo for DIR."
@ -427,17 +445,22 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
(pb/run-process dir "hg" "update"))
(t
(when (file-exists-p dir)
(delete-directory dir t nil))
(delete-directory dir t))
(pb/princ-checkout repo dir)
(pb/run-process nil "hg" "clone" repo dir)))
(apply 'pb/run-process dir "hg" "log" "--style" "compact" "-l1"
(pb/expand-source-file-list dir config))
(pb/find-parse-time
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}\\)"))))
"\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}\\( [+-][0-9]\\{4\\}\\)?\\)"))))
(defun pb/dump (data file)
"Write DATA to FILE as a pretty-printed Lisp sexp."
(write-region (concat (pp-to-string data) "\n") nil file))
(defun pb/dump (data file &optional pretty-print)
"Write DATA to FILE as a Lisp sexp.
Optionally PRETTY-PRINT the data."
(with-temp-file file
(pb/message "File: %s" file)
(if pretty-print
(pp data (current-buffer))
(print data (current-buffer)))))
(defun pb/write-pkg-file (pkg-file pkg-info)
"Write PKG-FILE containing PKG-INFO."
@ -451,7 +474,8 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
(list (car elt)
(package-version-join (cadr elt))))
(aref pkg-info 1)))
pkg-file))
pkg-file
t))
(defun pb/read-from-file (file-name)
"Read and return the Lisp data stored in FILE-NAME, or nil if no such file exists."
@ -459,22 +483,19 @@ Return a cons cell whose `car' is the root and whose `cdr' is the repository."
(car (read-from-string (pb/slurp-file file-name)))))
(defun pb/create-tar (file dir &optional files)
"Create a tar FILE containing the contents of DIR, or just FILES if non-nil.
The file is written to `package-build-working-dir'."
(let* ((default-directory package-build-working-dir))
(apply 'process-file
"tar" nil
(get-buffer-create "*package-build-checkout*")
nil "-cvf"
file
"--exclude=.svn"
"--exclude=CVS"
"--exclude=.git*"
"--exclude=_darcs"
"--exclude=.bzr"
"--exclude=.hg"
(or (mapcar (lambda (fn) (concat dir "/" fn)) files)
(list dir)))))
"Create a tar FILE containing the contents of DIR, or just FILES if non-nil."
(apply 'process-file
"tar" nil
(get-buffer-create "*package-build-checkout*")
nil "-cvf"
file
"--exclude=.svn"
"--exclude=CVS"
"--exclude=.git*"
"--exclude=_darcs"
"--exclude=.bzr"
"--exclude=.hg"
(or (mapcar (lambda (fn) (concat dir "/" fn)) files) (list dir))))
(defun pb/find-package-commentary (file-path)
@ -484,8 +505,8 @@ The file is written to `package-build-working-dir'."
(insert-file-contents file-path)
(lm-commentary))))
(defun pb/write-pkg-readme (commentary file-name)
"Write COMMENTARY to the FILE-NAME-readme.txt file."
(defun pb/write-pkg-readme (target-dir commentary file-name)
"In TARGET-DIR, write COMMENTARY to a -readme.txt file prefixed with FILE-NAME."
(when commentary
(with-temp-buffer
(insert commentary)
@ -502,12 +523,12 @@ The file is written to `package-build-working-dir'."
(delete-trailing-whitespace)
(let ((coding-system-for-write buffer-file-coding-system))
(write-region nil nil
(pb/readme-file-name file-name))))))
(pb/readme-file-name target-dir file-name))))))
(defun pb/readme-file-name (file-name)
"Name of the readme file for the package FILE-NAME."
(defun pb/readme-file-name (target-dir file-name)
"Name of the readme file in TARGET-DIR for the package FILE-NAME."
(expand-file-name (concat file-name "-readme.txt")
package-build-archive-dir))
target-dir))
(defun pb/update-or-insert-version (version)
"Ensure current buffer has a \"Version: VERSION\" header."
@ -564,38 +585,26 @@ The file is written to `package-build-working-dir'."
(nth 1 pkgfile-info)))
(error "No define-package found in %s" file-path)))))
(defun pb/merge-package-info (pkg-info name version config)
(defun pb/merge-package-info (pkg-info name version)
"Return a version of PKG-INFO updated with NAME, VERSION and info from CONFIG.
If PKG-INFO is nil, an empty one is created."
(let* ((merged (or (copy-sequence pkg-info)
(vector name nil "No description available." version))))
(aset merged 0 name)
(aset merged 2 (format "%s [%s]"
(aref merged 2) (plist-get config :fetcher)))
(aset merged 3 version)
merged))
(defun pb/dump-archive-contents ()
"Dump the list of built packages back to the archive-contents file."
(pb/dump (cons 1 (package-build-archive-alist))
(expand-file-name "archive-contents"
package-build-archive-dir)))
(defun pb/add-to-archive-contents (pkg-info type)
"Add the built archive with info PKG-INFO and TYPE to `package-build-archive-alist'."
(defun pb/archive-entry (pkg-info type)
"Return the archive-contents cons cell for PKG-INFO and TYPE."
(let* ((name (intern (aref pkg-info 0)))
(requires (aref pkg-info 1))
(desc (or (aref pkg-info 2) "No description available."))
(version (aref pkg-info 3))
(existing (assq name (package-build-archive-alist))))
(when existing (package-build-archive-alist-remove existing))
(package-build-archive-alist-add
(cons name
(vector (version-to-list version)
requires
desc
type)))))
(version (aref pkg-info 3)))
(cons name
(vector (version-to-list version)
requires
desc
type))))
(defun pb/archive-file-name (archive-entry)
"Return the path of the file in which the package for ARCHIVE-ENTRY is stored."
@ -607,22 +616,32 @@ If PKG-INFO is nil, an empty one is created."
(format "%s-%s.%s" name version (if (eq flavour 'single) "el" "tar"))
package-build-archive-dir)))
(defun pb/remove-archive (archive-entry)
(defun pb/entry-file-name (archive-entry)
"Return the path of the file in which the package for ARCHIVE-ENTRY is stored."
(let* ((name (car archive-entry))
(pkg-info (cdr archive-entry))
(version (package-version-join (aref pkg-info 0))))
(expand-file-name
(format "%s-%s.entry" name version)
package-build-archive-dir)))
(defun pb/delete-file-if-exists (file)
"Delete FILE if it exists."
(when (file-exists-p file)
(delete-file file)))
(defun pb/remove-archive-files (archive-entry)
"Remove ARCHIVE-ENTRY from archive-contents, and delete associated file.
Note that the working directory (if present) is not deleted by
this function, since the archive list may contain another version
of the same-named package which is to be kept."
(message "Removing archive: %s" archive-entry)
(let ((archive-file (pb/archive-file-name archive-entry))
(readme-file (pb/readme-file-name (symbol-name (car archive-entry)))))
(when (file-exists-p archive-file)
(delete-file archive-file))
(when (file-exists-p readme-file)
(delete-file readme-file)))
(package-build-archive-alist-remove archive-entry))
(pb/message "Removing archive: %s" archive-entry)
(mapcar 'pb/delete-file-if-exists
(list (pb/archive-file-name archive-entry)
(pb/entry-file-name archive-entry))))
(defun pb/read-recipe (file-name)
"Return the plist of recipe info for the package called FILE-NAME."
(let ((pkg-info (pb/read-from-file file-name)))
(if (string= (symbol-name (car pkg-info))
(file-name-nondirectory file-name))
@ -640,16 +659,19 @@ of the same-named package which is to be kept."
"Return a list of data structures for all recipes in `package-build-recipes-dir'."
(cl-loop for file-name in (directory-files package-build-recipes-dir t "^[^.]")
for pkg-info = (condition-case err (pb/read-recipe file-name)
(error (message (error-message-string err))
(error (pb/message (error-message-string err))
nil))
when pkg-info
collect pkg-info))
(defun pb/expand-file-specs (dir specs &optional subdir)
(defun package-build-expand-file-specs (dir specs &optional subdir allow-empty)
"In DIR, expand SPECS, optionally under SUBDIR.
The result is a list of (SOURCE . DEST), where SOURCE is a source
file path and DEST is the relative path to which it should be copied."
file path and DEST is the relative path to which it should be copied.
If the resulting list is empty, an error will be reported. Pass t
for ALLOW-EMPTY to prevent this error."
(let ((default-directory dir)
(prefix (if subdir (format "%s/" subdir) ""))
(lst))
@ -658,13 +680,15 @@ file path and DEST is the relative path to which it should be copied."
(if (consp entry)
(if (eq :exclude (car entry))
(cl-nset-difference lst
(pb/expand-file-specs dir (cdr entry))
(package-build-expand-file-specs dir (cdr entry) nil t)
:key 'car
:test 'equal)
(nconc lst
(pb/expand-file-specs dir
(cdr entry)
(concat prefix (car entry)))))
(package-build-expand-file-specs
dir
(cdr entry)
(concat prefix (car entry))
t)))
(nconc
lst (mapcar (lambda (f)
(let ((destname)))
@ -674,26 +698,31 @@ file path and DEST is the relative path to which it should be copied."
"\\.in\\'"
""
(file-name-nondirectory f)))))
(file-expand-wildcards entry))))))))
(file-expand-wildcards entry))))))
(when (and (null lst) (not allow-empty))
(error "No matching file(s) found in %s: %s" dir specs))
lst))
(defun pb/expand-config-file-list (dir config)
"In DIR, expand the :files for CONFIG using 'pb/expand-file-specs."
(let* ((patterns (or (plist-get config :files) pb/default-files-spec))
(files (pb/expand-file-specs dir patterns)))
(or files
(error "No matching file(s) found in %s: %s" dir patterns))))
(defun pb/config-file-list (config)
"Get the :files spec from CONFIG, or return `package-build-default-files-spec'."
(or (plist-get config :files) package-build-default-files-spec))
(defun pb/expand-source-file-list (dir config)
"Shorthand way to expand paths in DIR for source files listed in CONFIG."
(mapcar 'car (pb/expand-config-file-list dir config)))
(mapcar 'car (package-build-expand-file-specs dir (pb/config-file-list config))))
(defun pb/generate-info-files (files source-dir target-dir)
"Create .info files from any .texi files listed in FILES in SOURCE-DIR in TARGET-DIR.
"Create .info files from any .texi files listed in FILES.
Deletes the .texi(nfo) files if they exist."
The source and destination file paths are expanded in SOURCE-DIR
and TARGET-DIR respectively.
Any of the original .texi(nfo) files found in TARGET-DIR are
deleted."
(dolist (spec files)
(let* ((source-file (car spec))
(source-path (expand-file-name source-file source-dir))
(dest-file (cdr spec))
(info-path (expand-file-name
(concat (file-name-sans-extension dest-file) ".info")
@ -703,13 +732,13 @@ Deletes the .texi(nfo) files if they exist."
(with-current-buffer (get-buffer-create "*package-build-info*")
(ignore-errors
(pb/run-process
nil
(file-name-directory source-path)
"makeinfo"
(expand-file-name source-file source-dir)
source-path
"-o"
info-path)
(message "Created %s" info-path))))
(message "Removing %s" (expand-file-name dest-file target-dir))
(pb/message "Created %s" info-path))))
(pb/message "Removing %s" (expand-file-name dest-file target-dir))
(delete-file (expand-file-name dest-file target-dir))))))
(defun pb/generate-dir-file (files target-dir)
@ -746,10 +775,10 @@ FILES is a list of (SOURCE . DEST) relative filepath pairs."
(make-directory newdir t)))
(cond
((file-regular-p file)
(message "%s -> %s" file newname)
(pb/message "%s -> %s" file newname)
(copy-file file newname))
((file-directory-p file)
(message "%s => %s" file newname)
(pb/message "%s => %s" file newname)
(copy-directory file newname))))
@ -778,120 +807,140 @@ and a cl struct in Emacs HEAD. This wrapper normalises the results."
(package-desc-version desc))
desc)))
;;; Public interface
;;;###autoload
(defun package-build-archive (name)
"Build a package archive for package NAME."
(interactive (list (pb/package-name-completing-read)))
(let* ((file-name (symbol-name name))
(cfg (or (cdr (assoc name (package-build-recipe-alist)))
(rcp (or (cdr (assoc name (package-build-recipe-alist)))
(error "Cannot find package %s" file-name)))
(pkg-cwd
(pkg-working-dir
(file-name-as-directory
(expand-file-name file-name package-build-working-dir))))
(message "\n;;; %s\n" file-name)
(let* ((version (pb/checkout name cfg pkg-cwd))
(files (pb/expand-config-file-list pkg-cwd cfg))
(pb/message "\n;;; %s\n" file-name)
(let* ((version (package-build-checkout name rcp pkg-working-dir))
(default-directory package-build-working-dir)
(start-time (current-time))
(old-archive-entry (assq name (package-build-archive-alist))))
;; right before we create a new package, clean out the old one
(when old-archive-entry (pb/remove-archive old-archive-entry))
(cond
((not version)
(message "Unable to check out repository for %s" name))
((= 1 (length files))
(let* ((pkg-source (expand-file-name (caar files) pkg-cwd))
(pkg-target (expand-file-name
(concat file-name "-" version ".el")
package-build-archive-dir))
(pkg-info (pb/merge-package-info
(pb/get-package-info pkg-source)
file-name
version
cfg)))
(unless (string-equal (concat file-name ".el")
(file-name-nondirectory pkg-source))
(error "Single file %s does not match package name %s"
(file-name-nondirectory pkg-source) file-name))
(when (file-exists-p pkg-target)
(delete-file pkg-target t))
(copy-file pkg-source pkg-target)
(let ((enable-local-variables nil)
(make-backup-files nil))
(with-current-buffer (find-file pkg-target)
(pb/update-or-insert-version version)
(pb/ensure-ends-here-line pkg-source)
(write-file pkg-target nil)
(condition-case err
(pb/package-buffer-info-vec)
(error
(message "Warning: %S" err)))
(kill-buffer)))
(pb/write-pkg-readme (and (> (length pkg-info) 4) (aref pkg-info 4))
file-name)
(pb/add-to-archive-contents pkg-info 'single)))
((< 1 (length files))
(let* ((pkg-dir (concat file-name "-" version))
(pkg-file (concat file-name "-pkg.el"))
(pkg-file-source (or (pb/find-source-file pkg-file files)
pkg-file))
(file-source (concat file-name ".el"))
(pkg-source (or (pb/find-source-file file-source files)
file-source))
(pkg-info
(pb/merge-package-info
(let ((default-directory pkg-cwd))
(or (pb/get-pkg-file-info pkg-file-source)
;; some packages (like magit) provide name-pkg.el.in
(pb/get-pkg-file-info
(expand-file-name (concat pkg-file ".in")
(file-name-directory pkg-source)))
(pb/get-package-info pkg-source)))
file-name
version
cfg)))
(when (file-exists-p pkg-dir)
(delete-directory pkg-dir t nil))
(pb/copy-package-files files pkg-cwd pkg-dir)
(pb/write-pkg-file (expand-file-name pkg-file
(file-name-as-directory
(expand-file-name
pkg-dir
package-build-working-dir)))
pkg-info)
(pb/generate-info-files files pkg-cwd pkg-dir)
(pb/generate-dir-file files pkg-dir)
(pb/create-tar (expand-file-name (concat file-name "-" version ".tar")
package-build-archive-dir)
pkg-dir)
(let ((default-directory pkg-cwd))
(pb/write-pkg-readme (pb/find-package-commentary pkg-source)
file-name))
(delete-directory pkg-dir t nil)
(pb/add-to-archive-contents pkg-info 'tar)))
(t (error "Unable to find files matching recipe patterns")))
(pb/dump-archive-contents)
(message "Built in %.3fs, finished at %s"
(time-to-seconds (time-since start-time))
(current-time-string))
(archive-entry (package-build-package (symbol-name name)
version
(pb/config-file-list rcp)
pkg-working-dir
package-build-archive-dir)))
(pb/dump archive-entry (pb/entry-file-name archive-entry))
(pb/message "Built in %.3fs, finished at %s"
(time-to-seconds (time-since start-time))
(current-time-string))
file-name)))
;;;###autoload
(defun package-build-package (package-name version file-specs source-dir target-dir)
"Create PACKAGE-NAME with VERSION.
The information in FILE-SPECS is used to gather files from
SOURCE-DIR.
The resulting package will be stored as a .el or .tar file in
TARGET-DIR, depending on whether there are multiple files.
Argument FILE-SPECS is a list of specs for source files, which
should be relative to SOURCE-DIR. The specs can be wildcards,
and optionally specify different target paths. They extended
syntax is currently only documented in the MELPA README. You can
simply pass `package-build-default-files-spec' in most cases.
Returns the archive entry for the package."
(when (symbolp package-name)
(setq package-name (symbol-name package-name)))
(let ((files (package-build-expand-file-specs source-dir file-specs)))
(unless (equal file-specs package-build-default-files-spec)
(when (equal files (package-build-expand-file-specs
source-dir package-build-default-files-spec nil t))
(pb/message "Note: this :files spec is equivalent to the default.")))
(cond
((not version)
(error "Unable to check out repository for %s" package-name))
((= 1 (length files))
(let* ((pkg-source (expand-file-name (caar files) source-dir))
(pkg-target (expand-file-name
(concat package-name "-" version ".el")
target-dir))
(pkg-info (pb/merge-package-info
(pb/get-package-info pkg-source)
package-name
version)))
(unless (string-equal (downcase (concat package-name ".el"))
(downcase (file-name-nondirectory pkg-source)))
(error "Single file %s does not match package name %s"
(file-name-nondirectory pkg-source) package-name))
(when (file-exists-p pkg-target)
(delete-file pkg-target t))
(copy-file pkg-source pkg-target)
(let ((enable-local-variables nil)
(make-backup-files nil))
(with-current-buffer (find-file pkg-target)
(pb/update-or-insert-version version)
(pb/ensure-ends-here-line pkg-source)
(write-file pkg-target nil)
(condition-case err
(pb/package-buffer-info-vec)
(error
(pb/message "Warning: %S" err)))
(kill-buffer)))
(pb/write-pkg-readme target-dir
(and (> (length pkg-info) 4) (aref pkg-info 4))
package-name)
(pb/archive-entry pkg-info 'single)))
((< 1 (length files))
(let* ((tmp-dir (file-name-as-directory (make-temp-file package-name t)))
(pkg-dir-name (concat package-name "-" version))
(pkg-tmp-dir (expand-file-name pkg-dir-name tmp-dir))
(pkg-file (concat package-name "-pkg.el"))
(pkg-file-source (or (pb/find-source-file pkg-file files)
pkg-file))
(file-source (concat package-name ".el"))
(pkg-source (or (pb/find-source-file file-source files)
file-source))
(pkg-info (pb/merge-package-info
(let ((default-directory source-dir))
(or (pb/get-pkg-file-info pkg-file-source)
;; some packages (like magit) provide name-pkg.el.in
(pb/get-pkg-file-info
(expand-file-name (concat pkg-file ".in")
(file-name-directory pkg-source)))
(pb/get-package-info pkg-source)))
package-name
version)))
(pb/copy-package-files files source-dir pkg-tmp-dir)
(pb/write-pkg-file (expand-file-name pkg-file
(file-name-as-directory pkg-tmp-dir))
pkg-info)
(pb/generate-info-files files source-dir pkg-tmp-dir)
(pb/generate-dir-file files pkg-tmp-dir)
(let ((default-directory tmp-dir))
(pb/create-tar (expand-file-name (concat package-name "-" version ".tar")
target-dir)
pkg-dir-name))
(let ((default-directory source-dir))
(pb/write-pkg-readme target-dir
(pb/find-package-commentary pkg-source)
package-name))
(delete-directory pkg-tmp-dir t)
(pb/archive-entry pkg-info 'tar)))
(t (error "Unable to find files matching recipe patterns")))))
;;; Helpers for recipe authors
@ -931,7 +980,7 @@ and a cl struct in Emacs HEAD. This wrapper normalises the results."
(insert (pp-to-string template))
(emacs-lisp-mode)
(package-build-minor-mode)
(beginning-of-buffer))))
(goto-char (point-min)))))
;;;###autoload
(defun package-build-current-recipe ()
@ -949,11 +998,9 @@ and a cl struct in Emacs HEAD. This wrapper normalises the results."
(package-build-reinitialize)
(let ((pkg-name (intern (file-name-nondirectory (buffer-file-name)))))
(package-build-archive pkg-name)
(save-current-buffer
(switch-to-buffer-other-window
(find-file-noselect
(expand-file-name "archive-contents" package-build-archive-dir) t))
(revert-buffer t t))
(package-build-dump-archive-contents)
(with-output-to-temp-buffer "*package-build-result*"
(pp (assoc pkg-name (package-build-archive-alist))))
(when (yes-or-no-p "Install new package? ")
(package-install-file (pb/find-package-file pkg-name)))))
@ -969,7 +1016,7 @@ and a cl struct in Emacs HEAD. This wrapper normalises the results."
(condition-case err
(package-build-archive pkg)
(error
(message "%s" (error-message-string err))
(pb/message "%s" (error-message-string err))
nil))))
@ -992,11 +1039,11 @@ and a cl struct in Emacs HEAD. This wrapper normalises the results."
"Remove previously-built packages that no longer have recipes."
(interactive)
(let* ((known-package-names (mapcar 'car (package-build-recipe-alist)))
(stale-archives (cl-loop for built in (package-build-archive-alist)
(stale-archives (cl-loop for built in (pb/archive-entries)
when (not (memq (car built) known-package-names))
collect built)))
(mapc 'pb/remove-archive stale-archives)
(pb/dump-archive-contents)))
(mapc 'pb/remove-archive-files stale-archives)
(package-build-dump-archive-contents)))
(defun package-build-recipe-alist ()
"Retun the list of avalailable packages."
@ -1005,42 +1052,57 @@ and a cl struct in Emacs HEAD. This wrapper normalises the results."
pb/recipe-alist-initialized t))
pb/recipe-alist)
(defun package-build-archive-alist-remove (elt)
"Remove ELT from the archive list using `remove' and return the new value."
(setq pb/archive-alist (remove elt pb/archive-alist)))
(defun package-build-archive-alist-add (elt)
"Add ELT to the archive list if it isn't there yet and return the new value."
(add-to-list 'pb/archive-alist elt))
(defun package-build-archive-alist ()
"Return the archive list."
(unless pb/archive-alist-initialized
(setq pb/archive-alist
(cdr (pb/read-from-file
(expand-file-name "archive-contents"
package-build-archive-dir)))
pb/archive-alist-initialized t))
pb/archive-alist)
(cdr (pb/read-from-file
(expand-file-name "archive-contents"
package-build-archive-dir))))
(defun package-build-reinitialize ()
"Forget any information about packages which have already been built."
(interactive)
(setq pb/recipe-alist-initialized nil
pb/archive-alist-initialized nil))
(setq pb/recipe-alist-initialized nil))
(defun package-build-dump-archive-contents (&optional file-name)
"Dump the list of built packages to FILE-NAME.
If FILE-NAME is not specified, the default archive-contents file is used."
(pb/dump (cons 1 (pb/archive-entries))
(or file-name
(expand-file-name "archive-contents" package-build-archive-dir))))
(defun pb/archive-entries ()
"Read all .entry files from the archive directory and return a list of all entries."
(let ((entries '()))
(dolist (new (mapcar 'pb/read-from-file
(directory-files package-build-archive-dir t
".*\.entry$"))
entries)
(let ((old (assq (car new) entries)))
(when old
(when (version-list-< (package-desc-vers (cdr new))
(package-desc-vers (cdr old)))
;; swap old and new
(cl-rotatef old new))
(pb/remove-archive-files old)
(setq entries (remove old entries)))
(add-to-list 'entries new)))))
;; Utility functions
(require 'json)
(load (expand-file-name "json-fix" pb/this-dir))
(load (expand-file-name "json-fix" pb/this-dir) nil 'nomessage)
(defun package-build-recipe-alist-as-json (fn)
(defun package-build-recipe-alist-as-json (file-name)
"Dump the recipe list to FILE-NAME as json."
(interactive)
(with-temp-file fn
(with-temp-file file-name
(insert (json-encode (package-build-recipe-alist)))))
(defun package-build-archive-alist-as-json (fn)
(defun package-build-archive-alist-as-json (file-name)
"Dump the build packages list to FILE-NAME as json."
(interactive)
(with-temp-file fn
(with-temp-file file-name
(insert (json-encode (package-build-archive-alist)))))

View file

@ -1,10 +1,11 @@
((nil . ((eval . (when (and (buffer-file-name)
(file-regular-p (buffer-file-name))
(string-match-p "^[^.]" (buffer-file-name)))
(emacs-lisp-mode)
(when (fboundp 'flycheck-mode)
(flycheck-mode -1))
(unless (featurep 'package-build)
(let ((load-path (cons ".." load-path)))
(require 'package-build)))
(package-build-minor-mode))))))
((emacs-lisp-mode . ((flycheck-disabled-checkers '(emacs-lisp emacs-lisp-checkdoc))))
(nil . ((eval . (when (and (buffer-file-name)
(file-regular-p (buffer-file-name))
(string-match-p "^[^.]" (buffer-file-name)))
(emacs-lisp-mode)
(when (fboundp 'flycheck-mode)
(flycheck-mode -1))
(unless (featurep 'package-build)
(let ((load-path (cons ".." load-path)))
(require 'package-build)))
(package-build-minor-mode))))))

1
recipes/abl-mode Normal file
View file

@ -0,0 +1 @@
(abl-mode :fetcher github :repo "afroisalreadyinu/abl-mode")

View file

@ -0,0 +1 @@
(ac-cider-compliment :fetcher github :repo "alexander-yakushev/ac-cider-compliment")

1
recipes/ac-etags Normal file
View file

@ -0,0 +1 @@
(ac-etags :fetcher github :repo "syohex/emacs-ac-etags")

1
recipes/ac-inf-ruby Normal file
View file

@ -0,0 +1 @@
(ac-inf-ruby :fetcher github :repo "purcell/ac-inf-ruby")

1
recipes/ac-ispell Normal file
View file

@ -0,0 +1 @@
(ac-ispell :fetcher github :repo "syohex/emacs-ac-ispell")

1
recipes/ac-octave Normal file
View file

@ -0,0 +1 @@
(ac-octave :fetcher github :repo "coldnew/ac-octave")

View file

@ -1 +0,0 @@
(achievements-mode :fetcher github :repo "Fuco1/achievements-mode")

1
recipes/afternoon-theme Normal file
View file

@ -0,0 +1 @@
(afternoon-theme :fetcher github :repo "osener/emacs-afternoon-theme")

1
recipes/ant Normal file
View file

@ -0,0 +1 @@
(ant :fetcher github :repo "apgwoz/ant-el")

1
recipes/anx-api Normal file
View file

@ -0,0 +1 @@
(anx-api :fetcher github :repo "rmloveland/emacs-appnexus-api")

2
recipes/anyins Normal file
View file

@ -0,0 +1,2 @@
(anyins :fetcher github
:repo "antham/anyins")

View file

@ -0,0 +1,2 @@
(anything-prosjekt :fetcher github :repo "abingham/prosjekt"
:files ("prosjekt/ext/anything/anything-prosjekt.el"))

1
recipes/apples-mode Normal file
View file

@ -0,0 +1 @@
(apples-mode :fetcher github :repo "tequilasunset/apples-mode" :files ("*.el" "apples-mode"))

1
recipes/arduino-mode Normal file
View file

@ -0,0 +1 @@
(arduino-mode :fetcher github :repo "bookest/arduino-mode")

1
recipes/ariadne Normal file
View file

@ -0,0 +1 @@
(ariadne :fetcher github :repo "manzyuk/ariadne-el")

1
recipes/asn1-mode Normal file
View file

@ -0,0 +1 @@
(asn1-mode :fetcher github :repo "kawabata/asn1-mode")

1
recipes/aurel Normal file
View file

@ -0,0 +1 @@
(aurel :repo "alezost/aurel" :fetcher github)

View file

@ -0,0 +1,3 @@
(auto-complete-auctex
:repo "monsanto/auto-complete-auctex"
:fetcher github)

View file

@ -0,0 +1 @@
(auto-complete-c-headers :fetcher github :repo "mooz/auto-complete-c-headers")

View file

@ -0,0 +1,2 @@
(auto-complete-chunk :fetcher github :repo "tkf/auto-complete-chunk"
:files ("auto-complete-chunk.el"))

View file

@ -0,0 +1,2 @@
(auto-complete-rst :fetcher github :repo "tkf/auto-complete-rst"
:files ("*.el" "*.py"))

1
recipes/babel Normal file
View file

@ -0,0 +1 @@
(babel :fetcher github :repo "juergenhoetzel/babel")

2
recipes/bbdb- Normal file
View file

@ -0,0 +1,2 @@
(bbdb- :repo "aki2o/bbdb-"
:fetcher github)

1
recipes/bert Normal file
View file

@ -0,0 +1 @@
(bert :fetcher github :repo "manzyuk/bert-el")

1
recipes/bracketed-paste Normal file
View file

@ -0,0 +1 @@
(bracketed-paste :fetcher github :repo "hchbaw/bracketed-paste.el")

3
recipes/brainfuck-mode Normal file
View file

@ -0,0 +1,3 @@
(brainfuck-mode
:repo "tom-tan/brainfuck-mode"
:fetcher github)

View file

@ -0,0 +1 @@
(bubbleberry-theme :fetcher github :repo "jasonm23/emacs-bubbleberry-theme")

1
recipes/buffer-buttons Normal file
View file

@ -0,0 +1 @@
(buffer-buttons :fetcher github :repo "rpav/buffer-buttons")

1
recipes/cdnjs Normal file
View file

@ -0,0 +1 @@
(cdnjs :fetcher github :repo "yasuyk/cdnjs.el")

1
recipes/cedit Normal file
View file

@ -0,0 +1 @@
(cedit :fetcher github :repo "zk-phi/cedit")

2
recipes/centimacro Normal file
View file

@ -0,0 +1,2 @@
(centimacro :repo "abo-abo/centimacro"
:fetcher github)

View file

@ -0,0 +1,2 @@
(cfengine-code-style :repo "cfengine/core" :fetcher github
:files ("contrib/cfengine-code-style.el"))

View file

@ -0,0 +1 @@
(cherry-blossom-theme :fetcher github :repo "byels/emacs-cherry-blossom-theme")

1
recipes/chruby Normal file
View file

@ -0,0 +1 @@
(chruby :repo "plexus/chruby.el" :fetcher github)

1
recipes/clevercss Normal file
View file

@ -0,0 +1 @@
(clevercss :fetcher github :repo "jschaf/CleverCSS-Mode")

1
recipes/cm-mode Normal file
View file

@ -0,0 +1 @@
(cm-mode :fetcher github :repo "joostkremers/criticmarkup-emacs")

1
recipes/cmake-mode Normal file
View file

@ -0,0 +1 @@
(cmake-mode :fetcher github :repo "Kitware/CMake" :files ("Auxiliary/*.el"))

1
recipes/cobra-mode Normal file
View file

@ -0,0 +1 @@
(cobra-mode :fetcher github :repo "Nekroze/cobra-mode")

View file

@ -0,0 +1,3 @@
(color-identifiers-mode
:fetcher github
:repo "ankurdave/color-identifiers-mode")

View file

@ -0,0 +1 @@
(column-enforce-mode :fetcher github :repo "jordonbiondo/column-enforce-mode")

1
recipes/command-log-mode Normal file
View file

@ -0,0 +1 @@
(command-log-mode :fetcher github :repo "lewang/command-log-mode")

1
recipes/company-cider Normal file
View file

@ -0,0 +1 @@
(company-cider :fetcher github :repo "clojure-emacs/company-cider")

2
recipes/company-go Normal file
View file

@ -0,0 +1,2 @@
(company-go :repo "nsf/gocode" :fetcher github
:files ("emacs-company/company-go.el"))

4
recipes/company-jedi Normal file
View file

@ -0,0 +1,4 @@
(company-jedi
:fetcher "github"
:repo "proofit404/company-jedi"
:files ("start_jedi" "company-jedi.el" "Makefile" "requirements.txt"))

1
recipes/company-tern Normal file
View file

@ -0,0 +1 @@
(company-tern :fetcher "github" :repo "proofit404/company-tern")

1
recipes/creole-mode Normal file
View file

@ -0,0 +1 @@
(creole-mode :fetcher github :repo "nicferrier/creole-mode")

1
recipes/cssh Normal file
View file

@ -0,0 +1 @@
(cssh :fetcher github :repo "dimitri/cssh")

1
recipes/ctl-mode Normal file
View file

@ -0,0 +1 @@
(ctl-mode :fetcher github :repo "yyr/emacs-grads" :files ("ctl-mode.el"))

2
recipes/ctxmenu Normal file
View file

@ -0,0 +1,2 @@
(ctxmenu :repo "aki2o/emacs-ctxmenu"
:fetcher github)

3
recipes/cursor-test Normal file
View file

@ -0,0 +1,3 @@
(cursor-test :repo "ainame/cursor-test.el"
:fetcher github
:files ("cursor-test.el"))

1
recipes/cycbuf Normal file
View file

@ -0,0 +1 @@
(cycbuf :repo "martinp26/cycbuf" :fetcher github)

1
recipes/cypher-mode Normal file
View file

@ -0,0 +1 @@
(cypher-mode :repo "fxbois/cypher-mode" :fetcher github)

2
recipes/cython-mode Normal file
View file

@ -0,0 +1,2 @@
(cython-mode :fetcher github :repo "cython/cython"
:files ("Tools/*.el"))

3
recipes/dakrone-theme Normal file
View file

@ -0,0 +1,3 @@
(dakrone-theme
:fetcher github
:repo "dakrone/dakrone-theme")

2
recipes/darkburn-theme Normal file
View file

@ -0,0 +1,2 @@
(darkburn-theme :repo "gorauskas/darkburn-theme"
:fetcher github)

4
recipes/dayone Normal file
View file

@ -0,0 +1,4 @@
(dayone
:repo "mori-dev/emacs-dayone"
:fetcher github
:files ("*.el" "*.mustache"))

1
recipes/db-pg Normal file
View file

@ -0,0 +1 @@
(db-pg :fetcher github :repo "nicferrier/emacs-db-pg")

1
recipes/debpaste Normal file
View file

@ -0,0 +1 @@
(debpaste :repo "alezost/debpaste.el" :fetcher github)

1
recipes/debug-print Normal file
View file

@ -0,0 +1 @@
(debug-print :fetcher github :repo "kenoss/debug-print")

4
recipes/decl Normal file
View file

@ -0,0 +1,4 @@
(decl
:repo "preetpalS/decl.el"
:fetcher github
:files ("decl.el"))

1
recipes/dedukti-mode Normal file
View file

@ -0,0 +1 @@
(dedukti-mode :fetcher github :repo "rafoo/dedukti-mode")

3
recipes/demangle-mode Normal file
View file

@ -0,0 +1,3 @@
(demangle-mode
:fetcher github
:repo "liblit/demangle-mode")

1
recipes/dired-avfs Normal file
View file

@ -0,0 +1 @@
(dired-avfs :fetcher github :repo "Fuco1/dired-hacks" :files ("dired-avfs.el"))

1
recipes/dired-filter Normal file
View file

@ -0,0 +1 @@
(dired-filter :fetcher github :repo "Fuco1/dired-hacks" :files ("dired-filter.el"))

View file

@ -0,0 +1 @@
(dired-hacks-utils :fetcher github :repo "Fuco1/dired-hacks" :files ("dired-hacks-utils.el"))

3
recipes/dired-imenu Normal file
View file

@ -0,0 +1,3 @@
(dired-imenu :fetcher github
:repo "DamienCassou/dired-imenu"
:files ("dired-imenu.el"))

1
recipes/dired-open Normal file
View file

@ -0,0 +1 @@
(dired-open :fetcher github :repo "Fuco1/dired-hacks" :files ("dired-open.el"))

1
recipes/dired-rainbow Normal file
View file

@ -0,0 +1 @@
(dired-rainbow :fetcher github :repo "Fuco1/dired-hacks" :files ("dired-rainbow.el"))

1
recipes/dirtree Normal file
View file

@ -0,0 +1 @@
(dirtree :fetcher wiki)

2
recipes/dirtree-prosjekt Normal file
View file

@ -0,0 +1,2 @@
(dirtree-prosjekt :fetcher github :repo "abingham/prosjekt"
:files ("prosjekt/ext/dirtree/dirtree-prosjekt.el"))

1
recipes/discover Normal file
View file

@ -0,0 +1 @@
(discover :fetcher github :repo "mickeynp/discover.el")

View file

@ -0,0 +1 @@
(discover-js2-refactor :repo "NicolasPetton/discover-js2-refactor" :fetcher github)

1
recipes/display-theme Normal file
View file

@ -0,0 +1 @@
(display-theme :fetcher github :repo "kawabata/emacs-display-theme")

1
recipes/django-mode Normal file
View file

@ -0,0 +1 @@
(django-mode :fetcher github :repo "myfreeweb/django-mode" :files ("*.el" (:exclude "*-snippets.el")))

1
recipes/django-snippets Normal file
View file

@ -0,0 +1 @@
(django-snippets :fetcher github :repo "myfreeweb/django-mode" :files ("django-snippets.el" "snippets"))

1
recipes/dklrt Normal file
View file

@ -0,0 +1 @@
(dklrt :fetcher github :repo "davidkeegan/dklrt" :files ("*.el" "*.texi" "dir" "*.py"))

View file

@ -1,2 +1 @@
(dkmisc :fetcher github :repo "davidkeegan/dkmisc")

View file

@ -1 +0,0 @@
(docker-mode :fetcher github :repo "justinabrahms/docker-mode")

1
recipes/dokuwiki-mode Normal file
View file

@ -0,0 +1 @@
(dokuwiki-mode :fetcher github :repo "kbkbkbkb1/emacs-dokuwiki-mode")

1
recipes/dos Normal file
View file

@ -0,0 +1 @@
(dos :fetcher wiki)

1
recipes/download-region Normal file
View file

@ -0,0 +1 @@
(download-region :fetcher github :repo "zk-phi/download-region")

1
recipes/downplay-mode Normal file
View file

@ -0,0 +1 @@
(downplay-mode :fetcher github :repo "tobias/downplay-mode")

2
recipes/dtrt-indent Normal file
View file

@ -0,0 +1,2 @@
(dtrt-indent :fetcher github :repo "jscheid/dtrt-indent")

1
recipes/dummyparens Normal file
View file

@ -0,0 +1 @@
(dummyparens :fetcher github :repo "snosov1/dummyparens")

1
recipes/el-sprunge Normal file
View file

@ -0,0 +1 @@
(el-sprunge :fetcher github :repo "eschulte/el-sprunge")

1
recipes/el-spy Normal file
View file

@ -0,0 +1 @@
(el-spy :fetcher github :repo "uk-ar/el-spy")

1
recipes/elm-mode Normal file
View file

@ -0,0 +1 @@
(elm-mode :fetcher github :repo "jcollard/elm-mode")

View file

@ -1,5 +1,5 @@
(elnode
:fetcher github
:repo "nicferrier/elnode"
:commit "origin/melpa"
:branch "melpa"
:files ("*"))

Some files were not shown because too many files have changed in this diff Show more