From 58729b97e6fdd6ece2766a2b6651330c1561387b Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Resolve foo-devel dependencies correctly. --- smock/smock.pl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/smock/smock.pl b/smock/smock.pl index ed32162..d7ebbc5 100755 --- a/smock/smock.pl +++ b/smock/smock.pl @@ -167,10 +167,24 @@ sub is_member_of 0; } +sub dependency_in +{ + my $dep = shift; # eg. dbus-devel + + while ($dep) { + return $dep if is_member_of ($dep, @_); + my $newdep = $dep; + $newdep =~ s/-\w+$//; # eg. dbus-devel -> dbus + last if $newdep eq $dep; + $dep = $newdep; + } + 0; +} + my @names = keys %srpms; foreach my $name (@names) { my @buildrequires = @{$srpms{$name}->{buildrequires}}; - @buildrequires = grep { is_member_of ($_, @names) } @buildrequires; + @buildrequires = grep { $_ = dependency_in ($_, @names) } @buildrequires; $srpms{$name}{buildrequires} = \@buildrequires; } -- 1.8.3.1