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

Re: emsetup bug



On Thu, 01 Feb 2007 19:33:02 -0500
Jim Heck <jsurf@heckheck.com> wrote:

> > It may simply be necessary to *not* use 'emsetup' if the toolchain is
> > unsupported - I'm not sure if Jim's proposed method will work out but
> > I'll take a look at patches that have a neutral effect on the supported
> > usage.
> >
> >
> OK Thanks.  I'm not trying to create more work for you vis a vis bugs
> reported for unsupported configurations.  I understand people using
> non-latest toolchains would be on their own, and that the burden of
> proof in those cases for reporting problems would be at minimum that
> people should first test that something doesn't work within a supported
> configuration.

OK.

> The default behavior would certainly be latest, and the
> manual change necessary to enable a different toolchain should have a
> warning to the user stating the unsupported nature and higher burden of
> proof for problems.

I'll put a comment in the manpage and possibly the config file itself
but I'll stop short of actually outputting a message direct to the
user.

> It's not as simple as *not* running 'emsetup' since other tools such as
> em_make also call check_toolchain() before running.

True, but only to prevent problems involved in not finding a toolchain
at all. That check can be wrapped, if necessary.

> I do think
> supporting a custom/foreign toolchain needn't affect anything beyond the
> check_toolchain() function itself.

Allowing unsupported use of older toolchains may be down to changes in
check_toolchain but *supporting* other toolchains is quite another
matter.

> I first instrument the code with some prints to show that the
> conditional inside the find_latest_gcc never gets entered.

