From f70a9e8fd30963f47f5382588f67d011ad5872d0 Mon Sep 17 00:00:00 2001 From: "(no author)" <(no author)@b08762b0-b915-fc4b-9d8c-17b2551a87ff> Date: Mon, 8 Sep 2008 14:42:34 +0000 Subject: [PATCH] =?UTF-8?q?aqua=20server=20=E3=82=88=E3=82=8A=20ROM=20?= =?UTF-8?q?=E3=82=92=E8=87=AA=E5=8B=95=E5=8F=96=E5=BE=97=E3=81=99=E3=82=8B?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=81=AE=E3=82=B9=E3=82=AF=E3=83=AA=E3=83=97?= =?UTF-8?q?=E3=83=88=E3=82=92=E8=BF=BD=E5=8A=A0(=E7=A8=B2=E8=91=89?= =?UTF-8?q?=EF=BC=A0=E7=92=B0=E5=88=B6=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: file:///Users/lillianskinner/Downloads/platinum/twl/TwlIPL/trunk@2448 b08762b0-b915-fc4b-9d8c-17b2551a87ff --- .../work/pickup_tad.dev.sh | 55 +++++++ .../CustomSystemUpdater/work/pickup_tad.pl | 146 ++++++++++++++++++ build/tests/CustomSystemUpdater/work/util.pl | 110 +++++++++++++ 3 files changed, 311 insertions(+) create mode 100755 build/tests/CustomSystemUpdater/work/pickup_tad.dev.sh create mode 100755 build/tests/CustomSystemUpdater/work/pickup_tad.pl create mode 100755 build/tests/CustomSystemUpdater/work/util.pl diff --git a/build/tests/CustomSystemUpdater/work/pickup_tad.dev.sh b/build/tests/CustomSystemUpdater/work/pickup_tad.dev.sh new file mode 100755 index 00000000..98479574 --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/pickup_tad.dev.sh @@ -0,0 +1,55 @@ +#!/bin/sh +#! bash -f + +#---- commands +LS='/bin/ls' +ECHO='/bin/echo' +HEAD='/bin/head' +FIND='/bin/find' +COPY='/bin/cp' +DATE='/bin/date' +XARGS='/bin/xargs' +MKDIR='/bin/mkdir' +CHDIR='cd' + +#---- values +aqua_server='//10.116.1.5' +debug_dir="${aqua_server}/TWL_debug/sysmenu/rom/debug_rom" +redroms="${debug_dir}/sd.roms.template*" +clsbase="${debug_dir}/CLS_base" +datedir=`${DATE} +%Y%m%d` +regions='jp usa euro aus' + +#---- call pickup_tad.pl +${ECHO} "===== getting latest apps files =====" +perl ./pickup_tad.pl + +#---- gets the latest sd.roms.template roms +#redrom_dir=`${LS} -d --full-time ${redroms} | sort -k 7,10 | tail -n 1` +redrom_dir=`${LS} -dt ${redroms} | ${HEAD} -n 1` +${ECHO} -e "===== getting sd.roms.template* rom files =====" +${ECHO} -e "sd.roms.template dir : ${redrom_dir}" +${ECHO} -e "copy *.(tad|dat|nand) file -> ${datedir} dir\n" +${FIND} ${redrom_dir} -regextype posix-egrep -regex ".*.(tad|dat|nand)" | ${XARGS} ${COPY} -fut ${datedir} > /dev/null + +#---- gets the cls base roms +${ECHO} -e "===== getting sd.roms.template* rom files =====" +${ECHO} -e "CLS_base dir : ${clsbase}" +${ECHO} -e "copy *.tad file -> ${datedir} dir" +${FIND} ${clsbase} -name "*.tad" | ${XARGS} ${COPY} -fut ${datedir} > /dev/null + +#---- call mkcls.py +${ECHO} -e "===== create forcls dirs =====" +${MKDIR} ${datedir}_forcls +${CHDIR} ${datedir}_forcls +${FIND} ../${datedir} -name "*.tad" -exec ../mkcls.py {} \; + +${ECHO} -e "===== copy *.nand *.dat files -> (jp|usa|euro|aus) dirs =====\n" +for region in ${regions} +do + ${MKDIR} ${region} + ${COPY} ../${datedir}/*.nand ${region} + ${COPY} ../${datedir}/*.dat ${region} +done + +${COPY} ../cls.sh ./ \ No newline at end of file diff --git a/build/tests/CustomSystemUpdater/work/pickup_tad.pl b/build/tests/CustomSystemUpdater/work/pickup_tad.pl new file mode 100755 index 00000000..b003899e --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/pickup_tad.pl @@ -0,0 +1,146 @@ +#!/usr/bin/perl -w -I/usr/local/bin +use File::Copy; +use File::Copy::Recursive qw(fcopy rcopy dircopy); +use Class::Struct; +use POSIX 'strftime'; +use File::Find; + +require "util.pl"; + +my @apps = ("download_play", + "full_browser", + "nintendo_spot", + "photo", + "pictchat", + "shop", + "sound", + "sysmenu"); + +my $flgDate = 0; + +my $i; +my $date_dir = ""; +my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); +my $str_today = sprintf("%04d%02d%02d", $year+1900, $mon+1, $mday); +my $flghelp = 0; +my $err; +my @list_tad; + + +for ($i = 0; $i < $#ARGV+1; $i++) { + + my $opt = $ARGV[$i]; + + if ( $opt eq "-d" ) { + $flgDate = 1; + unless ( $#ARGV <= $i ) { + #$date_dir = $aqua_dir."/SD_".$ARGV[$i+1]; + $str_today = $ARGV[$i+1]; + $err = [ 1, "Not date (\"$date_dir\") !!"] if ( $date_dir !~ /[0-9]{8}/ ); + $i++; + + } else { + $err = [1,"No argument after -d !!"]; + } + } elsif ( $opt eq "-h" ) { + &show_help; + exit 0; + } else { + print "Unknown option: $opt\n"; + &show_help; + exit 1; + } + do { + print "*** Error *** : $err->[1]"; + exit 1; + } if ( $err->[0] ); +} + +# each application directory +foreach $app ( @apps ) +{ + my $dir_date; + #$dir_app = sprintf('//Aqua/TWL_debug/%s/rom/tad', $app); +$dir_app = sprintf('//10.116.1.5/TWL_debug/%s/rom/tad', $app); + $dir_app_date = &search_date_dir($dir_app); + + print "* $dir_app\n - $dir_app_date\n\n"; + + find( sub + { + do { + push @list_tad, $File::Find::name }if (/\.tad$/); + }, $dir_app_date + ); + #foreach ( @list_tad ) { print " * $_\n"; } +} + +#print "Date: $date_dir\n"; + +# Actually not today +mkdir($str_today); + +# copy to the local date directory +foreach ( @list_tad ) { + print("$_\n"); + copy($_, $str_today); +} + +# +exit 0; + +#----------------------------------------------------------------------- +# name : show_help +# function : +#----------------------------------------------------------------------- +sub show_help +{ +print <<__MSG_HELP__; +Usage: +\$ perl pickup_tad.pl [-d yyyymmdd] +__MSG_HELP__ +} + +#----------------------------------------------------------------------- +# name : search_date_dir +# function : +#----------------------------------------------------------------------- +sub search_date_dir +{ + my $root_dir; + my $date_dir; + my $prefix = ($#_<1) ? "" : $_[1]; + my $full_prefix; + my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); + + $year += 1900; + $mon += 1; + + $root_dir = ( $#_ < 0 ) ? "." : $_[0]; + + $full_prefix = $root_dir."/".$prefix; + $date_dir = $full_prefix.sprintf("%04d%02d%02d", $year, $mon, $mday); + + # search directory on going back date + while ( $year >= 2000 ) { + if ( -e "$date_dir" and -d "$date_dir") { + return "$date_dir"; + } else { + $mday -= 1; + $date_dir = $full_prefix.sprintf("%04d%02d%02d", $year, $mon, $mday); + } + do { + $mday = 31; # constant + $mon -= 1; + unless ( $mon ) { + $mon = 12; + $year -= 1; + } + } unless ( $mday ) ; + } + print "*** Error *** : Can't find the date directory !!\n"; + return 0; +} + +__END__ + diff --git a/build/tests/CustomSystemUpdater/work/util.pl b/build/tests/CustomSystemUpdater/work/util.pl new file mode 100755 index 00000000..e6d9a075 --- /dev/null +++ b/build/tests/CustomSystemUpdater/work/util.pl @@ -0,0 +1,110 @@ + +package util; + +#----------------------------------------------------------------------- +# name : get_title_version +# function : get the title version from the specified tad file +#----------------------------------------------------------------------- +sub get_title_version { + + my $titleVersion = 0 ; + my $cmdPython = "/usr/bin/python.exe"; + my $scrpPython = "/usr/local/bin/mkcls.py"; + $tad = $_[0]; + + open(PY, "$cmdPython $scrpPython $tad | ") or die "$!"; + $titleVersion = $1 if ( =~ /([0-9]{1,})/) ; + close(PY); + + $titleVersion; +} + +#----------------------------------------------------------------------- +# name : get_nlist +# function : get the list of the specified directory except "." and ".." +#----------------------------------------------------------------------- +sub get_nlist { + my $dirname = ( $#_ < 0) ? "." : $_[0]; + my @list; + + unless ( opendir(DIR, "$dirname") ) { + print "Can't open directory: $dirname\n"; + return ""; + } + + foreach $node ( readdir(DIR) ) { + push(@list, $node) unless ( $node =~ /^\.{1,2}$/ ); + } + closedir(DIR); + + @list; +} + + +#----------------------------------------------------------------------- +# name : fecheck +# function : check the specified file existence (Error if no file) +#----------------------------------------------------------------------- +sub fecheck { + my $filename = $_[0]; + unless ( -e $filename ) { +print <