public inbox for cygwin-apps-cvs@sourceware.org
help / color / mirror / Atom feed
* [setup - the official Cygwin setup program] branch master, updated. release_2.891-8-g4a6f824
@ 2018-06-10 20:57 jturney
  0 siblings, 0 replies; only message in thread
From: jturney @ 2018-06-10 20:57 UTC (permalink / raw)
  To: cygwin-apps-cvs




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

commit 4a6f8247d6bb71812aa564c4714fb58b5f61d46f
Author: Ken Brown <kbrown@cornell.edu>
Date:   Thu Jun 7 13:37:24 2018 -0400

    Fix detection of automatically added packages
    
    In the "confirm" dialog, report a package as automatically added for install
    if the version being installed is different from the version requested by
    the user.  This can happen if the global update mode is "Keep" but a package
    needs to be updated because of a versioned dependency.

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

commit 9ca5efb304540f2dfaa7a05fc4a2bf4eed70b48c
Author: Ken Brown <kbrown@cornell.edu>
Date:   Thu Jun 7 13:37:23 2018 -0400

    Improve the preparation of the package database
    
    Introduce a new function packagedb::noChanges() to set the database to a "no
    changes requested" state.  Call it the first time the chooser page is
    activated, before calling ChooserPage::applyCommandLinePackageSelection().
    
    Also use it to simplify the code in two places.
    
    Remove code from ChooserPage::changeTrust() that was making changes to the
    database after ChooserPage::applyCommandLinePackageSelection() had already
    been called.

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

commit d6e95b2561e3f91455e15db757bf9a028e2364f9
Author: Ken Brown <kbrown@cornell.edu>
Date:   Tue Mar 27 13:56:27 2018 -0400

    Allow command-line uninstallation of specific orphaned packages
    
    Also change the implementation of the "--delete-orphans" option to use
    the same definition of "orphaned" that's used elsewhere in the code.

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

commit 463042fea8e3d339f88fae4e619d236d5f5a63d7
Author: Ken Brown <kbrown@cornell.edu>
Date:   Sat Mar 17 10:59:53 2018 -0400

    Make sure that the IniDBBuilderPackage destructor is called when needed
    
    The IniDBBuilderPackage destructor contains code that is intended to be run
    after each setup.ini file is processed.  But the IniDBBuilderPackage
    variables in do_local_ini() and do_remote_ini were declared outside the loop
    that processed the files.  Move the declaration inside the loop so that the
    destructor is called after each iteration.


Diff:
---
 choose.cc     |   38 ++++++++++++--------------------------
 confirm.cc    |    2 +-
 ini.cc        |    8 ++++----
 libsolv.cc    |   11 +++--------
 package_db.cc |   12 ++++++++++++
 package_db.h  |    2 ++
 6 files changed, 34 insertions(+), 39 deletions(-)

diff --git a/choose.cc b/choose.cc
index 5a4d3ad..51d2fb6 100644
--- a/choose.cc
+++ b/choose.cc
@@ -295,13 +295,13 @@ ChooserPage::applyCommandLinePackageSelection()
       packagemeta &pkg = *(i->second);
       bool wanted    = pkg.isManuallyWanted();
       bool deleted   = pkg.isManuallyDeleted();
-      bool basemisc  = (pkg.categories.find ("Base") != pkg.categories.end ()
-		     || pkg.categories.find ("Orphaned") != pkg.categories.end ());
-      bool upgrade   = wanted || (!pkg.installed && basemisc);
+      bool base      = pkg.categories.find ("Base") != pkg.categories.end ();
+      bool orphaned  = pkg.categories.find ("Orphaned") != pkg.categories.end ();
+      bool upgrade   = wanted || (!pkg.installed && base);
       bool install   = wanted  && !deleted && !pkg.installed;
-      bool reinstall = (wanted  || basemisc) && deleted;
-      bool uninstall = (!(wanted  || basemisc) && (deleted || PruneInstallOption))
-		     || (!pkg.curr && CleanOrphansOption);
+      bool reinstall = (wanted  || base) && deleted;
+      bool uninstall = (!(wanted  || base) && (deleted || PruneInstallOption))
+		     || (orphaned && CleanOrphansOption);
       if (install)
 	pkg.set_action (packagemeta::Install_action, pkg.curr);
       else if (reinstall)
