This is the mail archive of the cygwin-apps-cvs mailing list for the cygwin-apps 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]

[setup - the official Cygwin setup program used to install Cygwin and keep it up to date] branch master, updated. release_2.877-20-gc23d96d




https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=c23d96d6520dd19dad0b947b370d4a1f6b961221

commit c23d96d6520dd19dad0b947b370d4a1f6b961221
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Sat Jan 21 16:03:02 2017 +0000

    Don't show source-only packages in package list
    
    external-source: packages which have no binary package will be marked skip:
    and so won't show up in setup.ini at all.
    
    If we change to using the Source: line to identify a source package, which
    is (by definition) source only, these will appear in setup.ini, but without
    any install: lines, so we need to explcitly avoid showing them in the
    package list.
    
    Future work: perhaps add another view to show just source packages?

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=9a4d0b4d437e479b6de44a155feded9e4b490b88

commit 9a4d0b4d437e479b6de44a155feded9e4b490b88
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Apr 28 12:27:42 2017 +0100

    Make building with DEBUG less useless
    
    Showing a messagebox with ldesc for every single package is annoying.

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=8aac1adc6602ccd97c3ebb206d9266a837ca4c3a

commit 8aac1adc6602ccd97c3ebb206d9266a837ca4c3a
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Apr 25 19:15:16 2017 +0100

    Don't do unneeded work when changing stability level
    
    Since 2c4487b3, we stopped recomputing all the dependencies every time
    something was changed in the PickView.  Remove all the depsolver code which
    was used to do that.
    
    The only remaining use was when we changed stability level, to select all
    the package versions at that stability level.  That work is already being
    done by packagedb::defaultTrust() (called by ChooserPage::changeTrust()).
    
    (Note that this changes behaviour slightly: New dependencies of currently
    installed packages used to be shown in the PickView, but now they won't be
    reported until the PrereqChecker)
    
    (This still leaves the crude depsolver we actually use in PrereqChecker,
    which just selects all the unmet dependencies with the current trust level)

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=a2607d344179953b3473bed9b716f3cc12a00639

commit a2607d344179953b3473bed9b716f3cc12a00639
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 26 21:03:01 2017 +0100

    Don't handle missing 'version:'
    
    If the setup.ini is missing a 'version:' line, parse the version number out
    of the 'install:' filename.  Let's not do that anymore...

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=3bc90d1a7092d6668a7e947df19a91671460685c

commit 3bc90d1a7092d6668a7e947df19a91671460685c
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 26 20:13:21 2017 +0100

    packageversion::sourcePackageSpecification() is const

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=b3f628f734fe9fe0d807768cdbf000771466a48a

commit b3f628f734fe9fe0d807768cdbf000771466a48a
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 26 16:24:43 2017 +0100

    Use const version of packageversion::depends() in PrereqChecker

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=96dbc204091b8f7c42ae5c2bfb5042b466218c9a

commit 96dbc204091b8f7c42ae5c2bfb5042b466218c9a
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 26 14:59:59 2017 +0100

    Make packageversion::source(|s) const
    
    Make packageversion::source() and sources() const
    
    Remove a temporary used to dererence an packageversion iterator to avoid
    problems with const-correctness

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=74a6693081ce9c12084985711b294568b67d7418

commit 74a6693081ce9c12084985711b294568b67d7418
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Wed Apr 26 00:07:25 2017 +0100

    Remove cygpackage::destroy() because it does nothing

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=8017000a722081613021e9fccea8579b17e51f43

commit 8017000a722081613021e9fccea8579b17e51f43
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Tue Apr 25 11:54:25 2017 +0100

    Remove unused package_status_t stored in packageversion class
    
    The package installed/not installed status is tracked by the packagemeta
    class, currently

https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/setup.git;h=618bd457849ed44d301d27d81d3b2f262f798897

commit 618bd457849ed44d301d27d81d3b2f262f798897
Author: Jon Turney <jon.turney@dronecode.org.uk>
Date:   Fri Apr 7 20:11:08 2017 +0100

    Remove pointless abstract base class IniDBBuilder
    
    There can be no instances of IniDBBuilder (it has pure virtual methods).
    There is only one derived class IniDBBuilderPackage.
    We can't think of any use for other derived classes.


