[setup - the official Cygwin setup program] branch master, updated. release_2.900

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=d997f4cfe147d5ee6aa886aa6bda066204f734ad

commit d997f4cfe147d5ee6aa886aa6bda066204f734ad
Author: Jon Turney <[email protected]>
Date:   Thu Jan 2 16:26:46 2020 +0000

    Ignore reinstall action when the package isn't installed
    
    '--packages X --remove-packages X' is interpreted by
    applyCommandLinePackageSelection() as a request to reinstall X (and
    similarly with --category X --remove-categories X).  If X isn't actually
    already installed, this leads to bogus 'erase/install no-package' tasks
    appearing in the task list.

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

commit 4938eeae36da8c6570b6abedeeb9960c6f9eea64
Author: Jon Turney <[email protected]>
Date:   Thu Jan 2 15:37:12 2020 +0000

    Dynamically size columns in transaction list log

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

commit 080aca57ed93ee055eee9ca030f34257bd3225df
Author: Jon Turney <[email protected]>
Date:   Thu Jan 2 14:56:07 2020 +0000

    Ignore install action when no current package exists
    
    This isn't ideal as a command line to install a package which only has a
    test version will do nothing.  But I think we don't want installing by
    category to install packages in that category which only have a test
    version. Unfortunately, both cases are currently identical by the time
    we get to applyCommandLinePackageSelection().

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

commit 849c42ad876d68f32516e01a1a9e7ee13b3ef632
Author: Jon Turney <[email protected]>
Date:   Thu Jan 2 14:51:04 2020 +0000

    Revert "Fix cases where incorrect action is stored by set_action()"
    
    This reverts commit e435a212a6e85169616a67c08eab1d9a387c6cfc.
    
    I'd forgotten that action = Install_action, desired = empty version is
    how we represent 'install any version of this package'.  Converting that
    to NoChange_action leaves us back mishandling obsolete packges specified
    on the command line, fixing which was the whole point of this change. So
    let's try to fix this a different way...


Diff:
---
 libsolv.cc      |   25 +++++++++++++++++++------
 package_meta.cc |   55 ++++++++++++++++++++++++++++++-------------------------
 2 files changed, 49 insertions(+), 31 deletions(-)

diff --git a/libsolv.cc b/libsolv.cc
index d7a9d01..a2f3f4c 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -21,7 +21,8 @@
 #include "solv/evr.h"
 
 #include "LogSingleton.h"
-#include  <iomanip>
+#include <iomanip>
+#include <algorithm>
 
 // ---------------------------------------------------------------------------
 // Utility functions for mapping between Operators and Relation Ids
@@ -655,7 +656,7 @@ SolverTasks::setTasks()
         case packagemeta::Install_action:
           if (pkg->desired)
             add(pkg->desired, taskInstall); // install/upgrade
-          else
+          else if (pkg->curr)
             add(pkg->curr, taskInstallAny); // install
           break;
 
@@ -948,7 +949,7 @@ SolverSolution::augmentTasks(SolverTasks &tasks)
     {
       const SolvableVersion &sv = (*i).first;
 
-      if (((*i).second) == SolverTasks::taskReinstall)
+      if (sv && (((*i).second) == SolverTasks::taskReinstall))
         {
           trans.push_back(SolverTransaction(SolvableVersion(sv.id, pool.pool),
                                             SolverTransaction::transErase));
@@ -986,15 +987,27 @@ SolverSolution::dumpTransactionList() const
 {
   if (trans.size())
     {
+      size_t width_name = 0;
+      size_t width_version = 0;
+
+      for (SolverTransactionList::const_iterator i = trans.begin ();
+           i != trans.end ();
+           ++i)
+        {
+          width_name = std::max(width_name, i->version.Name().length()+1);
+          width_version = std::max(width_version, i->version.Canonical_version().length()+1);
+        }
+
       Log (LOG_PLAIN) << "Augmented Transaction List:" << endLog;
       for (SolverTransactionList::const_iterator i = trans.begin ();
            i != trans.end ();
            ++i)
         {
           Log (LOG_PLAIN) << std::setw(4) << std::distance(trans.begin(), i)
-                          << std::setw(8) << i->type
-                          << std::setw(48) << i->version.Name()
-                          << std::setw(20) << i->version.Canonical_version() << endLog;
+                          << std::setw(8) << i->type << " "
+                          << std::left
+                          << std::setw(width_name) << i->version.Name()
+                          << std::setw(width_version) << i->version.Canonical_version() << endLog;
         }
     }
   else
diff --git a/package_meta.cc b/package_meta.cc
index 1f6ab16..121fc70 100644
--- a/package_meta.cc
+++ b/package_meta.cc
@@ -549,31 +549,30 @@ packagemeta::set_action (_actions action, packageversion const &default_version,
   else if (action == Install_action)
     {
       desired = default_version;
-      if (desired != installed)
-        if (desired.accessible ())
-          {
-            /* Memorize the fact that the user picked to install this package at least once. */
-            if (useraction)
-              user_picked = true;
-
-            pick (true);
-            srcpick (false);
-
-            /* Install no version is Uninstall */
-            if (!desired)
-              action = Uninstall_action;
-          }
-        else
-          {
-            pick (false);
-            srcpick (true);
-          }
-      else
-        {
-          action = NoChange_action;
-          pick (false);
-          srcpick (false);
-        }
+      if (desired)
+	{
+	  if (desired != installed)
+	    if (desired.accessible ())
+	      {
+		/* Memorize the fact that the user picked to install this package at least once. */
+		if (useraction)
+		  user_picked = true;
+
+		pick (true);
+		srcpick (false);
+	      }
+	    else
+	      {
+		pick (false);
+		srcpick (true);
+	      }
+	  else
+	    {
+	      action = NoChange_action;
+	      pick (false);
+	      srcpick (false);
+	    }
+	}
     }
   else if (action == Reinstall_action)
     {
@@ -583,6 +582,12 @@ packagemeta::set_action (_actions action, packageversion const &default_version,
 	  pick (true);
 	  srcpick (false);
 	}
+      else
+      {
+        action = NoChange_action;
+        pick (false);
+        srcpick (false);
+      }
     }
   else if (action == Uninstall_action)
     {
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.