From 73ef29c8e8861d735534b4b6a232a205c874258d Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Wed, 16 Jan 2008 10:08:14 +0100 Subject: [PATCH] dpkg-genchanges: some code refactoring to simplify the code * scripts/dpkg-genchanges.pl: Some code refactoring. Also fix the generation of the Description field to not have duplicate description in case of udeb (a single description per binary package is enough). --- ChangeLog | 7 +++ debian/changelog | 3 ++ scripts/dpkg-genchanges.pl | 88 ++++++++++++++++++-------------------- 3 files changed, 52 insertions(+), 46 deletions(-) diff --git a/ChangeLog b/ChangeLog index 07fb92d5..95e00bde 100644 --- a/ChangeLog +++ b/ChangeLog @@ -12,6 +12,13 @@ include the original tarball only if the current upstream version differs from the upstream version of the previous changelog entry. + * scripts/dpkg-genchanges.pl: Some code refactoring. Also fix the + generation of the Description field to not have duplicate description + in case of udeb (a single description per binary package is enough). + Source only uploads will loose their Description: fields since they + have no associated binary packages and Descriptions are only added + for binary packages where we have a corresponding .deb to upload. + 2008-01-18 Guillem Jover * m4/arch.m4 (_DPKG_ARCHITECTURE): Do not use backticks inside double diff --git a/debian/changelog b/debian/changelog index 6749004f..23d0f119 100644 --- a/debian/changelog +++ b/debian/changelog @@ -58,6 +58,9 @@ dpkg (1.14.16) UNRELEASED; urgency=low tarball only if the current upstream version differs from the upstream version of the previous changelog entry. Replaces the heuristic based on revision number (-0, -0.1 or -1). Closes: #28701 + * Some code refactoring on dpkg-genchanges and bug fixes in the generation + of the Description: field. As a result, source only uploads will no more + have Description fields. [ Updated manpages translations ] * Fix typo in French. Closes: #460021 diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl index 0255bcba..1fc7787f 100755 --- a/scripts/dpkg-genchanges.pl +++ b/scripts/dpkg-genchanges.pl @@ -259,58 +259,54 @@ foreach $_ (keys %{$src_fields}) { } } -# Scan control info of all binary packages -foreach my $pkg ($control->get_packages()) { +# Scan control info of all binary packages unless +# we have a source only upload +my @pkg; +push @pkg, $control->get_packages() unless is_sourceonly; +foreach my $pkg (@pkg) { my $p = $pkg->{"Package"}; my $a = $pkg->{"Architecture"}; + + if (not defined($p2f{$p})) { + # No files for this package... warn if it's unexpected + if ((debarch_eq('all', $a) and ($include & ARCH_INDEP)) || + (grep(debarch_is($host_arch, $_), split(/\s+/, $a)) + and ($include & ARCH_DEP))) { + warning(_g("package %s in control file but not in files list"), + $p); + } + next; # and skip it + } + + my @f = @{$p2f{$p}}; # List of files for this binary package + $p2arch{$p} = $a; + foreach $_ (keys %{$pkg}) { my $v = $pkg->{$_}; - if (!defined($p2f{$p}) && not is_sourceonly) { - if ((debarch_eq('all', $a) and ($include & ARCH_INDEP)) || - (grep(debarch_is($host_arch, $_), split(/\s+/, $a)) - and ($include & ARCH_DEP))) { - warning(_g("package %s in control file but not in files list"), - $p); - next; + + if (m/^Description$/) { + $v = $1 if $v =~ m/^(.*)\n/; + my $desc = sprintf("%-10s - %-.65s", $p, $v); + $desc .= " (udeb)" if (grep(/\.udeb$/, @f)); + push @descriptions, $desc; + } elsif (m/^Section$/) { + $f2seccf{$_} = $v foreach (@f); + } elsif (m/^Priority$/) { + $f2pricf{$_} = $v foreach (@f); + } elsif (s/^X[BS]*C[BS]*-//i) { # Include XC-* fields + $fields->{$_} = $v; + } elsif (m/^Architecture$/) { + if (grep(debarch_is($host_arch, $_), split(/\s+/, $v)) + and ($include & ARCH_DEP)) { + $v = $host_arch; + } elsif (!debarch_eq('all', $v)) { + $v = ''; } + push(@archvalues,$v) unless !$v || $archadded{$v}++; + } elsif (m/^$control_pkg_field_regex$/ || m/^X[BS]+-/i) { + # Silently ignore valid fields } else { - my @f; - @f = @{$p2f{$p}} if defined($p2f{$p}); - $p2arch{$p}=$a; - - if (m/^Description$/) { - $v=$PREMATCH if $v =~ m/\n/; - my %d; - # dummy file to get each description at least once (e.g. -S) - foreach my $f (("", @f)) { - my $desc = sprintf("%-10s - %-.65s%s", $p, $v, - $f =~ m/\.udeb$/ ? " (udeb)" : ''); - $d{$desc}++; - } - push @descriptions, keys %d; - } elsif (m/^Section$/) { - $f2seccf{$_} = $v foreach (@f); - } elsif (m/^Priority$/) { - $f2pricf{$_} = $v foreach (@f); - } elsif (s/^X[BS]*C[BS]*-//i) { # Include XC-* fields - $fields->{$_} = $v; - } elsif (m/^Architecture$/) { - if (not is_sourceonly) { - if (grep(debarch_is($host_arch, $_), split(/\s+/, $v)) - and ($include & ARCH_DEP)) { - $v = $host_arch; - } elsif (!debarch_eq('all', $v)) { - $v = ''; - } - } else { - $v = ''; - } - push(@archvalues,$v) unless !$v || $archadded{$v}++; - } elsif (m/^$control_pkg_field_regex$/ || m/^X[BS]+-/i) { - # Silently ignore valid fields - } else { - unknown(_g("package's section of control info file")); - } + unknown(_g("package's section of control info file")); } } } -- 2.39.5