Diff:
---
 IniDBBuilder.h         |   59 -------------------
 IniDBBuilderPackage.cc |   15 -----
 IniDBBuilderPackage.h  |   62 ++++++++++++---------
 PickView.cc            |    7 ++-
 ScanFindVisitor.cc     |    4 +-
 ScanFindVisitor.h      |    6 +-
 choose.cc              |    8 ---
 cygpackage.cc          |   11 ----
 cygpackage.h           |    7 --
 ini.h                  |    4 +-
 inilex.ll              |    4 +-
 iniparse.yy            |    4 +-
 package_db.cc          |   12 ----
 package_db.h           |    1 -
 package_meta.cc        |   47 ++++-----------
 package_meta.h         |   13 +---
 package_version.cc     |  147 +-----------------------------------------------
 package_version.h      |   15 +----
 prereq.cc              |    4 +-
 19 files changed, 77 insertions(+), 353 deletions(-)

diff --git a/IniDBBuilder.h b/IniDBBuilder.h
deleted file mode 100644
index b3f5c57..0000000
--- a/IniDBBuilder.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
- * Copyright (c) 2002, Robert Collins.
- *
- *     This program is free software; you can redistribute it and/or modify
- *     it under the terms of the GNU General Public License as published by
- *     the Free Software Foundation; either version 2 of the License, or
- *     (at your option) any later version.
- *
- *     A copy of the GNU General Public License can be found at
- *     http://www.gnu.org/
- *
- * Written by Robert Collins  <rbtcollins@hotmail.com>
- *
- */
-
-#ifndef SETUP_INIDBBUILDER_H
-#define SETUP_INIDBBUILDER_H
-
-#include "PackageSpecification.h"
-
-class IniDBBuilder
-{
-public:
-  virtual ~IniDBBuilder() {};
-  virtual void buildTimestamp (const std::string& ) = 0;
-  virtual void buildVersion (const std::string& ) = 0;
-  virtual void buildPackage (const std::string& ) = 0;
-  virtual void buildPackageVersion (const std::string& ) = 0;
-  virtual void buildPackageSDesc (const std::string& ) = 0;
-  virtual void buildPackageLDesc (const std::string& ) = 0;
-  virtual void buildPackageInstall (const std::string& ) = 0;
-  virtual void buildPackageSource (const std::string&, const std::string&) = 0;
-  virtual void buildPackageTrust (int) = 0;
-  virtual void buildPackageCategory (const std::string& ) = 0;
-  virtual void buildBeginDepends () = 0;
-  virtual void buildInstallSize (const std::string& ) = 0;
-  virtual void buildInstallSHA512 (unsigned char const[64]) = 0;
-  virtual void buildSourceSHA512 (unsigned char const[64]) = 0;
-  virtual void buildInstallMD5 (unsigned char const[16]) = 0;
-  virtual void buildSourceMD5 (unsigned char const[16]) = 0;
-  virtual void buildBeginBuildDepends () = 0;
-  virtual void buildSourceName (const std::string& ) = 0;
-  virtual void buildSourceNameVersion (const std::string& ) = 0;
-  virtual void buildPackageListAndNode () = 0;
-  virtual void buildPackageListOrNode (const std::string& ) = 0;
-  virtual void buildPackageListOperator (PackageSpecification::_operators const &) = 0;
-  virtual void buildPackageListOperatorVersion (const std::string& ) = 0;
-  virtual void buildMessage (const std::string&, const std::string&) = 0;
-  void set_arch (const std::string& a) { arch = a; }
-  void set_release (const std::string& rel) { release = rel; }
-
-  unsigned int timestamp;
-  std::string arch;
-  std::string release;
-  std::string version;
-  std::string parse_mirror;
-};
-
-#endif /* SETUP_INIDBBUILDER_H */
diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 582d249..d506a9f 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -24,7 +24,6 @@
 #include "package_meta.h"
 #include "package_version.h"
 #include "cygpackage.h"
-#include "filemanip.h"
 #include "ini.h"
 // for strtoul
 #include <string.h>
@@ -117,9 +116,6 @@ void
 IniDBBuilderPackage::buildPackageLDesc (const std::string& theDesc)
 {
   cbpv.set_ldesc(theDesc);
-#if DEBUG
-  _feedback.warning(theDesc.c_str());
-#endif
 }
 
 void
@@ -170,7 +166,6 @@ IniDBBuilderPackage::buildPackageSource (const std::string& path,
   spec.setOperator (PackageSpecification::Equals);
   spec.setVersion (cbpv.Canonical_version());
 
-  // process_src (*cspv.source(), path);
   setSourceSize (*cspv.source(), size);
 }
 
