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]

[PATCH] setup -e, --separate-src-dirs option


Many -src packages install files in /usr/src which have no PACKAGE[-VERSION] prefix or substring in file name. This makes it difficult to maintain or cleanup larger /usr/src directories.

The attached experimental patch for setup.exe adds option -e, --separate-src-dirs. If specified, each PACKAGE-VERSION-src.tar.bz2 is installed below /usr/src/PACKAGE-VERSION instead.

Christian

2011-12-14  Christian Franke  <franke@computer.org>

	* install.cc: New option variable SeparateSrcDirs.
	(installOne): Append PACKAGE-VERSION/ to /usr/src/
	if -e, --separate-src-dirs is set.

diff --git a/install.cc b/install.cc
index 5e3331a..638d67a 100644
--- a/install.cc
+++ b/install.cc
@@ -75,6 +75,9 @@ static int package_bytes = 0;
 static BoolOption NoReplaceOnReboot (false, 'r', "no-replaceonreboot",
 				     "Disable replacing in-use files on next "
 				     "reboot.");
+static BoolOption SeparateSrcDirs (false, 'e', "separate-src-dirs",
+				   "Install source packages in separate "
+				   "directories /usr/src/PACKAGE-VERSION.");
 
 struct std_dirs_t {
   const char *name;
@@ -740,9 +743,26 @@ do_install_thread (HINSTANCE h, HWND owner)
        i != sourceinstall_q.end (); ++i)
   {
     packagemeta & pkg = **i;
+
+    std::string prefix = "/usr/src/";
+    if (SeparateSrcDirs)
+      {
+	/* Install PACKAGE-VERSION-src.tar.bz2 contents in directory
+	   /usr/src/PACKAGE-VERSION .  */
+	const char *base = pkg.desired.sourcePackage().source()->Base();
+	if (base)
+	  {
+	    int len = strlen (base);
+	    if (len > 4 && ! strcmp (base + len - 4, "-src"))
+	      len -= 4;
+	    prefix.append(base, len);
+	    prefix += '/';
+	  }
+      }
+
     myInstaller.installOne (pkg, pkg.desired.sourcePackage(),
                             *pkg.desired.sourcePackage().source(),
-                            "cygfile://", "/usr/src/", owner);
+                            "cygfile://", prefix, owner);
   }
 
   if (rebootneeded)

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