[leaf-commits] src/bering-uclibc4/buildtool/tools getdirname.pl, 1.1.1.1, 1.2

david M brooke <[email protected]>
Newsgroups gmane.linux.leaf.cvs
Message-ID <[email protected]>
Update of /cvsroot/leaf/src/bering-uclibc4/buildtool/tools
In directory sfp-cvsdas-2.v30.ch3.sourceforge.com:/tmp/cvs-serv14340

Modified Files:
	getdirname.pl 
Log Message:
Added logic to handle .tar.bz2 files

Index: getdirname.pl
===================================================================
RCS file: /cvsroot/leaf/src/bering-uclibc4/buildtool/tools/getdirname.pl,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** getdirname.pl	26 Apr 2010 09:03:16 -0000	1.1.1.1
--- getdirname.pl	20 Oct 2010 21:33:53 -0000	1.2
***************
*** 1,3 ****
! #! /usr/bin/perl
  
  sub usage() {
--- 1,6 ----
! #!/usr/bin/perl
! 
! use strict;
! use warnings;
  
  sub usage() {
***************
*** 11,15 ****
  	print <<EOF;
  	$0 returns the dir name of the first
! 	entry of the given tgz file
  EOF
  
--- 14,18 ----
  	print <<EOF;
  	$0 returns the dir name of the first
! 	entry of the given .tgz  / .tar.gz / .tar.bz2 file
  EOF
  
***************
*** 24,33 ****
  
  my $filename=$ARGV[0];
! #print STDERR "tyring to open $filename\n";
! open DIRNAME, "tar tzf $filename | head -1 |" or die("unable to open tarfile $filename ");
  	
  my $line=<DIRNAME>;
  	chop $line;
- 	
  
  close DIRNAME;
--- 27,52 ----
  
  my $filename=$ARGV[0];
! 
! my $filetype=`file --brief $filename`;
! #print STDERR "file command says file is: $filetype\n";
! if ( ! defined( $filetype ) ) {
! 	printf STDERR "warning: file(1) not found; guessing file format gzip\n";
! 	$filetype = "gzip";
! }
! 
! my $tarcmd = "";
! if ( $filetype =~ /^bzip2/ ) {
! 	$tarcmd = "tar -tjf";
! } elsif ( $filetype =~ /^gzip/ ) {
! 	$tarcmd = "tar -tzf";
! } else {
! 	die ( "unsupported file type $filetype" );
! }
! 
! #print STDERR "trying to open $filename\n";
! open DIRNAME, "$tarcmd $filename | head -1 |" or die("unable to open tarfile $filename ");
  	
  my $line=<DIRNAME>;
  	chop $line;
  
  close DIRNAME;


------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.