]> git.e2factory.org Git - e2factory.git/commitdiff
sl: remove _sorted suffix
authorTobias Ulmer <tu@emlix.com>
Thu, 27 Oct 2016 15:42:13 +0000 (17:42 +0200)
committerTobias Ulmer <tu@emlix.com>
Wed, 16 Nov 2016 14:41:18 +0000 (15:41 +0100)
Signed-off-by: Tobias Ulmer <tu@emlix.com>
12 files changed:
local/e2-dlist.lua
local/e2-fetch-sources.lua
local/e2-ls-project.lua
local/e2build.lua
local/e2tool.lua
local/result.lua
local/sl.lua
plugins/collect_project.lua
plugins/cvs.lua
plugins/files.lua
plugins/git.lua
plugins/svn.lua

index f3bed30a11e4fac9a020f5eb6e980bdf61068ef7..6fd1b716b519390f5ab01b3b4bad4b3eb84fc31d 100644 (file)
@@ -61,7 +61,7 @@ local function e2_dlist(arg)
     if opts.recursive then
         dep, re = e2tool.dlist_recursive(resultname)
     else
-        dep, re = result.results[resultname]:depends_list():totable_sorted()
+        dep, re = result.results[resultname]:depends_list():totable()
     end
     if not dep then
         error(re)
index e73f6c884bf7097617e183d8fd4e4197284f74cb..15685a231a98f6232a90f3c895166639740df1b4 100644 (file)
@@ -182,7 +182,7 @@ local function e2_fetch_source(arg)
                 e2lib.logf(3, "is regarded as result: %s", srcresname)
                 local res = result.results[srcresname]
 
-                for sourcename in res:sources_list():iter_sorted() do
+                for sourcename in res:sources_list():iter() do
                     sel[sourcename] = true
                 end
             elseif opts.result then
index 5b08170be8ff3cd9e27d58cf2ab18903a7b4fd11..d17b47fcc515c917350eececbed8439e8f2571b5 100644 (file)
@@ -104,7 +104,7 @@ local function e2_ls_project(arg)
         for _, resultname in pairs(results) do
             local res = result.results[resultname]
 
-            for sourcename in res:sources_list():iter_sorted() do
+            for sourcename in res:sources_list():iter() do
                 if not yet[sourcename] then
                     table.insert(sources, sourcename)
                     yet[sourcename] = true
@@ -173,7 +173,7 @@ local function e2_ls_project(arg)
         console.infof("digraph \"%s\" {\n", project.name())
         for _, r in pairs(results) do
             local res = result.results[r]
-            local deps, re = res:depends_list():totable_sorted()
+            local deps, re = res:depends_list():totable()
             if not deps then
                 error(re)
             end
@@ -189,7 +189,7 @@ local function e2_ls_project(arg)
                 console.infof("  \"%s\"\n", r)
             end
             if opts["dot-sources"] then
-                for src in res:sources_list():iter_sorted() do
+                for src in res:sources_list():iter() do
                     if opts.swap then
                         console.infof("  \"%s-src\" %s \"%s\"\n", src, arrow, r)
                     else
index 50cd1b9c45bbbbe7447a324a5d34cf55efb25094..79a5515333166fec4c9a4db0b6d54241a9ffc662 100644 (file)
@@ -422,7 +422,7 @@ function e2build.build_process_class:_setup_chroot(res, return_flags)
     end
 
     local grp, path
-    for cgrpnm in res:chroot_list():iter_sorted() do
+    for cgrpnm in res:chroot_list():iter() do
         grp = chroot.groups_byname[cgrpnm]
 
         for f in grp:file_iter() do
@@ -678,7 +678,7 @@ function e2build.build_process_class:_install_build_time_dependencies(res, retur
 
     info = e2tool.info()
 
-    for dependsname in dependslist:iter_sorted() do
+    for dependsname in dependslist:iter() do
         dep = result.results[dependsname]
         destdir = e2lib.join(res:build_config().T, "dep", dep:get_name())
 
@@ -697,7 +697,7 @@ function e2build.build_process_class:_install_sources(res, return_flags)
     bc = res:build_config()
     info = e2tool.info()
 
-    for sourcename in res:sources_list():iter_sorted() do
+    for sourcename in res:sources_list():iter() do
         e = err.new("installing source failed: %s", sourcename)
 
         destdir = e2lib.join(bc.T, "build")
index 290dcb2abf1a34c7ae0f81197374f6fa5b046318..f517d20b546c24a0e2df41b02f38d7d91878f464 100644 (file)
@@ -582,7 +582,7 @@ function e2tool.dlist_recursive(resultv)
 
             deps = result.results[resultname]:depends_list()
 
-            for d in deps:iter_sorted() do
+            for d in deps:iter() do
                 rc, re = visit(d)
                 if not rc then
                     return false, re
@@ -595,7 +595,7 @@ function e2tool.dlist_recursive(resultv)
         return true
     end
 
-    for resultname in depends:iter_sorted() do
+    for resultname in depends:iter() do
         rc, re = visit(resultname)
         if not rc then
             return false, re
index 741fc4ba34570a7acd93cf775232f2d5316a05c5..da4a4675a678ee0c8ba0c03b6d50c67107445ae1 100644 (file)
@@ -351,7 +351,7 @@ end
 function result.result_class:post_initialize()
     local e
 
-    for depname in self:depends_list():iter_sorted() do
+    for depname in self:depends_list():iter() do
         if not result.results[depname] then
             e = e or err.new("in result %s:", self:get_name())
             e:append("dependency does not exist: %s", depname)
@@ -452,7 +452,7 @@ function result.result_class:merged_env()
     e:merge(projenv.get_global_env(), false)
 
     -- Sources env
-    for sourcename in self._sources_list:iter_sorted() do
+    for sourcename in self._sources_list:iter() do
         local src = source.sources[sourcename]
         e:merge(src:get_env(), true)
     end
@@ -486,7 +486,7 @@ function result.result_class:buildid()
     hash.hash_append(hc, self:get_type())
 
     -- sources
-    for sourcename in self:sources_list():iter_sorted() do
+    for sourcename in self:sources_list():iter() do
         local src, sourceset
 
         src = source.sources[sourcename]
@@ -501,7 +501,7 @@ function result.result_class:buildid()
     end
 
     -- chroot
-    for groupname in self:chroot_list():iter_sorted() do
+    for groupname in self:chroot_list():iter() do
         id, re = chroot.groups_byname[groupname]:chrootgroupid(info)
         if not id then
             return false, e:cat(re)
@@ -526,7 +526,7 @@ function result.result_class:buildid()
 
 
     -- depends
-    for depname in self:depends_list():iter_sorted() do
+    for depname in self:depends_list():iter() do
         id, re = result.results[depname]:buildid()
         if not id then
             return false, re
index 32d8b626c233d40abee455985038852dce5959a8..df038263c665549d4bc68ed50fe7ef7e46f4cf3b 100644 (file)
@@ -24,9 +24,6 @@ local err = require("err")
 local e2lib = require("e2lib")
 local strict = require("strict")
 
--- TODO: remove _sorted from method names,
--- insertion order methods were and should not be used
-
 --- String list class that keeps entries in sorted order
 -- while ignoring duplicate entries.
 -- Trying to use string list with anything but strings throws an exception.
@@ -123,7 +120,7 @@ end
 
 --- Iterate through the string list in alphabetical order.
 -- @return Iterator function.
-function sl.sl:iter_sorted()
+function sl.sl:iter()
     local t = {}
     local i = 0
 
@@ -150,13 +147,13 @@ end
 --- Concatenate the string list in alphabetical order.
 -- @param sep Separator, defaults to empty string.
 -- @return Concatenated string.
-function sl.sl:concat_sorted(sep)
+function sl.sl:concat(sep)
     assert(sep == nil or type(sep) == "string")
     local first = true
     local cat = ""
     sep = sep or ""
 
-    for e in self:iter_sorted() do
+    for e in self:iter() do
         if first then
             cat = e
             first = false
@@ -170,7 +167,7 @@ end
 
 --- Return string list entries as an array.
 -- @return Sorted array.
-function sl.sl:totable_sorted()
+function sl.sl:totable()
     local t = {}
     self:_sort_if_needed()
     for _,v in ipairs(self._list) do
@@ -183,7 +180,7 @@ end
 -- vectors, variadic functions, etc.
 -- @return All entries as individual return values, in sorted order.
 function sl.sl:unpack()
-    return unpack(self:totable_sorted())
+    return unpack(self:totable())
 end
 
 return strict.lock(sl)
index 75837e3de16916795da1be344b914cb3e814b5ba..9a36ad8582cff7d5b97b807270b73e1512b83c0a 100644 (file)
@@ -124,7 +124,7 @@ local function _build_collect_project(self, res, return_flags)
     end
     cp_depends:insert_table(rc)
 
-    for depname in cp_depends:iter_sorted() do
+    for depname in cp_depends:iter() do
         local dep = result.results[depname]
 
         if dep:get_type() ~= "result" then
@@ -136,7 +136,7 @@ local function _build_collect_project(self, res, return_flags)
         cp_sources:insert_sl(dep:sources_list())
     end
 
-    for sourcename in cp_sources:iter_sorted() do
+    for sourcename in cp_sources:iter() do
         local src = source.sources[sourcename]
         cp_licences:insert_sl(src:get_licences())
     end
@@ -183,7 +183,7 @@ local function _build_collect_project(self, res, return_flags)
 
     -- generate build driver file for each result
     -- project/chroot/<group>/<files>
-    for g in cp_chroot:iter_sorted() do
+    for g in cp_chroot:iter() do
         e2lib.logf(3, "chroot group: %s", g)
         local grp = chroot.groups_byname[g]
         local destdir = e2lib.join(bc.T, "project/chroot", g)
@@ -231,7 +231,7 @@ local function _build_collect_project(self, res, return_flags)
     end
 
     -- project/licences/<licence>/<files>
-    for licname in cp_licences:iter_sorted() do
+    for licname in cp_licences:iter() do
         local lic = licence.licences[licname]
         e2lib.logf(3, "licence: %s", lic:get_name())
         local destdir =
@@ -258,7 +258,7 @@ local function _build_collect_project(self, res, return_flags)
     end
 
     -- project/results/<res>/<files>
-    for depname in cp_depends:iter_sorted() do
+    for depname in cp_depends:iter() do
         e2lib.logf(3, "result: %s", depname)
         local dep = result.results[depname]
         local depbc = dep:build_config()
@@ -304,9 +304,9 @@ local function _build_collect_project(self, res, return_flags)
         -- generate config
         out = {
             string.format("### generated by e2factory for result %s ###\n", depname),
-            string.format("CHROOT='%s'\n", dep:chroot_list():concat_sorted(" ")),
-            string.format("DEPEND='%s'\n", dep:depends_list():concat_sorted(" ")),
-            string.format("SOURCE='%s'\n", dep:sources_list():concat_sorted(" ")),
+            string.format("CHROOT='%s'\n", dep:chroot_list():concat(" ")),
+            string.format("DEPEND='%s'\n", dep:depends_list():concat(" ")),
+            string.format("SOURCE='%s'\n", dep:sources_list():concat(" ")),
         }
 
         local config = e2lib.join(destdir, "config")
@@ -316,7 +316,7 @@ local function _build_collect_project(self, res, return_flags)
         end
     end
 
-    for sourcename in cp_sources:iter_sorted() do
+    for sourcename in cp_sources:iter() do
         e2lib.logf(3, "source: %s", sourcename)
         local destdir = e2lib.join(bc.T, "project",
             e2tool.sourcedir(sourcename))
@@ -335,7 +335,7 @@ local function _build_collect_project(self, res, return_flags)
     -- write topologically sorted list of result
     local destdir = e2lib.join(bc.T, "project")
     local tsorted_results, re =
-        e2tool.dlist_recursive(cp_depends:totable_sorted())
+        e2tool.dlist_recursive(cp_depends:totable())
     if not tsorted_results then
         return false, e:cat(re)
     end
index 6ac33b5b9910c77cee18a9dac3bd4d008899b3f5..2c2fa3e1d60a14b796929a48f95df1e15923678d 100644 (file)
@@ -222,7 +222,7 @@ function cvs.cvs_source:sourceid(sourceset)
     hash.hash_append(hc, self._type)
     hash.hash_append(hc, self._env:id())
     licences = self:get_licences()
-    for licencename in licences:iter_sorted() do
+    for licencename in licences:iter() do
         lid, re = licence.licences[licencename]:licenceid(info)
         if not lid then
             return false, re
@@ -265,7 +265,7 @@ function cvs.cvs_source:display()
     table.insert(d, string.format("working    = %s", self._working))
 
     licences = self:get_licences()
-    for licencename in licences:iter_sorted() do
+    for licencename in licences:iter() do
         table.insert(d, string.format("licence    = %s", licencename))
     end
 
@@ -476,7 +476,7 @@ function cvs.toresult(info, sourcename, sourceset, directory)
     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_sorted("\n").."\n"
+    local licence_list = licenses:concat("\n").."\n"
 
     rc, re = e2lib.mkdir_recursive(destdir)
     if not rc then
index 2ca0daba86b74bf43da038437a96f18cb1d293e4..358b137133aad09b2c7779742b0cf541b1552993 100644 (file)
@@ -278,7 +278,7 @@ function files.files_source:sourceid(sourceset --[[always ignored for files]])
     hash.hash_append(hc, self._env:id())
 
     -- all licences
-    for licencename in self:get_licences():iter_sorted() do
+    for licencename in self:get_licences():iter() do
         local lid, re = licence.licences[licencename]:licenceid(info)
         if not lid then
             return false, re
@@ -299,7 +299,7 @@ function files.files_source:sourceid(sourceset --[[always ignored for files]])
         hash.hash_append(hc, tostring(f.copy))
 
         -- per file licence list
-        for licencename in f.licences:iter_sorted() do
+        for licencename in f.licences:iter() do
             local lid, re = licence.licences[licencename]:licenceid(info)
             if not lid then
                 return false, re
@@ -323,13 +323,13 @@ function files.files_source:display()
     d = {}
     table.insert(d, string.format("type       = %s", self:get_type()))
     table.insert(d, string.format("licences   = %s",
-        self:get_licences():concat_sorted(" ")))
+        self:get_licences():concat(" ")))
 
     for f in self:file_iter() do
         s = string.format("file       = %s:%s", f.server, f.location)
         table.insert(d, s)
         table.insert(d, string.format("licences   = %s",
-            f.licences:concat_sorted(" ")))
+            f.licences:concat(" ")))
     end
 
     if self._sourceid then
