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: setup : request


On Sat, 2015-07-04 at 11:25 +0200, Marco Atzeri wrote:
> Achim,
> as you are playing with setup,
> can you add a switch that allow to commute between:
> 
> old     behaviour : current or test is default installed
> current behaviour : if installed is higher than current do nothing
> 
> The new behaviour is usually fine, but going back and forth
> between all new perl test stuff is a pain when I need to remove
> the 5.22 stuff.

On Fedora there is "yum update" and "yum distro-sync", which are
distinct commands corresponding to each of these behaviours.  So my
thought was that we could add a fourth "Sync" option to the
Keep/Curr/Exp radio buttons.  I've attached a barely tested *draft*
patch along these lines, but it almost certainly needs more work.

--
Yaakov

diff --git a/IniDBBuilderPackage.cc b/IniDBBuilderPackage.cc
index 7ee2af4..d7a4237 100644
--- a/IniDBBuilderPackage.cc
+++ b/IniDBBuilderPackage.cc
@@ -568,6 +568,7 @@ IniDBBuilderPackage::add_correct_version()
   switch (trust)
   {
     case TRUST_CURR:
+    case TRUST_SYNC:
       v = &(cp->curr);
     break;
     case TRUST_PREV:
diff --git a/PackageTrust.h b/PackageTrust.h
index 3e6801d..97f3a5f 100644
--- a/PackageTrust.h
+++ b/PackageTrust.h
@@ -23,6 +23,7 @@ typedef enum
   TRUST_PREV,
   TRUST_CURR,
   TRUST_TEST,
+  TRUST_SYNC,
   NTRUST
 }
 trusts;
diff --git a/choose.cc b/choose.cc
index ec42c94..1d318b5 100644
--- a/choose.cc
+++ b/choose.cc
@@ -81,6 +81,7 @@ static ControlAdjuster::ControlInfo ChooserControlsInfo[] = {
   {IDC_CHOOSE_KEEP, 		CP_RIGHT,   CP_TOP},
   {IDC_CHOOSE_CURR, 		CP_RIGHT,   CP_TOP},
   {IDC_CHOOSE_EXP, 		CP_RIGHT,   CP_TOP},
+  {IDC_CHOOSE_SYNC, 		CP_RIGHT,   CP_TOP},
   {IDC_CHOOSE_VIEW, 		CP_RIGHT,   CP_TOP},
   {IDC_LISTVIEW_POS, 		CP_RIGHT,   CP_TOP},
   {IDC_CHOOSE_VIEWCAPTION,	CP_RIGHT,   CP_TOP},
@@ -154,7 +155,7 @@ ChooserPage::createListview ()
 	 GetLastError () << endLog;
 
   /* FIXME: do we need to init the desired fields ? */
-  static int ta[] = { IDC_CHOOSE_KEEP, IDC_CHOOSE_CURR, IDC_CHOOSE_EXP, 0 };
+  static int ta[] = { IDC_CHOOSE_KEEP, IDC_CHOOSE_CURR, IDC_CHOOSE_EXP, IDC_CHOOSE_SYNC, 0 };
   rbset (GetHWND (), ta, IDC_CHOOSE_CURR);
   ClearBusy ();
 }
@@ -282,6 +283,7 @@ ChooserPage::OnInit ()
   AddTooltip (IDC_CHOOSE_KEEP, IDS_TRUSTKEEP_TOOLTIP);
   AddTooltip (IDC_CHOOSE_CURR, IDS_TRUSTCURR_TOOLTIP);
   AddTooltip (IDC_CHOOSE_EXP, IDS_TRUSTEXP_TOOLTIP);
+  AddTooltip (IDC_CHOOSE_SYNC, IDS_TRUSTSYNC_TOOLTIP);
   AddTooltip (IDC_CHOOSE_VIEW, IDS_VIEWBUTTON_TOOLTIP);
   AddTooltip (IDC_CHOOSE_HIDE, IDS_HIDEOBS_TOOLTIP);
   AddTooltip (IDC_CHOOSE_SEARCH_EDIT, IDS_SEARCH_TOOLTIP);
@@ -414,6 +416,11 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
         changeTrust (TRUST_TEST);
       break;
 
