This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Stop automatic dependency selection on setup.exe chooser screen


On Aug  6 19:21, Andy Koppe wrote:
> On 6 August 2010 18:09, Andy Koppe wrote:
> > On 6 August 2010 17:00, Corinna Vinschen wrote:
> >>> On Fri, Aug 06, 2010 at 01:25:54PM +0100, Andy Koppe wrote:
> >>> >The dependency resolver page only adds direct
> >>> >dependencies of packages that have been selected, not indirect ones,
> >>> >so you end up with missing DLLs. (They do get added before the package
> >>> >selection screen if you run setup.exe again.)
> >>
> >> I'm looking into it, but it's tricky for people not quite up to speed
> >> with STL. ÂBasically the elements in unmap also have to be tested for
> >> unsatisfied dependencies. ÂOne problem is that unmet is a map, so, when
> >> adding elements to unmet, there has to be some marker which allows to
> >> recognize elements which already have been tested for dependencies,
> >> otherwise it will be rather slow.
> >
> > I'm hoping this won't need to be implemented from scratch, given
> > indirect dependencies already do work elsewhere.
> 
> Misplaced hope, because packageversion::set_requirements, which is
> used on the chooser page, selects packages right away, whereas on the
> PreReq page they're first collected into a list of packages (and their
> requirees) to display to the user.
> 
> I'll have a go at PrereqChecker::isMet() then.

I had a go at it, see below.  Does it make sense?  I tested this by
selecting *only* the flac-devel package, which resulted in the following
"Resolve Dependecies" dialog:

  Package: libFLAC++6
	  Required by: flac-devel

  Package: libFLAC8
	  Required by: flac-devel

  Package: libogg-devel
	  Required by: flac-devel

  Package: libogg0
	  Required by: libogg-devel

Looks good, doesn't it?  Do you have another useful test for this code?


Index: package_meta.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/package_meta.cc,v
retrieving revision 2.57
diff -u -p -r2.57 package_meta.cc
--- package_meta.cc	17 Apr 2010 12:36:45 -0000	2.57
+++ package_meta.cc	6 Aug 2010 19:55:43 -0000
@@ -675,6 +675,18 @@ packagemeta::visited() const
 }
 
 void
+packagemeta::prereq_checked(bool const &aBool)
+{
+  prereq_checked_ = aBool;
+}
+
+bool
+packagemeta::prereq_checked() const
+{
+  return prereq_checked_;
+}
+
+void
 packagemeta::logSelectionStatus() const
 {
   packagemeta const & pkg = *this;
Index: package_meta.h
===================================================================
RCS file: /cvs/cygwin-apps/setup/package_meta.h,v
retrieving revision 2.38
diff -u -p -r2.38 package_meta.h
--- package_meta.h	13 Dec 2009 19:23:43 -0000	2.38
+++ package_meta.h	6 Aug 2010 19:55:43 -0000
@@ -36,7 +36,8 @@ public:
   packagemeta (packagemeta const &);
   packagemeta (const std::string& pkgname):name (pkgname), key(pkgname), installed_from (),
   prevtimestamp (0), currtimestamp (0),
-    exptimestamp (0), architecture (), priority(), visited_(false)
+    exptimestamp (0), architecture (), priority(), visited_(false),
+    prereq_checked_(false)
   {
   }
 
@@ -44,7 +45,8 @@ public:
 	       const std::string& installedfrom):name (pkgname), key(pkgname),
 	       installed_from (installedfrom),
     prevtimestamp (0), currtimestamp (0),
-    exptimestamp (0), architecture (), priority(), visited_(false)
+    exptimestamp (0), architecture (), priority(), visited_(false),
+    prereq_checked_(false)
   {
   }
 
@@ -54,6 +56,8 @@ public:
   void set_installed (packageversion &);
   void visited(bool const &);
   bool visited() const;
+  void prereq_checked(bool const &);
+  bool prereq_checked() const;
   void addToCategoryBase();
   bool hasNoCategories() const;
   void setDefaultCategories();
@@ -157,6 +161,7 @@ protected:
 private:
   std::string trustLabel(packageversion const &) const;
   bool visited_;
+  bool prereq_checked_;
 };
 
 #endif /* SETUP_PACKAGE_META_H */
Index: prereq.cc
===================================================================
RCS file: /cvs/cygwin-apps/setup/prereq.cc,v
retrieving revision 2.3
diff -u -p -r2.3 prereq.cc
--- prereq.cc	13 Dec 2009 19:23:43 -0000	2.3
+++ prereq.cc	6 Aug 2010 19:55:43 -0000
@@ -189,6 +189,39 @@ PrereqChecker::isMet ()
             }
         }
     }
+
+  bool foundUnmet2ndLevel = foundUnmet;
+  	
+  while (foundUnmet2ndLevel)
+    {
+      foundUnmet2ndLevel = false;
+
+      map <packagemeta *, vector <packagemeta *>, packagemeta_ltcomp>::iterator n;
+      for (n = unmet.begin (); n != unmet.end (); ++n)
+	{
+	  if (!(*n).first->prereq_checked ())
+	    {
+	      (*n).first->prereq_checked (true);
+	      for (vector <vector <PackageSpecification *> *>::iterator i =
+		   (*n).first->curr.depends ()->begin ();
+		   i < (*n).first->curr.depends ()->end (); ++i)
+		{
+		  PackageSpecification *spec = (*i)->at(0);
+		  packagemeta *pack = db.findBinary (*spec);
+		  if (!pack)
+		    continue;
+		  if (pack->desired && spec->satisfies (pack->desired))
+		    ;
+		  else if (unmet.find (pack) == unmet.end ())
+		    {
+		      foundUnmet2ndLevel = true;
+		      unmet[pack].push_back ((*n).first);
+		    }
+		}
+	    }
+
+	}
+    }
     
   return !foundUnmet;
 }


Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]