This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch main in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=aeee6269fbe5a3385ce1b0febd5919cd40fb7716 commit aeee6269fbe5a3385ce1b0febd5919cd40fb7716 Author: Guillem Jover <[email protected]> AuthorDate: Sun Oct 2 20:23:29 2022 +0200 Dpkg::Vendor: Deprecate loading vendor files with no special character mapping We should have clear and mapping rules for vendor files, to avoid strange filenames. It should also help that both the vendor files and the vendor modules will end up mapping based on the same set of special characters. --- man/deb-origin.pod | 6 ++++-- scripts/Dpkg/Vendor.pm | 37 ++++++++++++++++++++++++++++++------- 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/man/deb-origin.pod b/man/deb-origin.pod index 66fe46419..4621d4357 100644 --- a/man/deb-origin.pod +++ b/man/deb-origin.pod @@ -45,8 +45,10 @@ in all lowercase, but some variation is permitted. Namely, non-alphanumeric characters (‘B<[^A-Za-z0-9]>’) are mapped to dashes (‘B<->’), and lower-cased, as-is, lower-cased then capitalized and capitalized (since dpkg 1.21.10). -In addition, the above casing attempts will be tried first as-is with -no remapping, and then by remapping spaces to dashes (‘B<->’). +In addition, for historical and backwards compatibility, the above +casing attempts will be tried first as-is with no remapping, and then +by remapping spaces to dashes (‘B<->’). But these will be removed +during the dpkg 1.22.x release cycle. =head1 FIELDS diff --git a/scripts/Dpkg/Vendor.pm b/scripts/Dpkg/Vendor.pm index 2dbe1e760..f8917868f 100644 --- a/scripts/Dpkg/Vendor.pm +++ b/scripts/Dpkg/Vendor.pm @@ -20,7 +20,7 @@ use strict; use warnings; use feature qw(state); -our $VERSION = '1.01'; +our $VERSION = '1.02'; our @EXPORT_OK = qw( get_current_vendor get_vendor_info @@ -118,8 +118,10 @@ The vendor filename will be derived from the vendor name, by replacing any number of non-alphanumeric characters (that is B<[^A-Za-z0-9]>) into "B<->", then lower-casing, as-is, lower-casing then capitalizing, and capitalizing. -In addition the above casing attempts will be tried also first as-is with -no replacements, and then by replacing only spaces to "B<->". +In addition, for historical and backwards compatibility, the above casing +attempts will be tried also first as-is with no replacements, and then by +replacing only spaces to "B<->". +But these name lookups will be removed during the 1.22.x release cycle. =cut @@ -129,12 +131,28 @@ sub get_vendor_file(;$) { my @names; my $vendor_sep = $vendor =~ s{$vendor_sep_regex}{-}gr; push @names, lc $vendor_sep, $vendor_sep, ucfirst lc $vendor_sep, ucfirst $vendor_sep; - push @names, lc $vendor, $vendor, ucfirst lc $vendor, ucfirst $vendor; - if ($vendor =~ s{\s+}{-}g) { - push @names, lc $vendor, $vendor, ucfirst lc $vendor, ucfirst $vendor; - } + + # XXX: Backwards compatibility, remove on 1.22.x. + my %name_seen = map { $_ => 1 } @names; + my @obsolete_names = uniq grep { + my $seen = exists $name_seen{$_}; + $name_seen{$_} = 1; + not $seen; + } ( + (lc $vendor, $vendor, ucfirst lc $vendor, ucfirst $vendor), + ($vendor =~ s{\s+}{-}g) ? + (lc $vendor, $vendor, ucfirst lc $vendor, ucfirst $vendor) : () + ); + my %obsolete_name = map { $_ => 1 } @obsolete_names; + push @names, @obsolete_names; + foreach my $name (uniq @names) { next unless -e "$origins/$name"; + if (exists $obsolete_name{$name}) { + warning(g_('%s origin filename is deprecated; ' . + 'it should have only alphanumeric or dash characters'), + $name); + } return "$origins/$name"; } return; @@ -226,6 +244,11 @@ sub run_vendor_hook { =head1 CHANGES +=head2 Version 1.02 (dpkg 1.21.10) + +Deprecated behavior: get_vendor_file() loading vendor files with no special +characters remapping. + =head2 Version 1.01 (dpkg 1.17.0) New function: get_vendor_dir(). -- Dpkg.Org's dpkg

