From 800a2630497e1ec2c61199b3bc645d778c714529 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sun, 2 Jan 2011 19:20:23 +0000 Subject: [PATCH] build: remove some obsolete support scripts --- build/i18n-html2lua.pl | 48 -------- build/i18n-lua-xhtml1.xsl | 238 -------------------------------------- build/i18n-lua2po.pl | 120 ------------------- build/i18n-lua2xml.lua | 22 ---- build/i18n-xml2lua.sh | 38 ------ build/mklar.pl | 119 ------------------- 6 files changed, 585 deletions(-) delete mode 100755 build/i18n-html2lua.pl delete mode 100644 build/i18n-lua-xhtml1.xsl delete mode 100755 build/i18n-lua2po.pl delete mode 100755 build/i18n-lua2xml.lua delete mode 100644 build/i18n-xml2lua.sh delete mode 100755 build/mklar.pl diff --git a/build/i18n-html2lua.pl b/build/i18n-html2lua.pl deleted file mode 100755 index c6b893eee..000000000 --- a/build/i18n-html2lua.pl +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/perl - -@ARGV || die "Usage: $0 template1.htm [... templateN.htm]\n"; - - -my %tags; - -foreach my $file ( @ARGV ) -{ - if( open F, "< $file" ) - { - local $/ = undef; - - my $data = ; - - while( $data =~ m/ <%: -? (\w+) (.*?) %> /sgx ) - { - my ( $key, $val ) = ( $1, $2 ); - - if( $key && $val ) - { - $val =~ s/\s+/ /sg; - $val =~ s/^\s+//; - $val =~ s/\s+$//; - - $tags{$key} = $val; - } - else - { - $tags{$key} ||= ''; - } - } - - close F; - } -} - -foreach my $key ( sort keys %tags ) -{ - if( $val =~ /'/ ) - { - printf "%s = [[%s]]\n", $key, $tags{$key}; - } - else - { - printf "%s = '%s'\n", $key, $tags{$key}; - } -} diff --git a/build/i18n-lua-xhtml1.xsl b/build/i18n-lua-xhtml1.xsl deleted file mode 100644 index 53bd7be9a..000000000 --- a/build/i18n-lua-xhtml1.xsl +++ /dev/null @@ -1,238 +0,0 @@ - - - - - - - - - - - - - - - - = ' - - - - - - - - - - - ' - - - - - - - < - - - > - - </ - - > - - - - <span class=" - - " - - > - - </span> - - - - <br - - /> - - - - <img - - /> - - - - - - - - xml: - - - =" - - - - - - - " - - - - - - - - - - - xml:lang=" - - " - lang=" - - " - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build/i18n-lua2po.pl b/build/i18n-lua2po.pl deleted file mode 100755 index d72d2e975..000000000 --- a/build/i18n-lua2po.pl +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/perl - -@ARGV >= 2 || die "Usage: $0 []\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; -} diff --git a/build/i18n-lua2xml.lua b/build/i18n-lua2xml.lua deleted file mode 100755 index 674c8adb5..000000000 --- a/build/i18n-lua2xml.lua +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/lua -local util = require "luci.util" - -assert(arg[1]) - -local x = {} -local f = loadfile(arg[1]) -setfenv(f, x) -f() - -print '' -print '' -print '' -print '' - -for k, v in util.kspairs(x) do - print ('%s' % {k, v}) -end - -print '' -print '' - diff --git a/build/i18n-xml2lua.sh b/build/i18n-xml2lua.sh deleted file mode 100644 index d70e135de..000000000 --- a/build/i18n-xml2lua.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh -# Copyright (C) 2008 Alina Friedrichsen -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -# SUCH DAMAGE. - -i18n_xml2lua() { - echo '' - echo - echo '' - echo - LANG=C sed -e 's/^\s*\([A-Za-z][0-9A-Za-z_]*\)\s*[=]\s*\[\[//' -e 's/\]\]\s*$/<\/i18n:msg>/' -e 's/^\s*\([A-Za-z][0-9A-Za-z_]*\)\s*[=]\s*["]\(.*\)["]\s*$/\2<\/i18n:msg>/' -e 's/^\s*$//' - echo - echo '' - return 0 -} - -for file in "$@"; do - i18n_xml2lua < "$file" > "$(dirname "$file")/$(basename "$file" .lua).xml" || exit 1 -done diff --git a/build/mklar.pl b/build/mklar.pl deleted file mode 100755 index d91eaebef..000000000 --- a/build/mklar.pl +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/perl - -use strict; -use File::Find; -use Digest::MD5 qw(md5 md5_hex); - -my @search = @ARGV; -if( !@search ) { - @search = ( - glob("libs/*"), - glob("applications/*"), - glob("i18n/*"), - glob("modules/*") - ); -} - - -sub depth { - my $p = shift; - my $d = 0; - $d++ while( $p =~ m{/}g ); - return $d; -}; - - -my @index; -my $offset = 0; - - -# -# Build File Members -# - -find( sub { - # Skip non-files - ( -f $_ ) || return; - - # Skip stuff not in /luasrc/ - ( $File::Find::name =~ m{/luasrc/} ) || return; - - # Skip .svn foo - ( $File::Find::name !~ m{/\.svn\b} ) || return; - - # Exclude luci-statistics and lucittpd for now - ( $File::Find::name !~ m{/luci-statistics/} && $File::Find::name !~ m{/lucittpd/} ) || return; - - - my $file = $File::Find::name; - $file =~ s{^.+/luasrc/}{luci/}; - - my $command = ( $File::Find::name =~ m{\.lua\z} && $ENV{LUAC} ) - ? "$ENV{LUAC} -o - $_ |" : "< $_"; - - if( open F, $command ) - { - warn sprintf "Member at 0x%08X: %s\n", $offset, $file; - push @index, [ ]; - - my $size = 0; - my $pad = 0; - - $index[-1][0] = $offset; - - while( read F, my $buffer, 4096 ) { - $size += length $buffer; - print $buffer; - } - - if( $size % 4 ) { - $pad = ( 4 - ( $size % 4 ) ); - } - - print "\0" x $pad; - - $index[-1][1] = $size; - $index[-1][2] = md5($file); - $index[-1][3] = 0x0000; - $index[-1][4] = $file; - - $offset += $size + $pad; - - close F; - } -}, @search ); - - -# -# Build File List Member -# - -my $filelist = join("\0", map $_->[4], @index) . "\0"; -my $listsize = length $filelist; -push @index, [ $offset, $listsize, "", 0xFFFF, undef ]; - -warn sprintf "Filelist at 0x%08X, length 0x%08X\n", $offset, $listsize; - -print $filelist; -$offset += $listsize; - -if( $listsize % 4 ) -{ - $offset += ( 4 - ($listsize % 4) ); - print "\0" x ( 4 - ($listsize % 4) ); -} - - -my $count = 1; -foreach my $file ( @index ) -{ - warn sprintf "Index[%4d]: 0x%08X 0x%08X 0x%04X 0x%04X %32s\n", - $count++, $file->[0], $file->[1], $file->[3], 0x0000, - $file->[4] ? md5_hex($file->[4]) : "0" x 32 - ; - - print pack "NNnna16", $file->[0], $file->[1], $file->[3], 0x0000, $file->[2]; -} - -warn sprintf "Index at 0x%08X, length 0x%08X\n", $offset, @index * 28; -print pack "N", $offset; -- 2.25.1