On Fri, Jan 19, 2007 at 12:47:41PM +0100, Goswin von Brederlow wrote: > 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):
I reworked your patch, and the result is attached. This has been committed upstream as revision 1085. You can get the current sbuild with: svn co svn://svn.debian.org/svn/buildd-tools/trunk/sbuild > 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? With or without the patch applied, sbuild qd_2.1.200-1 succeeds and sbuild kfolding_1.0.0-rc2-5 fails. I haven't yet found out why. Thanks for the patch you proposed, which I have applied in a modified (working and debugged) form. If you have any further ideas about why kfolding won't build, I'll be happy to investigate further :) 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 1084) +++ sbuild (working copy) @@ -427,20 +427,28 @@ } { local($/) = ""; + my $package; my $ver; my $tfile; 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) { - @{$entries{$ver}} = map { (split( /\s+/, $_ ))[3] } + if (defined $package && defined $ver && defined $tfile) { + @{$entries{"$package $ver"}} = map { (split( /\s+/, $_ ))[3] } split( "\n", $tfile ); - } else { - print PLOG "$conf::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"); + undef($package); + undef($ver); + undef($tfile); } } + + if (! scalar keys %entries) { + print PLOG "$conf::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); waitpid $pid, 0; @@ -449,7 +457,7 @@ 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); @@ -464,7 +472,7 @@ } print PLOG "Fetching source files...\n"; - @made = @{$entries{$version}}; + @made = @{$entries{"$pkg $version"}}; my $command2 = get_apt_command("$conf::apt_get", "--only-source -q -d source $pkg=$version 2>&1 </dev/null", $main::username, 0); if (!open( PIPE, "$command2 |" )) { Index: debian/changelog =================================================================== --- debian/changelog (revision 1084) +++ debian/changelog (working copy) @@ -10,8 +10,12 @@ Lichtenheld for this patch (Closes: #407293). - When running apt-cache, divert STDOUT to the package log, so that warnings do not get mailed separately (Closes: #399178). - - fetch_source_files: Correct indentation, and error with brace - placement which caused apt-cache output to not be used. + - fetch_source_files: + + Correct indentation, and error with brace placement which caused + apt-cache output to not be used. + + Add package information into the key of the %entries hash, in + order to cope with multiple packages being returned by apt-cache. + Based on a patch by Goswin von Brederlow. * sbuild.conf.local: - Add pgp_options from sbuild.conf (Closes: #398128). - Add check_watches.
signature.asc
Description: Digital signature