PERFORCE change 164069 for review

David Forsythe dforsyth at FreeBSD.org
Thu Jun 11 05:17:06 UTC 2009


http://perforce.freebsd.org/chv.cgi?CH=164069

Change 164069 by dforsyth at squirrel on 2009/06/11 05:16:06

	Working on pkgdb overhaul.

Affected files ...

.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#13 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#8 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_private.h#8 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.c#5 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.h#5 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb.c#1 add
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb.h#1 add
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb_pkgdb_sub.c#1 add
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb_pkgdb_sub.h#1 add
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_old.h#2 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#8 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/pkg_info.h#4 edit

Differences ...

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#13 (text+ko) ====

@@ -13,6 +13,16 @@
 /* Create a new pkg. */
 
 struct pkg *
+pkg_new()
+{
+	struct pkg *p;
+
+	p = calloc(1, sizeof(*p));
+	return (p);
+}
+
+#if 0
+struct pkg *
 pkg_new(const char *ident)
 {
 	struct pkg *p;
@@ -34,6 +44,7 @@
 
 	return (p);
 }
+#endif
 
 /* TODO: Can't copy string for some _set_ functions and then just point to
  * the passed pkg_plist for _set_pkg_plist. */

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#8 (text+ko) ====

@@ -100,6 +100,7 @@
 
 	pl->text = textp;	
 	
+	/* XXX: Use fgets(), dummy. */
 	pkg_plist_pkg_file_list_init(pl);
 	set_parse_state_default(&st);
 	for (p = textp; *p != '\0'; p++) {

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_private.h#8 (text+ko) ====

@@ -13,8 +13,6 @@
 	char *comment; /* Mmmmm, should be 70 or less, right? */
 	struct pkg_plist *plist;
 
-	int legal; /* Soon to be used for pkg verification. */
-	
 	TAILQ_ENTRY(pkg) next;
 };
 

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.c#5 (text+ko) ====

@@ -10,7 +10,8 @@
 int
 subdir_sel(struct dirent *ent)
 {
-	if (strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0)
+	if (strcmp(ent->d_name, ".") != 0 && strcmp(ent->d_name, "..") != 0 &&
+		(ent->d_type & DT_DIR) && !(ent->d_type & DT_LNK))
 		return (1);
 	return (0);
 }
@@ -18,7 +19,7 @@
 char *
 path_strdup(const char *path)
 {
-	int l;
+	size_t l;
 	char *new_path;
 
 	l = strlen(path);
@@ -35,6 +36,29 @@
 	return (new_path);
 }
 
+char *
+path_build(const char *prefix, const char *suffix)
+{
+	size_t l;
+	int slash;
+	char *new_path;
+
+	slash = 0;
+	l = strlen(prefix);
+	if (prefix[l - 1] != '/')
+		slash = 1;
+	l += strlen(suffix) + slash;
+	new_path = malloc(l + 1);
+	if (new_path == NULL)
+		return (NULL);
+	strcpy(new_path, prefix);
+	if (slash)
+		strcat(new_path, '/');
+	strcat(new_path, suffix);
+
+	return (new_path);
+}
+
 void
 argument_rage_quit(const char *function, const char *message, int ret)
 {

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.h#5 (text+ko) ====

@@ -6,7 +6,6 @@
 int subdir_sel(struct dirent *ent);
 char *path_strdup(const char *name);
 
-void argument_rage_quit(const char *function, const char *message, 
-	int ret);
+void arg_rage_quit(const char *function, const char *message, int ret);
 
 #endif

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_old.h#2 (text+ko) ====

@@ -1,5 +1,5 @@
-#ifndef __PKGDB_H__
-#define __PKGDB_H__
+#ifndef __PKGDB_OLD_H__
+#define __PKGDB_OLD_H__
 
 #include "pkg_plist.h"
 #include <sys/queue.h>

==== //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#8 (text+ko) ====

@@ -5,9 +5,6 @@
 #include "pkg.h"
 #include "pkg_info.h"
 
-#define PKG_DBDIR_DEFAULT "/var/db/pkg" /* Move this. */
-#define BAD_OR_UNKNOWN_VALUE "???"
-
 short opt_all = 0;
 short opt_glob = 0;
 short opt_show_all_info = 0;

==== //depot/projects/soc2009/dforsyth_libpkg/pkg_info/pkg_info.h#4 (text+ko) ====

@@ -1,6 +1,9 @@
 #ifndef __PKG_INFO_H__
 #define __PKG_INFO_H__
 
+#define PKG_DBDIR_DEFAULT "/var/db/pkg" /* Move this. */
+#define BAD_OR_UNKNOWN_VALUE "???"
+
 void perform_on_db(struct pkgdb *db);
 void print_pkg_information(struct pkg *p);
 void parse_opts(int argc, char **argv);


More information about the p4-projects mailing list