Re: Catch 22 building gcc-wrapper

Will Partain <[email protected]> Thu, 09 Oct 2003 11:37:40 +0100
Newsgroups gmane.comp.sysutils.ark.devel
Message-ID <[email protected]>
(sorry to be slow)

Joel S writes:

> Summary: When building all packages from scratch, ark fails when it can't
> satisfy a gcc-wrapper install-bits constraint to first deploy a certain
> version of gcc.

Well, I'm reasonably confident I made the -wrapper
change/(*cough* you mean..)"hack" for some actual reason :-(

> I uncommented some print statements to debug the problem.  This tidbit was
> printed by the pkgsWithName method of package.py:
> 
> name sought: gcc ['gcc-wrapper']

I'm less worried that 'gcc-wrapper' is on the candidate list
and more worried that 'gcc--3.2.2' *isn't*.  If it were,
then it would satisfy the version spec, and all would be well.

Ah, I think I see what's going on: pkgsWithName is being
called *with* a candidates' list -- this is to try to
satisfy a constraint from already-seen constraints.
(Rationale: don't want to satisfy a configure constraint
with Berkeley DB version 3.x and then a comparable compile
constraint with a version 4.x -- yurk.  So, we feed in
"constraints so far" to the compile constraining, so that it
will pick the same thing again.)

The problem is that gcc-wrapper is on the candidates' list
to start with.  pkgsWithName simply returns that, and then
the version test fails.

My proposed heart-not-entirely-in-it is: try the candidates'
list thing first; if it fails, then retry the "normal" way.
*Untested* diffs are below.  Let me know what happens.  (I
am hoping to do a new release in the near future.)

Will

diff -u -1 -r1.75 thing.py
--- thing.py	28 Jul 2003 09:38:06 -0000	1.75
+++ thing.py	9 Oct 2003 10:35:45 -0000
@@ -1427,2 +1427,16 @@
                 pkgs_so_named = pkgs_mgr.pkgsWithName(name,cands=cands)
+                if version_spec == '*' or version_spec == None:
+                    return pkgs_so_named
+
+                pkgs_that_match = pkgMatchingVersionSpec(version_spec,pkgs_so_named)
+                # We need to do this pkgMatching... thing inside the try block
+                # because it might fail, because the candidates list might
+                # be bunk.  For example, if doing a dependency of gcc-wrapper
+                # on gcc, the name 'gcc-wrapper' will be in the candidates list
+                # but then the version check (on 'gcc') will fail.  We need
+                # to catch that and then go back and do it all over again
+                # *without* a candidates list.
+                if len(pkgs_that_match) == 0: # trigger a retry 
+                    raise ark.error.NoPackageWithName,'irrelevant'
+
             except ark.error.NoPackageWithName,msg:
@@ -1430,13 +1444,11 @@
                 pkgs_so_named = pkgs_mgr.pkgsWithName(name,cands=None)
-
-            if version_spec == '*' or version_spec == None:
-                return pkgs_so_named
-            else:
+                if version_spec == '*' or version_spec == None:
+                    return pkgs_so_named
                 pkgs_that_match = pkgMatchingVersionSpec(version_spec,pkgs_so_named)
 
-                if len(pkgs_that_match) == 0:
-                    raise ark.error.NoThingFitsConstraint,'type=package name=%s, version_spec=%s' % (name,version_spec)
+            if len(pkgs_that_match) == 0:
+                raise ark.error.NoThingFitsConstraint,'type=package name=%s, version_spec=%s' % (name,version_spec)
 
-                else:
-                    return pkgs_that_match
+            else:
+                return pkgs_that_match
 


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php