projects
/
rrq
/
newlisp-ftw.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
bca2888
)
speed up by using batch lookups
author
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Sun, 9 Jan 2022 00:39:04 +0000
(11:39 +1100)
committer
Ralph Ronnquist
<ralph.ronnquist@gmail.com>
Sun, 9 Jan 2022 00:39:04 +0000
(11:39 +1100)
autorecommended.lsp
patch
|
blob
|
history
diff --git
a/autorecommended.lsp
b/autorecommended.lsp
index 755123620fa789d5c7988174cecc40ab7d027a62..43252cbdbb7760281f54d6a3559012d7ff44bbea 100755
(executable)
--- a/
autorecommended.lsp
+++ b/
autorecommended.lsp
@@
-7,33
+7,35
@@
(setf INSTALLED (map noarch (exec "apt-mark showinstall")))
(write-line 2 (format "There are %d installed packages" (length INSTALLED)))
(setf INSTALLED (map noarch (exec "apt-mark showinstall")))
(write-line 2 (format "There are %d installed packages" (length INSTALLED)))
-; Determine the list of "manually installed"
-(setf MANUAL (map noarch (exec "apt-mark showmanual")))
-(write-line 2 (format "There are %d manual packages" (length MANUAL)))
+; Returns list of parsed result lines
+(define (dpkg-exec FMT) (map (fn (S) (parse S " ")) (exec FMT)))
; Set up hash table of provided packages by currently installed. This
; is needed for following up dependencies, which for an option
; dependency only automatically resolves the first of options.
(write 2 "Initializing 'provided-by' ")
; Set up hash table of provided packages by currently installed. This
; is needed for following up dependencies, which for an option
; dependency only automatically resolves the first of options.
(write 2 "Initializing 'provided-by' ")
-(setf PROVFMT "dpkg-query -W -f '${P
rovides}
' %s")
+(setf PROVFMT "dpkg-query -W -f '${P
ackage} ${Provides}\\n
' %s")
(define PROV:PROV nil)
(define PROV:PROV nil)
-(dolist (P INSTALLED)
- (if (= (% (inc COUNT) 100)) (write 2 "."))
- (if (PROV P) (push P (PROV P)) (PROV P (list P)))
- (let (PV (if (exec (format PROVFMT P)) ($it 0)))
- (when PV (if (PROV PV) (push P (PROV PV)) (PROV PV (list P))))))
+(dolist (P INSTALLED) (if (PROV P) (push P (PROV P)) (PROV P (list P))))
+(dolist (PL (explode INSTALLED 1000))
+ (write 2 ".")
+ (dolist (PPV (dpkg-exec (format PROVFMT (join PL " "))))
+ (let ((P (PPV 0)))
+ (dolist (PV (1 PPV))
+ (when PV (if (PROV PV) (push P (PROV PV)) (PROV PV (list P))))))))
(dolist (P (PROV)) (PROV (P 0) (sort (unique (P 1)))))
(write-line 2 " done")
; set up a hashtable of recommenders
(write 2 "Initializing 'recommended-by' ")
(dolist (P (PROV)) (PROV (P 0) (sort (unique (P 1)))))
(write-line 2 " done")
; set up a hashtable of recommenders
(write 2 "Initializing 'recommended-by' ")
-(setf COUNT 0)
-(setf RECFMT "dpkg-query -W -f '${Recommends}' %s")
+(setf RECFMT "dpkg-query -W -f '${Package} ${Recommends}' %s")
(define REC:REC nil)
(define REC:REC nil)
-(dolist (P INSTALLED)
- (if (= (% (inc COUNT) 100)) (write 2 "."))
- (dolist (R (exec (format RECFMT P)))
- (if (REC R) (push P (REC R)) (REC R (list P)))))
+(dolist (PL (explode INSTALLED 1000))
+ (write 2 ".")
+ (dolist (RR (dpkg-exec (format RECFMT (join PL " "))))
+ (let ((P (RR 0)))
+ (dolist (R (1 RR))
+ (if (REC R) (push P (REC R)) (REC R (list P)))))))
(dolist (P (REC)) (REC (P 0) (sort (unique (P 1)))))
(write-line 2 " done")
(dolist (P (REC)) (REC (P 0) (sort (unique (P 1)))))
(write-line 2 " done")
@@
-67,17
+69,22
@@
(clean null? (map depends-choices (clean empty? (map trim (parse X ","))))))
(write 2 "Initializing actual 'depends' ")
(clean null? (map depends-choices (clean empty? (map trim (parse X ","))))))
(write 2 "Initializing actual 'depends' ")
-(setf COUNT 0)
-(setf DEPFMT "dpkg-query -W -f '${Pre-Depends} ${Depends}' %s")
+(setf DEPFMT "dpkg-query -W -f '${Package} ${Pre-Depends} ${Depends}\\n' %s")
(define DEP:DEP nil)
(define DEP:DEP nil)
-(dolist (P INSTALLED)
- (if (= (% (inc COUNT) 100)) (write 2 "."))
- (DEP P (flat (map depends-fix (exec (format DEPFMT P))))))
+(dolist (PL (explode INSTALLED 1000))
+ (write 2 ".")
+ (dolist (RR (exec (format DEPFMT (join PL " "))))
+ (when (regex "([^ ]+) (.*)" RR)
+ (let ((P $1) (RL (flat (depends-fix $2))))
+ (DEP P RL)))))
(write-line 2 " done")
; Return the dependencies for installed package of empty list otherwise
(define (depends P) (or (DEP P) '()))
(write-line 2 " done")
; Return the dependencies for installed package of empty list otherwise
(define (depends P) (or (DEP P) '()))
+; Determine the list of "manually installed"
+(setf MANUAL (map noarch (exec "apt-mark showmanual")))
+
; Expands a list of packages to include the closure of its dependencies
(define (closure L)
(let ((P (sort L)))
; Expands a list of packages to include the closure of its dependencies
(define (closure L)
(let ((P (sort L)))