/
pkgbuild-mode.el
573 lines (483 loc) · 21.2 KB
/
pkgbuild-mode.el
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
;;; pkgbuild-mode.el --- Interface to the ArchLinux package manager
;; $Id: pkgbuild-mode.el,v 1.23 2007/10/20 16:02:14 juergen Exp $
;; Copyright (C) 2005-2010 Juergen Hoetzel
;;; License
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;; You should have received a copy of the GNU General Public License
;; along with this program; if not, write to the Free Software
;; Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
;;; TODO
;; - menu
;; - namcap/devtools integration
;; - use auto-insert
;;; Commentary:
;; This package provides an interface to the ArchLinux package manager.
;; Put this in your .emacs file to enable autoloading of pkgbuild-mode
;; and auto-recognition of "PKGBUILD" files:
;;
;; (autoload 'pkgbuild-mode "pkgbuild-mode.el" "PKGBUILD mode." t)
;; (setq auto-mode-alist (append '(("/PKGBUILD$" . pkgbuild-mode))
;; auto-mode-alist))
;;; Changelog:
;; 0.10
;; made the calculation of sums generic (use makepkg.conf setting)
;; 0.9
;; fixed `pkgbuild-tar' (empty directory name: thanks Stefan Husmann)
;; new custom variable: pkgbuild-template
;; code cleanup
;; 0.8
;; added `pkgbuild-shell-command' and
;; `pkgbuild-shell-command-to-string' (required to always use
;; "/bin/bash" when calling shell functions, which create new
;; buffers)
;; 0.7 make shell-file-name buffer-local set to "/bin/bash" (required
;; to parse PKGBUILDs)
;; 0.6
;; New interactive function pkgbuild-etags (C-c C-e)
;; create tags table for all PKGBUILDs in your source tree, so you
;; can search PKGBUILDs by pkgname. Customize your tags-table-list
;; to include the TAGS file in your source tree.
;; changed default makepkg-command (disabled ANSI colors in emacs TERM)
;; set default indentation to 2
;; 0.5
;; New interactive function pkgbuild-browse-url to visit project's website (C-c C-u).
;; Customize your browse-url-browser-function
;; emacs 22 (cvs snapshot) compatibility: ensure makepkg buffer is not read-only
;; 0.4
;; handle source parse errors when updating md5sums and opening PKGBUILDs
;; only update md5sums if all sources are available
;; code cleanup
;; highlight sources not available when trying to update md5sums and opening PKGBUILDs (this does not work when globbing returns multiple filenames)
;; 0.3
;; Update md5sums line when saving PKGBUILD
;; (Can be disabled via custom variable [pkgbuild-update-md5sums-on-save])
;; New interactive function pkgbuild-tar to create Source Tarball (C-c C-a)
;; (Usefull for AUR uploads)
;; Insert warn-messages in md5sums line when source files are not present
;; Several bug fixes
;;; Code
(require 'cl)
(require 'sh-script)
(require 'advice)
(require 'compile)
(defconst pkgbuild-mode-version "0.10" "Version of `pkgbuild-mode'.")
(defconst pkgbuild-mode-menu
(purecopy '("PKGBUILD"
["Update sums" pkgbuild-update-sums-line t]
["Browse url" pkgbuild-browse-url t]
["Increase release tag" pkgbuild-increase-release-tag t]
"---"
("Build package"
["Build tarball" pkgbuild-tar t]
["Build binary package" pkgbuild-makepkg t])
"---"
["Creates TAGS file" pkgbuild-etags t]
"---"
["About pkgbuild-mode" pkgbuild-about-pkgbuild-mode t]
)))
;; Local variables
(defgroup pkgbuild nil
"pkgbuild mode (ArchLinux Packages)."
:prefix "pkgbuild-"
:group 'languages)
(defcustom pkgbuild-template
"# $Id: pkgbuild-mode.el,v 1.23 2007/10/20 16:02:14 juergen Exp $
# Maintainer: %s <%s>
pkgname=%s
pkgver=VERSION
pkgrel=1
pkgdesc=\"\"
arch=('i686' 'x86_64')
url=\"\"
license=('GPL')
groups=()
depends=()
makedepends=()
optdepends=()
provides=()
conflicts=()
replaces=()
backup=()
options=()
install=
changelog=
source=($pkgname-$pkgver.tar.gz)
noextract=()
md5sums=()
build() {
cd $startdir/src/$pkgname-$pkgver
./configure --prefix=/usr
make
}
package() {
cd $startdir/src/$pkgname-$pkgver
make DESTDIR=$startdir/pkg install
}
# vim:set ts=2 sw=2 et:
"
"Template for new PKGBUILDs"
:type 'string
:group 'pkgbuild)
(defcustom pkgbuild-etags-command "find %s -name PKGBUILD|xargs etags.emacs -o %s --language=none --regex='/pkgname=\\([^ \t]+\\)/\\1/'"
"pkgbuild-etags needs to call the find and the etags program. %s is
the placeholder for the toplevel directory and tagsfile"
:type 'string
:group 'pkgbuild)
(defcustom pkgbuild-initialize t
"Automatically add default headings to new pkgbuild files."
:type 'boolean
:group 'pkgbuild)
(defcustom pkgbuild-update-sums-on-save t
"*Non-nil means buffer-safe will call a hook to update the sums line."
:type 'boolean
:group 'pkgbuild)
(defcustom pkgbuild-read-makepkg-command t
"*Non-nil means \\[pkgbuild-makepkg] reads the makepkg command to use.
Otherwise, \\[pkgbuild-makepkg] just uses the value of `pkgbuild-makepkg-command'."
:type 'boolean
:group 'pkgbuild)
(defcustom pkgbuild-read-tar-command t
"*Non-nil means \\[pkgbuild-tar] reads the tar command to use."
:type 'boolean
:group 'pkgbuild)
(defcustom pkgbuild-makepkg-command "makepkg -m -f "
"Command to create an ArchLinux package."
:type 'string
:group 'pkgbuild)
(defcustom pkgbuild-user-full-name user-full-name
"*Full name of the user.
This is used in the Maintainer tag. It defaults to the
value of `user-full-name'."
:type 'string
:group 'pkgbuild)
(defcustom pkgbuild-user-mail-address user-mail-address
"*Email address of the user.
This is used in the Maintainer tag. It defaults to the
value of `user-mail-address'."
:type 'string
:group 'pkgbuild)
(defcustom pkgbuild-source-directory-locations ".:src:/var/cache/pacman/src"
"search path for PKGBUILD source files"
:type 'string
:group 'pkgbuild)
(defcustom pkgbuild-sums-command "makepkg -g 2>/dev/null"
"shell command to generate *sums lines"
:type 'string
:group 'pkgbuild)
(defcustom pkgbuild-ask-about-save t
"*Non-nil means \\[pkgbuild-makepkg] asks which buffers to save before starting packaging.
Otherwise, it saves all modified buffers without asking."
:type 'boolean
:group 'pkgbuild)
(defconst pkgbuild-bash-error-line-re
"PKGBUILD:[ \t]+line[ \t]\\([0-9]+\\):[ \t]"
"Regular expression that describes errors.")
(defvar pkgbuild-mode-map nil ; Create a mode-specific keymap.
"Keymap for pkgbuild mode.")
(defface pkgbuild-error-face '((t (:underline "red")))
"Face for PKGBUILD errors."
:group 'pkgbuild)
(defvar pkgbuild-makepkg-history nil)
(defvar pkgbuild-hashtype "md5")
(defvar pkgbuild-in-hook-recursion nil) ;avoid recursion
(defvar pkgbuild-emacs ;helper variable for xemacs compatibility
(cond
((string-match "XEmacs" emacs-version)
'xemacs)
(t
'emacs))
"The type of Emacs we are currently running.")
(unless pkgbuild-mode-map ; Do not change the keymap if it is already set up.
(setq pkgbuild-mode-map (make-sparse-keymap))
(define-key pkgbuild-mode-map "\C-c\C-r" 'pkgbuild-increase-release-tag)
(define-key pkgbuild-mode-map "\C-c\C-b" 'pkgbuild-makepkg)
(define-key pkgbuild-mode-map "\C-c\C-a" 'pkgbuild-tar)
(define-key pkgbuild-mode-map "\C-c\C-u" 'pkgbuild-browse-url)
(define-key pkgbuild-mode-map "\C-c\C-m" 'pkgbuild-update-sums-line)
(define-key pkgbuild-mode-map "\C-c\C-e" 'pkgbuild-etags)
)
(defun pkgbuild-trim-right (str) ;Helper function
"Trim whitespace from end of the string"
(if (string-match "[ \f\t\n\r\v]+$" str -1)
(pkgbuild-trim-right (substring str 0 -1))
str))
(defun pkgbuild-source-points()
(interactive)
(save-excursion
(goto-char (point-min))
(if (search-forward-regexp "^\\s-*source=(\\([^()]*\\))" (point-max) t)
(let ((l (list (match-beginning 1) (match-end 1)))
(end (match-end 1)))
(goto-char (match-beginning 1))
(while (search-forward-regexp "\\(\\\\[ \f\t\n\r\v]\\|[ \f\t\n\r\v]\\)+" end t)
(setcdr (last l 2) (cons (match-beginning 0) (cdr (last l 2))))
(setcdr (last l 2) (cons (match-end 1) (cdr (last l 2)))))
l)
nil)))
(defun pkgbuild-source-locations()
"find source regions"
(delete-if (lambda (region) (= (car region) (cdr region))) (loop for item on (pkgbuild-source-points) by 'cddr collect (cons (car item) (cadr item)))))
(defun pkgbuild-shell-command-to-string(COMMAND)
"same as `shell-command-to-string' always uses '/bin/bash'"
(let ((shell-file-name "/bin/bash"))
(shell-command-to-string COMMAND)))
(defun pkgbuild-shell-command (COMMAND &optional OUTPUT-BUFFER ERROR-BUFFER)
"same as `shell-command' always uses '/bin/bash'"
(let ((shell-file-name "/bin/bash"))
(shell-command COMMAND OUTPUT-BUFFER ERROR-BUFFER)))
(defun pkgbuild-source-check ()
"highlight sources not available. Return true if all sources are available. This does not work if globbing returns multiple files"
(interactive)
(save-excursion
(goto-char (point-min))
(pkgbuild-delete-all-overlays)
(if (search-forward-regexp "^\\s-*source=(\\([^()]*\\))" (point-max) t)
(let ((all-available t)
(sources (split-string (pkgbuild-shell-command-to-string "source PKGBUILD 2>/dev/null && for source in ${source[@]};do echo $source|sed 's|^.*://.*/||g';done")))
(sources-renamed (split-string (pkgbuild-shell-command-to-string "source PKGBUILD 2>/dev/null && for source in ${source[@]};do echo $source|sed 's|::.*://.*||g';done")))
(source-locations (pkgbuild-source-locations)))
(if (= (length sources) (length source-locations))
(progn
(loop for source in sources
for source-renamed in sources-renamed
for source-location in source-locations
do (when (and (not (pkgbuild-find-file source (split-string pkgbuild-source-directory-locations ":")))
(not (pkgbuild-find-file source-renamed (split-string pkgbuild-source-directory-locations ":"))))
(progn
(setq all-available nil)
(pkgbuild-make-overlay (car source-location) (cdr source-location)))))
all-available)
(progn
(message "cannot verfify sources: don't use globbing %d/%d" (length sources) (length source-locations))
nil)))
(progn
(message "no source line found")
nil))))
(defun pkgbuild-delete-all-overlays ()
"Delete all the overlays used by pkgbuild-mode."
(interactive) ;test
(let ((l (overlays-in (point-min) (point-max))))
(while (consp l)
(progn
(if (pkgbuild-overlay-p (car l))
(delete-overlay (car l)))
(setq l (cdr l))))))
(defun pkgbuild-overlay-p (o)
"A predicate that return true iff O is an overlay used by pkgbuild-mode."
(and (overlayp o) (overlay-get o 'pkgbuild-overlay)))
(defun pkgbuild-make-overlay (beg end)
"Allocate an overlay to highlight. BEG and END specify the range in the buffer."
(let ((pkgbuild-overlay (make-overlay beg end nil t nil)))
(overlay-put pkgbuild-overlay 'face 'pkgbuild-error-face)
(overlay-put pkgbuild-overlay 'pkgbuild-overlay t)
pkgbuild-overlay))
(defun pkgbuild-find-file (file locations)
"Find file in multible locations"
(remove-if-not 'file-readable-p (mapcar (lambda (dir) (expand-file-name file dir)) locations)))
(defun pkgbuild-sums-line ()
"calculate *sums=() line in PKGBUILDs"
(pkgbuild-shell-command-to-string pkgbuild-sums-command))
(defun pkgbuild-update-sums-line ()
"Update the sums line in a PKGBUILD."
(interactive)
(if (not (file-readable-p "PKGBUILD")) (error "Missing PKGBUILD")
(if (not (pkgbuild-syntax-check)) (error "Syntax Error")
(if (pkgbuild-source-check) ;all sources available
(save-excursion
(goto-char (point-min))
(while (re-search-forward "^[[:alnum:]]+sums=([^()]*)[ \f\t\r\v]*\n?" (point-max) t) ;sum line exists
(delete-region (match-beginning 0) (match-end 0)))
(goto-char (point-min))
(if (re-search-forward "^source=([^()]*)" (point-max) t)
(insert "\n")
(error "Missing source line"))
(insert (pkgbuild-trim-right (pkgbuild-sums-line))))))))
(defun pkgbuild-about-pkgbuild-mode (&optional arg)
"About `pkgbuild-mode'."
(interactive "p")
(message
(concat "pkgbuild-mode version "
pkgbuild-mode-version
" by Juergen Hoetzel, <juergen@hoetzel.info>")))
(defun pkgbuild-update-sums-line-hook ()
"Update sum lines if the file was modified"
(if (and pkgbuild-update-sums-on-save (not pkgbuild-in-hook-recursion))
(progn
(setq pkgbuild-in-hook-recursion t)
(save-buffer) ;always save BUFFER 2 times so we get the correct sums in this hook
(setq pkgbuild-in-hook-recursion nil)
(pkgbuild-update-sums-line))))
(defun pkgbuild-initialize ()
"Create a default pkgbuild if one does not exist or is empty."
(interactive)
(insert (format pkgbuild-template
pkgbuild-user-full-name
pkgbuild-user-mail-address
(or (pkgbuild-get-directory (buffer-file-name)) "NAME"))))
(defun pkgbuild-process-check (buffer)
"Check if BUFFER has a running process.
If so, give the user the choice of aborting the process or the current
command."
(let ((process (get-buffer-process (get-buffer buffer))))
(if (and process (eq (process-status process) 'run))
(if (yes-or-no-p (concat "Process `" (process-name process)
"' running. Kill it? "))
(delete-process process)
(error "Cannot run two simultaneous processes ...")))))
(defun pkgbuild-get-directory (buffer-file-name)
(car (last (split-string (file-name-directory (buffer-file-name)) "/" t))))
(defun pkgbuild-makepkg (command)
"Build this package."
(interactive
(if pkgbuild-read-makepkg-command
(list (read-from-minibuffer "makepkg command: "
(eval pkgbuild-makepkg-command)
nil nil '(pkgbuild-makepkg-history . 1)))
(list (eval pkgbuild-makepkg-command))))
(save-some-buffers (not pkgbuild-ask-about-save) nil)
(if (file-readable-p "PKGBUILD")
(let ((pkgbuild-buffer-name (concat "*" command " " (pkgbuild-get-directory buffer-file-name) "*")))
(pkgbuild-process-check pkgbuild-buffer-name)
(if (get-buffer pkgbuild-buffer-name)
(kill-buffer pkgbuild-buffer-name))
(get-buffer-create pkgbuild-buffer-name)
(display-buffer pkgbuild-buffer-name)
(with-current-buffer pkgbuild-buffer-name
(compilation-mode)
(toggle-read-only -1))
(let ((process
(start-process-shell-command "makepkg" pkgbuild-buffer-name
command)))
(set-process-filter process 'pkgbuild-command-filter)))
(error "No PKGBUILD in current directory")))
(defun pkgbuild-command-filter (process string)
"Filter to process normal output."
(save-excursion
(set-buffer (process-buffer process))
(save-excursion
(goto-char (process-mark process))
(comint-watch-for-password-prompt string)
(insert-before-markers string)
(set-marker (process-mark process) (point)))))
(defun pkgbuild-increase-release-tag ()
"Increase the release tag by 1."
(interactive)
(save-excursion
(goto-char (point-min))
(if (search-forward-regexp "^pkgrel=[ \t]*\\([0-9]+\\)[ \t]*$" nil t)
(let ((release (1+ (string-to-number (match-string 1)))))
(setq release (int-to-string release))
(replace-match (concat "pkgrel=" release))
(message (concat "Release tag changed to " release ".")))
(message "No Release tag found..."))))
(defun pkgbuild-syntax-check ()
"evaluate PKGBUILD and search stderr for errors"
(interactive)
(let (
(stderr-buffer (concat "*PKGBUILD(" (pkgbuild-get-directory (buffer-file-name)) ") stderr*"))
(stdout-buffer (concat "*PKGBUILD(" (pkgbuild-get-directory (buffer-file-name)) ") stdout*")))
(if (get-buffer stderr-buffer) (kill-buffer stderr-buffer))
(if (get-buffer stdout-buffer) (kill-buffer stdout-buffer))
(if (not (equal
(flet ((message (arg &optional args) nil)) ;Hack disable empty output
(pkgbuild-shell-command "source PKGBUILD" stdout-buffer stderr-buffer))
0))
(multiple-value-bind (err-p line) (pkgbuild-postprocess-stderr stderr-buffer)
(if err-p
(goto-line line))
nil)
t)))
(defun pkgbuild-postprocess-stderr (buf) ;multiple values return
"Find errors in BUF.If an error occurred return multiple values (t line), otherwise return multiple values (nil line). BUF must exist."
(let (line err-p)
(save-excursion
(set-buffer buf)
(goto-char (point-min))
(if (re-search-forward pkgbuild-bash-error-line-re nil t)
(progn
(setq line (string-to-number (match-string 1)))
; (pkgbuild-highlight-line line) TODO
(setq err-p t)))
(values err-p line))))
(defun pkgbuild-tarball-files ()
"Return a list of required files for the tarball package"
(cons "PKGBUILD"
(remove-if (lambda (x) (string-match "^\\(https?\\|ftp\\)://" x))
(split-string (pkgbuild-shell-command-to-string
"source PKGBUILD 2>/dev/null && echo ${source[@]} $install")))))
(defun pkgbuild-tar-command ()
"Return default tar command"
(let* ((tarball-files (pkgbuild-tarball-files))
(dir (car (last (split-string (file-name-directory (buffer-file-name)) "/" t)))))
(concat "tar cvzf " dir ".tar.gz -C .. "
(mapconcat (lambda (l) (concat dir "/" l)) tarball-files " "))))
(defun pkgbuild-tar (command)
"Build a tarball containing all required files to build the package."
(interactive
(if pkgbuild-read-tar-command
(list (read-from-minibuffer "tar command: "
(pkgbuild-tar-command)
nil nil '(pkgbuild-tar-history . 1)))
(list (pkgbuild-tar-command))))
(let (pkgbuild-buffer-name)
(save-some-buffers (not pkgbuild-ask-about-save) nil)
(or (file-readable-p "PKGBUILD") (error "No PKGBUILD in current directory"))
(setq pkgbuild-buffer-name "*tar*")
(pkgbuild-process-check pkgbuild-buffer-name)
(if (get-buffer pkgbuild-buffer-name)
(kill-buffer pkgbuild-buffer-name))
(create-file-buffer pkgbuild-buffer-name)
(display-buffer pkgbuild-buffer-name)
(save-excursion
(set-buffer (get-buffer pkgbuild-buffer-name))
(goto-char (point-max)))
(let ((process
(start-process-shell-command "tar" pkgbuild-buffer-name
command)))
(set-process-filter process 'pkgbuild-command-filter))))
(defun pkgbuild-browse-url ()
"Vist URL (if defined in PKGBUILD)"
(interactive)
(let ((url (pkgbuild-shell-command-to-string (concat (buffer-string) "\nsource /dev/stdin >/dev/null 2>&1 && echo -n $url" ))))
(if (string= url "")
(message "No URL defined in PKGBUILD")
(browse-url url))))
;;;###autoload
(define-derived-mode pkgbuild-mode shell-script-mode "PKGBUILD"
"Major mode for editing PKGBUILD files. This is much like shell-script-mode mode.
Turning on pkgbuild mode calls the value of the variable `pkgbuild-mode-hook'
with no args, if that value is non-nil."
(require 'easymenu)
(easy-menu-define pkgbuild-call-menu pkgbuild-mode-map
"Post menu for `pkgbuild-mode'." pkgbuild-mode-menu)
(set (make-local-variable 'sh-basic-offset) 2) ;This is what judd uses
(sh-set-shell "/bin/bash")
(easy-menu-add pkgbuild-mode-menu)
;; This does not work because makepkg requires safed file
(add-hook 'local-write-file-hooks 'pkgbuild-update-sums-line-hook nil t)
(if (= (buffer-size) 0)
(pkgbuild-initialize)
(and (pkgbuild-syntax-check) (pkgbuild-source-check))))
(defadvice sh-must-be-shell-mode (around no-check-if-in-pkgbuild-mode activate)
"Do not check for shell-mode if major mode is \\[pkgbuild-makepkg]"
(if (not (eq major-mode 'pkgbuild-mode)) ;workaround for older shell-scrip-mode versions
ad-do-it))
(defun pkgbuild-etags (toplevel-directory)
"Create TAGS file by running `etags' recursively on the directory tree `pkgbuild-toplevel-directory'.
The TAGS file is also immediately visited with `visit-tags-table'."
(interactive "DToplevel directory: ")
(let* ((etags-file (expand-file-name "TAGS" toplevel-directory))
(cmd (format pkgbuild-etags-command toplevel-directory etags-file)))
(require 'etags)
(message "Running etags to create TAGS file: %s" cmd)
(pkgbuild-shell-command cmd)
(visit-tags-table etags-file)))
(provide 'pkgbuild-mode)
;;; pkgbuild-mode.el ends here