From: Tobias Ulmer Date: Mon, 6 Mar 2017 19:13:53 +0000 (+0100) Subject: remove set_licences()/get_licences() X-Git-Tag: e2factory-2.3.17~4 X-Git-Url: https://git.e2factory.org/?a=commitdiff_plain;h=9e2b6946bc495914668495f02c5b8e7f8195a05d;p=e2factory.git remove set_licences()/get_licences() Signed-off-by: Tobias Ulmer --- diff --git a/local/e2-ls-project.lua b/local/e2-ls-project.lua index dd65a0b..ef53037 100644 --- a/local/e2-ls-project.lua +++ b/local/e2-ls-project.lua @@ -201,7 +201,7 @@ local function e2_ls_project(arg) for _,sourcename in ipairs(sources) do local src = source.sources[sourcename] - for licencename in src:get_licences():iter() do + for licencename in src:licences():iter() do if not seen[licencename] then table.insert(licences, licencename) seen[licencename] = true diff --git a/local/source.lua b/local/source.lua index 041205c..ac43939 100644 --- a/local/source.lua +++ b/local/source.lua @@ -104,25 +104,6 @@ function source.basic_source:licences(lic_sl) return self._licences or false end ---- Set licence array. --- Obsolete interface. --- @param licences String list of licence names (sl). -function source.basic_source:set_licences(licences) - assert(type(licences) == "table" and licences.class.name == "sl") - self._licences = licences:copy() -end - ---- Get licence array. --- Obsolete interface. --- Must be set before calling get_licences(). Note that this returns all --- licences used in a source. Some sources may have more detailed licensing --- information which can be accessed by other means. --- @return String list of licence names (sl). -function source.basic_source:get_licences() - assert(type(self._licences) == "table") - return self._licences:copy() -end - --- Set env object. -- @param env Env object. function source.basic_source:set_env(env) diff --git a/plugins/collect_project.lua b/plugins/collect_project.lua index c996b2f..74cfe93 100644 --- a/plugins/collect_project.lua +++ b/plugins/collect_project.lua @@ -139,7 +139,7 @@ local function _build_collect_project(self, res, return_flags) for sourcename in cp_sources:iter() do local src = source.sources[sourcename] - cp_licences:insert_sl(src:get_licences()) + cp_licences:insert_sl(src:licences()) end -- project/proj/init/ diff --git a/plugins/cvs.lua b/plugins/cvs.lua index 0cac752..0157ce1 100644 --- a/plugins/cvs.lua +++ b/plugins/cvs.lua @@ -226,7 +226,7 @@ end function cvs.cvs_source:sourceid(sourceset) assert(type(sourceset) == "string" and #sourceset > 0) - local rc, re, hc, lid, licences + local rc, re, hc, lid if self._sourceids[sourceset] then return self._sourceids[sourceset] @@ -236,8 +236,7 @@ function cvs.cvs_source:sourceid(sourceset) hash.hash_append(hc, self._name) hash.hash_append(hc, self._type) hash.hash_append(hc, self._env:envid()) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do lid, re = licence.licences[licencename]:licenceid() if not lid then return false, re @@ -265,7 +264,6 @@ function cvs.cvs_source:sourceid(sourceset) end function cvs.cvs_source:display() - local licences local d = {} self:sourceid("tag") @@ -279,8 +277,7 @@ function cvs.cvs_source:display() table.insert(d, string.format("module = %s", self._module)) table.insert(d, string.format("working = %s", self:get_working())) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do table.insert(d, string.format("licence = %s", licencename)) end @@ -467,8 +464,7 @@ local function cvs_to_result(src, sourceset, directory) -- write licences local destdir = string.format("%s/licences", directory) local fname = string.format("%s/%s.licences", destdir, archive) - local licenses = src:get_licences() - local licence_list = licenses:concat("\n").."\n" + local licence_list = src:licences():concat("\n").."\n" rc, re = e2lib.mkdir_recursive(destdir) if not rc then diff --git a/plugins/git.lua b/plugins/git.lua index 396d007..6cba144 100644 --- a/plugins/git.lua +++ b/plugins/git.lua @@ -215,7 +215,7 @@ function git.git_source:sourceid(sourceset) assert(type(sourceset) == "string" and #sourceset > 0, "sourceset arg invalid") - local rc, re, id, hc, licences + local rc, re, id, hc if self._sourceids[sourceset] then return self._sourceids[sourceset] @@ -231,8 +231,7 @@ function git.git_source:sourceid(sourceset) hash.hash_append(hc, self._type) hash.hash_append(hc, self._env:envid()) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do local lid, re = licence.licences[licencename]:licenceid() if not lid then return false, re @@ -250,7 +249,7 @@ function git.git_source:sourceid(sourceset) end function git.git_source:display() - local rev_tag, rev_branch, licences + local rev_tag, rev_branch -- try to calculate the sourceid, but do not care if it fails. -- working copy might be unavailable @@ -273,8 +272,7 @@ function git.git_source:display() table.insert(d, string.format("location = %s", self._location)) table.insert(d, string.format("working = %s", self:get_working())) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do table.insert(d, string.format("licence = %s", licencename)) end @@ -750,8 +748,7 @@ local function git_to_result(src, sourceset, directory) -- write licences local destdir = e2lib.join(directory, "licences") local fname = string.format("%s/%s.licences", destdir, archive) - local licences = src:get_licences() - local licence_list = licences:concat("\n") .. "\n" + local licence_list = src:licences():concat("\n") .. "\n" rc, re = e2lib.mkdir_recursive(destdir) if not rc then return false, e:cat(re) diff --git a/plugins/gitrepo.lua b/plugins/gitrepo.lua index 2357d9c..f64f390 100644 --- a/plugins/gitrepo.lua +++ b/plugins/gitrepo.lua @@ -146,7 +146,7 @@ end function gitrepo_source:sourceid(sourceset) assertIsStringN(sourceset) - local rc, re, e, hc, licences, gitdir, argv, out + local rc, re, e, hc, gitdir, argv, out if self._sourceids[sourceset] then return self._sourceids[sourceset] @@ -166,8 +166,7 @@ function gitrepo_source:sourceid(sourceset) hash.hash_append(hc, self._branch) hash.hash_append(hc, self._env:envid()) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do local lid, re = licence.licences[licencename]:licenceid() if not lid then return false, e:cat(re) @@ -198,8 +197,6 @@ function gitrepo_source:sourceid(sourceset) end function gitrepo_source:display() - local licences - -- try to calculate the sourceid, but do not care if it fails. -- working copy might be unavailable self:sourceid("tag") @@ -213,8 +210,7 @@ function gitrepo_source:display() table.insert(d, string.format("location = %s", self._location)) table.insert(d, string.format("working = %s", self._working)) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do table.insert(d, string.format("licence = %s", licencename)) end @@ -632,8 +628,7 @@ local function gitrepo_to_result(src, sourceset, directory) -- write licences local destdir = e2lib.join(directory, "licences") local fname = string.format("%s/%s.licences", destdir, archive) - local licences = src:get_licences() - local licence_list = licences:concat("\n") .. "\n" + local licence_list = src:licences():concat("\n") .. "\n" rc, re = e2lib.mkdir_recursive(destdir) if not rc then return false, e:cat(re) diff --git a/plugins/licencesrc.lua b/plugins/licencesrc.lua index ec92606..30cd3d5 100644 --- a/plugins/licencesrc.lua +++ b/plugins/licencesrc.lua @@ -54,7 +54,7 @@ function licence_source:initialize(rawsrc) -- required but unused. self:set_env(environment.new()) - self:set_licences(sl.sl:new()) + self:licences(sl.sl:new()) rc, re = e2lib.vrfy_dict_exp_keys(rawsrc, "e2source config", { "name", @@ -257,10 +257,10 @@ function licence_source:prepare_source(sourceset, buildpath) end -- collect all licences for later processing - licence_list:insert_sl(src:get_licences()) + licence_list:insert_sl(src:licences()) -- write licences - local l = src:get_licences():concat("\n").."\n" + local l = src:licences():concat("\n").."\n" rc, re = eio.file_write(e2lib.join(srcdir, "licences"), l) if not rc then diff --git a/plugins/svn.lua b/plugins/svn.lua index beb9a48..92475ba 100644 --- a/plugins/svn.lua +++ b/plugins/svn.lua @@ -249,7 +249,7 @@ function svn.svn_source:sourceid(sourceset) assert(type(sourceset) == "string" and #sourceset > 0) local rc, re - local hc, surl, svnurl, argv, out, svnrev, lid, svnrev, licences + local hc, surl, svnurl, argv, out, svnrev, lid, svnrev if self._sourceids[sourceset] then return self._sourceids[sourceset] @@ -260,8 +260,7 @@ function svn.svn_source:sourceid(sourceset) hash.hash_append(hc, self._type) hash.hash_append(hc, self._env:envid()) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do lid, re = licence.licences[licencename]:licenceid() if not lid then return false, re @@ -311,7 +310,7 @@ function svn.svn_source:sourceid(sourceset) end function svn.svn_source:display() - local d, licences + local d -- try to calculte the sourceid, but do not care if it fails. -- working copy might be unavailable @@ -326,8 +325,7 @@ function svn.svn_source:display() table.insert(d, string.format("tag = %s", self._tag)) table.insert(d, string.format("working = %s", self:get_working())) - licences = self:get_licences() - for licencename in licences:iter() do + for licencename in self:licences():iter() do table.insert(d, string.format("licence = %s", licencename)) end @@ -500,8 +498,7 @@ local function svn_to_result(src, sourceset, directory) -- write licences local destdir = e2lib.join(directory, "licences") local fname = string.format("%s/%s.licences", destdir, archive) - local licences = src:get_licences() - local licence_list = licences:concat("\n") .. "\n" + local licence_list = src:licences():concat("\n") .. "\n" rc, re = e2lib.mkdir_recursive(destdir) if not rc then return false, e:cat(re)