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

Re: emsetup bug




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. 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.

It's not as simple as *not* running 'emsetup' since other tools such as em_make also call check_toolchain() before running. I do think supporting a custom/foreign toolchain needn't affect anything beyond the check_toolchain() function itself.
Jim: please could you only post/submit diff's or patches in -u format?
It's much easier to read. The diff you posted in your reply would break
other configurations horribly, if I've read it correctly.

As for this, I still think there is something wrong with the Perl. Sorry about not using -u on the diff, it was pretty late at night. So I don't risk wasting your time I'm doing a more thorough analysis. Here goes:

I first instrument the code with some prints to show that the conditional inside the find_latest_gcc never gets entered. 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.

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";
+               }
       }
+       print "Choice: $choice\n";
       return $choice;
}

androcross:/usr/share/perl5/Emdebian#
------------------------------------

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
Choice: 0
No packages found matching ???-0*.
Dry run only.
Need to add the emdebian toolchain repository to sources list.
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
Choice: 0
W: Unable to locate package gcc-0-powerpc-linux-gnu
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
Choice: 0
Need to install an emdebian toolchain to build 'powerpc' on 'i386'.
androcross: /usr/share/perl5/Emdebian

------------------------------------
Next I modified the regexp to the form I think fixes the problem. I removed the - from the grouping since we want a numeric comparison and - won't allow that. I added an additional .* before the $ to match all the stuff following the numeric gcc version. Here is the diff

------------------------------------
androcross:/usr/share/perl5/Emdebian# diff -u Tools.pm.orig Tools.pm.patched
--- Tools.pm.orig       2007-02-01 18:35:11.000000000 -0500
+++ Tools.pm.patched    2007-02-01 19:26:27.000000000 -0500
@@ -143,11 +143,17 @@
       my $choice = 0;
       foreach my $line (@list)
       {
-               if ($line =~ /gcc-([0-9\.\-]*)$/)
+               if ($line =~ /gcc-([0-9\.]*).*$/)
               {
+                   print "Comparing versions- $choice:$1\n";
                       if ($1 > $choice) { $choice = $1; }
               }
+               else
+               {
+                   print "Not comparing versions- $line\n";
+               }
       }
+       printf "Choice: $choice\n";
       return $choice;
}

androcross:/usr/share/perl5/Emdebian#

-------------------------------

Here is the output of running emsetup

--------------------------------
androcross: /usr/share/perl5/Emdebian
$ emsetup --simulate
Comparing versions- 0:4.1
Comparing versions- 4.1:3.4
Not comparing versions- gcc
Comparing versions- 4.1:4.1
Comparing versions- 4.1:2.95
Comparing versions- 4.1:4.1
Choice: 4.1
Dry run only.
Need to add the emdebian toolchain repository to sources list.
Comparing versions- 0:4.1
Comparing versions- 4.1:3.4
Not comparing versions- gcc
Comparing versions- 4.1:4.1
Comparing versions- 4.1:2.95
Comparing versions- 4.1:4.1
Choice: 4.1
Comparing versions- 0:4.1
Comparing versions- 4.1:3.4
Not comparing versions- gcc
Comparing versions- 4.1:4.1
Comparing versions- 4.1:2.95
Comparing versions- 4.1:4.1
Choice: 4.1
Need to install an emdebian toolchain to build 'powerpc' on 'i386'.
androcross: /usr/share/perl5/Emdebian


--


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




Reply to: