[gnome-continuous] builddisks: Only keep one current disk image



commit 744cd008a076ce18a929438ce33504d0e10015c1
Author: Colin Walters <walters verbum org>
Date:   Sat Nov 30 11:18:45 2013 -0500

    builddisks: Only keep one current disk image
    
    We stopped cleaning them due to me removing code I thought wasn't
    used.  Fix that, and at the same time, there was no reason to keep a
    previous, so don't.

 src/js/tasks/task-builddisks.js |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)
---
diff --git a/src/js/tasks/task-builddisks.js b/src/js/tasks/task-builddisks.js
index 37d0f1f..cd6503a 100644
--- a/src/js/tasks/task-builddisks.js
+++ b/src/js/tasks/task-builddisks.js
@@ -54,7 +54,6 @@ const TaskBuildDisks = new Lang.Class({
         GSystem.file_ensure_directory(baseImageDir, true, cancellable);
 
              let currentImageLink = baseImageDir.get_child('current');
-             let previousImageLink = baseImageDir.get_child('previous');
 
         let targetImageDir = baseImageDir.get_child(this._buildName);
         if (!isLocal && targetImageDir.query_exists(null)) {
@@ -133,20 +132,19 @@ const TaskBuildDisks = new Lang.Class({
         GSystem.file_rename(workImageDir, targetImageDir, cancellable);
 
         let currentInfo = null;
+        let oldCurrent = null;
         try {
             currentInfo = currentImageLink.query_info('standard::symlink-target', 
Gio.FileQueryInfoFlags.NOFOLLOW_SYMLINKS, cancellable);
         } catch (e) {
             if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
                 throw e;
         }
-        if (currentInfo != null) {
-            let newPreviousTmppath = baseImageDir.get_child('previous-new.tmp');
-            let currentLinkTarget = currentInfo.get_symlink_target();
-            GSystem.shutil_rm_rf(newPreviousTmppath, cancellable);
-            newPreviousTmppath.make_symbolic_link(currentLinkTarget, cancellable);
-            GSystem.file_rename(newPreviousTmppath, previousImageLink, cancellable);
-        }
+        if (currentInfo) {
+            oldCurrent = 
currentImageLink.get_parent().resolve_relative_path(currentInfo.get_symlink_target());
+        } 
         BuildUtil.atomicSymlinkSwap(baseImageDir.get_child('current'), targetImageDir, cancellable);
+        if (!isLocal && oldCurrent)
+            GSystem.shutil_rm_rf(oldCurrent, cancellable);
     },
 
     _postDiskCreation: function(squashedName, diskPath, cancellable) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]