Try to make it easier for when I update the build script template.
[pkgusr] / lisp / pkgusr.el
index e8fca3e..01c3c4f 100644 (file)
@@ -5,7 +5,7 @@
 ;; Author:     Steve Youngs <steve@sxemacs.org>
 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
 ;; Created:    <2007-07-13>
 ;; Author:     Steve Youngs <steve@sxemacs.org>
 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
 ;; Created:    <2007-07-13>
-;; Time-stamp: <Saturday Jun 23, 2012 13:56:29 steve>
+;; Time-stamp: <Sunday Feb  3, 2013 12:17:39 steve>
 ;; Homepage:   N/A
 ;; Keywords:   utils package-management
 
 ;; Homepage:   N/A
 ;; Keywords:   utils package-management
 
@@ -221,11 +221,12 @@ If non-interactive, return a list whose car is user and cdr is group."
   (let* ((allpkgs (pkgusr-all-pkgs))
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
   (let* ((allpkgs (pkgusr-all-pkgs))
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
-                                      nil t nil pkgusr-pkg-history))))
+                                      nil t nil pkgusr-pkg-history)))
+        (pkgfile (format "/usr/src/%s/.project" pkg)))
     (when (member pkg allpkgs)
       (with-temp-buffer
        (erase-buffer)
     (when (member pkg allpkgs)
       (with-temp-buffer
        (erase-buffer)
-       (insert (shell-command-to-string (format "pinky -l %s" pkg)))
+       (insert-file-contents pkgfile)
        (goto-char (point-min))
        (re-search-forward "Web_Site: <\\(.*\\)>$" nil t)
        (if (interactive-p)
        (goto-char (point-min))
        (re-search-forward "Web_Site: <\\(.*\\)>$" nil t)
        (if (interactive-p)
@@ -239,11 +240,12 @@ If non-interactive, return a list whose car is user and cdr is group."
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
                                       nil t nil pkgusr-pkg-history)))
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
                                       nil t nil pkgusr-pkg-history)))
+        (pkgfile (format "/usr/src/%s/.project" pkg))
         repo type)
     (when (member pkg allpkgs)
       (with-temp-buffer
        (erase-buffer)
         repo type)
     (when (member pkg allpkgs)
       (with-temp-buffer
        (erase-buffer)
-       (insert (shell-command-to-string (format "pinky -l %s" pkg)))
+       (insert-file-contents pkgfile)
        (goto-char (point-min))
        (re-search-forward "Repo_Type: <?\\(.*\\)>?$" nil t)
        (setq type (match-string 1))
        (goto-char (point-min))
        (re-search-forward "Repo_Type: <?\\(.*\\)>?$" nil t)
        (setq type (match-string 1))
@@ -259,11 +261,12 @@ If non-interactive, return a list whose car is user and cdr is group."
   (let* ((allpkgs (pkgusr-all-pkgs))
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
   (let* ((allpkgs (pkgusr-all-pkgs))
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
-                                      nil t nil pkgusr-pkg-history))))
+                                      nil t nil pkgusr-pkg-history)))
+        (pkgfile (format "/usr/src/%s/.project" pkg)))
     (if (member pkg allpkgs)
        (with-temp-buffer
          (erase-buffer)
     (if (member pkg allpkgs)
        (with-temp-buffer
          (erase-buffer)
-         (insert (shell-command-to-string (format "pinky -l %s" pkg)))
+         (insert-file-contents pkgfile)
          (goto-char (point-min))
          (re-search-forward "Version: \\(.*$\\)" nil t)
          (if (interactive-p)
          (goto-char (point-min))
          (re-search-forward "Version: \\(.*$\\)" nil t)
          (if (interactive-p)
@@ -277,11 +280,12 @@ If non-interactive, return a list whose car is user and cdr is group."
   (let* ((allpkgs (pkgusr-all-pkgs))
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
   (let* ((allpkgs (pkgusr-all-pkgs))
         (pkg (or pkg (completing-read "Package: "
                                       (mapcar #'list allpkgs)
-                                      nil t nil pkgusr-pkg-history))))
+                                      nil t nil pkgusr-pkg-history)))
+        (pkgfile (format "/usr/src/%s/.project" pkg)))
     (if (member pkg allpkgs)
        (with-temp-buffer
          (erase-buffer)
     (if (member pkg allpkgs)
        (with-temp-buffer
          (erase-buffer)
-         (insert (shell-command-to-string (format "pinky -l %s" pkg)))
+         (insert-file-contents pkgfile)
          (goto-char (point-min))
          (re-search-forward "Description: \\(.*$\\)" nil t)
          (if (interactive-p)
          (goto-char (point-min))
          (re-search-forward "Description: \\(.*$\\)" nil t)
          (if (interactive-p)
@@ -289,6 +293,25 @@ If non-interactive, return a list whose car is user and cdr is group."
            (match-string 1)))
       (error 'pkgusr-unknown-pkg pkg))))
 
            (match-string 1)))
       (error 'pkgusr-unknown-pkg pkg))))
 
+(defun pkgusr-pkg-deps (&optional pkg)
+  "Return the dependencies of PKG as a string."
+  (interactive)
+  (let* ((allpkgs (pkgusr-all-pkgs))
+        (pkg (or pkg (completing-read "Package: "
+                                      (mapcar #'list allpkgs)
+                                      nil t nil pkgusr-pkg-history)))
+        (pkgfile (format "/usr/src/%s/.project" pkg)))
+    (if (member pkg allpkgs)
+       (with-temp-buffer
+         (erase-buffer)
+         (insert-file-contents pkgfile)
+         (goto-char (point-min))
+         (re-search-forward "Deps: \\(.*$\\)" nil t)
+         (if (interactive-p)
+             (message "[%s Deps] %s" pkg (match-string 1))
+           (match-string 1)))
+      (error 'pkgusr-unknown-pkg pkg))))
+
 ;; A little bogus perhaps, but it works.  `pkgusr-find-file' is
 ;; something that only I can use because it ssh's through root to
 ;; get to the pkgusr. And nobody but me would have a need for
 ;; A little bogus perhaps, but it works.  `pkgusr-find-file' is
 ;; something that only I can use because it ssh's through root to
 ;; get to the pkgusr. And nobody but me would have a need for
@@ -338,6 +361,7 @@ after the setq.  Be bold and hard code it in pkgusr.el itself.")
 (global-set-key [(hyper c) f] #'pkgusr-file-pkg)
 (global-set-key [(hyper c) (hyper r)] #'pkgusr-list-pkgs-regexp)
 (global-set-key [(hyper c) d] #'pkgusr-pkg-description)
 (global-set-key [(hyper c) f] #'pkgusr-file-pkg)
 (global-set-key [(hyper c) (hyper r)] #'pkgusr-list-pkgs-regexp)
 (global-set-key [(hyper c) d] #'pkgusr-pkg-description)
+(global-set-key [(hyper c) D] #'pkgusr-pkg-deps)
 (global-set-key [(hyper c) g] #'pkgusr-pkg-general-notes)
 (global-set-key [(hyper c) i] #'pkgusr-pkg-install-notes)
 (global-set-key [(hyper c) r] #'pkgusr-pkg-repo)
 (global-set-key [(hyper c) g] #'pkgusr-pkg-general-notes)
 (global-set-key [(hyper c) i] #'pkgusr-pkg-install-notes)
 (global-set-key [(hyper c) r] #'pkgusr-pkg-repo)