@@ -457,16 +452,6 @@ IniDBBuilderPackage::process_src (packagesource &src, const std::string& path)
   if (!src.Canonical())
     src.set_canonical (path.c_str());
   src.sites.push_back(site(parse_mirror));
-
-  if (!cbpv.Canonical_version ().size())
-    {
-      fileparse f;
-      if (parse_filename (path, f))
-	{
-	  cbpv.setCanonicalVersion (f.ver);
-	  add_correct_version ();
-	}
-    }
 }
 
 void
diff --git a/IniDBBuilderPackage.h b/IniDBBuilderPackage.h
index a97c53f..a39a95f 100644
--- a/IniDBBuilderPackage.h
+++ b/IniDBBuilderPackage.h
@@ -16,48 +16,58 @@
 #ifndef SETUP_INIDBBUILDERPACKAGE_H
 #define SETUP_INIDBBUILDERPACKAGE_H
 
-#include "IniDBBuilder.h"
 #include <vector>
 #include "package_version.h"
 class IniParseFeedback;
 class packagesource;
 class packagemeta;
 
-class IniDBBuilderPackage:public IniDBBuilder
+class IniDBBuilderPackage
 {
 public:
   IniDBBuilderPackage (IniParseFeedback const &);
   ~IniDBBuilderPackage ();
-  virtual void buildTimestamp (const std::string& );
-  virtual void buildVersion (const std::string& );
-  virtual void buildPackage (const std::string& );
-  virtual void buildPackageVersion (const std::string& );
-  virtual void buildPackageSDesc (const std::string& );
-  virtual void buildPackageLDesc (const std::string& );
-  virtual void buildPackageInstall (const std::string& );
-  virtual void buildPackageSource (const std::string&, const std::string&);
-  virtual void buildPackageTrust (int);
-  virtual void buildPackageCategory (const std::string& );
 
-  virtual void buildBeginDepends ();
-  virtual void buildInstallSize (const std::string& );
-  virtual void buildInstallSHA512 (unsigned char const[64]);
-  virtual void buildSourceSHA512 (unsigned char const[64]);
-  virtual void buildInstallMD5 (unsigned char const[16]);
-  virtual void buildSourceMD5 (unsigned char const[16]);
-  virtual void buildBeginBuildDepends ();
-  virtual void buildMessage (const std::string&, const std::string&);
-  virtual void buildSourceName (const std::string& );
-  virtual void buildSourceNameVersion (const std::string& );
-  virtual void buildPackageListAndNode ();
-  virtual void buildPackageListOrNode (const std::string& );
-  virtual void buildPackageListOperator (PackageSpecification::_operators const &);
-  virtual void buildPackageListOperatorVersion (const std::string& );
+  void buildTimestamp (const std::string& );
+  void buildVersion (const std::string& );
+  void buildPackage (const std::string& );
+  void buildPackageVersion (const std::string& );
+  void buildPackageSDesc (const std::string& );
+  void buildPackageLDesc (const std::string& );
+  void buildPackageInstall (const std::string& );
+  void buildPackageSource (const std::string&, const std::string&);
+  void buildPackageTrust (int);
+  void buildPackageCategory (const std::string& );
+
+  void buildBeginDepends ();
+  void buildInstallSize (const std::string& );
+  void buildInstallSHA512 (unsigned char const[64]);
+  void buildSourceSHA512 (unsigned char const[64]);
+  void buildInstallMD5 (unsigned char const[16]);
+  void buildSourceMD5 (unsigned char const[16]);
+  void buildBeginBuildDepends ();
+  void buildMessage (const std::string&, const std::string&);
+  void buildSourceName (const std::string& );
+  void buildSourceNameVersion (const std::string& );
+  void buildPackageListAndNode ();
+  void buildPackageListOrNode (const std::string& );
+  void buildPackageListOperator (PackageSpecification::_operators const &);
+  void buildPackageListOperatorVersion (const std::string& );
+
+  void set_arch (const std::string& a) { arch = a; }
+  void set_release (const std::string& rel) { release = rel; }
+
+  unsigned int timestamp;
+  std::string arch;
+  std::string release;
+  std::string version;
+  std::string parse_mirror;
 
 private:
   void add_correct_version();
   void process_src (packagesource &src, const std::string& );
   void setSourceSize (packagesource &src, const std::string& );
+
   packagemeta *cp;
   packageversion cbpv;
   packagemeta *csp;
diff --git a/PickView.cc b/PickView.cc
index 3de49f7..b3b1c1a 100644
--- a/PickView.cc
+++ b/PickView.cc
@@ -165,6 +165,9 @@ PickView::setViewMode (views mode)
         {
           packagemeta & pkg = *(i->second);
 
+          if (!pkg.isBinary())
+            continue;
+
           if ( // "Full" : everything
               (view_mode == PickView::views::PackageFull)
 
@@ -442,9 +445,9 @@ PickView::init_headers (HDC dc)
           if (*i != pkg.installed)
             note_width (headers, dc, i->Canonical_version (),
                         HMARGIN + SPIN_WIDTH, new_col);
-	  std::string z = format_1000s(packageversion(*i).source ()->size);
+	  std::string z = format_1000s(i->source ()->size);
 	  note_width (headers, dc, z, HMARGIN, size_col);
-	  z = format_1000s(packageversion(i->sourcePackage ()).source ()->size);
+	  z = format_1000s(i->sourcePackage ().source ()->size);
 	  note_width (headers, dc, z, HMARGIN, size_col);
 	}
       std::string s = pkg.name;
diff --git a/ScanFindVisitor.cc b/ScanFindVisitor.cc
index 50e7415..02cd6e8 100644
--- a/ScanFindVisitor.cc
+++ b/ScanFindVisitor.cc
@@ -15,9 +15,9 @@
 
 #include "ScanFindVisitor.h"
 #include "filemanip.h"
-#include "IniDBBuilder.h"
+#include "IniDBBuilderPackage.h"
 
-ScanFindVisitor::ScanFindVisitor(IniDBBuilder &aBuilder) : _Builder (aBuilder) {}
+ScanFindVisitor::ScanFindVisitor(IniDBBuilderPackage &aBuilder) : _Builder (aBuilder) {}
 ScanFindVisitor::~ScanFindVisitor(){}
 
 /* look for potential packages we can add to the in-memory package
diff --git a/ScanFindVisitor.h b/ScanFindVisitor.h
index 5755ca4..b4c93d9 100644
--- a/ScanFindVisitor.h
+++ b/ScanFindVisitor.h
@@ -18,19 +18,19 @@
 
 #include "FindVisitor.h"
 
-class IniDBBuilder;
+class IniDBBuilderPackage ;
 /* Scan files and create a package db when no cached .ini exists */
 class ScanFindVisitor : public FindVisitor
 {
 public:
-  ScanFindVisitor (IniDBBuilder &aBuilder);
+  ScanFindVisitor (IniDBBuilderPackage &aBuilder);
   virtual void visitFile(const std::string& basePath, const WIN32_FIND_DATA *);
   virtual ~ ScanFindVisitor ();
 protected:
   ScanFindVisitor (ScanFindVisitor const &);
   ScanFindVisitor & operator= (ScanFindVisitor const &);
 private:
-  IniDBBuilder &_Builder;
+  IniDBBuilderPackage &_Builder;
 };
 
 #endif /* SETUP_SCANFINDVISITOR_H */
diff --git a/choose.cc b/choose.cc
index a0dcc1b..2016caa 100644
--- a/choose.cc
+++ b/choose.cc
@@ -372,14 +372,6 @@ ChooserPage::changeTrust(trusts aTrust)
 {
   SetBusy ();
   chooser->defaultTrust (aTrust);
-  packagedb db;
-  db.markUnVisited ();
-
-  for (packagedb::packagecollection::iterator i = db.packages.begin(); i != db.packages.end(); i++)
-    {
-      i->second->set_requirements(aTrust);
-    }
-
   chooser->refresh();
   PrereqChecker p;
   p.setTrust (aTrust);
diff --git a/cygpackage.cc b/cygpackage.cc
index cd4b6bd..56c1da8 100644
--- a/cygpackage.cc
+++ b/cygpackage.cc
@@ -36,7 +36,6 @@ packagev (),
 canonical (),
 sdesc (),
 ldesc (),
-status (package_installed),
 type (package_binary),
 listdata (),
 listfile ()
@@ -61,12 +60,10 @@ cygpackage::createInstance (const std::string& pkgname,
 packageversion
 cygpackage::createInstance (const std::string& pkgname,
                             const std::string& version,
-			    package_status_t const newstatus,
 			    package_type_t const newtype)
 {
   cygpackage *temp = new cygpackage;
   temp->name = pkgname;
-  temp->status = newstatus;
   temp->type = newtype;
   temp->setCanonicalVersion (version);
   return packageversion(temp);
@@ -104,14 +101,6 @@ cygpackage::setCanonicalVersion (const std::string& version)
 
 cygpackage::~cygpackage ()
 {
-  destroy ();
-}
-
-/* helper functions */
-
-void
-cygpackage::destroy ()
-{
 }
 
 const std::string
diff --git a/cygpackage.h b/cygpackage.h
index 991072a..4022472 100644
--- a/cygpackage.h
+++ b/cygpackage.h
@@ -34,10 +34,6 @@ public:
   virtual const std::string Vendor_version ();
   virtual const std::string Package_version ();
   virtual const std::string Canonical_version ();
-  virtual package_status_t Status ()
-  {
-    return status;
-  };
   virtual package_type_t Type ()
   {
     return type;
@@ -72,12 +68,10 @@ public:
 
   static packageversion createInstance (const std::string& pkgname,
                                         const std::string& version,
-					package_status_t const,
 					package_type_t const);
 
 private:
   cygpackage ();
-  void destroy ();
   std::string name;
   std::string vendor;
   std::string packagev;
@@ -86,7 +80,6 @@ private:
   char getfilenamebuffer[CYG_PATH_MAX];
 
 //  package_stability_t stability;
-  package_status_t status;
   package_type_t type;
 
   io_stream *listdata, *listfile;
diff --git a/ini.h b/ini.h
index 3072637..4b9ed69 100644
--- a/ini.h
+++ b/ini.h
@@ -30,9 +30,9 @@ extern std::string SetupIniDir;
 extern std::string SetupBaseName;
 
 class IniState;
-class IniDBBuilder;
+class IniDBBuilderPackage;
 class IniParseFeedback;
-void ini_init (io_stream *, IniDBBuilder *, IniParseFeedback &);
+void ini_init (io_stream *, IniDBBuilderPackage *, IniParseFeedback &);
 #define YYSTYPE char *
 
 /* When setup.ini is parsed, the information is stored according to
diff --git a/inilex.ll b/inilex.ll
index a6ae1fb..798a04b 100644
--- a/inilex.ll
+++ b/inilex.ll
@@ -160,13 +160,13 @@ B64	[a-zA-Z0-9_-]
 #include "io_stream.h"
 
 static io_stream *input_stream = 0;
-extern IniDBBuilder *iniBuilder;
+extern IniDBBuilderPackage *iniBuilder;
 static IniParseFeedback *iniFeedback;
 std::string current_ini_name, yyerror_messages;
 int yyerror_count;
 
 void
-ini_init(io_stream *stream, IniDBBuilder *aBuilder, IniParseFeedback &aFeedback)
+ini_init(io_stream *stream, IniDBBuilderPackage *aBuilder, IniParseFeedback &aFeedback)
 {
   input_stream = stream;
   iniBuilder = aBuilder;
diff --git a/iniparse.yy b/iniparse.yy
index 6213b70..9ef4801 100644
--- a/iniparse.yy
+++ b/iniparse.yy
@@ -25,13 +25,13 @@
 extern int yyerror (const std::string& s);
 int yylex ();
 
-#include "IniDBBuilder.h"
+#include "IniDBBuilderPackage.h"
 
 #define YYERROR_VERBOSE 1
 #define YYINITDEPTH 1000
 /*#define YYDEBUG 1*/
 
-IniDBBuilder *iniBuilder;
+IniDBBuilderPackage *iniBuilder;
 extern int yylineno;
 %}
 
diff --git a/package_db.cc b/package_db.cc
index ba1a561..c2e1b63 100644
--- a/package_db.cc
+++ b/package_db.cc
@@ -107,7 +107,6 @@ packagedb::packagedb ()
 
 		  packageversion binary = 
 		    cygpackage::createInstance (pkgname, f.ver,
-						package_installed,
 						package_binary);
 
 		  pkg->add_version (binary);
@@ -382,17 +381,6 @@ packagedb::connectedEnd()
 }
 
 void
-packagedb::markUnVisited()
-{
-  for (packagedb::packagecollection::iterator n = packages.begin ();
-       n != packages.end (); ++n)
-    {
-      packagemeta & pkgm = *(n->second);
-      pkgm.visited(false);
-    }
-}
-
-void
 packagedb::setExistence ()
 {
   /* binary packages */
diff --git a/package_db.h b/package_db.h
index 6a99398..d02dbc4 100644
--- a/package_db.h
+++ b/package_db.h
@@ -72,7 +72,6 @@ public:
   PackageDBConnectedIterator connectedEnd();
   void fillMissingCategory();
   void defaultTrust (trusts trust);
-  void markUnVisited();
   void setExistence();
   typedef std::map <std::string, packagemeta *> packagecollection;
   /* all seen binary packages */
diff --git a/package_meta.cc b/package_meta.cc
index 4ea9a4f..24ed17e 100644
--- a/package_meta.cc
+++ b/package_meta.cc
@@ -92,8 +92,7 @@ packagemeta::packagemeta (packagemeta const &rhs) :
   installed (rhs.installed), prev (rhs.prev),
   curr (rhs.curr),
   exp (rhs.exp),
-  desired (rhs.desired),
-  visited_(rhs.visited_)
+  desired (rhs.desired)
 {
   
 }
@@ -457,26 +456,6 @@ packagemeta::set_action (trusts const trust)
     user_picked = true;
 }
 
-int
-packagemeta::set_requirements (trusts deftrust, size_t depth)
-{
-  if (visited())
-    return 0;
-  /* Only prevent further checks once we have been required by something else */
-  if (depth)
-    visited(true);
-  int changed = 0;
-  /* handle build-depends */
-  if (depth == 0 && desired.sourcePackage ().picked())
-    changed += desired.sourcePackage ().set_requirements (deftrust, depth + 1);
-  if (!desired || (desired != installed && !desired.picked ()))
-    /* uninstall || source only */
-    return changed;
-
-  return changed + desired.set_requirements (deftrust, depth);
-}
-
-
 // Set a particular type of action.
 void
 packagemeta::set_action (_actions action, packageversion const &default_version)
@@ -558,6 +537,18 @@ packagemeta::sourceAccessible () const
       if (bin.sourcePackage().accessible())
         return true;
     }
+
+  return false;
+}
+
+bool
+packagemeta::isBinary () const
+{
+  for (set<packageversion>::iterator i=versions.begin();
+       i != versions.end(); ++i)
+    if ((i->Type() == package_binary) && i->accessible())
+      return true;
+
   return false;
 }
 
@@ -612,18 +603,6 @@ packagemeta::trustLabel(packageversion const &aVersion) const
 }
 
 void
-packagemeta::visited(bool const &aBool)
-{
-  visited_ = aBool;
-}
-
-bool
-packagemeta::visited() const
-{
-  return visited_;
-}
-
-void
 packagemeta::logSelectionStatus() const
 {
   packagemeta const & pkg = *this;
diff --git a/package_meta.h b/package_meta.h
index f23073e..5f7842c 100644
--- a/package_meta.h
+++ b/package_meta.h
@@ -35,8 +35,7 @@ public:
   static void ScanDownloadedFiles (bool);
   packagemeta (packagemeta const &);
   packagemeta (const std::string& pkgname)
-  : name (pkgname), key(pkgname), user_picked (false),
-    visited_(false)
+  : name (pkgname), key(pkgname), user_picked (false)
   {
   }
 
@@ -44,8 +43,6 @@ public:
 
   void add_version (packageversion &);
   void set_installed (packageversion &);
-  void visited(bool const &);
-  bool visited() const;
   void addToCategoryBase();
   bool hasNoCategories() const;
   void setDefaultCategories();
@@ -74,10 +71,7 @@ public:
   void set_action (trusts const t);
   void set_action (_actions, packageversion const & default_version);
   void uninstall ();
-  int set_requirements (trusts deftrust, size_t depth);
-  // explicit separation for generic programming.
-  int set_requirements (trusts deftrust) 
-    { return set_requirements (deftrust, 0); }
+
   void set_message (const std::string& message_id, const std::string& message_string)
   {
     message.set (message_id, message_string);
@@ -148,6 +142,8 @@ public:
   bool accessible () const;
   bool sourceAccessible() const;
 
+  bool isBinary() const;
+
   void logSelectionStatus() const;
   void logAllVersions() const;
 
@@ -155,7 +151,6 @@ protected:
   packagemeta &operator= (packagemeta const &);
 private:
   std::string trustLabel(packageversion const &) const;
-  bool visited_;
 };
 
 #endif /* SETUP_PACKAGE_META_H */
diff --git a/package_version.cc b/package_version.cc
index 8ed8ac8..7f52c27 100644
--- a/package_version.cc
+++ b/package_version.cc
@@ -45,7 +45,6 @@ public:
   const std::string Package_version() {return std::string();}
   const std::string Canonical_version() {return std::string();}
   void setCanonicalVersion (const std::string& ) {}
-  package_status_t Status (){return package_notinstalled;}
   package_type_t Type () {return package_binary;}
   const std::string getfirstfile () {return std::string();}
   const std::string getnextfile () {return std::string();}
@@ -219,7 +218,7 @@ packageversion::sourcePackage() const
 }
 
 PackageSpecification &
-packageversion::sourcePackageSpecification ()
+packageversion::sourcePackageSpecification () const
 {
   return data->sourcePackageSpecification ();
 }
@@ -263,7 +262,7 @@ packageversion::uninstall ()
 }
 
 packagesource *
