]> git.e2factory.org Git - e2factory.git/commitdiff
new-source: if required, enable writeback and warn about it
authorTobias Ulmer <tu@emlix.com>
Fri, 4 Nov 2016 13:14:36 +0000 (14:14 +0100)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/e2-new-source.lua

index 075a420479571c8b6d7b80fe5809ea2ccbcae364..115a23b83139ed16493cb7b8dd0b4a61fcf82c19 100644 (file)
@@ -189,18 +189,25 @@ local function new_files_source(c, server, location, source_file, checksum_file,
         end
     end
 
-    local flags = { writeback = true } -- !!
+    if not cache.writeback_enabled(c, server) then
+        e2lib.warnf("WOTHER", "enabling writeback for server: %s",
+            server)
+        rc, re = cache.set_writeback(c, server, true)
+        if not rc then
+            return false, e:cat(re)
+        end
+    end
 
     -- upload checksum to cache (maybe) and server (always)
     local rc, re = cache.push_file(c, source.localfn_digest, server,
-        source.rlocation_digest, flags)
+        source.rlocation_digest)
     if not rc then
         return false, e:cat(re)
     end
 
     -- upload source file, see above.
     local rc, re = cache.push_file(c, source.localfn, server,
-        source.rlocation, flags)
+        source.rlocation)
     if not rc then
         return false, e:cat(re)
     end