RE: Freeze in perl script after cygwin upgrade 1.5.17 - 1.5.18 (corection)

2005-07-05 Thread Jacek Piskozub
Ignore my previous post. I attached the HTMLized version downloaded as a 
test of wget :-(


This is the real script.

J.
#!/perl

# make-jars [-f] [-v] [-l] [-x] [-a] [-e] [-d chromeDir] [-s srcdir] [-t 
topsrcdir] [-c localedir] [-z zipprog] [-o operating-system]  jar.mn

my $cygwin_mountprefix = ;
if ($^O eq cygwin) {
$cygwin_mountprefix = $ENV{CYGDRIVE_MOUNT};
if ($cygwin_mountprefix eq ) {
  $cygwin_mountprefix = `mount -p | awk '{ if (/^\\//) { print \$1; exit } 
}'`;
  if ($cygwin_mountprefix eq ) {
print Cannot determine cygwin mount points. Exiting.\n;
exit(1);
  }
}
chomp($cygwin_mountprefix);
# Remove extra ^M caused by using dos-mode line-endings
chop $cygwin_mountprefix if (substr($cygwin_mountprefix, -1, 1) eq \r);
} else {
# we'll be pulling in some stuff from the script directory
require FindBin;
import FindBin;
push @INC, $FindBin::Bin;
}

use strict;

use Getopt::Std;
use Cwd;
use File::stat;
use Time::localtime;
use File::Copy;
use File::Path;
use File::Spec;
use File::Basename;
use IO::File;
use Config;
require mozLock;
import mozLock;

my $objdir = getcwd;