@@ -329,6 +329,7 @@ ChooserPage::OnActivate()
     {
       // Do things which should only happen once, but rely on packagedb being
       // ready to use, so OnInit() is too early
+      db.noChanges();
       applyCommandLinePackageSelection();
       initialUpdateState();
 
@@ -392,13 +393,7 @@ ChooserPage::keepClicked()
 {
   update_mode_id = IDC_CHOOSE_KEEP;
   packagedb db;
-  for (packagedb::packagecollection::iterator i = db.packages.begin ();
-        i != db.packages.end (); ++i)
-    {
-      packagemeta & pkg = *(i->second);
-      pkg.desired = pkg.installed;
-      pkg.pick(false);
-    }
+  db.noChanges();
   chooser->refresh();
 }
 
@@ -431,20 +426,11 @@ ChooserPage::changeTrust(int button, bool test, bool initial)
 
   // usually we want to apply the solver to an empty task list to get the list
   // of packages to upgrade (if any)
+  // but initially we want a task list with any package changes caused by
+  // command line options
   if (initial)
-    {
-      // but initially we want a task list with any package changes caused by
-      // command line options
-      // (also note the installed version to avoid generating spurious taskKeep
-      // or taskSkip tasks)
-      for (packagedb::packagecollection::iterator p = db.packages.begin ();
-           p != db.packages.end (); ++p)
-        {
-          packagemeta *pkg = p->second;
-          pkg->default_version = pkg->installed;
-        }
-      q.setTasks();
-    }
+    q.setTasks();
+
   db.defaultTrust(q, mode, test);
 
   // configure PickView so 'test' or 'curr' version is chosen when an
diff --git a/confirm.cc b/confirm.cc
index cd749c0..d0a8420 100644
--- a/confirm.cc
+++ b/confirm.cc
@@ -109,7 +109,7 @@ ConfirmPage::OnActivate()
             line += i->version.Canonical_version();
             if (i->version.Type() == package_source)
               line += " (source)";
-            else if (pkg && !pkg->desired)
+            else if (pkg && pkg->desired != pv)
               line += " (automatically added)";
             line += "\r\n";
             install.push_back (line);
diff --git a/ini.cc b/ini.cc
index d807ed6..7afeba2 100644
--- a/ini.cc
+++ b/ini.cc
@@ -209,13 +209,13 @@ static bool
 do_local_ini (HWND owner)
 {
   bool ini_error = false;
-  GuiParseFeedback myFeedback;
-  IniDBBuilderPackage aBuilder (myFeedback);
   io_stream *ini_file, *ini_sig_file;
   // iterate over all setup files found in do_from_local_dir
   for (IniList::const_iterator n = found_ini_list.begin ();
        n != found_ini_list.end (); ++n)
     {
+      GuiParseFeedback myFeedback;
+      IniDBBuilderPackage aBuilder (myFeedback);
       bool sig_fail = false;
       std::string current_ini_ext, current_ini_name, current_ini_sig_name;
 
@@ -268,8 +268,6 @@ static bool
 do_remote_ini (HWND owner)
 {
   bool ini_error = false;
-  GuiParseFeedback myFeedback;
-  IniDBBuilderPackage aBuilder (myFeedback);
   io_stream *ini_file = NULL, *ini_sig_file;
 
   /* FIXME: Get rid of this io_stream pointer travesty.  The need to
@@ -279,6 +277,8 @@ do_remote_ini (HWND owner)
   for (SiteList::const_iterator n = site_list.begin ();
        n != site_list.end (); ++n)
     {
+      GuiParseFeedback myFeedback;
+      IniDBBuilderPackage aBuilder (myFeedback);
       bool sig_fail = false;
       std::string current_ini_ext, current_ini_name, current_ini_sig_name;
       // iterate over known extensions for setup
diff --git a/libsolv.cc b/libsolv.cc
index 2eb04e2..11394a2 100644
--- a/libsolv.cc
+++ b/libsolv.cc
@@ -658,14 +658,9 @@ void
 SolverSolution::trans2db() const
 {
   packagedb db;
-  // First reset all packages to the "no change" state
-  for (packagedb::packagecollection::iterator i = db.packages.begin();
-       i != db.packages.end(); i++)
-    {
-      packagemeta *pkg = i->second;
-      pkg->desired = pkg->default_version = pkg->installed;
-      pkg->pick(false);
-    }
+  // First reset all packages to the "no changes" state
+  db.noChanges ();
+
   // Now make changes according to trans.  transErase requires some
   // care; it could either be a "plain" uninstall, or it could be
   // paired with a transInstall for an upgrade/downgrade or reinstall.
diff --git a/package_db.cc b/package_db.cc
index 072b419..2bbe3b1 100644
--- a/package_db.cc
+++ b/package_db.cc
@@ -752,3 +752,15 @@ packagedb::prep()
 
   prepped = true;
 }
+
+void
+packagedb::noChanges ()
+{
+  for (packagecollection::iterator i = packages.begin();
+       i != packages.end(); i++)
+    {
+      packagemeta *pkg = i->second;
+      pkg->desired = pkg->default_version = pkg->installed;
+      pkg->pick(false);
+    }
+}
diff --git a/package_db.h b/package_db.h
index e500e4b..da73171 100644
--- a/package_db.h
+++ b/package_db.h
@@ -68,6 +68,8 @@ public:
   /* 0 on success */
   int flush ();
   void prep();
+  /* Set the database to a "no changes requested" state.  */
+  void noChanges ();
 
   packagemeta * findBinary (PackageSpecification const &) const;
   packageversion findBinaryVersion (PackageSpecification const &) const;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-06-10 20:57 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-10 20:57 [setup - the official Cygwin setup program] branch master, updated. release_2.891-8-g4a6f824 jturney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).