|
|
5523e9 |
--- rpm-4.11.3/scripts/perl.req.old 2019-05-26 15:41:33.316395021 +0200
|
|
|
5523e9 |
+++ rpm-4.11.3/scripts/perl.req 2019-05-26 14:08:38.248028422 +0200
|
|
|
5523e9 |
@@ -90,10 +90,10 @@
|
|
|
5523e9 |
|
|
|
5523e9 |
sub compute_global_requires {
|
|
|
5523e9 |
|
|
|
5523e9 |
-# restrict require to all non provided by the file
|
|
|
5523e9 |
- foreach my $moduler (sort keys %require) {
|
|
|
5523e9 |
- if (exists $provide{$moduler} && length($require{$moduler}) == 0) {
|
|
|
5523e9 |
- $require = delete $require{$moduler};
|
|
|
5523e9 |
+# restrict require_removable to all non provided by the file
|
|
|
5523e9 |
+ foreach my $moduler (sort keys %require_removable) {
|
|
|
5523e9 |
+ if (exists $provide{$moduler} && length($require_removable{$moduler}) == 0) {
|
|
|
5523e9 |
+ $require_removable = delete $require_removable{$moduler};
|
|
|
5523e9 |
}
|
|
|
5523e9 |
}
|
|
|
5523e9 |
# store requires to global_requires
|
|
|
5523e9 |
@@ -107,8 +107,21 @@
|
|
|
5523e9 |
$global_require{$module} = $newver;
|
|
|
5523e9 |
}
|
|
|
5523e9 |
}
|
|
|
5523e9 |
+
|
|
|
5523e9 |
+# store requires_removable to global_requires
|
|
|
5523e9 |
+ foreach my $module (sort keys %require_removable) {
|
|
|
5523e9 |
+ my $oldver = $global_require{$module};
|
|
|
5523e9 |
+ my $newver = $require_removable{$module};
|
|
|
5523e9 |
+ if ($oldver) {
|
|
|
5523e9 |
+ $global_require{$module} = $newver
|
|
|
5523e9 |
+ if ($HAVE_VERSION && $newver && version->new($oldver) < $newver);
|
|
|
5523e9 |
+ } else {
|
|
|
5523e9 |
+ $global_require{$module} = $newver;
|
|
|
5523e9 |
+ }
|
|
|
5523e9 |
+ }
|
|
|
5523e9 |
# remove all local requires and provides
|
|
|
5523e9 |
undef %require;
|
|
|
5523e9 |
+ undef %require_removable;
|
|
|
5523e9 |
undef %provide;
|
|
|
5523e9 |
}
|
|
|
5523e9 |
|
|
|
5523e9 |
@@ -124,6 +137,18 @@
|
|
|
5523e9 |
}
|
|
|
5523e9 |
}
|
|
|
5523e9 |
|
|
|
5523e9 |
+sub add_require_removable {
|
|
|
5523e9 |
+ my ($module, $newver) = @_;
|
|
|
5523e9 |
+ my $oldver = $require_removable{$module};
|
|
|
5523e9 |
+ if ($oldver) {
|
|
|
5523e9 |
+ $require_removable{$module} = $newver
|
|
|
5523e9 |
+ if ($HAVE_VERSION && $newver && version->new($oldver) < $newver);
|
|
|
5523e9 |
+ }
|
|
|
5523e9 |
+ else {
|
|
|
5523e9 |
+ $require_removable{$module} = $newver;
|
|
|
5523e9 |
+ }
|
|
|
5523e9 |
+}
|
|
|
5523e9 |
+
|
|
|
5523e9 |
sub process_file {
|
|
|
5523e9 |
|
|
|
5523e9 |
my ($file) = @_;
|
|
|
5523e9 |
@@ -286,7 +311,6 @@
|
|
|
5523e9 |
|
|
|
5523e9 |
# if the module starts with /, it is an absolute path to a file
|
|
|
5523e9 |
if ($module =~ m(^/)) {
|
|
|
5523e9 |
- print "$module\n";
|
|
|
5523e9 |
next;
|
|
|
5523e9 |
}
|
|
|
5523e9 |
|
|
|
5523e9 |
@@ -346,7 +370,13 @@
|
|
|
5523e9 |
add_require($_, undef) for split(' ', $1);
|
|
|
5523e9 |
}
|
|
|
5523e9 |
elsif ($version =~ /(["'])([^"']+)\1/) {
|
|
|
5523e9 |
- add_require($2, undef);
|
|
|
5523e9 |
+ # requires like "use base name" can be removed if they are
|
|
|
5523e9 |
+ # provided in the same file
|
|
|
5523e9 |
+ if (($whitespace eq "") && ($statement eq "use") && ($module eq "base")) {
|
|
|
5523e9 |
+ add_require_removable($2, undef);
|
|
|
5523e9 |
+ } else {
|
|
|
5523e9 |
+ add_require($2, undef);
|
|
|
5523e9 |
+ }
|
|
|
5523e9 |
}
|
|
|
5523e9 |
next;
|
|
|
5523e9 |
}
|