Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Jun 2009 05:19:48 GMT
From:      David Forsythe <dforsyth@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 164927 for review
Message-ID:  <200906230519.n5N5JmHC041173@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=164927

Change 164927 by dforsyth@squirrel on 2009/06/23 05:18:48

	Little changes.  Added conflict type, but it's none of its list
	building functions.

Affected files ...

.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/Makefile#8 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#24 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#23 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_cfl.c#1 add
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_cfl.h#1 add
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_dep.h#4 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#16 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#13 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.c#7 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.h#8 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#17 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/pkg_info.h#5 edit

Differences ...

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/Makefile#8 (text+ko) ====

@@ -2,7 +2,7 @@
 INCS=	pkg.h
 WARNS=	6
 SRCS=	pkgdb.c pkgdb_hierdb.c pkgdb_hierdb_pkgdb_sub.c pkg.c pkg_util.c \
-		pkg_file.c pkg_dep.c pkg_plist.c
+		pkg_file.c pkg_dep.c pkg_cfl.c pkg_plist.c
 NO_MAN=	yes
 
 .include <bsd.lib.mk>

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

@@ -7,6 +7,7 @@
 #include "pkg_util.h"
 #include "pkg_dep.h"
 #include "pkg_file.h"
+#include "pkg_cfl.h"
 #include "pkg_plist.h"
 #include "pkgdb_hierdb_pkgdb_sub.h"
 #include "pkgdb_hierdb.h"

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#23 (text+ko) ====

@@ -167,17 +167,6 @@
 
 void pkg_delete(struct pkg *p);
 
-/* Check style. */
-
-#define pkg_ent_list_init(t, p) \
-	pkg_##t##_list_init(p)
-
-#define pkg_ent_list_next(t, p) \
-	pkg_##t##_list_next(p)
-
-#define pkg_ent_list_add(t, p) \
-	pkg_##t##_list_add(t, p)
-
 /* pkgdb */
 
 struct pkgdb;

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

@@ -8,6 +8,8 @@
 struct pkg_dep {
 	const char *name;
 	const char *origin;
+	
+	int version;
 
 	TAILQ_ENTRY(pkg_dep) next;
 };

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

@@ -272,7 +272,15 @@
 			pkg_dep_set_name(pd, argument);
 			pkg_plist_pkg_dep_list_append(pl, pd);
 			st->last_elem = PLIST_PKGDEP;
+		} 
+#if 0
+		else if (strcmp(comment, PLIST_CMD_CONFLICTS) == 0) {
+			pc = pkg_cfl_new();
+			pc = pkg_cfl_set_name(pc, argument);
+			pkg_plist_pkg_cfl_list_append(pl, pd);
+			st->last_elem = PLIST_CONFLICTS;
 		}
+#endif
 #if 0
 		else if (strcmp(command, PLIST_CMD_NOINST) == 0) {
 			if ((sep = strchr(argument, ' ')) != NULL)
@@ -398,7 +406,7 @@
 pkg_plist_pkg_file_list_reset(struct pkg_plist *pl)
 {
 	/* If you init again, it clears the list.  So don't. */
-	pl->pf_curr = NULL;
+	pl->pkg_file_curr = NULL;
 }
 
 struct pkg_file *
@@ -409,13 +417,13 @@
 	if (pl == NULL)
 		return (NULL);
 	
-	if (pl->pf_curr == NULL) 
+	if (pl->pkg_file_curr == NULL) 
 		pf = pkg_plist_pkg_file_list_first(pl);
 	else
-		pf = TAILQ_NEXT(pl->pf_curr, next);
+		pf = TAILQ_NEXT(pl->pkg_file_curr, next);
 	
 	if (pf != NULL)
-		pl->pf_curr = pf;
+		pl->pkg_file_curr = pf;
 	
 	return (pf);
 }
@@ -426,7 +434,7 @@
 	if (pl == NULL)
 		return;
 
-	TAILQ_INIT(&pl->pf_head);
+	TAILQ_INIT(&pl->pkg_file_head);
 }
 
 struct pkg_file *
@@ -435,7 +443,7 @@
 	if (pl == NULL)
 		return (NULL);
 
-	return (TAILQ_FIRST(&pl->pf_head));
+	return (TAILQ_FIRST(&pl->pkg_file_head));
 }
 
 struct pkg_file *
@@ -444,7 +452,7 @@
 	if (pl == NULL)
 		return (NULL);
 
-	return (TAILQ_LAST(&pl->pf_head, pf_head));
+	return (TAILQ_LAST(&pl->pkg_file_head, pkg_file_head));
 }
 
 void
@@ -453,7 +461,7 @@
 	if (pl == NULL || pf == NULL)
 		return;
 	
-	TAILQ_INSERT_TAIL(&pl->pf_head, pf, next);
+	TAILQ_INSERT_TAIL(&pl->pkg_file_head, pf, next);
 }
 
 /* pkg_dep list manipulation and access. */
@@ -465,7 +473,7 @@
 	if (pl == NULL)
 		return;
 
-	pl->pd_curr = NULL;
+	pl->pkg_dep_curr = NULL;
 }
 
 void
@@ -474,7 +482,7 @@
 	if (pl == NULL)
 		return;
 
