| 1 | # Copyright © 2009-2011 Raphaël Hertzog <hertzog@debian.org> | ||
| 2 | # Copyright © 2009-2024 Guillem Jover <guillem@debian.org> | ||
| 3 | # Copyright © 2017-2019 Matthias Klumpp <matthias.klumpp@puri.sm> | ||
| 4 | # Copyright © 2021 Jonas Smedegaard <dr@jones.dk> | ||
| 5 | # Copyright © 2021 Purism, SPC | ||
| 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::PureOS - PureOS vendor class | ||
| 25 | |||
| 26 | =head1 DESCRIPTION | ||
| 27 | |||
| 28 | This vendor class customizes the behavior of dpkg scripts for PureOS | ||
| 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::PureOS 0.01; | ||
| 36 | |||
| 37 | use v5.36; | ||
| 38 | |||
| 39 | use Dpkg::ErrorHandling; | ||
| 40 | use Dpkg::Gettext; | ||
| 41 | use Dpkg::Control::Types; | ||
| 42 | |||
| 43 | use parent qw(Dpkg::Vendor::Debian); | ||
| 44 | |||
| 45 | sub run_hook { | ||
| 46 | my ($self, $hook, @params) = @_; | ||
| 47 | |||
| 48 | if ($hook eq 'before-source-build') { | ||
| 49 | my $src = shift @params; | ||
| 50 | my $fields = $src->{fields}; | ||
| 51 | |||
| 52 | if (defined($fields->{'Version'}) and | ||
| 53 | defined($fields->{'Maintainer'}) and | ||
| 54 | $fields->{'Version'} =~ /pureos/) | ||
| 55 | { | ||
| 56 | unless ($fields->{'Original-Maintainer'}) { | ||
| 57 | warning(g_('version number suggests %s vendor changes, ' . | ||
| 58 | 'but there is no %s field'), | ||
| 59 | 'PureOS', 'XSBC-Original-Maintainer'); | ||
| 60 | } | ||
| 61 | } | ||
| 62 | |||
| 63 | } elsif ($hook eq 'keyrings') { | ||
| 64 | return $self->run_hook('package-keyrings', @params); | ||
| 65 | } elsif ($hook eq 'package-keyrings') { | ||
| 66 | return ($self->SUPER::run_hook($hook), | ||
| 67 | '/usr/share/keyrings/pureos-archive-keyring.pgp'); | ||
| 68 | } elsif ($hook eq 'archive-keyrings') { | ||
| 69 | return ($self->SUPER::run_hook($hook), | ||
| 70 | '/usr/share/keyrings/pureos-archive-keyring.pgp'); | ||
| 71 | } elsif ($hook eq 'archive-keyrings-historic') { | ||
| 72 | return ($self->SUPER::run_hook($hook), | ||
| 73 | '/usr/share/keyrings/pureos-archive-removed-keys.pgp'); | ||
| 74 | } else { | ||
| 75 | return $self->SUPER::run_hook($hook, @params); | ||
| 76 | } | ||
| 77 | } | ||
| 78 | |||
| 79 | =head1 CHANGES | ||
| 80 | |||
| 81 | =head2 Version 0.xx | ||
| 82 | |||
| 83 | This is a private module. | ||
| 84 | |||
| 85 | =cut | ||
| 86 | |||
| 87 | 1; |