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]

Re: [PATCH 4/4 setup] package re-/de-installation from CLI


>From 8d0ee8f914e0af9b6af90909e95a0cd6c3f60215 Mon Sep 17 00:00:00 2001
From: Achim Gratz <Stromeko@Stromeko.DE>
Date: Wed, 24 Jul 2013 22:14:19 +0200
Subject: [PATCH 4/4] Implement deletion of orphaned packages and upgrading
 while installing/removing

	* choose.cc (UpgradeAlsoOption): Add new CLI option
	  -g/--upgrade-also.
	  (CleanOrphansOption): Add new CLI option -o/--delete-orphans.
	  (OnInit): Implement -g/--upgrade-also, considers all installed
	  packages as candidates for upgrades (the default when no CLI
	  package or category options have been given) also when manual
	  additions or removals are requested at the same time.
	  Implement -o/--delete-orphans, considers installed packages
	  that do not exist anymore in the package repositories as
	  candidates for deletion.
---
 choose.cc | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/choose.cc b/choose.cc
index fd75790..0e05796 100644
--- a/choose.cc
+++ b/choose.cc
@@ -61,6 +61,10 @@ static const char *cvsid =
 
 #include "UserSettings.h"
 
+#include "getopt++/BoolOption.h"
+static BoolOption UpgradeAlsoOption (false, 'g', "upgrade-also", "also upgrade installed packages");
+static BoolOption CleanOrphansOption (false, 'o', "delete-orphans", "remove orphaned packages");
+
 using namespace std;
 
 extern ThreeBarProgressPage Progress;
@@ -248,8 +252,8 @@ ChooserPage::OnInit ()
       bool deleted   = pkg.isManuallyDeleted();
       bool basemisc  = (pkg.categories.find ("Base") != pkg.categories.end ()
 		     || pkg.categories.find ("Misc") != pkg.categories.end ());
-      bool current   = pkg.curr;
-      bool upgrade   =  wanted  || (!pkg.installed && basemisc) || !hasManualSelections;
+      bool current   = pkg.curr || CleanOrphansOption;
+      bool upgrade   =  wanted  || (!pkg.installed && basemisc) || UpgradeAlsoOption || !hasManualSelections;
       bool install   =   wanted  && !deleted && !pkg.installed;
       bool reinstall =  (wanted  || basemisc ) && deleted;
       bool uninstall = !(wanted  || basemisc ) && deleted;
-- 
1.8.3.1

Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf Blofeld V1.15B11:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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