Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Feb 2020 16:41:16 +0000 (UTC)
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r358291 - head/usr.sbin/config
Message-ID:  <202002241641.01OGfGKt032848@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: imp
Date: Mon Feb 24 16:41:16 2020
New Revision: 358291
URL: https://svnweb.freebsd.org/changeset/base/358291

Log:
  Create ../compile
  
  Give up the battle to keep extra files in $MACHINE/compile to keep the file in
  the tree. Instead, create CDIR (usually ../compile) if it doesn't exist when
  we're using a default build location (eg, not using -d). If it does, we do
  nothing. This only affects people that do old-school builds, but it's bit me a
  dozen times since last summer so time to fix the bug.

Modified:
  head/usr.sbin/config/main.c

Modified: head/usr.sbin/config/main.c
==============================================================================
--- head/usr.sbin/config/main.c	Mon Feb 24 16:25:11 2020	(r358290)
+++ head/usr.sbin/config/main.c	Mon Feb 24 16:41:16 2020	(r358291)
@@ -116,6 +116,7 @@ main(int argc, char **argv)
 	char *kernfile;
 	struct includepath* ipath;
 	int printmachine;
+	bool cust_dest = false;
 
 	printmachine = 0;
 	kernfile = NULL;
@@ -140,6 +141,7 @@ main(int argc, char **argv)
 				strlcpy(destdir, optarg, sizeof(destdir));
 			else
 				errx(EXIT_FAILURE, "directory already set");
+			cust_dest = true;
 			break;
 		case 'g':
 			debugging++;
@@ -232,7 +234,14 @@ main(int argc, char **argv)
 		exit(0);
 	}
 
-	/* Make compile directory */
+	/*
+	 * Make CDIR directory, if doing a default destination. Some version
+	 * control systems delete empty directories and this seemlessly copes.
+	 */
+	if (!cust_dest && stat(CDIR, &buf))
+		if (mkdir(CDIR, 0777))
+			err(2, "%s", CDIR);
+	/* Create the compile directory */
 	p = path((char *)NULL);
 	if (stat(p, &buf)) {
 		if (mkdir(p, 0777))



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202002241641.01OGfGKt032848>