]> git.e2factory.org Git - e2factory.git/commitdiff
e2-fetch-sources: plugins handle fetch & update - remove WC checks
authorTobias Ulmer <tu@emlix.com>
Thu, 19 Jan 2017 20:12:01 +0000 (21:12 +0100)
committerTobias Ulmer <tu@emlix.com>
Mon, 30 Jan 2017 13:33:34 +0000 (14:33 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/e2-fetch-sources.lua

index 5381d9b5954fc4272a9b1886d1a86ffa1ed5bc2f..204e2217db6388076da4f08fe8552f0f5bb3a7bb 100644 (file)
@@ -113,50 +113,38 @@ local function e2_fetch_source(arg)
     -- @return bool
     -- @return nil, an error string on error
     local function fetch_sources(info, opts, sel)
-        local rc1 = true    -- global return code
-        local nfail = 0     -- failure counter
+        local rc, re
+        local nfail
         local e = err.new()  -- no message yet, append the summary later on
 
         -- fetch
         for sourcename, _ in pairs(source.sources) do
-            local has_wc = scm.has_working_copy(info, sourcename)
-            local wc_avail = scm.working_copy_available(info, sourcename)
             if opts.fetch and sel[sourcename] then
-                if wc_avail then
-                    e2lib.logf(1,
-                    "working copy for %s is already available", sourcename)
-                else
-                    e2lib.logf(1, "fetching working copy for source %s", sourcename)
-                    local rc, re = scm.fetch_source(info, sourcename)
-                    if not rc then
-                        e:cat(re)
-                    end
+                e2lib.logf(1, "fetching working copy for source %s", sourcename)
+                rc, re = scm.fetch_source(info, sourcename)
+                if not rc then
+                    e:cat(re)
                 end
             end
         end
 
         -- update
         for sourcename, _ in pairs(source.sources) do
-            local has_wc = scm.has_working_copy(info, sourcename)
-            local wc_avail = scm.working_copy_available(info, sourcename)
-            if opts.update and has_wc and sel[sourcename] then
-                if not wc_avail then
-                    e2lib.logf(1, "working copy for %s is not available", sourcename)
-                else
-                    e2lib.logf(1, "updating working copy for %s", sourcename)
-                    local rc, re = scm.update(info, sourcename)
-                    if not rc then
-                        e:cat(re)
-                    end
+            if opts.update and sel[sourcename] then
+                e2lib.logf(1, "updating working copy for %s", sourcename)
+                rc, re = scm.update(info, sourcename)
+                if not rc then
+                    e:cat(re)
                 end
             end
         end
-        local nfail = e:getcount()
+
+        nfail = e:getcount()
         if nfail > 0 then
             e:append("There were errors fetching %d sources", nfail)
             return false, e
         end
-        return true, nil
+        return true
     end
 
     local sel = {} -- selected sources