From 6ee4d58b1f6424924ef55ccc4ae11f7c0bac7b2d Mon Sep 17 00:00:00 2001 From: Yann Dirson Date: Sat, 4 Feb 2006 13:37:02 +0000 Subject: [PATCH] Canonicalize path names to prevent issues with ./ --- NEWS | 10 ++++++++++ doc/README.dbk.xml | 6 +----- lib/graphincludes/project.pm | 6 +++--- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index ee58c90..6efe96a 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ +Version 0.13 - UNRELEASED + + Bugs fixed: + + * The path-handling functions in the default project class were + confused by leading "./" in paths and failed to idendify some + dependencies. + +================================================== + Version 0.12 - 2006-02-03 End-user-visible changes diff --git a/doc/README.dbk.xml b/doc/README.dbk.xml index 26391b6..791dc86 100644 --- a/doc/README.dbk.xml +++ b/doc/README.dbk.xml @@ -715,7 +715,7 @@ graph transformations a rather clean dependency graph - Maelstrom-3.0.6$ graph-includes -v -sysI /usr/include/SDL -I . -I ./netlogic -I ./maclib -I ./screenlib --prefixstrip ./ -o deps.ps . + Maelstrom-3.0.6$ graph-includes -v -sysI /usr/include/SDL -I . -I ./netlogic -I ./maclib -I ./screenlib -o deps.ps . more work has to be put in the wesnoth example class: @@ -971,10 +971,6 @@ graph transformations allow -I syntax for programs using eg. -I. from source subdirectory - - behave as expected wrt leading "./", use - File::Spec for more portability - consider using Cwd::realpath or so, for correct "../" handling diff --git a/lib/graphincludes/project.pm b/lib/graphincludes/project.pm index 86c09fd..c25efeb 100644 --- a/lib/graphincludes/project.pm +++ b/lib/graphincludes/project.pm @@ -12,7 +12,7 @@ our @ISA; use graphincludes::graph; -use File::Spec::Functions qw(catfile catpath splitdir splitpath); +use File::Spec::Functions qw(catfile catpath splitdir splitpath canonpath); use Hash::Util qw(lock_keys); use Carp qw(croak); @@ -32,7 +32,7 @@ sub new { my $class = shift; my %args = @_; my $prefixstrip = $args{prefixstrip}; - my @files = @{$args{files}}; # take a copy of @ARGV + my @files = map { canonpath($_) } @{$args{files}}; # take a (cleaned up) copy of @ARGV my $self = {}; # if (defined $_language) { @@ -94,7 +94,7 @@ sub locatefile { my $dstfile; foreach my $dir (@path) { my @srcpath = splitdir ($dir); - if (defined($dstfile = fullpath(\@dstpath,$strip,\@srcpath)) and + if (defined($dstfile = canonpath(fullpath(\@dstpath,$strip,\@srcpath))) and grep { $_->{LABEL} eq $dstfile } $self->{ROOTGRAPH}->get_nodes) { print STDERR " Found from $dir ($dstfile)\n" if $graphincludes::params::debug; last; -- 2.11.4.GIT