p4-projects@freebsd.org
[Top] [All Lists]

PERFORCE change 164399 for review

Subject: PERFORCE change 164399 for review
From: David Forsythe
Date: Mon, 15 Jun 2009 06:28:29 GMT
http://perforce.freebsd.org/chv.cgi?CH=164399

Change 164399 by dforsyth@squirrel on 2009/06/15 06:27:51

        Pulled pkgdb struct into a seperate header.  Still combing through 
functions that need to be adjusted.

Affected files ...

.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/Makefile#6 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#17 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#17 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.c#3 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.h#3 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#10 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb.c#5 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb_pkgdb_sub.h#4 
edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_private.h#1 add
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#11 edit

Differences ...

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

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

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

@@ -9,6 +9,7 @@
 #include "pkg_file.h"
 #include "pkg_plist.h"
 #include "pkgdb_hierdb_pkgdb_sub.h"
+#include "pkgdb_hierdb.h"
 #include "pkgdb.h"
 #include "pkg_private.h"
 #include "pkg.h"

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

@@ -1,11 +1,13 @@
 #ifndef __PKG_H__
 #define __PKG_H__
 
-/* When I get more than one, I'll plop it into an enum type. */
 #define HIER_DB                        0
+#define FLAT_DB                                1       /* O_o */
 
 /* Here have some error codes. */
 
+/* These error codes are no good.  Switch to contextual errors/macros. */
+
 #define OK                                     0x00000000
 #define NOT_OK                         0x00000001
 #define MEMORY_ERR                     0x00000002
@@ -31,7 +33,7 @@
 /* pkg_file */
 
 struct pkg_file;
-#if 0
+
 struct pkg_file *pkg_file_new(void);
 
 const char *pkg_file_path(struct pkg_file *pf);
@@ -49,7 +51,7 @@
 int pkg_file_set_owner(struct pkg_file *pf, const char *owner);
 
 int pkg_file_set_group(struct pkg_file *pf, const char *group);
-#endif
+
 /* pkg */
 
 /* Add mtree stuff later. */
@@ -118,8 +120,12 @@
 
 int pkgdb_db_init(struct pkgdb *db);
 
+char *pkgdb_db_root(struct pkgdb *db);
+
 int pkgdb_db_close(struct pkgdb *db);
 
+void pkgdb_db_delete(struct pkgdb *db);
+
 int pkgdb_pkg_next(struct pkgdb *db, struct pkg *p);
 
 int pkgdb_pkg_get(struct pkgdb *db, struct pkg *p, const char *ident);

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.c#3 (text+ko) ====

@@ -5,18 +5,11 @@
 #include "pkg.h"
 
 struct pkg_file *
-pkg_file_new(const char *path, const char *md5, const char *owner,
-       const char *group)
+pkg_file_new()
 {      
        struct pkg_file *pf;
 
        pf = calloc(1, sizeof(*pf));
-       if (pf != NULL) {
-               pf->path = path;
-               pf->md5 = md5;
-               pf->owner = owner;
-               pf->group = group;
-       }
 
        return (pf);
 }
@@ -60,7 +53,7 @@
        return (pf->group);
 }
 
-struct pkg_file *
+int
 pkg_file_set_md5(struct pkg_file *pf, const char *md5)
 {
        if (pf == NULL)
@@ -70,7 +63,7 @@
        return (pf);
 }
 
-struct pkg_file *
+int
 pkg_file_set_path(struct pkg_file *pf, const char *path)
 {
        if (pf == NULL)
@@ -80,7 +73,7 @@
        return (pf);
 }
 
-struct pkg_file *
+int
 pkg_file_set_owner(struct pkg_file *pf, const char *owner)
 {
        if (pf == NULL)
@@ -90,7 +83,7 @@
        return (pf);
 }
 
-struct pkg_file *
+int
 pkg_file_set_group(struct pkg_file *pf, const char *group)
 {
        if (pf == NULL)

==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.h#3 (text+ko) ====

@@ -14,6 +14,7 @@
        TAILQ_ENTRY(pkg_file) next;
 };
 
+#if 0
 struct pkg_file *pkg_file_new(const char *path, const char *md5, 
        const char *owner, const char *group);
 
@@ -23,7 +24,7 @@
        const char *owner);
 struct pkg_file *pkg_file_set_group(struct pkg_file *pf, 
        const char *group);
-
+#endif
 
 
 #endif

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

@@ -263,7 +263,11 @@
                }
 #endif
        } else {
-               pf = pkg_file_new(line, NULL, st->owner, st->group);
+               pf = pkg_file_new();
+               pkg_file_set_path(pf, line);
+               pkg_file_set_md5(pf, NULL);
+               pkg_file_set_owner(pf, st->owner);
+               pkg_file_set_group(pf, st->group);
                pkg_plist_pkg_file_list_append(pl, pf);
                st->last_elem = PLIST_FILE;
        }

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

@@ -1,3 +1,7 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <dirent.h>
@@ -5,6 +9,7 @@
 #include "pkg_util.h"
 #include "pkg.h"
 #include "pkgdb.h"
+#include "pkgdb_private.h"
 #include "pkgdb_hierdb.h"
 #include "pkgdb_hierdb_pkgdb_sub.h"
 
@@ -20,14 +25,14 @@
        if (db == NULL)
                arg_rage_quit(__func__, "Not a valid database.", 
RAGE_AT_CLIENT);
        if (db_root == NULL)
-               arg_rage_quit(__func__, "Not a valid root directory for
-                       database.", RAGE_AT_CLIENT);
+               arg_rage_quit(__func__, "Not a valid root directory for 
database.", 
+                       RAGE_AT_CLIENT);
        
        if (db->open)
-               return (DB_IS_OPEN);
+               return (DB_OPEN);
 
-       s = lstat(&sb);
-       if (s < 0 || !S_ISDIR(sb.st_mode) || S_ISLINK(sb.st_mode))
+       s = lstat(db_root, &sb);
+       if (s < 0 || !S_ISDIR(sb.st_mode) || S_ISLNK(sb.st_mode))
                return (DB_INVALID_ROOT);
 
        db->db_root = strdup(db_root);

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

@@ -1,6 +1,7 @@
 #ifndef __PKGDB_SUB_H__
 #define __PKGDB_SUB_H__
 
+#include <sys/queue.h>
 #include "pkg.h"
 
 /* Keep this in here until (if) I ditch queues. */

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

@@ -58,7 +58,8 @@
        }
 
        perform_on_db(db);
-
+       
+       pkgdb_db_delete(db);
        return (EXIT_SUCCESS);
 }
 
@@ -100,7 +101,7 @@
        status = pkgdb_db_init(db);
        if (status) {
                fprintf(stderr, "Could not initialize database \"%s\"\n",
-                       pkgdb_db_root(db_root));
+                       pkgdb_db_root(db));
                exit(EXIT_FAILURE);
        }
 
_______________________________________________
p4-projects@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/p4-projects
To unsubscribe, send any mail to "p4-projects-unsubscribe@xxxxxxxxxxx"

<Prev in Thread] Current Thread [Next in Thread>
  • PERFORCE change 164399 for review, David Forsythe <=