[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#494714: dpkg-dev - dpkg-genchanges should fold lines



tag 494714 + patch
thanks

On Mon, 11 Aug 2008, Bastian Blank wrote:
> dpkg-genchanges should fold lines in the output to a sane length. There
> is a package in the archive (linux-modules-extra-2.6) which produces a
> 25k long Binary line, which is cropped by gpg during signing.

I guess we should do the same for the Binary: field in the .dsc in that
case. Why did you mention only the .changes ?

CCing -devel to have input about possible stuff that would break if the
Binary field is split over multiple lines. I have checked
dak/process_unchecked.py and it seems to handle correctly a Binary: field
split over multiple lines. But we have many other tools that parses
.dsc and .changes.

The Binary: field in .dsc is the one that has the biggest impact since
it's copied over in Sources files on mirrors and parsed by many custom
scripts. The one in .changes concerns fewer tools probably.

CCing -policy, do we need to update policy to allow Binary: fields
over multiple lines? Currently it only says that the fields are
comma-separated and space-separated. Does "space" include newlines
like in the usual \s perl regexp or not ? (comma can also be followed by
spaces so the same reasoning applies)
http://www.debian.org/doc/debian-policy/ch-controlfields.html#s-f-Binary

A first patch for dpkg-dev is attached but I'll refrain from committing it
until I received some more feedback.

Cheers,
-- 
Raphaël Hertzog

Contribuez à Debian et gagnez un cahier de l'admin Debian Lenny :
http://www.ouaza.com/wp/2009/03/02/contribuer-a-debian-gagner-un-livre/
>From bc62fd60bb2347e4550bb3ccba701561cab5e1fe Mon Sep 17 00:00:00 2001
From: Raphael Hertzog <hertzog@debian.org>
Date: Fri, 15 May 2009 18:09:25 +0200
Subject: [PATCH] dpkg-source/dpkg-genchanges: split long Binary: field values

---
 scripts/dpkg-genchanges.pl |    2 ++
 scripts/dpkg-source.pl     |    2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index 32b5bff..2bbcd29 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -483,6 +483,8 @@ if (!defined($fields->{'Date'})) {
 }
 
 $fields->{'Binary'} = join(' ', map { $_->{'Package'} } $control->get_packages());
+# Avoid overly long line (>~1000 chars) by splitting over multiple lines
+$fields->{'Binary'} =~ s/(.{980,}?) /$1\n /g;
 
 unshift(@archvalues,'source') unless is_binaryonly;
 @archvalues = ('all') if $include == ARCH_INDEP;
diff --git a/scripts/dpkg-source.pl b/scripts/dpkg-source.pl
index 6ea264c..44d8bbb 100755
--- a/scripts/dpkg-source.pl
+++ b/scripts/dpkg-source.pl
@@ -247,6 +247,8 @@ if ($options{'opmode'} eq 'build') {
     }
     
     $fields->{'Binary'} = join(', ', @binarypackages);
+    # Avoid overly long line (>~1000 chars) by splitting over multiple lines
+    $fields->{'Binary'} =~ s/(.{980,}?), ?/$1,\n /g;
 
     # Generate list of formats to try
     my @try_formats = (@cmdline_formats);
-- 
1.6.3


Reply to: