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 patch - simplistic --include-source for download/installed pkgs


For easier evaluation I've pulled this patch to current CVS head.  I
also did some whitespace changes and slightly modified the Changelog.

>From 8f7b091fd2f136da52099fcbdd89ad224a433693 Mon Sep 17 00:00:00 2001
From: David Hoke <d_hoke@hotmail.com>
Date: Wed, 26 Jun 2013 19:13:48 +0000
Subject: [PATCH] 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.
---
 download.cc | 6 ++++--
 install.cc  | 9 +++++++--
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/download.cc b/download.cc
index fa210f9..0af6161 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)
 {
@@ -222,7 +224,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<packagesource>::iterator i =
 		       sourceversion.sources ()->begin();
@@ -261,7 +263,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<packagesource>::iterator i =
    		   sourceversion.sources ()->begin();
diff --git a/install.cc b/install.cc
index d63ad62..09d1f45 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.");
@@ -772,8 +773,9 @@ do_install_thread (HINSTANCE h, HWND owner)
       }
     }
 
-    if (pkg.desired.sourcePackage ().picked())
+    if (pkg.desired.sourcePackage ().picked() || IncludeSource)
     {
+      bool skiprequested = false ;
       try
       {
         md5_one (*pkg.desired.sourcePackage ().source ());
@@ -781,9 +783,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;
-- 
1.8.3.1


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

SD adaptation for Waldorf microQ V2.22R2:
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]