1999-09-05 06:03:10 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
|
#
|
|
|
|
|
# Misc. functions used by alien.
|
|
|
|
|
|
|
|
|
|
package Alien;
|
|
|
|
|
|
|
|
|
|
use strict;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Pass this the name and version and revision of a package, it will return the
|
|
|
|
|
# filename of a patch file for the package or undef if there is none.
|
|
|
|
|
sub GetPatch { my ($name,$version,$revision)=@_;
|
2000-04-21 22:18:49 +00:00
|
|
|
my @patches=();
|
|
|
|
|
my $dir;
|
|
|
|
|
foreach $dir (@main::patchdirs) {
|
|
|
|
|
push @patches,glob("$dir/$name\_$version-$revision*.diff.gz");
|
|
|
|
|
}
|
1999-09-05 06:03:10 +00:00
|
|
|
if ($#patches < 0) {
|
|
|
|
|
# try not matching the revision, see if that helps.
|
2000-04-21 22:18:49 +00:00
|
|
|
foreach $dir (@main::patchdirs) {
|
|
|
|
|
push @patches,glob("$dir/$name\_$version*.diff.gz");
|
|
|
|
|
}
|
1999-09-05 06:03:10 +00:00
|
|
|
if ($#patches < 0) {
|
|
|
|
|
# fallback to anything that matches the name.
|
2000-04-21 22:18:49 +00:00
|
|
|
foreach $dir (@main::patchdirs) {
|
|
|
|
|
push @patches,glob("$dir/$name\_*.diff.gz");
|
|
|
|
|
}
|
1999-09-05 06:03:10 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
# If we ended up with multiple matches, return the first.
|
|
|
|
|
return $patches[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
1
|