Not true. Try this example:
(You'll need to edit the dpkg_cross_dir variable)

#!/usr/bin/perl -w

	my $arch = "arm";
	my $suite = "unstable";
	my $dpkg_cross_dir = "/home/neil/.dpkg-cross/";
	my $result = `fakeroot apt-cache -o Apt::Architecture=$arch -c $dpkg_cross_dir/apt.conf-$suite pkgnames gcc`;
	my @list = split (/\n/, $result);
	my $choice = 0;
	foreach my $line (@list)
	{
		if ($line =~ /gcc-([0-9\.\-]*)$/)
		{
			if ($1 > $choice) { $choice = $1; }
			print "1 = $1\n";
		}
	}
	print "final choice = $choice\n";

The output from this snippet is:

$ perl jim.pl
1 = 3.2
1 = 3.3
1 = 3.4
1 = 4.0
1 = 4.1
1 = 2.95
final choice = 4.1

Clearly, the regexp is matching.

I suspect your problem is to do with these lines:

my $dpkg_cross_dir = "/home/neil/.dpkg-cross/";
my $result = `fakeroot apt-cache -o Apt::Architecture=$arch -c
$dpkg_cross_dir/apt.conf-$suite pkgnames gcc`;

It looks like your *cross-architecture* cache is failing. The fix from
emsetup is:

my $q = "";
$q = "-v" if ($verbose >= 2);
$q = '-q' if ($verbose < 1);
system ("apt-cross $q -a $arch -S $suite -u");
system ("apt-get $q -o Apt::Architecture=$arch -c ~/.dpkg-cross/apt.conf-$suite update");

apt-cross ensures that the correct directories exist beneath
~/.dpkg-cross/ to hold the archives and package lists. apt-get update
then reads the Debian mirrors *for the target $arch*, not your own and
places this cache data under ~/.dpkg-cross instead of privileged system
folders.

> By my
> analysis, this is due to the fact that in the regexp, the grouping
> ([0-9\.\-]*) is followed by $.  The first part will match the gcc
> numeric version including a trailing (or inclusive) -.  Next comes the
> $, which matches only the end of line, so the pattern never matches any
> package name and $choice remains 0.

No. $choice is only zero in your tests because apt-cache is providing
no data.

> Here is a diff
>
>
> androcross:/usr/share/perl5/Emdebian# diff -u Tools.pm.orig Tools.pm.printf
> --- Tools.pm.orig       2007-02-01 18:35:11.000000000 -0500
> +++ Tools.pm.printf     2007-02-01 19:30:15.000000000 -0500
> @@ -145,9 +145,15 @@
>         {
>                 if ($line =~ /gcc-([0-9\.\-]*)$/)
>                 {
> +                   print "Comparing versions- $choice:$1\n";
>                         if ($1 > $choice) { $choice = $1; }
>                 }
> +               else
> +               {
> +                   print "Not comparing versions- $line\n";
> +               }

The else statement will always be executed but provides no useful data.
If a genuine package list is available, lots of packages will fail the
regexp - that is expected:

	foreach my $line (@list)
	{
		if ($line =~ /gcc-([0-9\.\-]*)$/)
		{
			if ($1 > $choice) { $choice = $1; }
			print "1 = $1\n";
		}
		else
		{
			print "match failed\n";
		}
	}
	print "final choice = $choice\n";

match failed
match failed
match failed
match failed
match failed
match failed
match failed
match failed
match failed
match failed
1 = 3.2
1 = 3.3
1 = 3.4
1 = 4.0
1 = 4.1
match failed
match failed
match failed
match failed
match failed
match failed
match failed
match failed
match failed
1 = 2.95
match failed
match failed
match failed
final choice = 4.1

The point is that the match succeeds when it matters - when a gcc
package is identified.

> Here are the results of running emsetup
>
> ------------------------------------
>
> $ emsetup --simulate
> Not comparing versions- gcc-4.1-powerpc-linux-gnu
> Not comparing versions- gcc-3.4-base
> Not comparing versions- gcc
> Not comparing versions- gcc-4.1-powerpc-linux-gnu-base
> Not comparing versions- gcc-2.95-powerpc-cross
> Not comparing versions- gcc-4.1-source

Something is wrong with your apt-cross cache. gcc-4.1 does exist on all
Debian platforms and for all architectures.

> androcross: /usr/share/perl5/Emdebian
> $ emsetup --simulate
> Comparing versions- 0:4.1
> Comparing versions- 4.1:3.4

WRONG. We are not comparing VERSIONS. We are comparing PACKAGE NAMES.

$ apt-cache show gcc-4.1
Package: gcc-4.1
Priority: optional
Section: devel
Installed-Size: 1424
Maintainer: Debian GCC  . . . .
Architecture: amd64
Source: gcc-4.1 (4.1.1ds2-21)
Version: 4.1.1-21

What matters is:
Package: gcc-4.1

NOT
Version: 4.1.1-21

nor
Source: gcc-4.1 (4.1.1ds2-21)

Those are inconsequential.

The call to apt-cache is 'apt-cache pkgnames' not 'apt-cache search'.

Try the example above and the apt-cross and apt-get fixes.

Also try:

apt-cache pkgnames gcc | grep 4.1

to check what you should see with your main system cache. I get:
gcc-4.1-doc
gcc-4.1-locales
gcc-4.1-mipsel-linux-gnu-base
gcc-4.1-s390-linux-gnu
gcc-4.1-alpha-linux-gnu
gcc-4.1-m68k-linux-gnu
gcc-4.1-source
gcc-4.1-powerpc-linux-gnu-base
gcc-4.1-arm-linux-gnu-base
gcc-4.1-mipsel-linux-gnu
gcc-4.1-sparc-linux-gnu
gcc-4.1-mips-linux-gnu
gcc-4.1
gcc-4.1-sparc-linux-gnu-base
gcc-4.1-mips-linux-gnu-base
gcc-4.1-powerpc-linux-gnu
gcc-4.1-arm-linux-gnu
gcc-4.1-base
gcc-4.1-m68k-linux-gnu-base
gcc-4.1-ia64-linux-gnu
gcc-4.1-ia64-linux-gnu-base

Your list will vary but gcc-4.1 should still exist in the cache - even if not installed.

--


Neil Williams
=============
http://www.data-freedom.org/
http://www.nosoftwarepatents.com/
http://www.linux.codehelp.co.uk/

Attachment: pgpdHrZnYo1fb.pgp
Description: PGP signature


Reply to: