summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason Woodward2013-02-02 12:49:51 -0500
committerJason Woodward2013-02-02 12:49:51 -0500
commit2c34118c7f46cb0862f136ff778c3ab3c9a30f9c (patch)
tree7d14eb96c40769b6e97eb8327b3ac723490bf543
parent9dcd37e15b7aadf14e8e4e8e8cc79a67927eb8c4 (diff)
downloadcpan2tgz-2c34118c7f46cb0862f136ff778c3ab3c9a30f9c.tar.gz
installed packages and dependency fix
Iain Paton reports: Recently however I've uncovered a couple of small problems, both triggered by the DateTime module. First is the regex used when reading the contents of /var/log/packages only grabs the first two dash seperated parts of the filename. This presents a problem when I have something like perl-datetime-timezone-1.56-noarch-1.txz installed as that's seen as being just perl-datetime which causes a "deferred, already in queue or installed" error. As there's lots of perl modules that result in filenames with more than two parts, I'm kind of suprised that one hasn't shown up previously, but this is certainly the first I've seen it. Second, after fixing the above, I find that DateTime seems to have somehow put in a dependency on perl 5.008. I'm assuming this means anything greater than that version. This then shows up in what's returned by $pack->prereq_pm() under requires and leads to the somewhat amusing message: handling 1 dependencies for DateTime: perl it then unsurprisingly fails to find a module called perl.
-rwxr-xr-xcpan2tgz4
1 files changed, 3 insertions, 1 deletions
diff --git a/cpan2tgz b/cpan2tgz
index 01814ee..0ccb5e0 100755
--- a/cpan2tgz
+++ b/cpan2tgz
@@ -66,7 +66,7 @@ usage() unless (scalar(@ARGV) > 0 || $upgrade_all);
if ( opendir(my $pkg_log_dir,"/var/log/packages") ) {
my @pkgs =
- map { s/(perl\-?.*?)\-(.*?[\.\-].*?[\.\-].*)/$1/; $_;}
+ map { s/^(perl-[\w\-]+)-(([\w\.]+)-(\w+)-(\w+))$/$1/; $_;}
grep { m/^perl/ }
grep { ! m/^\.+$/}
readdir($pkg_log_dir);
@@ -171,6 +171,7 @@ sub do_package
# only get the deps that are not installed
@deps = grep { defined && m/\w+/; }
+ grep { ! m/^perl$/ }
map { defined $PACKAGE_CACHE_LIST{$_} ? undef : $_ }
map { m/requires$/ ? keys %{$deps->{$_}} : $_ }
keys %{$deps};
@@ -179,6 +180,7 @@ sub do_package
# get all dependencies
@deps = grep { $_ && m/\w+/; }
+ grep { ! m/^perl$/ }
map { defined $PACKAGE_CACHE_LIST{$_} ? undef : $_ }
map { eval "no warnings 'all'; use $_;"; if ($@) { $_ } }
map { m/requires$/ ? keys %{$deps->{$_}} : $_ }