]> git.e2factory.org Git - e2factory.git/commitdiff
remove set_licences()/get_licences()
authorTobias Ulmer <tu@emlix.com>
Mon, 6 Mar 2017 19:13:53 +0000 (20:13 +0100)
committerTobias Ulmer <tu@emlix.com>
Mon, 6 Mar 2017 19:13:53 +0000 (20:13 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
local/e2-ls-project.lua
local/source.lua
plugins/collect_project.lua
plugins/cvs.lua
plugins/git.lua
plugins/gitrepo.lua
plugins/licencesrc.lua
plugins/svn.lua

index dd65a0b522e7f482cf94ef6e5a888bc32c3178d1..ef530374a24aa2f1bd18ff0bf4f77b167fbe40dd 100644 (file)
@@ -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
index 041205c08ca0b359df54503a2bd600d84bce4091..ac439393e677b21b930593319e4aa1e89cde77dc 100644 (file)
@@ -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)
index c996b2fea26b4855b8cf22b09503e00ef6ab2d6c..74cfe93fa5228a4bbc22dd94726ed608c7cad48d 100644 (file)
@@ -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/<files>
index 0cac752c53dfa47309ee40706513ee2a2b5a753f..0157ce14135de9658ccc4fa64cf5618482793913 100644 (file)
@@ -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
index 396d007d50e0dd27267a12ccf946df1e32142041..6cba144551f25882c14614ea1712461196b58899 100644 (file)
@@ -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)
index 2357d9cff5a5c3607e77976cce73d3448b13d790..f64f390b38092465e033ad6e8028e98037529db5 100644 (file)
@@ -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)
index ec92606fd1cae448e8e3b549d932417f5e374d03..30cd3d5637735b585e6815e724124d9c11961c3c 100644 (file)
@@ -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
index beb9a48902264303d613ee263a3c6e2a331574ff..92475ba6920c321a63b1c1fa2ba25abd6c3d8ce4 100644 (file)
@@ -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)