PERFORCE change 178131 for review

Garrett Cooper gcooper at FreeBSD.org
Wed May 12 01:45:12 UTC 2010


http://p4web.freebsd.org/@@178131?ac=10

Change 178131 by gcooper at starr-bastion on 2010/05/12 01:45:06

	       Fix indentation, because gavin noted that 8-space tabs are _actually_
	       hard tabs. Fix a testcase, and add a testcase for the predeinstall script.

Affected files ...

.. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/tools/regression/usr.sbin/pkg_install/create/testplan#6 edit
.. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/perform.c#18 edit

Differences ...

==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/tools/regression/usr.sbin/pkg_install/create/testplan#6 (text+ko) ====

@@ -47,9 +47,20 @@
 	- PF Criteria: Package will be installed, with the preinstall script
 		       being executed prior to install and the postinstall
 		       script being executed after the install. The deinstall
-		       will fail though because the deinstall scripts are
+		       will fail though because the postdeinstall scripts are
 		       missing.
 
+	*install scripts - missing predeinstall scripts:
+	- Type: Positive
+	- Setup: Create basic comments and description files. Create a series
+		 of scripts for testing *install states (preinstall,
+		 postinstall, predeinstall, and postdeinstall). Create package.
+	- Test: Install package. Delete predeinstall script. Delete package.
+	- PF Criteria: Package will be installed, with the preinstall script
+		       being executed prior to install and the postinstall
+		       script being executed after the install. The deinstall
+		       will fail because the predeinstall script is missing.
+
 	*install scripts - missing postdeinstall scripts:
 	- Type: Positive
 	- Setup: Create basic comments and description files. Create a series

==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/create/perform.c#18 (text+ko) ====

@@ -340,43 +340,43 @@
 {
 
 	/* XXX (gcooper): add acl and xattr support? */
-#define ADD_FILE(srcfile, destfile, archive_entry_open_flags)                 \
-	if (error == NULL) {                                                  \
-		if ((archive_entry_fd = open(srcfile,                         \
-		    archive_entry_open_flags)) == -1 ||                       \
-		    fstat(archive_entry_fd, sb) == -1) {                      \
-			error = strerror(errno);                              \
-		} else if ((archive_entry_map_addr = mmap(NULL,               \
-		    PROT_READ, sb->st_size, MAP_SHARED,                       \
-		    archive_entry_fd, 0)) == NULL) {                          \
-			error = strerror(errno);                              \
-		} else {                                                      \
-			if ((entry = archive_entry_new()) == NULL)            \
-				error = archive_error_string(archive);        \
-			else {                                                \
-				archive_entry_copy_stat(entry, sb);           \
+#define ADD_FILE(srcfile, destfile, archive_entry_open_flags)		      \
+	if (error == NULL) {						      \
+		if ((archive_entry_fd = open(srcfile,			      \
+		    archive_entry_open_flags)) == -1 ||			      \
+		    fstat(archive_entry_fd, sb) == -1) {		      \
+			error = strerror(errno);			      \
+		} else if ((archive_entry_map_addr = mmap(NULL,		      \
+		    PROT_READ, sb->st_size, MAP_SHARED,			      \
+		    archive_entry_fd, 0)) == NULL) {			      \
+			error = strerror(errno);			      \
+		} else {						      \
+			if ((entry = archive_entry_new()) == NULL)	      \
+				error = archive_error_string(archive);	      \
+			else {						      \
+				archive_entry_copy_stat(entry, sb);	      \
 				archive_entry_copy_pathname(entry, destfile); \
-				if (archive_write_header(archive,             \
-				    entry) != ARCHIVE_OK)                     \
+				if (archive_write_header(archive,	      \
+				    entry) != ARCHIVE_OK)		      \
 					error = archive_error_string(archive);\
-				else if (archive_write_data(archive,          \
-				    archive_entry_map_addr,                   \
-				    sb->st_size) != ARCHIVE_OK)               \
+				else if (archive_write_data(archive,	      \
+				    archive_entry_map_addr,		      \
+				    sb->st_size) != ARCHIVE_OK)		      \
 					error = archive_error_string(archive);\
-				(void) munmap(archive_entry_map_addr,         \
-				    sb->st_size);                             \
-				archive_entry_free(entry);                    \
-			}                                                     \
-		}                                                             \
-		if (0 <= archive_entry_fd)                                    \
-			close(archive_entry_fd);                              \
+				(void) munmap(archive_entry_map_addr,	      \
+				    sb->st_size);			      \
+				archive_entry_free(entry);		      \
+			}						      \
+		}							      \
+		if (0 <= archive_entry_fd)				      \
+			close(archive_entry_fd);			      \
 	}
 
 	PackingList p;
 	struct stat *sb;
 	struct archive *archive = NULL;
 	struct archive_entry *entry = NULL;
-        struct lafe_matching *match_patterns = NULL;
+	struct lafe_matching *match_patterns = NULL;
 	char *destbase = NULL;
 	char *destfile = NULL;
 	char *prefix = NULL;
@@ -406,10 +406,10 @@
 
 	archive_open_flags = O_WRONLY;
 
-        if (Regenerate == TRUE)
-                archive_open_flags |= O_TRUNC;
-        else
-                archive_open_flags |= O_CREAT;
+	if (Regenerate == TRUE)
+		archive_open_flags |= O_TRUNC;
+	else
+		archive_open_flags |= O_CREAT;
 
 	/* 
 	 * NOTE (gcooper): No sense in calloc'ing destfile or srcfile as the
@@ -435,19 +435,19 @@
 		error = archive_error_string(archive);
 	else {
 
-                /* 
-                 * XXX (gcooper): replace these bits with a proper callback
-                 * via archive(3) when the time rolls around.
-                 */
-                if (ExcludeFrom != NULL) {
-                        if (lafe_exclude_from_file(&match_patterns,
-                            ExcludeFrom) < 0)
-                                error = strerror(EINVAL);
-                }
+		/* 
+		 * XXX (gcooper): replace these bits with a proper callback
+		 * via archive(3) when the time rolls around.
+		 */
+		if (ExcludeFrom != NULL) {
+			if (lafe_exclude_from_file(&match_patterns,
+			    ExcludeFrom) < 0)
+				error = strerror(EINVAL);
+		}
 
-        }
+	}
 