+    case IDC_CHOOSE_SYNC:
+      if (IsButtonChecked (id))
+        changeTrust (TRUST_SYNC);
+      break;
+
     case IDC_CHOOSE_VIEW:
       chooser->cycleViewMode ();
       if (!SetDlgItemText
diff --git a/package_meta.h b/package_meta.h
index b24d4fc..ccb64e6 100644
--- a/package_meta.h
+++ b/package_meta.h
@@ -101,8 +101,10 @@ public:
        than "curr".  Rather than pulling the user back to "curr", we install
        "test" if a "test" version is available and the version number is higher,
        or we stick to "installed" if not.  This reflects the behaviour of
-       `yum update' on Fedora. */
-    if (_default && curr && installed
+       `yum update' on Fedora.
+       If TRUST_SYNC is chosen, then we want to pull the user back to "curr".
+       This reflects the behaviour of `yum distro-sync' on Fedora. */
+    if (_default && curr && installed && t != TRUST_SYNC
 	&& packageversion::compareVersions (curr, installed) < 0)
       {
 	if (exp && packageversion::compareVersions (installed, exp) < 0)
diff --git a/res.rc b/res.rc
index 5013b31..0b574db 100644
--- a/res.rc
+++ b/res.rc
@@ -316,7 +316,8 @@ END
 #define SETUP_VIEWCAP_X		(SETUP_STANDARD_DIALOG_W - SETUP_VIEWCAP_W - 7)
 #define SETUP_VIEW_W		(26)
 #define SETUP_VIEW_X		(SETUP_VIEWCAP_X - SETUP_VIEW_W - 5)
-#define SETUP_EXP_X		(SETUP_VIEW_X - SETUP_KPCE_W - 5)
+#define SETUP_SYNC_X		(SETUP_VIEW_X - SETUP_KPCE_W - 5)
+#define SETUP_EXP_X		(SETUP_SYNC_X - SETUP_KPCE_W - 5)
 #define SETUP_CURR_X		(SETUP_EXP_X - SETUP_KPCE_W - 5)
 #define SETUP_KEEP_X		(SETUP_CURR_X - SETUP_KPCE_W - 5)
 
@@ -346,6 +347,8 @@ BEGIN
                     SETUP_CURR_X, 30, SETUP_KPCE_W, 14
     CONTROL         "E&xp", IDC_CHOOSE_EXP, "Button", BS_AUTORADIOBUTTON,
                     SETUP_EXP_X, 30, SETUP_KPCE_W, 14
+    CONTROL         "S&ync", IDC_CHOOSE_SYNC, "Button", BS_AUTORADIOBUTTON,
+                    SETUP_SYNC_X, 30, SETUP_KPCE_W, 14
     PUSHBUTTON      "&View", IDC_CHOOSE_VIEW, SETUP_VIEW_X, 30, SETUP_VIEW_W,
                     14, WS_GROUP
     CONTROL         "", IDC_HEADSEPARATOR, "Static", SS_BLACKFRAME | SS_SUNKEN,
@@ -531,10 +534,12 @@ BEGIN
     IDS_TRUSTKEEP_TOOLTIP   "Sets all packages to their currently installed "
        "version.  This is equivalent to telling setup not to make any "
        "changes to any package."
-    IDS_TRUSTCURR_TOOLTIP   "Globally select the version that is currently "
-       "considered the most stable. (RECOMMENDED)"
+    IDS_TRUSTCURR_TOOLTIP   "Globally select the most stable version unless it "
+       "is older than the currently installed version. (RECOMMENDED)"
     IDS_TRUSTEXP_TOOLTIP    "Globally select the most recent version, even if "
        "that version is considered Experimental or for test use by the maintainer."
+    IDS_TRUSTSYNC_TOOLTIP   "Globally select the most stable version, even if "
+       "that version is older than the currently installed version."
     IDS_VIEWBUTTON_TOOLTIP  "Cycles the package view.  This determines "
        "which packages are shown in the chooser below.\r\n"
        "\r\n"
diff --git a/resource.h b/resource.h
index 48f03ab..125eb4f 100644
--- a/resource.h
+++ b/resource.h
@@ -26,6 +26,7 @@
 #define IDS_UNCAUGHT_EXCEPTION_WITH_ERRNO 123
 #define IDS_SKIP_PACKAGE                  124
 #define IDS_TRUSTKEEP_TOOLTIP             125
+#define IDS_TRUSTSYNC_TOOLTIP             126
 #define IDS_TRUSTCURR_TOOLTIP             127
 #define IDS_TRUSTEXP_TOOLTIP              128
 #define IDS_VIEWBUTTON_TOOLTIP            129
@@ -119,6 +120,7 @@
 #define IDC_CHOOSE_VIEW                   531
 #define IDC_CHOOSE_EXP                    532
 #define IDC_CHOOSE_CURR                   533
+#define IDC_CHOOSE_SYNC                   534
 #define IDC_CHOOSE_LIST                   535
 #define IDC_INS_ACTION                    536
 #define IDC_ROOT_DESKTOP                  537

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