-packageversion::source ()
+packageversion::source () const
 {
   if (!data->sources.size())
     data->sources.push_back (packagesource());
@@ -271,7 +270,7 @@ packageversion::source ()
 }
 
 vector<packagesource> *
-packageversion::sources ()
+packageversion::sources () const
 {
   return &data->sources;
 }
@@ -310,146 +309,6 @@ packageversion::scan (bool mirror_mode)
     }
 }
 
-static bool
-checkForInstalled (PackageSpecification *spec)
-{
-  packagedb db;
-  packagemeta *required = db.findBinary (*spec);
-  if (!required)
-    return false;
-  if (spec->satisfies (required->installed)
-      && required->desired == required->installed )
-    /* done, found a satisfactory installed version that will remain
-       installed */
-    return true;
-  return false;
-}
-
-static bool
-checkForUpgradeable (PackageSpecification *spec)
-{
-  packagedb db;
-  packagemeta *required = db.findBinary (*spec);
-  if (!required || !required->installed)
-    return false;
-  for (set <packageversion>::iterator i = required->versions.begin();
-       i != required->versions.end(); ++i)
-    if (spec->satisfies (*i))
-      return true;
-  return false;
-}
-
-static bool
-checkForSatisfiable (PackageSpecification *spec)
-{
-  packagedb db;
-  packagemeta *required = db.findBinary (*spec);
-  if (!required)
-    return false;
-  for (set <packageversion>::iterator i = required->versions.begin();
-       i != required->versions.end(); ++i)
-    if (spec->satisfies (*i))
-      return true;
-  return false;
-}
-
-static int
-select (trusts deftrust, size_t depth, packagemeta *required,
-        const packageversion &aVersion)
-{
-  /* preserve source */
-  bool sourceticked = required->desired.sourcePackage ().picked();
-  /* install this version */
-  required->desired = aVersion;
-  required->desired.pick (required->installed != required->desired, required);
-  required->desired.sourcePackage ().pick (sourceticked, NULL);
-  /* does this requirement have requirements? */
-  return required->set_requirements (deftrust, depth + 1);
-}
-
-static int
-processOneDependency (trusts deftrust, size_t depth,
-                      PackageSpecification *spec)
-{
-  /* TODO: add this to a set of packages to be offered to meet the
-     requirement. For now, simply set the install to the first
-     satisfactory version. The user can step through the list if
-     desired */
-  packagedb db;
-  packagemeta *required = db.findBinary (*spec);
-
-  packageversion trusted = required->trustp(false, deftrust);
-  if (spec->satisfies (trusted)) {
-      return select (deftrust, depth, required, trusted);
-  }
-
-  Log (LOG_TIMESTAMP) << "Warning, the default trust level for package "
-    << trusted.Name() << " does not meet this specification " << *spec
-    << endLog;
-  
-  set <packageversion>::iterator v;
-  for (v = required->versions.begin();
-    v != required->versions.end() && !spec->satisfies (*v); ++v);
-
-  if (v == required->versions.end())
-      /* assert ?! */
-      return 0;
-  
-  return select (deftrust, depth, required, *v);
-}
-
-int
-packageversion::set_requirements (trusts deftrust, size_t depth)
-{
-  int changed = 0;
-  vector <vector <PackageSpecification *> *>::iterator dp = depends ()->begin();
-  /* cheap test for too much recursion */
-  if (depth > 30)
-    return changed;
-  /* walk through each and clause */
-  while (dp != depends ()->end())
-    {
-      /* three step:
-	 1) is a satisfactory or clause installed?
-	 2) is an unsatisfactory version of an or clause which has
-	 a satisfactory version available installed?
-	 3) is a satisfactory package available?
-	 */
-      /* check each or clause for an installed match */
-      vector <PackageSpecification *>::iterator i =
-	find_if ((*dp)->begin(), (*dp)->end(), checkForInstalled);
-      if (i != (*dp)->end())
-	{
-	  /* we found an installed ok package */
-	  /* next and clause */
-	  ++dp;
-	  continue;
-	}
-      /* check each or clause for an upgradeable version */
-      i = find_if ((*dp)->begin(), (*dp)->end(), checkForUpgradeable);
-      if (i != (*dp)->end())
-	{
-	  /* we found a package that can be up/downgraded to meet the
-	     requirement. (*i is the packagespec that can be satisfied.)
-	     */
-	  ++dp;
-	  changed += processOneDependency (deftrust, depth, *i) + 1;
-	  continue;
-	}
-      /* check each or clause for an installable version */
-      i = find_if ((*dp)->begin(), (*dp)->end(), checkForSatisfiable);
-      if (i != (*dp)->end())
-	{
-	  /* we found a package that can be installed to meet the requirement */
-	  ++dp;
-	  changed += processOneDependency (deftrust, depth, *i) + 1;
-	  continue;
-	}
-      ++dp;
-    }
-  return changed;
-}
-
 void
 packageversion::addScript(Script const &aScript)
 {
diff --git a/package_version.h b/package_version.h
index edfd15a..b728acc 100644
--- a/package_version.h
+++ b/package_version.h
@@ -57,13 +57,6 @@ package_stability_t;
 
 typedef enum
 {
-  package_notinstalled,
-  package_installed
-}
-package_status_t;
-
-typedef enum
-{
   package_binary,
   package_source
 }
@@ -105,7 +98,6 @@ public:
   const std::string Package_version () const;
   const std::string Canonical_version () const;
   void setCanonicalVersion (const std::string& );
-  package_status_t Status () const;
   package_type_t Type () const;
   const std::string getfirstfile ();
   const std::string getnextfile ();
@@ -114,7 +106,7 @@ public:
   const std::string LDesc () const;
   void set_ldesc (const std::string& );
   packageversion sourcePackage () const;
-  PackageSpecification & sourcePackageSpecification ();
+  PackageSpecification & sourcePackageSpecification () const;
   void setSourcePackageSpecification (PackageSpecification const &);
 
   /* invariant: these never return NULL */
@@ -126,9 +118,9 @@ public:
 
   void uninstall ();
   /* invariant: never null */
-  packagesource *source(); /* where can we source the file from */
+  packagesource *source() const; /* where can we source the file from */
   /* invariant: never null */
-  std::vector <packagesource> *sources(); /* expose the list of files.
+  std::vector <packagesource> *sources() const; /* expose the list of files.
 					source() returns the 'default' file
 					sources() allows managing multiple files
 					in a single package
@@ -165,7 +157,6 @@ public:
   virtual const std::string Package_version () = 0;
   virtual const std::string Canonical_version () = 0;
   virtual void setCanonicalVersion (const std::string& ) = 0;
-  virtual package_status_t Status () = 0;
 //  virtual package_stability_t Stability () = 0;
   virtual package_type_t Type () = 0;
   /* TODO: we should probably return a metaclass - file name & path & size & type
diff --git a/prereq.cc b/prereq.cc
index 0d3b93c..4b6cd68 100644
--- a/prereq.cc
+++ b/prereq.cc
@@ -211,10 +211,10 @@ PrereqChecker::isMet ()
 
       // Fetch the dependencies of the package. This assumes that the
       // dependencies of the prev, curr, and exp versions are all the same.
-      vector <vector <PackageSpecification *> *> *deps = pack->curr.depends ();
+      const vector <vector <PackageSpecification *> *> *deps = pack->curr.depends ();
 
       // go through the package's dependencies
-      for (vector <vector <PackageSpecification *> *>::iterator d =
+      for (vector <vector <PackageSpecification *> *>::const_iterator d =
             deps->begin (); d != deps->end (); ++d)
         {
           // XXX: the following assumes that there is only a single


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