Skip to content

Commit

Permalink
Merge pull request openwrt#415 from chris5560/for-15.05
Browse files Browse the repository at this point in the history
[for-15.05]luci-app-privoxy: update to version 1.0.4-2
  • Loading branch information
jow- committed Jun 16, 2015
2 parents 3d08fcb + 4ff133f commit f27ebb6
Show file tree
Hide file tree
Showing 4 changed files with 484 additions and 30 deletions.
4 changes: 2 additions & 2 deletions applications/luci-app-privoxy/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ PKG_NAME:=luci-app-privoxy

# Version == major.minor.patch
# increase "minor" on new functionality and "patch" on patches/optimization
PKG_VERSION:=1.0.3
PKG_VERSION:=1.0.4

# Release == build
# increase on changes of translation files
PKG_RELEASE:=1
PKG_RELEASE:=2

PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Christian Schoenebeck <[email protected]>
Expand Down
41 changes: 13 additions & 28 deletions applications/luci-app-privoxy/luasrc/controller/privoxy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ end

-- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>"
function ipkg_ver_compare(ver1, comp, ver2)
if not ver1 or not (#ver1 > 0)
or not ver2 or not (#ver2 > 0)
if not ver1 or not ver2
or not comp or not (#comp > 0) then return nil end
-- correct compare string
if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~="
Expand All @@ -90,33 +89,19 @@ function ipkg_ver_compare(ver1, comp, ver2)
for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do
local s1 = av1[i] or ""
local s2 = av2[i] or ""
local n1 = tonumber(s1)
local n2 = tonumber(s2)

-- one numeric and other empty string then set other to 0
if n1 and not n2 and (not s2 or #s2 == 0) then n2 = 0 end
if n2 and not n1 and (not s1 or #s1 == 0) then n1 = 0 end

local nc = (n1 and n2) -- numeric compare

if nc then
-- first "not equal" found return true
if comp == "~=" and (n1 ~= n2) then return true end
-- first "lower" found return true
if (comp == "<" or comp == "<=") and (n1 < n2) then return true end
-- first "greater" found return true
if (comp == ">" or comp == ">=") and (n1 > n2) then return true end
-- not equal then return false
if (n1 ~= n2) then return false end
else
if comp == "~=" and (s1 ~= s2) then return true end
if (comp == "<" or comp == "<=") and (s1 < s2) then return true end
if (comp == ">" or comp == ">=") and (s1 > s2) then return true end
if (s1 ~= s2) then return false end
end

-- first "not equal" found return true
if comp == "~=" and (s1 ~= s2) then return true end
-- first "lower" found return true
if (comp == "<" or comp == "<=") and (s1 < s2) then return true end
-- first "greater" found return true
if (comp == ">" or comp == ">=") and (s1 > s2) then return true end
-- not equal then return false
if (s1 ~= s2) then return false end
end
-- all equal then true
return true

-- all equal and not compare greater or lower then true
return not (comp == "<" or comp == ">")
end

-- read version information for given package if installed
Expand Down
1 change: 1 addition & 0 deletions applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ if not nixio.fs.access("/etc/config/privoxy") or not VEROK then
local f = SimpleForm("_no_config")
f.title = TITLE
f.description = DESC
f.embedded = true
f.submit = false
f.reset = false

Expand Down
Loading

0 comments on commit f27ebb6

Please sign in to comment.