diff options
Diffstat (limited to 'tools/install-xml-file-list')
| -rwxr-xr-x | tools/install-xml-file-list | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/tools/install-xml-file-list b/tools/install-xml-file-list index f5b809a9d..64c70b9c6 100755 --- a/tools/install-xml-file-list +++ b/tools/install-xml-file-list @@ -19,10 +19,12 @@ if ($>) { $ENV{PATH} = "/sbin:/usr/sbin:$ENV{PATH}"; } +my $verbose; #$verbose = 1; my $initial_dir = cwd(); my $ARCH = arch() =~ /i.86/ ? 'i386' : arch(); +$ARCH =~ s/^(arm).*/$1/; my $LIB = arch() =~ /x86_64/ ? "lib64" : "lib"; my $base_cpio_options = '-pumd --quiet'; @@ -91,7 +93,7 @@ sub valid_cond { sub add_to_env { my ($env, $tag, $attr) = @_; - my %env = map_each { $::a => +{%$::b} } %$env; + my %env = map_each { $::a => +{ %$::b } } %$env; foreach (keys %$attr) { !$env{$tag}{$_} or die qq(overriding attribute <$tag $_="$env{$tag}{$_}"> with $_="$attr->{$_}"\n); $env{$tag}{$_} = $attr->{$_}; @@ -148,17 +150,17 @@ sub collect_needed_libraries { @to_check = (); } } -sub install_needed_libraries { +sub install_needed_libraries() { copy_files('', $DEST, [ keys %needed_libraries ], '', '--dereference'); } sub collect_needed_perl_files { - my ($local_rep, $dest, @scripts) = @_; + my ($local_rep, @scripts) = @_; my (%local, %global); foreach my $script (@scripts) { foreach (`strace -efile perl -cw -I$local_rep $script 2>&1`) { - my ($f) = /^open\("(.*?)",.*\)\s*=\s*\d+$/ or next; + my ($f) = /^open(?:at\([^,]*, |)"(.*?)",.*\)\s*=\s*\d+$/ or next; if ($f =~ m!^\Q$local_rep\E/(.*)!) { $local{$1} = 1; } elsif (begins_with($f, '/dev/')) { @@ -230,11 +232,11 @@ sub install { @l = all_files_rec_($l[0]); } @l = grep { !m!/(\.svn|CVS)($|/)! } @l; - if (my $re = $env->{from}{matching}) { + if (my $re = expand_macros($env->{from}{matching})) { @l = grep { eval $re } @l; } - collect_needed_libraries(grep { -x $_ } @l); + collect_needed_libraries(grep { -f $_ && -x $_ } @l); chdir $initial_dir; @l; @@ -258,7 +260,9 @@ sub install { } elsif ($expand eq 'binary') { $disallow_from_dir->(); - my @PATH = qw(/sbin /bin /usr/bin /usr/sbin /usr/X11R6/bin); + my @PATH = qw(/usr/sbin /usr/bin /usr/X11R6/bin); + unshift(@PATH, "/bin") unless -l "/bin"; + unshift(@PATH, "/sbin") unless -l "/sbin"; foreach my $name (map { expand_macros($_) } @text_l) { my @l = grep { -x $_ } map { "$_/$name" } @PATH; @l or error("can't find binary $name"), next; @@ -295,20 +299,28 @@ sub install { push @files, @l; } + } elsif ($expand eq 'perl-bin') { + $disallow_from_dir->(); + $from_dir = '/usr/LIB/perl5/vendor_perl/'; + @files = @text_l; } elsif ($expand eq 'perl') { $disallow_from_dir->(); - $from_dir = '/usr/lib/perl5/vendor_perl/*'; + $from_dir = '/usr/share/perl5/vendor_perl/'; @files = @text_l; } elsif ($expand eq 'main-perl') { $disallow_from_dir->(); $from_dir = $Config{privlib}; @files = @text_l; + } elsif ($expand eq 'main-perl-bin') { + $disallow_from_dir->(); + $from_dir = $Config{archlib}; + @files = @text_l; } elsif ($expand =~ /collect-perl-files/) { my (undef, $local, $to) = split(' ', $expand); @files = @text_l; warn "collect-perl-files $local $to @files ($env->{filter}{command})\n"; - my ($local_perl_files, $global_perl_files) = collect_needed_perl_files($local, $to, @files); + my ($local_perl_files, $global_perl_files) = collect_needed_perl_files($local, @files); warn "collect-perl-files gave: ", join(' ', @$local_perl_files), "\n"; # warn " and: ", join(' ', @$global_perl_files), "\n"; copy_and_filter($local =~ m!/! ? $local : "$working_dir/$local", "$DEST$to", $local_perl_files, $env->{filter}, '', '--dereference'); @@ -353,6 +365,7 @@ sub apply_filter { @l = grep { ! -d $_ } @l or next; if (my $subst = $filter->{subst}) { + warn "running substition $subst \n" if $verbose; system('perl', '-pi', '-e', $subst, @l); } if (my $command = $filter->{command}) { |
