[Buildd-tools-devel] Bug#408091: [rleigh@whinlatter.ukfsn.org: Re: Bug#400112: [PROPOSAL] forbid source/binary package name conflicts]

Lucas Nussbaum lucas at lucas-nussbaum.net
Wed Feb 21 12:19:30 CET 2007


This mail went to 408901 instead of 408091.

----- Forwarded message from Roger Leigh <rleigh at whinlatter.ukfsn.org> -----

From: Roger Leigh <rleigh at whinlatter.ukfsn.org>
To: Lucas Nussbaum <lucas at lucas-nussbaum.net>
Cc: Goswin von Brederlow <brederlo at informatik.uni-tuebingen.de>,
	Kurt Roeckx <kurt at roeckx.be>, 408901 at bugs.debian.org
Date: Sat, 3 Feb 2007 22:21:58 +0000
Subject: Re: Bug#400112: [PROPOSAL] forbid source/binary package name conflicts

On Tue, Jan 23, 2007 at 01:57:19PM +0100, Lucas Nussbaum wrote:
> On 19/01/07 at 12:47 +0100, Goswin von Brederlow wrote:
> > Kurt Roeckx <kurt at roeckx.be> writes:
> > 
> > > On Thu, Jan 18, 2007 at 03:12:12PM +0100, Goswin von Brederlow wrote:
> > >> 
> > >> In the initial report you mentioned that sbuild has a problem with
> > >> confusing names like this. Afaik sbuild solely works on source package
> > >> name and version and that is always unique. Where do you get a
> > >> conflict?
> > >
> > > It uses apt-cache to check for available versions, which as you show
> > > gives both results. And sbuild's behaviour depends on the order
> > > apt-cache returns those.
> > 
> > Reading the source sbuild is prepared to parse multiple returns from
> > apt-cache just fine. But it ignores the package name and only uses the
> > version to keep them apart.
> > 
> > So a case that would screw up sbuild would have to look something like
> > this:
> > 
> > Package: foo
> > Binary: bar, foo
> > Version: 1.2-3
> > 
> > Package: bar
> > Binary: bar
> > Version: 1.2-3
> > 
> > Too bad apt-cache doesn't have a --only-source option. Sbuild has to
> > use package name and version.
> > 
> > Something like this (untested):
> > 
> > Line 424...
> > 
> >                           while( <PIPE> ) {
> > +                                 $package = $1 if /^Package:\s+(\S+)\s*$/mi;
> >                                   $ver = $1 if /^Version:\s+(\S+)\s*$/mi;
> >                                   $tfile = $1 if /^Files:\s*\n((\s+.*\s*\n)+)/mi;
> >                           }
> > -                          if (defined $ver && defined $tfile) {
> > +                          if (defined $package && defined $ver && defined $tfile) {
> > -                                  @{$entries{$ver}} = map { (split( /\s+/, $_ ))[3] }
> > +                                  @{$entries{"$package $ver"}} = map { (split( /\s+/, $_ ))[3] }
> >                                           split( "\n", $tfile );
> >                           } else {
> >                                   print PLOG "apt-cache returned no information about $pkg source\n";
> >                                   print PLOG "Are there any deb-src lines in your /etc/apt/sources.list?\n";
> >                                   return ("ERROR");
> >                           }
> >                   }
> >                         close( PIPE );
> >                         if ($?) {
> >                                 print PLOG "$conf::apt_cache failed\n";
> >                                 return ("ERROR");
> >                         }
> > 
> > -                        if (!defined($entries{$version})) {
> > +                        if (!defined($entries{"$pkg $version"})) {

I have attached a tested version of this patch which fixes a bug in the
while loop.  This applies to the current SVN version of sbuild:

  svn://svn.debian.org/svn/buildd-tools/trunk/sbuild

but will also apply to the testing/unstable version.

> > But I don't yet see a problem here. The apt-cache check is purely
> > informational. As long as it finds an entry with the right version it
> > is happy and the "apt-get --only-source source" below that will always
> > do the right thing. So the worst you get is that the "Can't find
> > source" message is skipped and apt-get fails.
> > 
> > Or not?
> 
> No, the problem is that sbuild only keeps the *last* version it sees
> (see the while (<PIPE>) loop above). Anyway, that part is clearly an sbuild
> problem. See that log, after asking sbuild to build qd 2.1.200-1:

> Build started at 20070103-0339
> ******************************************************************************
> Checking available source versions...
> Checking available source versions...
> Can't find source for qd_2.1.200-1
> (only different version(s) 1.0.0-rc2-5 found)

  % sbuild -s -A qd_2.1.200-1

works for me, but I can't build kfolding:

  % sbuild -s -A kfolding_1.0.0-rc2-5

  Automatic build of kfolding_1.0.0-rc2-5 on hardknott by sbuild/powerpc 0.52
  Build started at 20070203-2218
  ******************************************************************************
  Checking available source versions...
  apt-cache returned no information about kfolding source
  Are there any deb-src lines in your /etc/apt/sources.list?
  ******************************************************************************
  Finished at 20070203-2218
  Build needed 00:00:00, 0k disk space

This is without the above patch applied.  After applying the patch, I
get:

  Automatic build of kfolding_1.0.0-rc2-5 on hardknott by sbuild/powerpc 0.52
  Build started at 20070203-2219
  ******************************************************************************
  Checking available source versions...
  Checking available source versions...
  Can't find source for kfolding_1.0.0-rc2-5
  ******************************************************************************
  Finished at 20070203-2219
  Build needed 00:00:00, 0k disk space

This fixes the while loop problem, but I've not yet figured out what's
still failing.


Regards,
Roger

-- 
  .''`.  Roger Leigh
 : :' :  Debian GNU/Linux             http://people.debian.org/~rleigh/
 `. `'   Printing on GNU/Linux?       http://gutenprint.sourceforge.net/
   `-    GPG Public Key: 0x25BFB848   Please GPG sign your mail.

Index: sbuild
===================================================================
--- sbuild	(revision 1075)
+++ sbuild	(working copy)
@@ -419,29 +419,32 @@
 				print PLOG "Can't open pipe to apt-cache: $!\n";
 				return ("ERROR");
 			}
-			{ local($/) = "";
-			  my $ver;
-			  my $tfile;
-			  while( <PIPE> ) {
-				  $ver = $1 if /^Version:\s+(\S+)\s*$/mi;
-				  $tfile = $1 if /^Files:\s*\n((\s+.*\s*\n)+)/mi;
-			  }
-			  if (defined $ver && defined $tfile) {
-				  @{$entries{$ver}} = map { (split( /\s+/, $_ ))[3] }
-					  split( "\n", $tfile );
-			  } else {
-				  print PLOG "apt-cache returned no information about $pkg source\n";
-				  print PLOG "Are there any deb-src lines in your /etc/apt/sources.list?\n";
-				  return ("ERROR");
-			  }
-		  }
-			close( PIPE );
-			if ($?) {
-				print PLOG "$conf::apt_cache failed\n";
-				return ("ERROR");
+			{
+				local($/) = "";
+				my $ver;
+				my $tfile;
+				my $package;
+				while( <PIPE> ) {
+					$package = $1 if /^Package:\s+(\S+)\s*$/mi;
+					$ver = $1 if /^Version:\s+(\S+)\s*$/mi;
+					$tfile = $1 if /^Files:\s*\n((\s+.*\s*\n)+)/mi;
+					if (defined $ver && defined $tfile && defined $package) {
+						@{$entries{"$package $ver"}} = map { (split( /\s+/, $_ ))[3] }
+							split( "\n", $tfile );
+					} else {
+						print PLOG "apt-cache returned no information about $pkg source\n";
+						print PLOG "Are there any deb-src lines in your /etc/apt/sources.list?\n";
+						return ("ERROR");
+					}
+				}
+
+				close( PIPE );
+				if ($?) {
+					print PLOG "$conf::apt_cache failed\n";
+					return ("ERROR");
+				}
 			}
-				
-			if (!defined($entries{$version})) {
+			if (!defined($entries{"$pkg $version"})) {
 				if (!$retried) {
 					# try to update apt's cache if nothing found
 					run_apt_command("$conf::apt_get", "update >/dev/null", "root", 0);




----- End forwarded message -----

-- 
| Lucas Nussbaum
| lucas at lucas-nussbaum.net   http://www.lucas-nussbaum.net/ |
| jabber: lucas at nussbaum.fr             GPG: 1024D/023B3F4F |




More information about the Buildd-tools-devel mailing list