luci-0.8: drop lpk, unused
authorJo-Philipp Wich <jow@openwrt.org>
Fri, 25 Sep 2009 13:05:06 +0000 (13:05 +0000)
committerJo-Philipp Wich <jow@openwrt.org>
Fri, 25 Sep 2009 13:05:06 +0000 (13:05 +0000)
libs/lpk/Makefile [deleted file]
libs/lpk/luasrc/lpk.lua [deleted file]
libs/lpk/luasrc/lpk/core.lua [deleted file]
libs/lpk/luasrc/lpk/core/download.lua [deleted file]
libs/lpk/luasrc/lpk/core/install.lua [deleted file]
libs/lpk/luasrc/lpk/core/resolve.lua [deleted file]
libs/lpk/luasrc/lpk/core/retrieve.lua [deleted file]
libs/lpk/luasrc/lpk/core/unpack.lua [deleted file]
libs/lpk/luasrc/lpk/util.lua [deleted file]
libs/lpk/root/etc/lpk.conf [deleted file]
libs/lpk/root/usr/bin/lpk [deleted file]

diff --git a/libs/lpk/Makefile b/libs/lpk/Makefile
deleted file mode 100644 (file)
index f7fac77..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-include ../../build/config.mk
-include ../../build/module.mk
diff --git a/libs/lpk/luasrc/lpk.lua b/libs/lpk/luasrc/lpk.lua
deleted file mode 100644 (file)
index 7117c75..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-module("luci.lpk", package.seeall)
-require("luci.lpk.util")
-require("luci.lpk.core")
-
-__appname__ = "LuCI »lpk« Package Manager"
-__version__ = "0.1"
-__authors__ = "Steven Barth, Jo-Philipp Wich"
-__cpyrght__ = string.format("Copyright (c) 2008 %s", __authors__)
-
-options, arguments = luci.lpk.util.getopt(arg)
-config  = luci.util.dtable()
-machine = luci.lpk.core.Machine()
-
-local cfgdump = loadfile("/etc/lpk.conf")
-if cfgdump then
-       setfenv(cfgdump, config)
-       pcall(cfgdump)
-end
-
-if #arguments < 1 then
-       luci.lpk.util.splash()
-else
-       local task, error = machine:task(table.remove(arguments, 1),
-        unpack(arguments))
-               
-       if task then
-               local stat, error = task:perform()
-               if not stat then
-                       luci.util.perror(error or task.register.errstr or "Unknown Error")
-                       os.exit(task.register.error or 1)
-               end
-       else
-               luci.util.perror((error or "Unknown Error") .. "\n")
-               luci.lpk.util.splash()
-               os.exit(1)
-       end             
-end
-
-
-
diff --git a/libs/lpk/luasrc/lpk/core.lua b/libs/lpk/luasrc/lpk/core.lua
deleted file mode 100644 (file)
index 97de4fa..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-module("luci.lpk.core", package.seeall)
-require("luci.util")
-
-Task = luci.util.class()
-
-function Task.__init__(self, machine, register, start)
-       self.machine = machine
-
-       -- The queue that has to be processed
-       self.work = {start}
-       
-       -- The queue that has to be processed in case of rollback
-       self.done = {}
-       
-       -- The Task register
-       self.register = register
-end
-
-function Task.rollback(self)
-       if #self.done < 1 then
-               return false
-       end
-       
-       local state = table.remove(self.done)
-       if not state.rollback then
-               return true
-       end
-       
-       local ret, err = pcall(state.rollback, state, self.register)
-       
-       if ret then
-               return true
-       else
-               return false, err
-       end
-end
-
-function Task.step(self)
-       local state = table.remove(self.work)
-       local ret, next = pcall(state.process, self.register)
-       
-       if ret then
-               if next then
-                       local nstate = self.machine:state(next)
-                       if nstate then
-                               table.insert(self.work, state)
-                               table.insert(self.work, nstate)
-                       else
-                               self.register.error = 2
-                               self.register.errstr = "Unknown state: " .. next
-                               return false
-                       end
-               else
-                       table.insert(self.done, state)
-               end
-               
-               return #self.work > 0 
-       else
-               self.register.error = next
-               return false
-       end
-end
-
-function Task.perform(self)
-       while self:step() do
-       end
-       
-       if not self.register.error then
-               return true
-       else
-               local stat, err
-               repeat
-                       stat, err = self:rollback()
-               until not stat
-               
-               if err then
-                       self.register.errstr = err
-                       self.register.error = 2
-               end
-               
-               return false
-       end     
-end
-
-
-Machine = luci.util.class()
-
-function Machine.__init__(self, namespace)
-       self.namespace = namespace or _NAME
-end
-
-function Machine.state(self, name)
-       local ret, state = pcall(require, self.namespace .. "." .. name)
-       return ret and state
-end
-
-function Machine.task(self, name, ...)
-       local start = self:state(name)
-       
-       if type(start) ~= "table" or not start.entry then
-               return false, "No such command: " .. name
-       end
-       
-       local register = {}
-       
-       return start.entry(register, ...) and Task(self, register, start)
-end 
diff --git a/libs/lpk/luasrc/lpk/core/download.lua b/libs/lpk/luasrc/lpk/core/download.lua
deleted file mode 100644 (file)
index 7b30647..0000000
+++ /dev/null
@@ -1 +0,0 @@
-module("luci.lpk.core.download", package.seeall)
diff --git a/libs/lpk/luasrc/lpk/core/install.lua b/libs/lpk/luasrc/lpk/core/install.lua
deleted file mode 100644 (file)
index 434f618..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-module("luci.lpk.core.install", package.seeall)
-
-function entry(register, ...)
-       print("Requested install of " .. table.concat(arg, ", "))
-       return true
-end
-
-function process(register)
-       register.sometext = "Test"
-       if not register.retrieved then
-               print("Step down to retrieve")
-               return "retrieve"
-       else
-               print("Coming up again")
-       end
-end
\ No newline at end of file
diff --git a/libs/lpk/luasrc/lpk/core/resolve.lua b/libs/lpk/luasrc/lpk/core/resolve.lua
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/libs/lpk/luasrc/lpk/core/retrieve.lua b/libs/lpk/luasrc/lpk/core/retrieve.lua
deleted file mode 100644 (file)
index 6176a94..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-module("luci.lpk.core.retrieve", package.seeall)
-
-function process(register)
-       print "Now in retrieve"
-       print (register.sometext)
-       register.retrieved = true
-end
\ No newline at end of file
diff --git a/libs/lpk/luasrc/lpk/core/unpack.lua b/libs/lpk/luasrc/lpk/core/unpack.lua
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/libs/lpk/luasrc/lpk/util.lua b/libs/lpk/luasrc/lpk/util.lua
deleted file mode 100644 (file)
index 95bdb96..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-module("luci.lpk.util", package.seeall)
-
-function getopt( arg, options )
-       options = options or ""
-       local tab = {}
-       local args = {}
-       for k, v in ipairs(arg) do
-               if v:sub(1, 2) == "--" then
-                       local x = v:find( "=", 1, true )
-                       if x then
-                               tab[ v:sub( 3, x-1 ) ] = v:sub( x+1 )
-                       else 
-                           tab[ v:sub( 3 ) ] = true
-                       end
-               elseif v:sub( 1, 1 ) == "-" then
-                       local y = 2
-                       local l = #v
-                       local jopt
-                       while ( y <= l ) do
-                               jopt = v:sub( y, y )
-                               if options:find( jopt, 1, true ) then
-                                       if y < l then
-                                               tab[ jopt ] = v:sub( y+1 )
-                                               y = l
-                                       else
-                                               tab[ jopt ] = arg[ k + 1 ]
-                                               arg[ k + 1 ] = ""
-                                       end
-                               else
-                                       tab[ jopt ] = true
-                               end
-                               y = y + 1
-                       end
-           elseif #v > 0 then
-               table.insert(args, v)
-           end
-       end
-       return tab, args
-end
-
-function splash()
-       require("luci.lpk")
-       luci.util.perror(string.format("%s v%s\n%s",
-        luci.lpk.__appname__, luci.lpk.__version__, luci.lpk.__cpyrght__))
-       luci.util.perror([[
-       
-Usage:
- lpk [options] <command> [arguments]
- lpk [options] install|remove pkg1 [pkg2] [...] [pkgn]
-
-Commands:
- install       -       Install packages
- remove                -       Remove packages
- purge         -       Remove packages and their configuration files
-Options:
- --force-depends       -       Ignore unresolvable dependencies
-]])
-end
\ No newline at end of file
diff --git a/libs/lpk/root/etc/lpk.conf b/libs/lpk/root/etc/lpk.conf
deleted file mode 100644 (file)
index 7ff49f8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-backend.model = "ipkg"
\ No newline at end of file
diff --git a/libs/lpk/root/usr/bin/lpk b/libs/lpk/root/usr/bin/lpk
deleted file mode 100755 (executable)
index 6e6dcde..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/usr/bin/lua
-require("luci.lpk")
\ No newline at end of file