From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 110139 invoked by alias); 1 Aug 2015 15:51:18 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 110120 invoked by uid 10076); 1 Aug 2015 15:51:18 -0000 Date: Sat, 01 Aug 2015 15:51:00 -0000 Message-ID: <20150801155118.110091.qmail@sourceware.org> From: gratz@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [setup] branch master, updated. release_2.871-10-gec8ad64 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: e993e2449417ab6f1c559b3fedc239bdb1e0a485 X-Git-Newrev: ec8ad645c451dd21e72f64d0fdc9f2141f75a8c6 X-SW-Source: 2015-q3/txt/msg00002.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-setup.git;h=ec8ad645c451dd21e72f64d0fdc9f2141f75a8c6 commit ec8ad645c451dd21e72f64d0fdc9f2141f75a8c6 Author: David Hoke Date: Wed Jun 26 19:13:48 2013 +0000 Implement -I/--include-source option to download and install sources automatically * download.cc (IncludeSource): New command line switch -I/--include-source. Automatically download sources associated with any binary package being downloaded when IncludeSource is true. * install.cc (do_install_thread): Automatically install sources associated with any binary package being installed when IncludeSource is true. https://sourceware.org/git/gitweb.cgi?p=cygwin-setup.git;h=2e6cf467b2f59bcab4796bf1126944c81244e930 commit 2e6cf467b2f59bcab4796bf1126944c81244e930 Author: Achim Gratz Date: Sat May 9 20:25:43 2015 +0200 Implement -Y/--prune-install option to bring an installation into a known state * choose.cc (PruneInstallOption): New option -Y/--prune-install. (OnInit): Implement PruneInstallOption to downgrade packages installed with a higher version and delete all packages not explicitly requested to be installed. This brings an existing installation to the same state a fresh installation would create. Put the handling for upgrade==true into a separate else branch. Diff: --- ChangeLog | 19 +++++++++++++++++++ choose.cc | 11 +++++++---- download.cc | 6 ++++-- install.cc | 9 +++++++-- 4 files changed, 37 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4471acb..7d14458 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,22 @@ +2015-08-01 David Hoke + + * download.cc (IncludeSource): New command line switch + -I/--include-source. Automatically download sources + associated with any binary package being downloaded when + IncludeSource is true. + * install.cc (do_install_thread): Automatically install + sources associated with any binary package being installed + when IncludeSource is true. + +2015-08-01 Achim Gratz + + * choose.cc (PruneInstallOption): New option -Y/--prune-install. + (OnInit): Implement PruneInstallOption to downgrade packages + installed with a higher version and delete all packages not + explicitly requested to be installed. This brings an existing + installation to the same state a fresh installation would create. + Put the handling for upgrade==true into a separate else branch. + 2015-07-26 Achim Gratz * iniparse.yy (singleitem): Fix a copy-and-paste bug, use diff --git a/choose.cc b/choose.cc index ec42c94..19c7e4d 100644 --- a/choose.cc +++ b/choose.cc @@ -64,6 +64,7 @@ static const char *cvsid = #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"); +static BoolOption PruneInstallOption (false, 'Y', "prune-install", "prune the installation to only the requested packages"); static BoolOption MirrorOption (false, 'm', "mirror-mode", "Skip availability check when installing from local directory (requires local directory to be clean mirror!)"); using namespace std; @@ -257,7 +258,7 @@ ChooserPage::OnInit () || UpgradeAlsoOption || !hasManualSelections; bool install = wanted && !deleted && !pkg.installed; bool reinstall = (wanted || basemisc) && deleted; - bool uninstall = (!(wanted || basemisc) && deleted) + bool uninstall = (!(wanted || basemisc) && (deleted || PruneInstallOption)) || (!pkg.curr && CleanOrphansOption); if (install) pkg.set_action (packagemeta::Install_action, pkg.curr); @@ -265,10 +266,12 @@ ChooserPage::OnInit () pkg.set_action (packagemeta::Reinstall_action, pkg.curr); else if (uninstall) pkg.set_action (packagemeta::Uninstall_action, packageversion ()); + else if (PruneInstallOption) + pkg.set_action (packagemeta::Default_action, pkg.curr); + else if (upgrade) + pkg.set_action (packagemeta::Default_action, pkg.trustp(true, TRUST_UNKNOWN)); else - pkg.set_action (packagemeta::Default_action, - upgrade ? pkg.trustp (true, TRUST_UNKNOWN) - : pkg.installed); + pkg.set_action (packagemeta::Default_action, pkg.installed); } ClearBusy (); diff --git a/download.cc b/download.cc index 011353f..a5aebe0 100644 --- a/download.cc +++ b/download.cc @@ -56,6 +56,8 @@ using namespace std; extern ThreeBarProgressPage Progress; +BoolOption IncludeSource (false, 'I', "include-source", "Automatically include source download"); + static bool validateCachedPackage (const std::string& fullname, packagesource & pkgsource) { @@ -228,7 +230,7 @@ do_download_thread (HINSTANCE h, HWND owner) if (!check_for_cached (*i)) total_download_bytes += i->size; } - if (sourceversion.picked ()) + if (sourceversion.picked () || IncludeSource) { for (vector::iterator i = sourceversion.sources ()->begin(); @@ -267,7 +269,7 @@ do_download_thread (HINSTANCE h, HWND owner) i != version.sources ()->end(); ++i) e += download_one (*i, owner); } - if (sourceversion && sourceversion.picked()) + if (sourceversion && (sourceversion.picked() || IncludeSource)) { for (vector::iterator i = sourceversion.sources ()->begin(); diff --git a/install.cc b/install.cc index 715d5fe..4274715 100644 --- a/install.cc +++ b/install.cc @@ -73,6 +73,7 @@ static long long int total_bytes = 0; static long long int total_bytes_sofar = 0; static int package_bytes = 0; +extern BoolOption IncludeSource; static BoolOption NoReplaceOnReboot (false, 'r', "no-replaceonreboot", "Disable replacing in-use files on next " "reboot."); @@ -782,8 +783,9 @@ do_install_thread (HINSTANCE h, HWND owner) } } - if (pkg.desired.sourcePackage ().picked()) + if (pkg.desired.sourcePackage ().picked() || IncludeSource) { + bool skiprequested = false ; try { chksum_one (*pkg.desired.sourcePackage ().source ()); @@ -791,9 +793,12 @@ do_install_thread (HINSTANCE h, HWND owner) catch (Exception *e) { if (yesno (owner, IDS_SKIP_PACKAGE, e->what()) == IDYES) + { + skiprequested = true ; //(err occurred,) skip pkg desired pkg.desired.sourcePackage ().pick (false, &pkg); + } } - if (pkg.desired.sourcePackage().picked()) + if (pkg.desired.sourcePackage().picked() || (IncludeSource && !skiprequested)) { md5sum_total_bytes_sofar += pkg.desired.sourcePackage ().source()->size; total_bytes += pkg.desired.sourcePackage ().source()->size;