# if there's a --, everything after it goes into $defines.  We don't do
# this with the remaining args in @ARGV after the getopts call because
# old versions of Getopt::Std don't understand --.
my $ddindex = 0;
foreach my $arg (@ARGV) {
  ++$ddindex;
  last if ($arg eq --);
}
my $defines = join(' ', @ARGV[ $ddindex .. $#ARGV ]);

getopts(d:s:t:c:f:avlD:o:p:xz:e:);

my $baseFilesDir = .;
if (defined($::opt_s)) {
$baseFilesDir = $::opt_s;
}

my $topSrcDir;
if (defined($::opt_t)) {
$topSrcDir = $::opt_t;
}

my $localeDir;
if (defined($::opt_c)) {
$localeDir = $::opt_c;
}

my $maxCmdline = 4000;
if ($Config{'archname'} =~ /VMS/) {
$maxCmdline = 200;
}

my $chromeDir = .;
if (defined($::opt_d)) {
$chromeDir = $::opt_d;
}

my $verbose = 0;
if (defined($::opt_v)) {
$verbose = 1;
}

my $fileformat = jar;
if (defined($::opt_f)) {
($fileformat = $::opt_f) =~ tr/A-Z/a-z/;
}

if ($fileformat ne jar 
$fileformat ne flat 
$fileformat ne symlink 
$fileformat ne both) {
print File format specified by -f option must be one of: jar, flat, both, 
or symlink.\n;
exit(1);
}

my $zipmoveopt = ;
if ($fileformat eq jar) {
$zipmoveopt = -m -0;
}
if ($fileformat eq both) {
$zipmoveopt = -0;
}

my $nofilelocks = 0;
if (defined($::opt_l)) {
$nofilelocks = 1;
}

my $autoreg = 1;
if (defined($::opt_a)) {
$autoreg = 0;
}

my $useExtensionManifest = 0;
if (defined($::opt_e)) {
$useExtensionManifest = 1;
}

my $preprocessor = ;
if (defined($::opt_p)) {
$preprocessor = $::opt_p;
}

my $force_x11 = 0;
if (defined($::opt_x)) {
$force_x11 = 1;
}

my $zipprog = $ENV{ZIP};
if (defined($::opt_z)) {
$zipprog = $::opt_z;
}

if ($zipprog eq ) {
print A valid zip program must be given via the -z option or the ZIP 
environment variable. Exiting.\n;
exit(1);
}

my $force_os;
if (defined($::opt_o)) {
$force_os = $::opt_o;
}

if ($verbose) {
print make-jars 
. -v -d $chromeDir 
. -z $zipprog 
. ($fileformat ? -f $fileformat  : )
. ($nofilelocks ? -l  : )
. ($baseFilesDir ? -s $baseFilesDir  : )
. \n;
}

my $win32 = ($^O =~ /((MS)?win32)|msys|cygwin|os2/i) ? 1 : 0;
my $macos = ($^O =~ /MacOS|darwin/i) ? 1 : 0;
my $unix  = !($win32 || $macos) ? 1 : 0;
my $vms   = ($^O =~ /VMS/i) ? 1 : 0;

if ($force_x11) {
$win32 = 0;
$macos = 0;
$unix = 1;
}

if (defined($force_os)) {
$win32 = 0;
$macos = 0;
$unix = 0;
if ($force_os eq WINNT) {
$win32 = 1;
} elsif ($force_os eq OS2) {
$win32 = 1;
} elsif ($force_os eq Darwin) {
$macos = 1;
} else {
$unix = 1;
}
}

sub foreignPlatformFile
{
   my ($jarfile) = @_;
   
   if (!$win32  index($jarfile, -win) != -1) {
 return 1;
   }
   
   if (!$unix  index($jarfile, -unix) != -1) {
 return 1; 
   }

   if (!$macos  index($jarfile, -mac) != -1) {
 return 1;
   }

   return 0;
}

sub zipErrorCheck($$)
{
my ($err,$lockfile) = @_;
return if ($err == 0 || $err == 12);
mozUnlock($lockfile) if (!$nofilelocks);
die (Error invoking zip: $err);
}

sub JarIt
{
my ($destPath, $jarfile, $args, $overrides) = @_;
my $oldDir = cwd();
chdir($destPath/$jarfile);

if ($fileformat eq flat || $fileformat eq symlink) {
unlink(../$jarfile.jar) if ( -e ../$jarfile.jar);
chdir($oldDir);
return 0;
}

#print cd $destPath/$jarfile\n;

my $lockfile = ../$jarfile.lck;

mozLock($lockfile) if (!$nofilelocks);

if (!($args eq )) {
my $cwd = getcwd;
my $err = 0; 

#print $zipprog $zipmoveopt -uX ../$jarfile.jar $args\n;

# Handle posix cmdline limits
while (length($args)  $maxCmdline) {
#print Exceeding POSIX cmdline limit:  . length($args) . \n;
my $subargs = substr($args, 

RE: Freeze in perl script after cygwin upgrade 1.5.17 - 1.5.18 (corection)

2005-07-05 Thread Dave Korn
Original Message
From: Jacek Piskozub
Sent: 05 July 2005 12:09

 Ignore my previous post. I attached the HTMLized version downloaded as a
 test of wget :-(
 
 This is the real script.
 
 J.

[EMAIL PROTECTED] /test/perl ./make-jars.pl
: bad interpreter: No such file or directory
[EMAIL PROTECTED] /test/perl write ./make-jars.pl
  [ changed shebang to /bin/perl ]
[EMAIL PROTECTED] /test/perl d2u make-jars.pl
make-jars.pl: done.
[EMAIL PROTECTED] /test/perl ./make-jars.pl
Can't locate mozLock.pm in @INC (@INC contains: /usr/lib/perl5/5.8/cygwin
/usr/l
ib/perl5/5.8 /usr/lib/perl5/site_perl/5.8/cygwin
/usr/lib/perl5/site_perl/5.8 /u
sr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin
/usr/lib/perl5/
vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 .) at ./make-jars.pl line 37.
[EMAIL PROTECTED] /test/perl


cheers,
  DaveK
-- 
Can't think of a witty .sigline today


--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/