Revision 3716

Date:
2019-09-29 22:12:32
Author:
dsb
Revision Log:
[I keep accidentally checking in too much at once.

unpack-base.pl:
- Instead of hard-coding current/previous/beta versions, use the T4
library to scrape them out of the current version list.
- Also unzip possessors DLC from the beta version if --beta and --possess
are both set. Might expand that to other DLCs later.

go.sh:
- Try to use the proximate t-engine binary if we're obviously in an
addons or T2 working copy.
- Failing that, scrape the current version from the Perl T4 lib and check
for -src-, -linux64- and -linux- directories to run from.
Files:

Legend:

 
Added
 
Removed
 
Modified
  • tome2/trunk/go.sh

     
    1 1 #!/bin/sh
    2 2 # $Id$
    3 VERSION='1.5.10'
    3 VERSION=`perl -I$HOME/lib/perl -MT4 -e 'print T4:latest_version()'`
    4 4
    5 cd $HOME/t-engine4-src-$VERSION
    6 exec ./t-engine --flush-stdout 2>&1 | tee /tmp/hmm.out
    5 if pwd | egrep 'addons.src$' ; then
    6 # In an addons working copy; use the executable for the version we're in.
    7 cd ../..
    8 elif pwd | egrep 'modules/tome2-[^/]+$' ; then
    9 # In a module working copy; as above.
    10 cd ../../..
    11 elif [ -x $HOME/t-engine4-src-$VERSION/t-engine ] ; then
    12 # Try various manually compiled or pre-built executables for the version
    13 # specified above.
    14 echo "Using default directory $HOME/t-engine4-src-$VERSION"
    15 cd $HOME/t-engine4-src-$VERSION
    16 elif [ -x $HOME/t-engine4-linux64-$VERSION/t-engine ] ; then
    17 echo "Using default directory $HOME/t-engine4-linux64-$VERSION"
    18 cd $HOME/t-engine4-linux64-$VERSION
    19 elif [ -x $HOME/t-engine4-linux-$VERSION/t-engine ] ; then
    20 echo "Using default directory $HOME/t-engine4-linux-$VERSION"
    21 cd $HOME/t-engine4-linux-$VERSION
    22 else
    23 echo "Cannot find default directory for version $VERSION"
    24 exit 1
    25 fi
    26
    27 CWD=`pwd`
    28 if [ -x ./t-engine ] ; then
    29 echo "Running from directory $CWD"
    30 exec ./t-engine --flush-stdout 2>&1 | tee /tmp/hmm.out
    31 else
    32 echo "No t-engine executable in $CWD"
    33 exit 1
    34 fi
  • tome2/trunk/unpack-base.pl

     
    1 1 #!/usr/bin/perl -w
    2 2 # $Id$
    3 3
    4 use lib "$ENV{HOME}/lib/perl";
    4 5 use Getopt::Long;
    6 use T4;
    5 7
    6 8 my %data = (
    7 cur => { ver => '1.5.10', dir => '1.5.10' },
    8 prev => { ver => '1.5.9', dir => '1.5.9' },
    9 beta => { ver => '1.5.11', dir => '1.5.11' },
    9 # cur => { ver => '1.5.10', dir => '1.5.10' },
    10 # prev => { ver => '1.5.9', dir => '1.5.9' },
    11 # beta => { ver => '1.6.0', dir => '1.6.0b1' },
    12 cur => { ver => '', dir => '' },
    13 prev => { ver => '', dir => '' },
    14 beta => { ver => '', dir => '' },
    10 15 );
    11 16
    17 my $latest = T4::latest_version();
    18 $data{cur}{ver} = $latest;
    19 $data{cur}{dir} = $latest;
    20 my @ver = T4::all_versions();
    21 if (scalar @ver > 1 && $ver[$#ver] eq $latest) {
    22 $data{prev}{ver} = $ver[$#ver-1];
    23 $data{prev}{dir} = $ver[$#ver-1];
    24 }
    25 else {
    26 $data{prev}{ver} = $latest;
    27 $data{prev}{ver} =~ s/(\d+)$/$1-1/e;
    28 $data{prev}{dir} = $data{prev}{ver};
    29 }
    30 @ver = T4::all_versions(beta => 1);
    31 if (scalar @ver > 0 && $ver[$#ver] =~ /^(\d+\.\d+\.\d+)b\d+/) {
    32 $data{beta}{ver} = $1;
    33 $data{beta}{dir} = $ver[$#ver];
    34 }
    35 else {
    36 my @v = split /\./, $latest, 3;
    37 $data{beta}{ver} = "$v[0].${\($v[1]+1)}.0";
    38 $data{beta}{dir} = $data{beta}{ver} . 'b1';
    39 }
    40
    12 41 my %opt;
    13 42 %opt = (
    14 43 prev => 0,
     
    52 81 my @cands = ();
    53 82 if (opendir DIR, "$ENV{HOME}") {
    54 83 for (readdir DIR) {
    55 if (-d "$ENV{HOME}/$_" && /^t-engine4-src-(\Q$data{$tag}{ver}\E.*)$/) {
    56 push @cands, $1;
    84 if (-d "$ENV{HOME}/$_" &&
    85 /^t-engine4-(?:src|linux(?:|64))-(?:\Q$data{$tag}{ver}\E.*)$/)
    86 {
    87 push @cands, "$ENV{HOME}/$_/game/";
    57 88 }
    58 89 }
    59 90 closedir DIR;
    60 91 }
    61 92 @cands = reverse sort { lc($a) cmp lc($b) } @cands;
    62 93 unshift @cands, $data{$tag}{dir}, $data{$tag}{ver};
    63 for my $cand (@cands) {
    64 my $dir = "$ENV{HOME}/t-engine4-src-$cand/game/";
    94 for my $dir (@cands) {
    65 95 return $dir . $tmpl if -f $dir . $tmpl;
    66 96 }
    67 97 die "No directory for $tmpl; tried @cands\n";
     
    98 128 }
    99 129 if ($opt{possess}) {
    100 130 unzip '/tmp/tome-possessors', file_loc('cur', 'addons/tome-possessors.teaa');
    131 unzip '/tmp/tome-new-possessors', file_loc('beta', 'addons/tome-possessors.teaa') if $opt{beta};
    101 132 }