| 1 | # Copyright © 2008 Ian Jackson <ijackson@chiark.greenend.org.uk> | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # Copyright © 2008 Canonical, Ltd. | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # written by Colin Watson <cjwatson@ubuntu.com> | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # Copyright © 2008 James Westby <jw+debian@jameswestby.net> | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # Copyright © 2009 Raphaël Hertzog <hertzog@debian.org> | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # This program is free software; you can redistribute it and/or modify | ||||||||||||||||||||||||||||||||||||||||||
| 8 | # it under the terms of the GNU General Public License as published by | ||||||||||||||||||||||||||||||||||||||||||
| 9 | # the Free Software Foundation; either version 2 of the License, or | ||||||||||||||||||||||||||||||||||||||||||
| 10 | # (at your option) any later version. | ||||||||||||||||||||||||||||||||||||||||||
| 11 | # | ||||||||||||||||||||||||||||||||||||||||||
| 12 | # This program is distributed in the hope that it will be useful, | ||||||||||||||||||||||||||||||||||||||||||
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||||||||||||||||||||||||||||||||||||||||
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||||||||||||||||||||||||||||||||||||||||
| 15 | # GNU General Public License for more details. | ||||||||||||||||||||||||||||||||||||||||||
| 16 | # | ||||||||||||||||||||||||||||||||||||||||||
| 17 | # You should have received a copy of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||
| 18 | # along with this program. If not, see <https://www.gnu.org/licenses/>. | ||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | =encoding utf8 | ||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | =head1 NAME | ||||||||||||||||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||||||||||||||||
| 24 | Dpkg::Vendor::Ubuntu - Ubuntu vendor class | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | =head1 DESCRIPTION | ||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | This vendor class customizes the behavior of dpkg scripts for Ubuntu | ||||||||||||||||||||||||||||||||||||||||||
| 29 | specific behavior and policies. | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | B<Note>: This is a private module, its API can change at any time. | ||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | package Dpkg::Vendor::Ubuntu 0.01; | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 3 | ▶ | use v5.36; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 3 | ▶ | use List::Util qw(any); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||||||||
| 41 | 3 | ▶ | use Dpkg::ErrorHandling; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 3 | ▶ | use Dpkg::Gettext; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 3 | ▶ | use Dpkg::Control::Types; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | 3 | ▶ | use parent qw(Dpkg::Vendor::Debian); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 256 | ▶ | sub run_hook { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
run_hook: called CC=16 SCAR=43.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 256 | my ($self, $hook, @params) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||||||||||||||||
| 50 | 256 | ▶ | if ($hook eq 'before-source-build') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 6 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | my $src = shift @params; | |||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $fields = $src->{fields}; | |||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | # Check that Maintainer/XSBC-Original-Maintainer comply to: | ||||||||||||||||||||||||||||||||||||||||||
| 55 | # <https://wiki.ubuntu.com/DebianMaintainerField>. | ||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | if (defined($fields->{'Version'}) and | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
defined $fields->{"Version"} and defined $fields->{"Maintainer"} and $fields->{"Version"} =~ /ubuntu/u
defined $fields->{"Version"} and defined $fields->{"Maintainer"}
MC/DC0%0/3
defined $fields->{"Version"} and defined $fields->{"Maintainer"} and $fields->{"Version"} =~ /ubuntu/u
defined $fields->{"Version"}
defined $fields->{"Maintainer"}
$fields->{"Version"} =~ /ubuntu/u
Truth table0%0/4
A and B and C
A= defined $fields->{"Version"}B= defined $fields->{"Maintainer"}C= $fields->{"Version"} =~ /ubuntu/u
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | defined($fields->{'Maintainer'}) and | ||||||||||||||||||||||||||||||||||||||||||
| 58 | $fields->{'Version'} =~ /ubuntu/) | ||||||||||||||||||||||||||||||||||||||||||
| 59 | { | ||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | if ($fields->{'Maintainer'} !~ /(?:ubuntu|canonical)/i) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 0 | ▶ | if (length $ENV{DEBEMAIL} and | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
length $ENV{"DEBEMAIL"} and $ENV{"DEBEMAIL"} =~ /\@(?:ubuntu|canonical)\.com/u
MC/DC0%0/2
length $ENV{"DEBEMAIL"} and $ENV{"DEBEMAIL"} =~ /\@(?:ubuntu|canonical)\.com/u
length $ENV{"DEBEMAIL"}
$ENV{"DEBEMAIL"} =~ /\@(?:ubuntu|canonical)\.com/u
Truth table0%0/3
A and B
A= length $ENV{"DEBEMAIL"}B= $ENV{"DEBEMAIL"} =~ /\@(?:ubuntu|canonical)\.com/u
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | $ENV{DEBEMAIL} =~ /\@(?:ubuntu|canonical)\.com/) | ||||||||||||||||||||||||||||||||||||||||||
| 63 | { | ||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | error(g_('version number suggests %s vendor changes, ' . | |||||||||||||||||||||||||||||||||||||||||
| 65 | 'but the %s field does not have %s vendor address'), | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 'Ubuntu', 'Maintainer', 'Ubuntu'); | ||||||||||||||||||||||||||||||||||||||||||
| 67 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | warning(g_('version number suggests %s vendor changes, ' . | |||||||||||||||||||||||||||||||||||||||||
| 69 | 'but the %s field does not have %s vendor address'), | ||||||||||||||||||||||||||||||||||||||||||
| 70 | 'Ubuntu', 'Maintainer', 'Ubuntu'); | ||||||||||||||||||||||||||||||||||||||||||
| 71 | } | ||||||||||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | unless ($fields->{'Original-Maintainer'}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | warning(g_('version number suggests %s vendor changes, ' . | |||||||||||||||||||||||||||||||||||||||||
| 75 | 'but there is no %s field'), | ||||||||||||||||||||||||||||||||||||||||||
| 76 | 'Ubuntu', 'XSBC-Original-Maintainer'); | ||||||||||||||||||||||||||||||||||||||||||
| 77 | } | ||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||
| 79 | } elsif ($hook eq 'package-keyrings') { | ||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | return ($self->SUPER::run_hook($hook), | |||||||||||||||||||||||||||||||||||||||||
| 81 | '/usr/share/keyrings/ubuntu-archive-keyring.gpg'); | ||||||||||||||||||||||||||||||||||||||||||
| 82 | } elsif ($hook eq 'archive-keyrings') { | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | return ($self->SUPER::run_hook($hook), | |||||||||||||||||||||||||||||||||||||||||
| 84 | '/usr/share/keyrings/ubuntu-archive-keyring.gpg'); | ||||||||||||||||||||||||||||||||||||||||||
| 85 | } elsif ($hook eq 'archive-keyrings-historic') { | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | return ($self->SUPER::run_hook($hook), | |||||||||||||||||||||||||||||||||||||||||
| 87 | '/usr/share/keyrings/ubuntu-archive-removed-keys.gpg'); | ||||||||||||||||||||||||||||||||||||||||||
| 88 | } elsif ($hook eq 'register-custom-fields') { | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 1 | my @field_ops = $self->SUPER::run_hook($hook); | |||||||||||||||||||||||||||||||||||||||||
| 90 | 1 | push @field_ops, [ | |||||||||||||||||||||||||||||||||||||||||
| 91 | 'register', 'Launchpad-Bugs-Fixed', | ||||||||||||||||||||||||||||||||||||||||||
| 92 | CTRL_FILE_CHANGES | CTRL_CHANGELOG, | ||||||||||||||||||||||||||||||||||||||||||
| 93 | ], [ | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 'insert_after', CTRL_FILE_CHANGES, 'Closes', 'Launchpad-Bugs-Fixed', | ||||||||||||||||||||||||||||||||||||||||||
| 95 | ], [ | ||||||||||||||||||||||||||||||||||||||||||
| 96 | 'insert_after', CTRL_CHANGELOG, 'Closes', 'Launchpad-Bugs-Fixed', | ||||||||||||||||||||||||||||||||||||||||||
| 97 | ]; | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 1 | return @field_ops; | |||||||||||||||||||||||||||||||||||||||||
| 99 | } elsif ($hook eq 'post-process-changelog-entry') { | ||||||||||||||||||||||||||||||||||||||||||
| 100 | 250 | my $fields = shift @params; | |||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||
| 102 | # Add Launchpad-Bugs-Fixed field. | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 250 | ▶ | my $bugs = find_launchpad_closes($fields->{'Changes'} // ''); | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$fields->{"Changes"} // ""
MC/DC0%0/1
$fields->{"Changes"} // ""
$fields->{"Changes"}
Truth table50%1/2
A
A= $fields->{"Changes"}
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 250 | ▶ | if (scalar(@$bugs)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 105 | 7 | $fields->{'Launchpad-Bugs-Fixed'} = join(' ', @$bugs); | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 108 | 5 | return $self->SUPER::run_hook($hook, @params); | |||||||||||||||||||||||||||||||||||||||||
| 109 | } | ||||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | # Override Debian default features. | ||||||||||||||||||||||||||||||||||||||||||
| 113 | 5 | ▶ | sub init_build_features { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_build_features: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 5 | my ($self, $use_feature, $builtin_feature) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 5 | $self->SUPER::init_build_features($use_feature, $builtin_feature); | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 5 | require Dpkg::Arch; | |||||||||||||||||||||||||||||||||||||||||
| 119 | 5 | my $arch = Dpkg::Arch::get_host_arch(); | |||||||||||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||||||||||||
| 121 | 5 | ▶ | if (any { $_ eq $arch } qw(amd64 arm64 ppc64el s390x)) { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 3 | $use_feature->{optimize}{lto} = 1; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | } | ||||||||||||||||||||||||||||||||||||||||||
| 125 | |||||||||||||||||||||||||||||||||||||||||||
| 126 | 5 | ▶ | sub set_build_features { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_build_features: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | 5 | my ($self, $flags) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||
| 129 | 5 | $self->SUPER::set_build_features($flags); | |||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | 5 | require Dpkg::Arch; | |||||||||||||||||||||||||||||||||||||||||
| 132 | 5 | my $arch = Dpkg::Arch::get_host_arch(); | |||||||||||||||||||||||||||||||||||||||||
| 133 | |||||||||||||||||||||||||||||||||||||||||||
| 134 | 5 | ▶ | if ($arch eq 'ppc64el' && $flags->get_option_value('optimize-level') != 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$arch eq "ppc64el" and $flags->get_option_value("optimize-level") != 0
MC/DC50%1/2
$arch eq "ppc64el" and $flags->get_option_value("optimize-level") != 0
$arch eq "ppc64el"
$flags->get_option_value("optimize-level") != 0
Truth table66%2/3
A and B
A= $arch eq "ppc64el"B= $flags->get_option_value("optimize-level") != 0
| |||||||||||||||||||||||||||||||||||||||||||
| 135 | 1 | $flags->set_option_value('optimize-level', 3); | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | |||||||||||||||||||||||||||||||||||||||||||
| 138 | 5 | $flags->set_option_value('fortify-level', 3); | |||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | |||||||||||||||||||||||||||||||||||||||||||
| 141 | 5 | ▶ | sub add_build_flags { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_build_flags: called CC=13 SCAR=32.2
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | 5 | my ($self, $flags) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 5 | my @compile_flags = qw( | |||||||||||||||||||||||||||||||||||||||||
| 145 | CFLAGS | ||||||||||||||||||||||||||||||||||||||||||
| 146 | CXXFLAGS | ||||||||||||||||||||||||||||||||||||||||||
| 147 | OBJCFLAGS | ||||||||||||||||||||||||||||||||||||||||||
| 148 | OBJCXXFLAGS | ||||||||||||||||||||||||||||||||||||||||||
| 149 | FFLAGS | ||||||||||||||||||||||||||||||||||||||||||
| 150 | FCFLAGS | ||||||||||||||||||||||||||||||||||||||||||
| 151 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 5 | $self->SUPER::add_build_flags($flags); | |||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | # Per <https://wiki.ubuntu.com/DistCompilerFlags>. | ||||||||||||||||||||||||||||||||||||||||||
| 156 | 5 | $flags->prepend('LDFLAGS', '-Wl,-Bsymbolic-functions'); | |||||||||||||||||||||||||||||||||||||||||
| 157 | |||||||||||||||||||||||||||||||||||||||||||
| 158 | # In Ubuntu these flags are set by the compiler, so when disabling the | ||||||||||||||||||||||||||||||||||||||||||
| 159 | # features we need to pass appropriate flags to disable them. | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 5 | ▶ | if (! $flags->use_feature('hardening', 'stackprotectorstrong') && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$flags->use_feature("hardening", "stackprotectorstrong") or $flags->use_feature("hardening", "stackprotector")
MC/DC0%0/2
$flags->use_feature("hardening", "stackprotectorstrong") or $flags->use_feature("hardening", "stackprotector")
$flags->use_feature("hardening", "stackprotectorstrong")
$flags->use_feature("hardening", "stackprotector")
Truth table33%1/3
A or B
A= $flags->use_feature("hardening", "stackprotectorstrong")B= $flags->use_feature("hardening", "stackprotector")
| |||||||||||||||||||||||||||||||||||||||||||
| 161 | ! $flags->use_feature('hardening', 'stackprotector')) { | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | my $flag = '-fno-stack-protector'; | |||||||||||||||||||||||||||||||||||||||||
| 163 | 0 | $flags->append($_, $flag) foreach @compile_flags; | |||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 5 | ▶ | if (! $flags->use_feature('hardening', 'stackclash')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 3 | my $flag = '-fno-stack-clash-protection'; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 3 | $flags->append($_, $flag) foreach @compile_flags; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | |||||||||||||||||||||||||||||||||||||||||||
| 171 | 5 | ▶ | if (! $flags->use_feature('hardening', 'fortify')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | $flags->append('CPPFLAGS', '-D_FORTIFY_SOURCE=0'); | |||||||||||||||||||||||||||||||||||||||||
| 173 | } | ||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 5 | ▶ | if (! $flags->use_feature('hardening', 'format')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $flag = '-Wno-format -Wno-error=format-security'; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $flags->append('CFLAGS', $flag); | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $flags->append('CXXFLAGS', $flag); | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | $flags->append('OBJCFLAGS', $flag); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | $flags->append('OBJCXXFLAGS', $flag); | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 5 | ▶ | if (! $flags->use_feature('hardening', 'branch')) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 3 | my $cpu = $flags->get_option_value('hardening-branch-cpu'); | |||||||||||||||||||||||||||||||||||||||||
| 185 | 3 | my $flag; | |||||||||||||||||||||||||||||||||||||||||
| 186 | 3 | ▶ | if ($cpu eq 'arm64') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | $flag = '-mbranch-protection=none'; | |||||||||||||||||||||||||||||||||||||||||
| 188 | } elsif ($cpu eq 'amd64') { | ||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $flag = '-fcf-protection=none'; | |||||||||||||||||||||||||||||||||||||||||
| 190 | } | ||||||||||||||||||||||||||||||||||||||||||
| 191 | 3 | ▶ | if (defined $flag) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | $flags->append($_, $flag) foreach @compile_flags; | |||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 5 | return; | |||||||||||||||||||||||||||||||||||||||||
| 197 | } | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | =head1 PUBLIC FUNCTIONS | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | =over | ||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | =item $bugs_list = Dpkg::Vendor::Ubuntu::find_launchpad_closes($changes) | ||||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | Takes one string as argument and finds "LP: #123456, #654321" statements, | ||||||||||||||||||||||||||||||||||||||||||
| 206 | which are references to bugs on Launchpad. Returns all closed bug | ||||||||||||||||||||||||||||||||||||||||||
| 207 | numbers in an array reference. | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 250 | ▶ | sub find_launchpad_closes { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
find_launchpad_closes: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 250 | my $changes = shift; | |||||||||||||||||||||||||||||||||||||||||
| 213 | 250 | my %closes; | |||||||||||||||||||||||||||||||||||||||||
| 214 | |||||||||||||||||||||||||||||||||||||||||||
| 215 | 250 | ▶ | while ($changes && | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$changes and $changes =~ /lp:\s+\#\d+(?:,\s*\#\d+)*/gipu
MC/DC50%1/2
$changes and $changes =~ /lp:\s+\#\d+(?:,\s*\#\d+)*/gipu
$changes
$changes =~ /lp:\s+\#\d+(?:,\s*\#\d+)*/gipu
Truth table66%2/3
A and B
A= $changesB= $changes =~ /lp:\s+\#\d+(?:,\s*\#\d+)*/gipu
| |||||||||||||||||||||||||||||||||||||||||||
| 216 | ($changes =~ /lp:\s+\#\d+(?:,\s*\#\d+)*/pig)) { | ||||||||||||||||||||||||||||||||||||||||||
| 217 | 9 | $closes{$_} = 1 foreach (${^MATCH} =~ /\#?\s?(\d+)/g); | |||||||||||||||||||||||||||||||||||||||||
| 218 | } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | |||||||||||||||||||||||||||||||||||||||||||
| 220 | 250 | my @closes = sort { $a <=> $b } keys %closes; | |||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 250 | return \@closes; | |||||||||||||||||||||||||||||||||||||||||
| 223 | } | ||||||||||||||||||||||||||||||||||||||||||
| 224 | |||||||||||||||||||||||||||||||||||||||||||
| 225 | =back | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | =head1 CHANGES | ||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | =head2 Version 0.xx | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | This is a semi-private module. Only documented functions are public. | ||||||||||||||||||||||||||||||||||||||||||
| 232 | |||||||||||||||||||||||||||||||||||||||||||
| 233 | =cut | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||