diff options
author | Guillem Jover <guillem@debian.org> | 2014-01-26 22:44:44 +0100 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2014-04-21 16:23:49 +0200 |
commit | 74e7ba89e0478355cf929e6abde534992bc13342 (patch) | |
tree | c43c62fde0ef498a76c5aab3699089f9d7f01aaa | |
parent | 93a41e1bd09c6eef0383eb67df5a77a28b69ec55 (diff) | |
download | dpkg-74e7ba89e0478355cf929e6abde534992bc13342.tar.gz |
dpkg-checkbuilddeps: Split check_line into build_depends and build_conflicts
The functions have less in common than what it looks like. Splitting the
functions actually reduces the line count.
-rwxr-xr-x | scripts/dpkg-checkbuilddeps.pl | 48 |
1 files changed, 18 insertions, 30 deletions
diff --git a/scripts/dpkg-checkbuilddeps.pl b/scripts/dpkg-checkbuilddeps.pl index 21a7720cf..fdb6dd0d7 100755 --- a/scripts/dpkg-checkbuilddeps.pl +++ b/scripts/dpkg-checkbuilddeps.pl @@ -189,39 +189,27 @@ sub parse_status { # in as the 4th parameter. If not set, dpkg will be queried for the build # architecture. sub build_depends { - return check_line(1, @_); + my ($dep_list, $facts) = @_; + + $dep_list->simplify_deps($facts); + if ($dep_list->is_empty()) { + return (); + } else { + return $dep_list->get_deps(); + } } -# This function is exactly like unmet_build_depends, except it +# This function is exactly like build_depends(), except it # checks for build conflicts, and returns a list of the packages # that are installed and are conflicted with. sub build_conflicts { - return check_line(0, @_); -} - -# This function does all the work. The first parameter is 1 to check build -# deps, and 0 to check build conflicts. -sub check_line { - my $build_depends=shift; - my $dep_list=shift; - my $facts=shift; - - my @unmet=(); - - if ($build_depends) { - $dep_list->simplify_deps($facts); - if ($dep_list->is_empty()) { - return (); - } else { - return $dep_list->get_deps(); - } - } else { # Build-Conflicts - my @conflicts = (); - foreach my $dep ($dep_list->get_deps()) { - if ($dep->get_evaluation($facts)) { - push @conflicts, $dep; - } - } - return @conflicts; - } + my ($dep_list, $facts) = @_; + + my @conflicts = (); + foreach my $dep ($dep_list->get_deps()) { + if ($dep->get_evaluation($facts)) { + push @conflicts, $dep; + } + } + return @conflicts; } |