mirror of
https://github.com/Project-OSS-Revival/alien.git
synced 2026-04-24 14:00:17 +00:00
Moved in patch finding code.
This commit is contained in:
@@ -200,6 +200,38 @@ sub unpack {
|
||||
return 1;
|
||||
}
|
||||
|
||||
=item getpatch
|
||||
|
||||
This method tries to find a patch file to use in the prep stage. If it
|
||||
finds one, it returns it. Pass in a list of directories to search for
|
||||
patches in.
|
||||
|
||||
=cut
|
||||
|
||||
sub getpatch {
|
||||
my $this=shift;
|
||||
|
||||
my @patches;
|
||||
foreach my $dir (@_) {
|
||||
push @patches,glob("$dir/".$this->name."_".$this->version."-".$this->revision."*.diff.gz");
|
||||
}
|
||||
unless (@patches) {
|
||||
# Try not matching the revision, see if that helps.
|
||||
foreach my $dir (@_) {
|
||||
push @patches,glob("$dir/".$this->name."_".$this->version."*.diff.gz");
|
||||
}
|
||||
unless (@patches) {
|
||||
# Fallback to anything that matches the name.
|
||||
foreach my $dir (@_) {
|
||||
push @patches,glob("$dir/".$this->name."_*.diff.gz");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If we ended up with multiple matches, return the first.
|
||||
return $patches[0];
|
||||
}
|
||||
|
||||
=item prep
|
||||
|
||||
Adds a populated debian directory the unpacked package tree, making it
|
||||
|
||||
35
lib/Alien.pm
35
lib/Alien.pm
@@ -1,35 +0,0 @@
|
||||
#!/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)=@_;
|
||||
my @patches=();
|
||||
my $dir;
|
||||
foreach $dir (@main::patchdirs) {
|
||||
push @patches,glob("$dir/$name\_$version-$revision*.diff.gz");
|
||||
}
|
||||
if ($#patches < 0) {
|
||||
# try not matching the revision, see if that helps.
|
||||
foreach $dir (@main::patchdirs) {
|
||||
push @patches,glob("$dir/$name\_$version*.diff.gz");
|
||||
}
|
||||
if ($#patches < 0) {
|
||||
# fallback to anything that matches the name.
|
||||
foreach $dir (@main::patchdirs) {
|
||||
push @patches,glob("$dir/$name\_*.diff.gz");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# If we ended up with multiple matches, return the first.
|
||||
return $patches[0];
|
||||
}
|
||||
|
||||
1
|
||||
Reference in New Issue
Block a user