This is an automated email from the git hooks/post-receive script. guillem pushed a commit to branch master in repository dpkg.
View the commit online: https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=55cdf5fac707895e42a356b3d32d9d648e28fc40 commit 55cdf5fac707895e42a356b3d32d9d648e28fc40 Author: Guillem Jover <[email protected]> AuthorDate: Mon Jan 7 22:32:22 2019 +0100 dpkg-scanpackages: Unroll a single iteration loop When not in multi-version mode, we can only ever have one package in the %packages hash, remove the confusing loop and replace with an explicit assignment using the first array reference element. --- debian/changelog | 1 + scripts/dpkg-scanpackages.pl | 28 ++++++++++++++-------------- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/debian/changelog b/debian/changelog index b244c8d3b..6fac0102c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -54,6 +54,7 @@ dpkg (1.19.3) UNRELEASED; urgency=medium - dpkg-source: Move source format selection earlier in the build. - dpkg-source: Use new format argument for Dpkg::Source::Package->new(). - dpkg-shlibdeps: Remove unused variable. + - dpkg-scanpackages: Unroll a single iteration loop. * Build system: - get-version: Use a format string with printf. - run-script: Use $() instead of deprecated ``. diff --git a/scripts/dpkg-scanpackages.pl b/scripts/dpkg-scanpackages.pl index dd4308641..bb0bebcf2 100755 --- a/scripts/dpkg-scanpackages.pl +++ b/scripts/dpkg-scanpackages.pl @@ -174,20 +174,20 @@ sub process_deb { if not defined $p; if (defined($packages{$p}) and not $options{multiversion}) { - foreach my $pkg (@{$packages{$p}}) { - if (version_compare_relation($fields->{'Version'}, REL_GT, - $pkg->{'Version'})) - { - warning(g_('package %s (filename %s) is repeat but newer ' . - 'version; used that one and ignored data from %s!'), - $p, $fn, $pkg->{Filename}); - $packages{$p} = []; - } else { - warning(g_('package %s (filename %s) is repeat; ' . - 'ignored that one and using data from %s!'), - $p, $fn, $pkg->{Filename}); - return; - } + my $pkg = ${$packages{$p}}[0]; + + if (version_compare_relation($fields->{'Version'}, REL_GT, + $pkg->{'Version'})) + { + warning(g_('package %s (filename %s) is repeat but newer ' . + 'version; used that one and ignored data from %s!'), + $p, $fn, $pkg->{Filename}); + $packages{$p} = []; + } else { + warning(g_('package %s (filename %s) is repeat; ' . + 'ignored that one and using data from %s!'), + $p, $fn, $pkg->{Filename}); + return; } } -- Dpkg.Org's dpkg

