[setup - the official Cygwin setup program] branch master, updated. release_2.891-4-g0ffb779

jturney-9JcytcrH/[email protected]
Newsgroups gmane.os.cygwin.cvs.apps
Message-ID <[email protected]>


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

commit 0ffb77947cadfe6a6113a5972064ef291a9aa588
Author: Jon Turney <[email protected]>
Date:   Wed Jun 6 19:57:56 2018 +0100

    Handle test-only packages better
    
    Don't create a current version with an empty version string when parsing a
    package which doesn't have a current version.

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

commit 55654e1f3a785e9f2cc2b5a37a89773064210159
Author: Ken Brown <[email protected]>
Date:   Sun Mar 18 12:31:37 2018 -0400

    Sort the packages listed in the "confirm" dialog


Diff:
---
 IniDBBuilderPackage.cc |    3 +++
 confirm.cc             |   44 ++++++++++++++++++++++++++++++--------------
 2 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index d560cb7..d5f167d 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -363,6 +363,9 @@ IniDBBuilderPackage::process ()
   if (!name.size())
     return;
 
+  if (cbpv.version.empty())
+    return;
+
 #if DEBUG
   Log (LOG_BABBLE) << "Finished with package " << name << endLog;
   Log (LOG_BABBLE) << "Version " << cbpv.version << endLog;
diff --git a/confirm.cc b/confirm.cc
index eb6bd99..cd749c0 100644
--- a/confirm.cc
+++ b/confirm.cc
@@ -19,6 +19,8 @@
 #include "package_db.h"
 #include "package_meta.h"
 
+#include <algorithm>
+
 extern ThreeBarProgressPage Progress;
 
 // Sizing information.
@@ -61,26 +63,34 @@ ConfirmPage::OnActivate()
   // first list things we will erase
   if (source != IDC_SOURCE_DOWNLOAD)
     {
+      std::vector<std::string> erase;
       for (SolverTransactionList::const_iterator i = trans.begin ();
            i != trans.end (); i++)
         {
           if (i->type == SolverTransaction::transErase)
             {
+              std::string line;
               packageversion pv = i->version;
               packagemeta *pkg = db.findBinary (PackageSpecification (pv.Name ()));
 
-              s += "Uninstall ";
-              s += i->version.Name();
-              s += " ";
-              s += i->version.Canonical_version();
+              line += "Uninstall ";
+              line += i->version.Name();
+              line += " ";
+              line += i->version.Canonical_version();
               if (pkg && pkg->desired)
-                s += " (automatically added)";
-              s += "\r\n";
+                line += " (automatically added)";
+              line += "\r\n";
+              erase.push_back (line);
             }
         }
+      sort (erase.begin(), erase.end());
+      for (std::vector<std::string>::const_iterator i = erase.begin ();
+           i != erase.end(); i++)
+        s += *i;
     }
 
   // then list things downloaded or installed
+  std::vector<std::string> install;
   for (SolverTransactionList::const_iterator i = trans.begin ();
        i != trans.end (); i++)
     {
@@ -89,20 +99,26 @@ ConfirmPage::OnActivate()
 
       if (i->type == SolverTransaction::transInstall)
           {
+            std::string line;
             if (source != IDC_SOURCE_DOWNLOAD)
-              s += "Install ";
+              line += "Install ";
             else
-              s += "Download ";
-            s += i->version.Name();
-            s += " ";
-            s += i->version.Canonical_version();
+              line += "Download ";
+            line += i->version.Name();
+            line += " ";
+            line += i->version.Canonical_version();
             if (i->version.Type() == package_source)
-              s += " (source)";
+              line += " (source)";
             else if (pkg && !pkg->desired)
-              s += " (automatically added)";
-            s += "\r\n";
+              line += " (automatically added)";
+            line += "\r\n";
+            install.push_back (line);
           }
     }
+  sort (install.begin(), install.end());
+  for (std::vector<std::string>::const_iterator i = install.begin ();
+       i != install.end(); i++)
+    s += *i;
 
   // be explicit about doing nothing
   if (s.empty())
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.