-        if (error == NULL) { 
+	if (error == NULL) { 
 
 		switch(Zipper) {
 		case BZIP2:
@@ -542,7 +542,7 @@
 				    PATH_MAX)
 					error = strerror(ENAMETOOLONG);
 
-                        /* Same as above, if srcbase is NULL. */
+			/* Same as above, if srcbase is NULL. */
 			if (srcbase != NULL)
 				if (strlcat(srcfile, srcbase,
 				    PATH_MAX) > PATH_MAX)
@@ -553,9 +553,9 @@
 				    PATH_MAX)
 					error = strerror(ENAMETOOLONG);
 
-                        if (lafe_excluded(match_patterns, srcfile) == 0)
-        			ADD_FILE(srcfile, destfile,
-                                    archive_entry_open_flags);
+			if (lafe_excluded(match_patterns, destfile) == 0)
+	 			ADD_FILE(srcfile, destfile,
+				    archive_entry_open_flags);
 
 			break;
 
@@ -569,13 +569,13 @@
 				 * whitespace.
 				 */
 				assert(prefix != NULL);
-                                
-                                /* 
-                                 * NOTE (gcooper): strcpy is safe here so long
-                                 * as the buffers are of equal size, and also
-                                 * because the value has been sanitized below
-                                 * and because of the assert above.
-                                 */
+
+				/* 
+				 * NOTE (gcooper): strcpy is safe here so long
+				 * as the buffers are of equal size, and also
+				 * because the value has been sanitized below
+				 * and because of the assert above.
+				 */
 				strcpy(destbase, prefix);
 
 				/* Reset srcbase */
@@ -584,8 +584,8 @@
 					if (strlcpy(srcbase, BaseDir,
 					    PATH_MAX) > PATH_MAX)
 						error = strerror(ENAMETOOLONG);
-                                } 
-                                if (strlcpy(srcbase, prefix, PATH_MAX) >
+				} 
+				if (strlcpy(srcbase, prefix, PATH_MAX) >
 				    PATH_MAX)
 					error = strerror(ENAMETOOLONG);
 
@@ -599,24 +599,26 @@
 				/* First @cwd -- wewt! */
 				if (prefix == NULL) {
 
-                                        if (strlen(p->name) > PATH_MAX)
-                                                error = strerror(ENAMETOOLONG);
-                                        else {
+					if (strlen(p->name) > PATH_MAX)
+						error = strerror(ENAMETOOLONG);
+					else {
+
+						prefix = p->name;
 
-                                                prefix = p->name;
+					 	/*
+						 * Tack BaseDir on the front if
+						 * defined and this is the first
+						 * run.
+						 */
+						if (BaseDir != NULL) {
+							if (strlcpy(srcbase,
+							    BaseDir, PATH_MAX) >
+							    PATH_MAX)
+								error = strerror(ENAMETOOLONG);
+						} else
+							srcbase[0] = '\0';
 
-	        			 	/*
-		        			 * Tack BaseDir on the front if
-			        		 * defined and this is the first run.
-				        	 */
-					        if (BaseDir != NULL) {
-						        if (strlcpy(srcbase,
-                                                            BaseDir, PATH_MAX) >
-                                                            PATH_MAX)
-	        						error = strerror(ENAMETOOLONG);
-		        			} else
-			        			srcbase[0] = '\0';
-                                        }
+					}
 
 				}
 
@@ -694,11 +696,11 @@
 			warn("%s: failed to remove incomplete package - '%s'",
 			    __func__, tball);
 	}
-        free(destbase);
-        free(destfile);
-        free(srcbase);
-        free(srcfile);
-        free(destfile);
+	free(destbase);
+	free(destfile);
+	free(srcbase);
+	free(srcfile);
+	free(destfile);
 
 }
 


More information about the p4-projects mailing list