-	TAILQ_INIT(&pl->pd_head);
+	TAILQ_INIT(&pl->pkg_dep_head);
 }
 
 struct pkg_dep *
@@ -483,7 +491,7 @@
 	if (pl == NULL)
 		arg_rage_quit(__func__, "Not a valid plist.", RAGE_AT_LIBPKG);
 
-	return (TAILQ_LAST(&pl->pd_head, pd_head));
+	return (TAILQ_LAST(&pl->pkg_dep_head, pkg_dep_head));
 }
 
 void
@@ -492,7 +500,7 @@
 	if (pl == NULL || pd == NULL)
 		return;
 	
-	TAILQ_INSERT_TAIL(&pl->pd_head, pd, next);
+	TAILQ_INSERT_TAIL(&pl->pkg_dep_head, pd, next);
 }
 
 struct pkg_dep *
@@ -503,13 +511,13 @@
 	if (pl == NULL)
 		return (NULL);
 	
-	if (pl->pd_curr == NULL) 
+	if (pl->pkg_dep_curr == NULL) 
 		pd = pkg_plist_pkg_dep_list_first(pl);
 	else
-		pd = TAILQ_NEXT(pl->pd_curr, next);
+		pd = TAILQ_NEXT(pl->pkg_dep_curr, next);
 	
 	if (pd != NULL)
-		pl->pd_curr = pd;
+		pl->pkg_dep_curr = pd;
 	
 	return (pd);
 }
@@ -520,5 +528,5 @@
 	if (pl == NULL)
 		arg_rage_quit(__func__, "Not a valid plist.", RAGE_AT_LIBPKG);
 	
-	return (TAILQ_FIRST(&pl->pd_head));
+	return (TAILQ_FIRST(&pl->pkg_dep_head));
 }

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#13 (text+ko) ====

@@ -79,15 +79,18 @@
 
 	char *text; /* The entire plist */
 
-	struct pkg_file *pf_curr;
-	struct pkg_dep *pd_curr;
-	
+	struct pkg_file *pkg_file_curr;
+	struct pkg_dep *pkg_dep_curr;
+	struct pkg_cfl *pkg_cfl_curr;
+
 	/* Use these lists here so that appending to our list doesnt need a
 	 * bunch of realloc procedures.  This will be convenient for clients
 	 * that want to build plists on the fly, modify plists, etc. */
 
-	TAILQ_HEAD(pf_head, pkg_file) pf_head; /* pkg_file list. */
-	TAILQ_HEAD(pd_head, pkg_dep) pd_head; /* pkg_dep list. */
+	TAILQ_HEAD(pkg_file_head, pkg_file) pkg_file_head; /* pkg_file list. */
+	TAILQ_HEAD(pkg_dep_head, pkg_dep) pkg_dep_head; /* pkg_dep list. */
+	TAILQ_HEAD(pkg_cfl_head, pkg_cfl) pkg_cfl_head; /* pkg_cfl list. */
+
 	short parsed;
 };
 

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

@@ -43,16 +43,13 @@
 	char *new_path;
 
 	l = strlen(prefix);
-	if (prefix[l - 1] == '/') {
-		new_path = malloc(l + strlen(suffix) + 1);
-		strcpy(new_path, prefix);
-		strcat(new_path, suffix);
-	} else {
-		new_path = malloc(l + strlen(suffix) + 2);
-		strcpy(new_path, prefix);
-		strcat(new_path, "/");
-		strcat(new_path, suffix);
-	}
+	while (prefix + l > prefix && prefix[l - 1] == '/')
+		--l;
+
+	new_path = malloc(l + strlen(suffix) + 2);
+	memcpy(new_path, prefix, l);
+	strcpy(new_path + l, "/");
+	strcat(new_path, suffix);
 
 	return (new_path);
 }

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


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

@@ -163,8 +163,8 @@
 		printf("\tcomplete: %s\n",
 			(pkg_complete(p) ? "YES" : "NO"));
 		printf("\tfiles:\n");
-		pkg_ent_list_init(pkg_file, p);
-		while ((pf = pkg_ent_list_next(pkg_file, p)) != NULL) {
+		pkg_pkg_file_list_init(p);
+		while ((pf = pkg_pkg_file_list_next(p)) != NULL) {
 			path = pkg_file_path(pf);
 			md5 = pkg_file_md5(pf);
 			owner = pkg_file_owner(pf);
@@ -183,8 +183,8 @@
 		}
 
 		printf("\tdepends:\n");
-		pkg_ent_list_init(pkg_dep, p);
-		while ((pd = pkg_ent_list_next(pkg_dep, p)) != NULL) {
+		pkg_pkg_dep_list_init(p);
+		while ((pd = pkg_pkg_dep_list_next(p)) != NULL) {
 			name = pkg_dep_name(pd);
 			origin = pkg_dep_origin(pd);
 			printf("\t\t%s : %s\n", name, origin);

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

@@ -2,6 +2,9 @@
 #define __PKG_INFO_H__
 
 #define PKG_DBDIR_DEFAULT "/var/db/pkg" /* Move this. */
+/* A goal should be to eliminate this directory, and instead store options
+ * seamlessly in plists. */
+#define PORTS_DBDIR_DEFAULT "/var/db/ports"
 #define BAD_OR_UNKNOWN_VALUE "???"
 
 void perform_on_db(struct pkgdb *db);



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