Select Git revision

Andrej Shadura authored
The signature only specified one argument, leading to inability to pass anything else to the sub. Revert the signature addition, instead use the traditional "shift" to make sure variadic arguments work as expected. Fixes: ea7734c6 ("aptly: Detect errors only where needed") Signed-off-by:Andrej Shadura <andrew.shadura@collabora.co.uk>
BSAptly.pm 13.44 KiB
#
# SPDX-License-Identifier: GPL-2.0+
#
# Copyright 2022 Collabora Ltd.
package BSAptly;
use BSConfiguration;
use BSPublisher::Util;
use BSRevision;
use BSUtil;
use Build::Deb;
use POSIX qw(strftime);
use strict;
# TODO: drop "no warnings" when upgraded to Perl 5.36
no warnings 'experimental::signatures';
use feature 'signatures';
use feature 'say';
our %aptly_config_projects;
BEGIN {
# From the obsolete aptly configuration, generate hash mapping project and repositories
# to the distribution where they live.
say STDERR 'WARNING: Deprecated configuration option \$aptly_config used, please use $aptly_projects instead!'
if defined $BSConfig::aptly_config;
foreach my $prefix (keys %{ $BSConfig::aptly_config }) {
my $distros = $BSConfig::aptly_config->{$prefix};
foreach my $distro (keys %{ $distros }) {
my $distro_config = $distros->{$distro};
die "$prefix -> $distro does not have aptly-server defined" if !defined $distro_config->{'aptly-server'};
my $distro_components = $distro_config->{'components'};
foreach my $component (keys %{ $distro_components }) {
my $component_config = $distro_components->{$component};
$aptly_config_projects{$component_config->{'project'}}{$component_config->{'repository'}} = $distro_config;
$distro_config->{'prefix'} = $prefix;
$distro_config->{'distribution'} = $distro;
$component_config->{'component'} = $component;
}
}
}
my $repo_components = {};
foreach my $projid (keys %{$BSConfig::aptly_projects}) {
my $repos = $BSConfig::aptly_projects->{$projid};
foreach my $repoid (keys %{$repos}) {
my $repo_config = $repos->{$repoid};
if (defined $repo_config->{'target'}) {
my $target_config = $BSConfig::aptly_targets->{$repo_config->{'target'}};
die "$projid/$repoid refers to an undefined target repository $repo_config->{'target'}" if !defined $target_config;
$repo_config->{'aptly-server'} ||= $target_config->{'server'};
$repo_config->{'gpg-key'} ||= $target_config->{'gpg-key'};
$repo_config->{'prefix'} ||= $target_config->{'prefix'};
}
die "$projid/$repoid does not have either aptly-server or target defined" if !defined $repo_config->{'aptly-server'};
die "$projid/$repoid does not have prefix defined" if !defined $repo_config->{'prefix'};
die "$projid/$repoid does not have distribution defined" if !defined $repo_config->{'distribution'};
# OBS gives us a single OBS project/repoid, but we need to publish all projects in the same prefix at once
# For this reason, we need to share the components set, which means that we (confusingly) have aptly
# repo-specific configs that contain information about their sibling repos.
my $all_components_in_prefix = ($repo_components
->{$repo_config->{'aptly-server'}}
->{$repo_config->{'prefix'}}