branch: elpa-admin
commit 9d4a8f1045f3acce026bb8f005ab3a28de7b3061
Author: Stefan Monnier <[email protected]>
Commit: Stefan Monnier <[email protected]>

    (elpaa--prune-old-tarballs): Delete sig file along with the tarball
    
    * elpa-admin.el (elpaa--prune-old-tarballs): Don't consider the ago of
    the sig file when deciding whether to delete files.
---
 elpa-admin.el | 30 +++++++++++++++---------------
 1 file changed, 15 insertions(+), 15 deletions(-)

diff --git a/elpa-admin.el b/elpa-admin.el
index bb47cddcf0..ac29394782 100644
--- a/elpa-admin.el
+++ b/elpa-admin.el
@@ -620,27 +620,27 @@ returns.  Return the selected revision."
                                     (file-name-sans-extension filename)
                                   filename)
                                 ".sig"))
+                   (fa (file-attributes filename))
+                   (age (when (and minage fa)
+                          (float-time
+                           (time-subtract
+                            (current-time)
+                            (file-attribute-modification-time fa)))))
                    (mvfun (lambda (f)
-                            (let* ((src (expand-file-name f destdir))
-                                   (fa (file-attributes src)))
+                            (let* ((src (expand-file-name f destdir)))
                               (cond
-                               ((not fa)
+                               ((not (file-exists-p src))
                                 (message "Not existing/moving: %S" src))
-                               ((and minage
-                                     (< (float-time
-                                         (time-subtract
-                                          (current-time)
-                                          (file-attribute-modification-time
-                                           fa)))
-                                        ;; One year.
-                                        minage))
-                                (message "File too young: %S" src))
                                (t
                                 (rename-file src
                                              (expand-file-name f olddir))))))))
-              (make-directory olddir t)
-              (funcall mvfun filename)
-              (funcall mvfun sig))))
+              (if (and age (< age minage))
+                  (message "File too young (%s years): %S"
+                           (/ age 60 60 24 365)
+                           filename)
+                (make-directory olddir t)
+                (funcall mvfun filename)
+                (funcall mvfun sig)))))
         (setq oldtarballs keep)))
     (dolist (oldtarball oldtarballs)
       ;; Compress oldtarballs.

Reply via email to