From b25a24dab08b58fefd830cf37e536d0028090c09 Mon Sep 17 00:00:00 2001 From: Gordon Hecker Date: Thu, 29 Apr 2010 15:20:18 +0200 Subject: [PATCH] deployment: initial implementation Signed-off-by: Gordon Hecker --- local/e2build.lua | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/local/e2build.lua b/local/e2build.lua index 992ef53..3f59c0d 100644 --- a/local/e2build.lua +++ b/local/e2build.lua @@ -787,6 +787,10 @@ function store_result(info, r, return_flags) if not rc then return false, e:cat(re) end + rc, re = deploy(info, r, return_flags) + if not rc then + return false, e:cat(re) + end rc, re = e2tool.lcd(info, ".") if not rc then return false, e:cat(re) @@ -1203,6 +1207,49 @@ function collect_project(info, r, return_flags) return true, nil end +--- deploy a result to the archive +-- @param info +-- @param r string: result name +-- @param return_flags table +-- @return bool +-- @return an error object on failure +function deploy(info, r, return_flags) +--[[ + This function is called located in a temporary directory that contains + the unpacked result structure and the result tarball itself as follows: + ./result/build.log.gz + ./result/checksums + ./result/files/* + ./result.tar + + This function pushes the result files and the checksum file as follows: + -- result/checksums + -- -> releases:////checksums + -- result/files/* + -- -> releases:////files/* +--]] + local files = {} + for f in e2lib.directory("result/files") do + table.insert(files, string.format("files/%s", f)) + end + table.insert(files, "checksums") + local server = "releases" + local location = string.format("%s/archive/%s/%s", info.project_location, + info.release_id, r) + for _,f in ipairs(files) do + local sourcefile = string.format("result/%s", f) + local location1 = string.format("%s/%s", location, f) + local cache_flags = {} + e2lib.logf(1, "result: %s deploying %s:%s", r, server, location1) + local rc, re = info.cache:push_file(sourcefile, server, location1, + cache_flags) + if not rc then + return false, e:cat(re) + end + end + return true +end + --- register a function to extend the build process -- @param info -- @param name string: build function name (used for logging) -- 2.39.5