@@ -746,7 +746,7 @@ function files.toresult(info, sourcename, sourceset, directory)
         local destdir = string.format("%s/licences", directory)
         local fname = string.format("%s/%s.licences", destdir,
             e2lib.basename(file.location))
-        local licence_list = file.licences:concat_sorted("\n") .. "\n"
+        local licence_list = file.licences:concat("\n") .. "\n"
         rc, re = e2lib.mkdir_recursive(destdir)
         if not rc then
             return false, e:cat(re)
index 9d98489b7da684907ec83180b68f65c4de4d7315..70cc3c647e709662525f903bbf2e60616b4065ae 100644 (file)
@@ -201,7 +201,7 @@ function git.git_source:sourceid(sourceset)
     hash.hash_append(hc, self._env:id())
 
     licences = self:get_licences()
-    for licencename in licences:iter_sorted() do
+    for licencename in licences:iter() do
         local lid, re = licence.licences[licencename]:licenceid(info)
         if not lid then
             return false, re
@@ -244,7 +244,7 @@ function git.git_source:display()
     table.insert(d, string.format("working    = %s", self._working))
 
     licences = self:get_licences()
-    for licencename in licences:iter_sorted() do
+    for licencename in licences:iter() do
         table.insert(d, string.format("licence    = %s", licencename))
     end
 
@@ -713,7 +713,7 @@ function git.toresult(info, sourcename, sourceset, directory)
     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_sorted("\n") .. "\n"
+    local licence_list = licences:concat("\n") .. "\n"
     rc, re = e2lib.mkdir_recursive(destdir)
     if not rc then
         return false, e:cat(re)
index d88843ef030461a8051ea0fed8986f9c9b79898c..11777404aa8af54d49787c44f8baa62ebd9cd411 100644 (file)
@@ -281,7 +281,7 @@ function svn.svn_source:sourceid(sourceset)
     assert(type(info) == "table")
 
     licences = self:get_licences()
-    for licencename in licences:iter_sorted() do
+    for licencename in licences:iter() do
         lid, re = licence.licences[licencename]:licenceid(info)
         if not lid then
             return false, re
@@ -349,7 +349,7 @@ function svn.svn_source:display()
     table.insert(d, string.format("working    = %s", self._working))
 
     licences = self:get_licences()
-    for licencename in licences:iter_sorted() do
+    for licencename in licences:iter() do
         table.insert(d, string.format("licence    = %s", licencename))
     end
 
@@ -512,7 +512,7 @@ function svn.toresult(info, sourcename, sourceset, directory)
     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_sorted("\n") .. "\n"
+    local licence_list = licences:concat("\n") .. "\n"
     rc, re = e2lib.mkdir_recursive(destdir)
     if not rc then
         return false, e:cat(re)