This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: genini: support multiple compression formats


On Wed, Mar 10, 2010 at 09:41:34PM -0500, Charles Wilson wrote:
>I'm working on adding .xz support to setup via mingw-liblzma. It's
>code-complete, but I still have a lot of testing to do.  To that end, I
>found that genini needs to be taught about tarballs whose name ends in
>something other than ".bz2".
>
>upset will need something similar, I guess.
>
>2010-03-10  Charles Wilson  <...>
>
>	* genini (parsedir): Support tarballs whose name ends in gz,
>	lzma, and xz in addition to bz2.
>	(filer): Test for existence of tarballs to determine which
>	compression format/extension is used. If not found, default
>	to .bz2.
>	(addfiles): Ripple from changes to filer().
>
>--
>Chuck

>Index: genini
>===================================================================
>RCS file: /cvs/cygwin-apps/genini/genini,v
>retrieving revision 1.9
>diff -u -p -r1.9 genini
>--- genini	2 Mar 2010 00:23:04 -0000	1.9
>+++ genini	11 Mar 2010 02:37:41 -0000
>@@ -173,7 +173,7 @@ sub parsedir {
>     }
> 
>     return if $explicit;
>-    my @files = sort grep{!/-src\.tar.bz2/} glob("$d/*.tar.bz2");
>+    my @files = sort grep{!/-src\.tar\.(gz|bz2|lzma|xz)/} glob("$d/*.tar.{gz,bz2,lzma,xz}");

This is ok, but maybe it would be worth exploring putting all of the
extensions at the top of the file somewhere.

>     if (!@files) {
> 	myerror "not enough package files in $d";
> 	return;
>@@ -192,8 +192,8 @@ sub addfiles {
>     my $pname = shift;
>     my $x = shift;
>     my $d = shift;
>-
>-    my $install = "$d/" . tarball($pname, $x->{'version'});
>+    my @exts = qw(bz2 xz gz lzma);
>+    my $install = tarball($d, \@exts, $pname, $x->{'version'});

Why not just pass the extensions as the final N arguments?  Then there's
no need to pass a reference to an array...

>     filer($x, 'install', $install);
> 
>     if ($pkg{$pname}{''}{'external-source'}) {
>@@ -201,7 +201,7 @@ sub addfiles {
> 	$d = finddir($d, $pname) or return;
>     }
> 
>-    my $source  = "$d/" . tarball($pname, $x->{'version'}, 'src');
>+    my $source  = tarball($d, \@exts, $pname, $x->{'version'}, 'src');
>     filer($x, 'source', $source);
> }
> 
>@@ -225,7 +225,19 @@ sub filer {
> }
> 
> sub tarball {
>-    return join('-', @_) . '.tar.bz2';
>+    my $d = shift;
>+    my @c = @{(shift)};
>+    my $b = join('-', @_) . '.tar.';
>+    my $f;
>+    for my $e (@c) {

...then you just iterate over @_ here.

cgf


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]