| 1 | # Copyright © 1998 Richard Braakman | ||||||||||
| 2 | # Copyright © 1999 Darren Benham | ||||||||||
| 3 | # Copyright © 2000 Sean 'Shaleh' Perry | ||||||||||
| 4 | # Copyright © 2004 Frank Lichtenheld | ||||||||||
| 5 | # Copyright © 2006 Russ Allbery | ||||||||||
| 6 | # Copyright © 2007-2009 Raphaël Hertzog <hertzog@debian.org> | ||||||||||
| 7 | # Copyright © 2008-2009, 2012-2014 Guillem Jover <guillem@debian.org> | ||||||||||
| 8 | # | ||||||||||
| 9 | # This program is free software; you can redistribute it and/or modify | ||||||||||
| 10 | # it under the terms of the GNU General Public License as published by | ||||||||||
| 11 | # the Free Software Foundation; either version 2 of the License, or | ||||||||||
| 12 | # (at your option) any later version. | ||||||||||
| 13 | # | ||||||||||
| 14 | # This program is distributed in the hope that it will be useful, | ||||||||||
| 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||
| 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||
| 17 | # GNU General Public License for more details. | ||||||||||
| 18 | # | ||||||||||
| 19 | # You should have received a copy of the GNU General Public License | ||||||||||
| 20 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||||||||
| 21 | |||||||||||
| 22 | =encoding utf8 | ||||||||||
| 23 | |||||||||||
| 24 | =head1 NAME | ||||||||||
| 25 | |||||||||||
| 26 | Dpkg::Deps::Union - list of unrelated dependencies | ||||||||||
| 27 | |||||||||||
| 28 | =head1 DESCRIPTION | ||||||||||
| 29 | |||||||||||
| 30 | This class represents a list of relationships. | ||||||||||
| 31 | It inherits from L<Dpkg::Deps::Multiple>. | ||||||||||
| 32 | |||||||||||
| 33 | =cut | ||||||||||
| 34 | |||||||||||
| 35 | package Dpkg::Deps::Union 1.00; | ||||||||||
| 36 | |||||||||||
| 37 | 4 | ▶ | use v5.36; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 38 | |||||||||||
| 39 | 4 | ▶ | use parent qw(Dpkg::Deps::Multiple); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 40 | |||||||||||
| 41 | =head1 METHODS | ||||||||||
| 42 | |||||||||||
| 43 | =over 4 | ||||||||||
| 44 | |||||||||||
| 45 | =item $dep->output([$fh]) | ||||||||||
| 46 | |||||||||||
| 47 | The output() method uses ", " to join the list of relationships. | ||||||||||
| 48 | |||||||||||
| 49 | =cut | ||||||||||
| 50 | |||||||||||
| 51 | 3 | ▶ | sub output { | ||||||||
|
Subroutine
output: called CC=2 SCAR=7.5
Pod
documented
| |||||||||||
| 52 | 3 | my ($self, $fh) = @_; | |||||||||
| 53 | |||||||||||
| 54 | my $res = join(', ', map { | ||||||||||
| 55 | 6 | $_->output() | |||||||||
| 56 | } grep { | ||||||||||
| 57 | 3 | not $_->is_empty() | |||||||||
| 58 | } $self->get_deps()); | ||||||||||
| 59 | |||||||||||
| 60 | 3 | ▶ | if (defined $fh) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | print { $fh } $res; | |||||||||
| 62 | } | ||||||||||
| 63 | 3 | return $res; | |||||||||
| 64 | } | ||||||||||
| 65 | |||||||||||
| 66 | =item $dep->implies($other_dep) | ||||||||||
| 67 | |||||||||||
| 68 | =item $dep->get_evaluation($other_dep) | ||||||||||
| 69 | |||||||||||
| 70 | These methods are not meaningful for this object and always return undef. | ||||||||||
| 71 | |||||||||||
| 72 | =cut | ||||||||||
| 73 | |||||||||||
| 74 | 0 | ▶ | sub implies { | ||||||||
|
Subroutine
implies: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 75 | # Implication test is not useful on Union. | ||||||||||
| 76 | 0 | return; | |||||||||
| 77 | } | ||||||||||
| 78 | |||||||||||
| 79 | 0 | ▶ | sub get_evaluation { | ||||||||
|
Subroutine
get_evaluation: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 80 | # Evaluation is not useful on Union. | ||||||||||
| 81 | 0 | return; | |||||||||
| 82 | } | ||||||||||
| 83 | |||||||||||
| 84 | =item $dep->simplify_deps($facts) | ||||||||||
| 85 | |||||||||||
| 86 | The simplification is done to generate an union of all the relationships. | ||||||||||
| 87 | It uses $simple_dep->merge_union($other_dep) to get its job done. | ||||||||||
| 88 | |||||||||||
| 89 | =cut | ||||||||||
| 90 | |||||||||||
| 91 | 2 | ▶ | sub simplify_deps { | ||||||||
|
Subroutine
simplify_deps: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||
| 92 | 2 | my ($self, $facts) = @_; | |||||||||
| 93 | 2 | my @new; | |||||||||
| 94 | |||||||||||
| 95 | 2 | ▶ | WHILELOOP: while (@{$self->{list}}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 96 | 9 | my $odep = shift @{$self->{list}}; | |||||||||
| 97 | 9 | foreach my $dep (@new) { | |||||||||
| 98 | 17 | ▶ | next WHILELOOP if $dep->merge_union($odep); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 99 | } | ||||||||||
| 100 | 6 | push @new, $odep; | |||||||||
| 101 | } | ||||||||||
| 102 | 2 | $self->{list} = [ @new ]; | |||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | =back | ||||||||||
| 106 | |||||||||||
| 107 | =head1 CHANGES | ||||||||||
| 108 | |||||||||||
| 109 | =head2 Version 1.00 (dpkg 1.15.6) | ||||||||||
| 110 | |||||||||||
| 111 | Mark the module as public. | ||||||||||
| 112 | |||||||||||
| 113 | =cut | ||||||||||
| 114 | |||||||||||
| 115 | 4 | 1; | |||||||||