PERFORCE change 163854 for review
David Forsythe
dforsyth at FreeBSD.org
Tue Jun 9 03:49:05 UTC 2009
http://perforce.freebsd.org/chv.cgi?CH=163854
Change 163854 by dforsyth at squirrel on 2009/06/09 03:49:03
faux-pkg_info now vomits all file information on to your screen at
your request.
Affected files ...
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/Makefile#5 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#12 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#12 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_dep.c#2 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_dep.h#2 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.c#2 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.h#2 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#7 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#7 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_private.h#7 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.c#4 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.h#4 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.c#13 edit
.. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.h#8 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/Makefile#4 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#7 edit
.. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/pkg_info.h#3 edit
Differences ...
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/Makefile#5 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#12 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#12 (text+ko) ====
@@ -11,6 +11,13 @@
const char *pkg_file_md5(struct pkg_file *pf);
+/* These might not be client accessible since they're really only useful
+ * when reading a plist. A client creating a plist should already have
+ * this information. */
+const char *pkg_file_owner(struct pkg_file *pf);
+
+const char *pkg_file_group(struct pkg_file *pf);
+
/* TODO: Get pkg_plist out of here. */
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_dep.c#2 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_dep.h#2 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.c#2 (text+ko) ====
@@ -39,6 +39,27 @@
return (pf->md5);
}
+/* If NULL is returned from pkg_file_owner or pkg_file_group, assume the
+ * default owner and group. */
+
+const char *
+pkg_file_owner(struct pkg_file *pf)
+{
+ if (pf == NULL)
+ return (NULL);
+
+ return (pf->owner);
+}
+
+const char *
+pkg_file_group(struct pkg_file *pf)
+{
+ if (pf == NULL)
+ return (NULL);
+
+ return (pf->group);
+}
+
struct pkg_file *
pkg_file_set_md5(struct pkg_file *pf, const char *md5)
{
@@ -58,3 +79,23 @@
pf->path = path;
return (pf);
}
+
+struct pkg_file *
+pkg_file_set_owner(struct pkg_file *pf, const char *owner)
+{
+ if (pf == NULL)
+ return (NULL);
+
+ pf->owner = owner;
+ return (pf);
+}
+
+struct pkg_file *
+pkg_file_set_group(struct pkg_file *pf, const char *group)
+{
+ if (pf == NULL)
+ return (NULL);
+
+ pf->group = group;
+ return (pf);
+}
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.h#2 (text+ko) ====
@@ -19,5 +19,11 @@
struct pkg_file *pkg_file_set_md5(struct pkg_file *pf, const char *md5);
struct pkg_file *pkg_file_set_path(struct pkg_file *pf, const char *path);
+struct pkg_file *pkg_file_set_owner(struct pkg_file *pf,
+ const char *owner);
+struct pkg_file *pkg_file_set_group(struct pkg_file *pf,
+ const char *group);
+
+
#endif
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#7 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#7 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_private.h#7 (text+ko) ====
@@ -12,6 +12,8 @@
char *ident; /* User given name for this pkg. */
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#4 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_util.h#4 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.c#13 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb.h#8 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/pkg_info/Makefile#4 (text+ko) ====
==== //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#7 (text+ko) ====
@@ -6,6 +6,7 @@
#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;
@@ -101,6 +102,13 @@
print_pkg_information(struct pkg *p)
{
struct pkg_file *pf;
+ const char *name;
+ const char *cwd;
+ const char *origin;
+ const char *path;
+ const char *md5;
+ const char *owner;
+ const char *group;
/* Just print the basic PKGNAME COMMENT scheme right now. Other
* information isn't collected by the library yet. */
@@ -109,13 +117,29 @@
printf("%s %s\n", pkg_ident(p), pkg_comment(p));
else {
/* Testing plist interaction. */
- printf("%s:\n", pkg_name(p));
- printf("\tcwd: %s\n", pkg_cwd(p));
- printf("\torigin: %s\n", pkg_origin(p));
- printf("\tplist:\n");
+ name =
+ ((name = pkg_name(p)) == NULL ? BAD_OR_UNKNOWN_VALUE : name);
+ cwd = ((cwd = pkg_cwd(p)) == NULL ? BAD_OR_UNKNOWN_VALUE : cwd);
+ origin =
+ ((origin = pkg_origin(p)) == NULL ? BAD_OR_UNKNOWN_VALUE : origin);
+
+ printf("%s:\n", name);
+ printf("\tcwd: %s\n", cwd);
+ printf("\torigin: %s\n", origin);
+ printf("\tfiles:\n");
pkg_file_list_init(p);
while ((pf = pkg_file_list_next(p)) != NULL) {
- printf("\t\t%s\n\t\t\tMD5: %s\n", pkg_file_path(pf), pkg_file_md5(pf));
+ path =
+ ((path = pkg_file_path(pf)) == NULL ? BAD_OR_UNKNOWN_VALUE : path);
+ md5 =
+ ((md5 = pkg_file_md5(pf)) == NULL ? BAD_OR_UNKNOWN_VALUE : md5);
+ owner =
+ ((owner = pkg_file_owner(pf)) == NULL ? BAD_OR_UNKNOWN_VALUE : owner);
+ group =
+ ((group = pkg_file_group(pf)) == NULL ? BAD_OR_UNKNOWN_VALUE : group);
+ printf("\t\t%s\n\t\t\tMD5: %s\n\t\t\tOWNER: %s\n\t\t\t",
+ path, md5, owner);
+ printf("GROUP: %s\n", owner);
}
}
}
==== //depot/projects/soc2009/dforsyth_libpkg/pkg_info/pkg_info.h#3 (text+ko) ====
More information about the p4-projects
mailing list