From 40f0e5eef359547baf64eaa2a3de8e7f9e4d6f47 Mon Sep 17 00:00:00 2001 From: Bozhidar Batsov Date: Wed, 11 Apr 2012 14:21:57 +0300 Subject: [PATCH] fixed #33 - added bazaar support --- package-build.el | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/package-build.el b/package-build.el index 996de5a7..bd8a7a5e 100644 --- a/package-build.el +++ b/package-build.el @@ -231,6 +231,34 @@ seconds; the server cuts off after 10 requests in 20 seconds.") (let* ((url (format "git://github.com/%s.git" (plist-get config :repo)))) (pb/checkout-git name (plist-put (copy-sequence config) :url url) dir))) +(defun pb/bzr-repo (dir) + "Get the current bzr repo for DIR." + (with-temp-buffer + (pb/run-process dir "bzr" "info") + (goto-char (point-min)) + (re-search-forward "parent branch: \\(.*\\)") + (match-string-no-properties 1))) + +(defun pb/checkout-bzr (name config dir) + "Check package NAME with config CONFIG out of bzr into DIR." + (let ((repo (plist-get config :url))) + (with-current-buffer (get-buffer-create "*package-build-checkout*") + (goto-char (point-max)) + (cond + ((and (file-exists-p (expand-file-name ".bzr" dir)) + (string-equal (pb/bzr-repo dir) repo)) + (print "checkout directory exists, updating...") + (pb/run-process dir "bzr" "merge")) + (t + (when (file-exists-p dir) + (delete-directory dir t nil)) + (print "cloning repository") + (pb/run-process nil "bzr" "branch" repo dir))) + (pb/run-process dir "bzr" "info" "-vv") + (pb/find-parse-time + "\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} [0-9]\\{2\\}:[0-9]\\{2\\}:[0-9]\\{2\\}\\)")))) + + (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)) @@ -278,6 +306,7 @@ The file is written to `package-build-working-dir'." "--exclude=.svn" "--exclude=.git*" "--exclude=_darcs" + "--exclude=.bzr" (or (mapcar (lambda (fn) (concat dir "/" fn)) files) (list dir)))))