mirror of
https://git.in.rschanz.org/ryan77627/guix.git
synced 2025-01-25 20:19:18 -05:00
guix package: Remove dead code and unused variables.
Suggested by Alex Kost <alezost@gmail.com>. * guix/scripts/package.scm (options->installable)[deduplicate]: Remove. [packages-to-upgrade]: Remove unused variable 'newest'. (roll-back): Remove unused variable 'manifest'. (guix-package): Remove unused variables 'guile-missing?', 'verbose?', and 'packages'.
This commit is contained in:
parent
26c398b182
commit
3d6e65d529
1 changed files with 13 additions and 40 deletions
|
@ -104,8 +104,7 @@ (define (roll-back profile)
|
||||||
"Roll back to the previous generation of PROFILE."
|
"Roll back to the previous generation of PROFILE."
|
||||||
(let* ((number (generation-number profile))
|
(let* ((number (generation-number profile))
|
||||||
(previous-number (previous-generation-number profile number))
|
(previous-number (previous-generation-number profile number))
|
||||||
(previous-generation (generation-file-name profile previous-number))
|
(previous-generation (generation-file-name profile previous-number)))
|
||||||
(manifest (string-append previous-generation "/manifest")))
|
|
||||||
(cond ((not (file-exists? profile)) ; invalid profile
|
(cond ((not (file-exists? profile)) ; invalid profile
|
||||||
(leave (_ "profile '~a' does not exist~%")
|
(leave (_ "profile '~a' does not exist~%")
|
||||||
profile))
|
profile))
|
||||||
|
@ -623,24 +622,6 @@ (define %options
|
||||||
(define (options->installable opts manifest)
|
(define (options->installable opts manifest)
|
||||||
"Given MANIFEST, the current manifest, and OPTS, the result of 'args-fold',
|
"Given MANIFEST, the current manifest, and OPTS, the result of 'args-fold',
|
||||||
return the new list of manifest entries."
|
return the new list of manifest entries."
|
||||||
(define (deduplicate deps)
|
|
||||||
;; Remove duplicate entries from DEPS, a list of propagated inputs, where
|
|
||||||
;; each input is a name/path tuple.
|
|
||||||
(define (same? d1 d2)
|
|
||||||
(match d1
|
|
||||||
((_ p1)
|
|
||||||
(match d2
|
|
||||||
((_ p2) (eq? p1 p2))
|
|
||||||
(_ #f)))
|
|
||||||
((_ p1 out1)
|
|
||||||
(match d2
|
|
||||||
((_ p2 out2)
|
|
||||||
(and (string=? out1 out2)
|
|
||||||
(eq? p1 p2)))
|
|
||||||
(_ #f)))))
|
|
||||||
|
|
||||||
(delete-duplicates deps same?))
|
|
||||||
|
|
||||||
(define (package->manifest-entry* package output)
|
(define (package->manifest-entry* package output)
|
||||||
(check-package-freshness package)
|
(check-package-freshness package)
|
||||||
;; When given a package via `-e', install the first of its
|
;; When given a package via `-e', install the first of its
|
||||||
|
@ -659,19 +640,18 @@ (define packages-to-upgrade
|
||||||
(()
|
(()
|
||||||
'())
|
'())
|
||||||
((_ ...)
|
((_ ...)
|
||||||
(let ((newest (find-newest-available-packages)))
|
(filter-map (match-lambda
|
||||||
(filter-map (match-lambda
|
(($ <manifest-entry> name version output path _)
|
||||||
(($ <manifest-entry> name version output path _)
|
(and (any (cut regexp-exec <> name)
|
||||||
(and (any (cut regexp-exec <> name)
|
upgrade-regexps)
|
||||||
upgrade-regexps)
|
(upgradeable? name version path)
|
||||||
(upgradeable? name version path)
|
(let ((output (or output "out")))
|
||||||
(let ((output (or output "out")))
|
(call-with-values
|
||||||
(call-with-values
|
(lambda ()
|
||||||
(lambda ()
|
(specification->package+output name output))
|
||||||
(specification->package+output name output))
|
list))))
|
||||||
list))))
|
(_ #f))
|
||||||
(_ #f))
|
(manifest-entries manifest)))))
|
||||||
(manifest-entries manifest))))))
|
|
||||||
|
|
||||||
(define to-upgrade
|
(define to-upgrade
|
||||||
(map (match-lambda
|
(map (match-lambda
|
||||||
|
@ -762,11 +742,6 @@ (define (parse-options)
|
||||||
%default-options
|
%default-options
|
||||||
#f))
|
#f))
|
||||||
|
|
||||||
(define (guile-missing?)
|
|
||||||
;; Return #t if %GUILE-FOR-BUILD is not available yet.
|
|
||||||
(let ((out (derivation->output-path (%guile-for-build))))
|
|
||||||
(not (valid-path? (%store) out))))
|
|
||||||
|
|
||||||
(define (ensure-default-profile)
|
(define (ensure-default-profile)
|
||||||
;; Ensure the default profile symlink and directory exist and are
|
;; Ensure the default profile symlink and directory exist and are
|
||||||
;; writable.
|
;; writable.
|
||||||
|
@ -819,7 +794,6 @@ (define (process-actions opts)
|
||||||
;; Process any install/remove/upgrade action from OPTS.
|
;; Process any install/remove/upgrade action from OPTS.
|
||||||
|
|
||||||
(define dry-run? (assoc-ref opts 'dry-run?))
|
(define dry-run? (assoc-ref opts 'dry-run?))
|
||||||
(define verbose? (assoc-ref opts 'verbose?))
|
|
||||||
(define profile (assoc-ref opts 'profile))
|
(define profile (assoc-ref opts 'profile))
|
||||||
|
|
||||||
(define (same-package? entry name output)
|
(define (same-package? entry name output)
|
||||||
|
@ -1059,7 +1033,6 @@ (define (list-generation number)
|
||||||
(('search-paths)
|
(('search-paths)
|
||||||
(let* ((manifest (profile-manifest profile))
|
(let* ((manifest (profile-manifest profile))
|
||||||
(entries (manifest-entries manifest))
|
(entries (manifest-entries manifest))
|
||||||
(packages (map manifest-entry-name entries))
|
|
||||||
(settings (search-path-environment-variables entries profile
|
(settings (search-path-environment-variables entries profile
|
||||||
(const #f))))
|
(const #f))))
|
||||||
(format #t "~{~a~%~}" settings)
|
(format #t "~{~a~%~}" settings)
|
||||||
|
|
Loading…
Reference in a new issue