PERFORCE change 164825 for review
David Forsythe
dforsyth at FreeBSD.org
Sun Jun 21 19:45:53 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=164825
Change 164825 by dforsyth at squirrel on 2009/06/21 19:45:10
Added a little sweet macro action.
Affected files ...
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#22 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#21 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#14 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#11 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.c#17 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.h#11 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#15 edit
Differences ...
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#22 (text+ko) ====
@@ -226,6 +226,17 @@
return (pkg_plist_origin(&p->plist));
}
+char *
+pkg_mtree_file(struct pkg *p)
+{
+ if (p == NULL)
+ arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT);
+
+ if (pkg_parse_plist(p) != OK)
+ return (NULL);
+ return (pkg_plist_mtree_file(&p->plist));
+}
+
/* These need to be renamed. */
void
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#21 (text+ko) ====
@@ -113,6 +113,8 @@
char *pkg_display(struct pkg *p);
+char *pkg_mtree_file(struct pkg *p);
+
int pkg_set_ident(struct pkg *p, const char *ident);
int pkg_set_name(struct pkg *p, const char *name);
@@ -133,6 +135,10 @@
int pkg_set_display(struct pkg *p, const char *display);
+#if 0
+int pkg_set_mtree_file(struct pkg *p, const char *mtree_file);
+#endif
+
int pkg_parse_plist(struct pkg *p);
void pkg_pkg_file_list_init(struct pkg *p);
@@ -151,6 +157,17 @@
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_plist.c#14 (text+ko) ====
@@ -328,6 +328,15 @@
return (pl->origin);
}
+char *
+pkg_plist_mtree_file(struct pkg_plist *pl)
+{
+ if (pl == NULL)
+ arg_rage_quit(__func__, "Not a valid plist.", RAGE_AT_LIBPKG);
+
+ return (pl->mtree_file);
+}
+
/* pkg_file list manipulation and access. */
/* I should really just write a set of generic routine to handle this
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#11 (text+ko) ====
@@ -101,6 +101,7 @@
char *pkg_plist_name(struct pkg_plist *pl);
char *pkg_plist_cwd(struct pkg_plist *pl);
char *pkg_plist_origin(struct pkg_plist *pl);
+char *pkg_plist_mtree_file(struct pkg_plist *pl);
void pkg_plist_pkg_file_list_init(struct pkg_plist *pl);
struct pkg_file *pkg_plist_pkg_file_list_first(struct pkg_plist *pl);
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.c#17 (text+ko) ====
@@ -126,8 +126,26 @@
pkgdb_pkg_get(struct pkgdb *db, struct pkg *p, const char *ident)
{
/* TODO: Write this function. */
+ int status;
+
+ if (db == NULL)
+ arg_rage_quit(__func__, "Not a valid database.", RAGE_AT_CLIENT);
+ if (p == NULL)
+ arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT);
+
+ status = PKG_OK;
+ pkg_reset(p);
+
return (OK);
}
+
+/* Grab a specific sub out of the pkgdb_sub list. */
+struct pkgdb_sub *
+pkgdb_pkgdb_sub_get(struct pkgdb *db, const char *ident)
+{
+ /* TODO: Write this function. */
+ return (NULL);
+}
#endif
void
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.h#11 (text+ko) ====
@@ -15,4 +15,5 @@
void pkgdb_pkgdb_sub_list_append(struct pkgdb *db, struct pkgdb_sub *sub);
+struct pkgdb_sub *pkgdb_pkgdb_sub_get(struct pkgdb *db, const char *ident);
#endif
==== //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#15 (text+ko) ====
@@ -125,6 +125,7 @@
const char *name;
const char *cwd;
const char *origin;
+ const char *mtree_file;
const char *path;
const char *md5;
const char *owner;
@@ -144,6 +145,7 @@
name = pkg_name(p);
cwd = pkg_cwd(p);
origin = pkg_origin(p);
+ mtree_file = pkg_mtree_file(p);
printf("%s:\n",
(name != NULL ? name : BAD_OR_UNKNOWN_VALUE));
@@ -151,9 +153,11 @@
(cwd != NULL ? name : BAD_OR_UNKNOWN_VALUE));
printf("\torigin: %s\n",
(origin != NULL ? origin : BAD_OR_UNKNOWN_VALUE));
+ printf("\tmtree file: %s\n",
+ (mtree_file != NULL ? mtree_file : BAD_OR_UNKNOWN_VALUE));
printf("\tfiles:\n");
- pkg_pkg_file_list_init(p);
- while ((pf = pkg_pkg_file_list_next(p)) != NULL) {
+ pkg_ent_list_init(pkg_file, p);
+ while ((pf = pkg_ent_list_next(pkg_file, p)) != NULL) {
path = pkg_file_path(pf);
md5 = pkg_file_md5(pf);
owner = pkg_file_owner(pf);
@@ -169,8 +173,8 @@
}
printf("\tdepends:\n");
- pkg_pkg_dep_list_init(p);
- while ((pd = pkg_pkg_dep_list_next(p)) != NULL) {
+ pkg_ent_list_init(pkg_dep, p);
+ while ((pd = pkg_ent_list_next(pkg_dep, p)) != NULL) {
name = pkg_dep_name(pd);
origin = pkg_dep_origin(pd);
printf("\t\t%s : %s\n", name, origin);
More information about the p4-projects
mailing list