From 961192d783a0cd962e90fe5f0beabb6a7977b25f Mon Sep 17 00:00:00 2001
From: Pascal Rigaux <pixel@mandriva.com>
Date: Thu, 23 Oct 2008 09:21:04 +0000
Subject: simplify previous commit (detect when @l becomes empty instead of not
 doing things when it's empty)

---
 tools/install-xml-file-list | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

(limited to 'tools/install-xml-file-list')

diff --git a/tools/install-xml-file-list b/tools/install-xml-file-list
index f187f746e..f53f6993b 100755
--- a/tools/install-xml-file-list
+++ b/tools/install-xml-file-list
@@ -349,24 +349,22 @@ sub apply_filter {
     chdir $to_dir;
     foreach (group_by_n(20, $all_files)) {
 	my @l = $b_flatten ? (map { basename($_) } @$_) : (map { "./$_" } @$_);
-	@l = grep { ! -d $_ } @l;
+	@l = grep { ! -d $_ } @l or next;
 
 	if (my $subst = $filter->{subst}) {
-	    system('perl', '-pi', '-e', $subst, @l) if @l;
+	    system('perl', '-pi', '-e', $subst, @l);
 	}
 	if (my $command = $filter->{command}) {
 	    $command = $initial_dir . "/$command" if $command =~ m!^..?/!;
 	    if ($command =~ /simplify-drakx-modules/) {
-		@l = grep { !/\.so($|\.)/ } @l;
+		@l = grep { !/\.so($|\.)/ } @l or next;
 	    }
 	    my @options = (
 		if_($command eq 'gzip', '-9f'),
 		if_($command eq 'strip', '2>/dev/null'),
 	    );
-	    if (@l) {
-		warn "running $command @options @l\n" if $verbose;
-		system(join(' ', $command, @options, @l));
-	    }
+	    warn "running $command @options @l\n" if $verbose;
+	    system(join(' ', $command, @options, @l));
 	}
     }
     chdir $initial_dir;
-- 
cgit v1.2.1