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]

[PATCH setup 04/15] Remove packageversion::sources(), only packageversion::source() is useful


The comments seems to indicate this was for supporting a package consisting
of multiple archives.

We only supported downloading such packages, not describing them in
setup.ini or installing them.

No such mythical beast has been sighted.
---
 download.cc        | 24 ++++++------------------
 package_version.cc | 31 ++++++++++---------------------
 package_version.h  |  8 +-------
 3 files changed, 17 insertions(+), 46 deletions(-)

diff --git a/download.cc b/download.cc
index f9354bb..5cc5e2b 100644
--- a/download.cc
+++ b/download.cc
@@ -219,19 +219,13 @@ do_download_thread (HINSTANCE h, HWND owner)
 	    {
     	      if (version.picked())
 		{
-		  for (vector<packagesource>::iterator i = 
-		       version.sources ()->begin(); 
-		       i != version.sources ()->end(); ++i)
-		    if (!check_for_cached (*i))
-      		      total_download_bytes += i->size;
+		    if (!check_for_cached (*version.source()))
+		      total_download_bytes += version.source()->size;
 		}
     	      if (sourceversion.picked () || IncludeSource)
 		{
-		  for (vector<packagesource>::iterator i =
-		       sourceversion.sources ()->begin();
-		       i != sourceversion.sources ()->end(); ++i)
-		    if (!check_for_cached (*i))
-		      total_download_bytes += i->size;
+		    if (!check_for_cached (*sourceversion.source()))
+		      total_download_bytes += sourceversion.source()->size;
 		}
 	    }
 	  catch (Exception * e)
@@ -259,17 +253,11 @@ do_download_thread (HINSTANCE h, HWND owner)
 	  packageversion sourceversion = version.sourcePackage();
 	  if (version.picked())
 	    {
-	      for (vector<packagesource>::iterator i =
-   		   version.sources ()->begin();
-		   i != version.sources ()->end(); ++i)
-    		e += download_one (*i, owner);
+		e += download_one (*version.source(), owner);
 	    }
 	  if (sourceversion && (sourceversion.picked() || IncludeSource))
 	    {
-	      for (vector<packagesource>::iterator i =
-   		   sourceversion.sources ()->begin();
-		   i != sourceversion.sources ()->end(); ++i)
-    		e += download_one (*i, owner);
+		e += download_one (*sourceversion.source (), owner);
 	    }
 	  errors += e;
 #if 0
diff --git a/package_version.cc b/package_version.cc
index 7f52c27..1fc5d77 100644
--- a/package_version.cc
+++ b/package_version.cc
@@ -264,15 +264,7 @@ packageversion::uninstall ()
 packagesource *
 packageversion::source () const
 {
-  if (!data->sources.size())
-    data->sources.push_back (packagesource());
-  return &data->sources[0];
-}
-
-vector<packagesource> *
-packageversion::sources () const
-{
-  return &data->sources;
+  return &data->source;
 }
 
 bool
@@ -392,24 +384,21 @@ _packageversion::sourcePackage ()
   return sourceVersion;
 }
 
+// is archive accessible
 bool
 _packageversion::accessible() const
 {
-  bool cached (sources.size() > 0);
-  for (vector<packagesource>::const_iterator i = sources.begin();
-       i!=sources.end(); ++i)
-    if (!i->Cached ())
-      cached = false;
-  if (cached) 
+  // cached ?
+  if (source.Cached ())
     return true;
+  // net access allowed?
   if (::source == IDC_SOURCE_LOCALDIR)
     return false;
-  unsigned int retrievable = 0;
-  for (vector<packagesource>::const_iterator i = sources.begin();
-      i!=sources.end(); ++i)
-    if (i->sites.size() || i->Cached ())
-      retrievable += 1;
-  return retrievable > 0;
+  // retrievable ?
+  if (source.sites.size() || source.Cached ())
+    return true;
+  // otherwise, not accessible
+  return false;
 }
 
 void
diff --git a/package_version.h b/package_version.h
index b728acc..1b255a5 100644
--- a/package_version.h
+++ b/package_version.h
@@ -119,12 +119,6 @@ public:
   void uninstall ();
   /* invariant: never null */
   packagesource *source() const; /* where can we source the file from */
-  /* invariant: never null */
-  std::vector <packagesource> *sources() const; /* expose the list of files.
-					source() returns the 'default' file
-					sources() allows managing multiple files
-					in a single package
-					*/
 
   bool accessible () const;
   /* scan for local copies */
@@ -184,7 +178,7 @@ public:
 		/* This will also trigger reinstalled if it is set */
 
   virtual void uninstall () = 0;
-  std::vector<packagesource> sources; /* where can we source the files from */
+  packagesource source; /* where can we source the file from */
 
   virtual bool accessible () const;
 
-- 
2.12.3


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