PERFORCE change 185174 for review

David Forsythe dforsyth at FreeBSD.org
Thu Oct 28 06:57:39 UTC 2010


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

Change 185174 by dforsyth at skunk on 2010/10/28 06:57:35

	Do just enough to get pkg_delete to build.  Also, last commit was spaces to
	tabs, not tabs to spaces.

Affected files ...

.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#7 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#8 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#3 edit
.. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#3 edit
.. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#4 edit

Differences ...

==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#7 (text+ko) ====

@@ -16,7 +16,8 @@
 	freebsd_database_directorydb.c \
 	util.c \
 	file.c \
-	depend.c
+	depend.c \
+	reqby.c
 
 
 CFLAGS+=  -std=c99

==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#8 (text+ko) ====

@@ -173,3 +173,11 @@
 	return (pkg);
 }
 
+int
+pkg_db_remove(struct pkg_db *db, struct pkg *pkg)
+{
+	(void)db;
+	(void)pkg;
+	return (PKG_NOT_OK);
+}
+

==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#3 (text+ko) ====

@@ -1,6 +1,8 @@
+#include <assert.h>
 #include <stdlib.h>
 #include <string.h>
 
+#include "pkg.h"
 #include "reqby.h"
 
 struct pkg_reqby *

==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#3 (text+ko) ====

@@ -21,4 +21,17 @@
 
 #include "pkg_types.h"
 
+struct pkg_reqby		*pkg_reqby_alloc(void);
+
+void				 pkg_reqby_release(struct pkg_reqby *);
+
+void				 _pkg_reqby_set_pkg(struct pkg_reqby *,
+					struct pkg *);
+
+void 				 _pkg_reqby_set_name(struct pkg_reqby *,
+					const char *);
+
+void				 _pkg_reqby_set_version(struct pkg_reqby *,
+					const char *);
+
 #endif

==== //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#4 (text+ko) ====

@@ -1,10 +1,13 @@
+#include <err.h>
 #include <getopt.h>
 #include <sys/types.h>
 #include <md5.h>
 #include <regex.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <string.h>
 #include <sys/queue.h>
+#include <unistd.h>
 
 #include <pkg.h>
 
@@ -199,7 +202,8 @@
 
 	failure = 0;
 	match_count = 0;
-
+	
+	pkgs = pkg_db_pkgs(db);
 	if (_c->match == MATCH_ALL) {
 		TAILQ_FOREACH(pkg, pkgs, next)
 			if (delete(pkg, db, _c) != 0) failure++;
@@ -231,14 +235,11 @@
 
 	struct pkg *rpkg;
 
+#if 0
 	const char *script;
-	const char *rb;
+#endif
 	char pathname[PATH_MAX];
 	int rval;
-	int r;
-	int rb_count;
-	const char *dep_name;
-	const char *dep_origin;
 	
 	rval = 0;
 
@@ -255,7 +256,7 @@
 	}
 
 	if (_c->interactive) {
-		fprintf(stderr, "Delete %s?", pkg_name);
+		fprintf(stderr, "Delete %s?", pkg_name(pkg));
 		fflush(stderr);
 		/* XXX: */
 	}
@@ -273,7 +274,8 @@
 
 	}
 #endif
-
+	
+#if 0
 	script = pkg_require(pkg);
 	if (script != NULL) {
 		if (_c->verbose) printf("Executing 'require' script.\n");
@@ -289,6 +291,7 @@
 			warnx("RUN: %s %s %s", script, pkg_name(pkg),
 				"DEINSTALL");
 	}
+#endif
 
 	depends = pkg_depends(pkg);
 	TAILQ_FOREACH(depend, depends, next) {
@@ -332,10 +335,12 @@
 		if (_c->verbose) printf("Delete file %s\n", pathname);
 
 		if (!_c->fake) warnx("DELETE: %s", pathname);
-		
+#if 0	
 		if (pkg_preserve(pkg)) {/* Do preserve stuff... */}
+#endif
 	}
 
+#if 0
 	while (pkg_freebsd_get_next_unexec(p, &e) == PKG_OK) {
 		/* 
 		 * I need to do whatever format_cmd does in here so that the
@@ -375,9 +380,10 @@
 			warnx("RUN: %s %s %s", script, pkg_name, "DEINSTALL");
 		}
 	}
+#endif
 
 	/* Remove the package from the database. */
-	pkg_database_remove_pkg(db, pkg_name);
+	pkg_db_remove(db, pkg);
 	
 	return (rval);
 }
@@ -389,7 +395,7 @@
 }
 
 static int
-pkg_info_hash_match(struct pkg_file *filw)
+pkg_info_hash_match(struct pkg_file *file)
 {
 	char path[PATH_MAX];
 	char hash[33];
@@ -416,8 +422,7 @@
 		link_len = readlink(path, link_buf, PATH_MAX);
 		if (link_len > 0)
 			calc_hash = MD5Data(link_buf, link_len, hash);
-
-	else if (S_ISREG(sb.st_mode)) calc_hash = MD5File(path, hash);
+	} else if (S_ISREG(sb.st_mode)) calc_hash = MD5File(path, hash);
 	
 	if (calc_hash != NULL)
 		return ((strcmp(calc_hash, pkg_file_hash(file)) == 0 ? 1 : 0));
@@ -439,12 +444,10 @@
 		regfree(&re);
 	}
 
-	if (r == 0) {
-		return (1);
-	} else if (r != REG_NOMATCH) {
+	if (r == 0) return (1);
+	else if (r != REG_NOMATCH)
 		/* XXX: Should print an error. */
 		return (0);
-	}
 
 	return (0);
 }


More information about the p4-projects mailing list