build: remove two obsolete scripts
This commit is contained in:
parent
5af8df6d1a
commit
ffec6bd451
2 changed files with 0 additions and 253 deletions
|
@ -1,133 +0,0 @@
|
|||
#!/usr/bin/lua
|
||||
--[[
|
||||
LuCI - Lua Configuration Interface
|
||||
|
||||
Copyright 2008 Steven Barth <steven@midlink.org>
|
||||
Copyright 2008 Jo-Philipp Wich <xm@leipzig.freifunk.net>
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
$Id: index.lua 3548 2008-10-09 20:28:07Z Cyrus $
|
||||
]]--
|
||||
|
||||
local cbi = require "luci.cbi"
|
||||
local i18n = require "luci.i18n"
|
||||
local util = require "luci.util"
|
||||
|
||||
if not arg[1] then
|
||||
util.perror("Usage %s path/to/cbi/model.lua [i18nfilename]" % arg[0])
|
||||
os.exit(1)
|
||||
end
|
||||
|
||||
i18n.load("base", "en")
|
||||
|
||||
if arg[2] then
|
||||
i18n.load(arg[2], "en")
|
||||
end
|
||||
|
||||
if arg[3] then
|
||||
pcall(function()
|
||||
require "uci"
|
||||
require "luci.model.uci".cursor = function(config, save)
|
||||
return uci.cursor(config or arg[3] .. "/etc/config", save or arg[3] .. "/tmp/.uci")
|
||||
end
|
||||
end)
|
||||
end
|
||||
|
||||
local map = cbi.load(arg[1])[1]
|
||||
assert(map)
|
||||
|
||||
print ("package "..map.config)
|
||||
print ("\nconfig package")
|
||||
|
||||
if #map.title > 0 then
|
||||
print (" option title '%s'" % util.striptags(map.title))
|
||||
end
|
||||
|
||||
if #map.description > 0 then
|
||||
print (" option description '%s'" % util.striptags(map.description))
|
||||
end
|
||||
|
||||
for i, sec in pairs(map.children) do if util.instanceof(sec, cbi.AbstractSection) then
|
||||
print ("\nconfig section")
|
||||
print (" option name '%s'" % sec.sectiontype)
|
||||
print (" option package '%s'" % map.config)
|
||||
|
||||
if #sec.title > 0 then
|
||||
print (" option title '%s'" % util.striptags(sec.title))
|
||||
end
|
||||
|
||||
if #sec.description > 0 then
|
||||
print (" option description '%s'" % util.striptags(sec.description))
|
||||
end
|
||||
|
||||
if not sec.addremove then
|
||||
print (" option unique true")
|
||||
print (" option required true")
|
||||
end
|
||||
|
||||
if not sec.anonymous then
|
||||
print (" option named true")
|
||||
end
|
||||
|
||||
if sec.dynamic then
|
||||
print (" option dynamic true")
|
||||
end
|
||||
|
||||
for j, opt in ipairs(sec.children) do
|
||||
if opt.option:sub(1,1) ~= "_" or util.instanceof(opt, cbi.Value) then
|
||||
print ("\nconfig variable")
|
||||
print (" option name '%s'" % opt.option)
|
||||
print (" option section '%s.%s'" % {map.config, sec.sectiontype})
|
||||
if #opt.title > 0 then
|
||||
print (" option title '%s'" % util.striptags(opt.title))
|
||||
end
|
||||
|
||||
if #opt.description > 0 then
|
||||
print (" option description '%s'" % util.striptags(opt.description))
|
||||
end
|
||||
|
||||
if not opt.rmempty and not opt.optional then
|
||||
print (" option required true")
|
||||
end
|
||||
|
||||
if util.instanceof(opt, cbi.Flag) then
|
||||
print (" option datatype boolean")
|
||||
elseif util.instanceof(opt, cbi.DynamicList) then
|
||||
print (" option type list")
|
||||
elseif util.instanceof(opt, cbi.ListValue) then
|
||||
print (" option type enum")
|
||||
util.perror("*** Warning: Please verify '%s.%s.%s' ***" %
|
||||
{map.config, sec.sectiontype, opt.option} )
|
||||
end
|
||||
|
||||
for i, dep in ipairs(opt.deps) do
|
||||
if not dep.add or dep.add == "" then
|
||||
local depstring
|
||||
for k, v in pairs(dep.deps) do
|
||||
depstring = (depstring and depstring .. "," or "") .. "%s=%s" % {k, v}
|
||||
end
|
||||
print (" list depends '%s'" % depstring)
|
||||
else
|
||||
util.perror("*** Warning: Unable to decode dependency '%s' in '%s.%s.%s[%s]' ***" %
|
||||
{util.serialize_data(dep.deps), map.config, sec.sectiontype, opt.option, dep.add})
|
||||
end
|
||||
end
|
||||
|
||||
if util.instanceof(opt, cbi.ListValue) then
|
||||
for k, key in ipairs(opt.keylist) do
|
||||
print ("\nconfig enum")
|
||||
print (" option variable '%s.%s.%s'" % {map.config, sec.sectiontype, opt.option})
|
||||
print (" option value '%s'" % key)
|
||||
if opt.vallist[k] and opt.vallist[k] ~= opt.keylist[k] then
|
||||
print (" option title '%s'" % util.striptags(opt.vallist[k]))
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end end
|
|
@ -1,120 +0,0 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
@ARGV >= 2 || die "Usage: $0 <source-dir> <dest-dir> [<target-language>]\n";
|
||||
|
||||
my $source_dir = shift @ARGV;
|
||||
my $target_dir = shift @ARGV;
|
||||
my $target_lang = shift @ARGV;
|
||||
my $master_lang = "en";
|
||||
|
||||
|
||||
if( ! -d "$target_dir/" . ( $target_lang || 'templates' ) )
|
||||
{
|
||||
system('mkdir', '-p', "$target_dir/" . ( $target_lang || 'templates' ));
|
||||
}
|
||||
|
||||
|
||||
my %target_strings;
|
||||
|
||||
if( $target_lang && open F, "find $source_dir -path '*/luasrc/i18n/*' -name '*.$target_lang.lua' |" )
|
||||
{
|
||||
while( chomp( my $file = readline F ) )
|
||||
{
|
||||
if( open L, "< $file" )
|
||||
{
|
||||
my ( $basename ) = $file =~ m{.+/([^/]+)\.[\w\-]+\.lua$};
|
||||
$target_strings{$basename} = { };
|
||||
|
||||
while( chomp( my $entry = readline L ) )
|
||||
{
|
||||
my ( $k, $v );
|
||||
if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ )
|
||||
{
|
||||
( $k, $v ) = ( $1, $2 );
|
||||
}
|
||||
elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ )
|
||||
{
|
||||
( $k, $v ) = ( $1, $2 );
|
||||
}
|
||||
elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ )
|
||||
{
|
||||
( $k, $v ) = ( $1, $2 );
|
||||
}
|
||||
|
||||
if( $k && $v )
|
||||
{
|
||||
$v =~ s/"/\\"/g;
|
||||
$v =~ s/\\\\"/\\"/g;
|
||||
$target_strings{$basename}{$k} = $v;
|
||||
}
|
||||
}
|
||||
|
||||
close L;
|
||||
}
|
||||
}
|
||||
|
||||
close F;
|
||||
}
|
||||
|
||||
|
||||
if( open F, "find . -path '*/luasrc/i18n/*' -name '*.$master_lang.lua' |" )
|
||||
{
|
||||
my $destfile = sprintf '%s/%s/%%s.%s',
|
||||
$target_dir,
|
||||
$target_lang || 'templates',
|
||||
$target_lang ? 'po' : 'pot'
|
||||
;
|
||||
|
||||
while( chomp( my $file = readline F ) )
|
||||
{
|
||||
if( open L, "< $file" )
|
||||
{
|
||||
my ( $basename ) = $file =~ m{.+/([^/]+)\.\w+\.lua$};
|
||||
my $filename = sprintf $destfile, $basename;
|
||||
|
||||
if( open T, "> $filename" )
|
||||
{
|
||||
printf "Generating %-40s ", $filename;
|
||||
|
||||
printf T "# %s.%s\n# generated from %s\n\nmsgid \"\"\n" .
|
||||
"msgstr \"Content-Type: text/plain; charset=UTF-8\"\n\n",
|
||||
$basename, $target_lang ? 'po' : 'pot', $file;
|
||||
|
||||
while( chomp( my $entry = readline L ) )
|
||||
{
|
||||
my ( $k, $v );
|
||||
if( $entry =~ /^\s*(\w+)\s*=\s*\[\[(.+)\]\]/ )
|
||||
{
|
||||
( $k, $v ) = ( $1, $2 );
|
||||
}
|
||||
elsif( $entry =~ /^\s*(\w+)\s*=\s*'(.+)'/ )
|
||||
{
|
||||
( $k, $v ) = ( $1, $2 );
|
||||
}
|
||||
elsif( $entry =~ /^\s*(\w+)\s*=\s*"(.+)"/ )
|
||||
{
|
||||
( $k, $v ) = ( $1, $2 );
|
||||
}
|
||||
|
||||
if( $k && $v )
|
||||
{
|
||||
$v =~ s/"/\\"/g;
|
||||
$v =~ s/\\\\"/\\"/g;
|
||||
printf T "#: %s:%d\n#. %s\nmsgid \"%s\"\nmsgstr \"%s\"\n\n",
|
||||
$file, $., $v, $k,
|
||||
( $target_strings{$basename} && $target_strings{$basename}{$k} )
|
||||
? $target_strings{$basename}{$k} : "";
|
||||
}
|
||||
}
|
||||
|
||||
close T;
|
||||
|
||||
print "done\n";
|
||||
}
|
||||
|
||||
close L;
|
||||
}
|
||||
}
|
||||
|
||||
close F;
|
||||
}
|
Loading…
Reference in a new issue