Permalink
Browse files

build system to make a tar ball

  • Loading branch information...
1 parent e1d0baf commit e5d4c7013c9bca9d7bde38a1d2d7284f0c56d88a @nicferrier nicferrier committed Aug 12, 2012
Showing with 116 additions and 0 deletions.
  1. +49 −0 Makefile
  2. +2 −0 build-parts.txt
  3. +23 −0 build.el
  4. +41 −0 packagedir.el
  5. +1 −0 requirements.txt
View
@@ -0,0 +1,49 @@
+# package.el multi-file package install
+
+# These are the variables that are specific to the package
+NAME=mongo
+VERSION=0.2
+DOC="A MongoDB client."
+
+# Everything beyond here should be generic
+REQUIREMENTS=requirements.txt
+REQUIREMENTS_TEST=requirements-test.txt
+package_parts = $(shell cat build-parts.txt)
+PACKAGE=$(NAME)-$(VERSION)
+TARBALL=$(PACKAGE).tar
+
+all: tarball
+
+# Install the tarball in a test package store
+test: REQUIREMENTS=$(REQUIREMENTS_TEST)
+test: tarball
+ emacs -Q --batch -l ./packagedir.el -- $(TARBALL)
+
+# Install the tarball in the user's emacs
+install: tarball
+ emacs --batch -l ~/.emacs.d/init.el -l ./build.el -- $(TARBALL)
+
+# Really would like this to clean the elc files of the package_parts
+clean-elc:
+ rm -f *.elc
+
+clean: clean-elc
+ rm -rf .elpa
+ rm -rf $(TARBALL)
+ rm -rf $(PACKAGE)
+ rm -rf $(NAME)-pkg.el
+ rm -rf README
+
+tarball: $(TARBALL)
+
+$(TARBALL): $(PACKAGE) $(PACKAGE)/$(NAME)-pkg.el
+ tar cf $@ $<
+
+$(PACKAGE): $(package_parts)
+ mkdir $@
+ cp $(package_parts) $@
+
+$(PACKAGE)/$(NAME)-pkg.el:
+ echo "(define-package \"$(NAME)\" \"$(VERSION)\" \"$(DOC)\" `cat $(REQUIREMENTS)`)" > $@
+
+# End
View
@@ -0,0 +1,2 @@
+bson.el
+mongo.el
View
@@ -0,0 +1,23 @@
+;; Batch test web package
+(require 'cl)
+(setq base-dir (file-name-directory
+ (or (buffer-file-name)
+ load-file-name
+ default-directory)))
+(setq package-user-dir (concat base-dir ".elpa"))
+(setq package-archives
+ `(("local" . ,(concat base-dir "packages"))))
+(package-initialize)
+(package-refresh-contents)
+(destructuring-bind
+ (dashes tar-file-name &optional requirements) command-line-args-left
+ (let ((tar-package
+ (concat
+ (file-name-directory
+ (or (buffer-file-name)
+ load-file-name))
+ tar-file-name)))
+ (message "the package is: %s" tar-package)
+ (package-install-file tar-package)))
+
+;; End
View
@@ -0,0 +1,41 @@
+;; Sets the package store to a dummy location
+
+(setq package-user-dir
+ (concat
+ (file-name-directory
+ (or (buffer-file-name)
+ load-file-name
+ default-directory))
+ ".elpa"))
+(load-file "build.el")
+;; Load all the files in the list
+(flet ((map-regex (buffer regex fn)
+ (with-current-buffer buffer
+ (save-excursion
+ (goto-char (point-min))
+ (let (res)
+ (save-match-data
+ (while (re-search-forward regex nil t)
+ (let ((f (match-data)))
+ (setq res
+ (append res
+ (list
+ (save-match-data
+ (funcall fn f))))))))
+ res)))))
+ (map-regex
+ (find-file-noselect
+ (concat
+ (file-name-directory
+ (or (buffer-file-name)
+ load-file-name
+ default-directory)) "build-parts.txt"))
+ "^\\(.*.el\\(\\.gz\\)*\\)$"
+ (lambda (md)
+ (let ((filename (match-string 0)))
+ (when (file-exists-p filename)
+ (load-file filename))))))
+;; And now run the tests
+(ert-run-tests-batch-and-exit)
+
+;; End
View
@@ -0,0 +1 @@
+

0 comments on commit e5d4c70

Please sign in to comment.