From owner-p4-projects@FreeBSD.ORG Tue Jun 9 03:49:04 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 920AF1065675; Tue, 9 Jun 2009 03:49:04 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4EDAA1065670 for ; Tue, 9 Jun 2009 03:49:04 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 3384E8FC17 for ; Tue, 9 Jun 2009 03:49:04 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.3/8.14.3) with ESMTP id n593n4Lg090625 for ; Tue, 9 Jun 2009 03:49:04 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n593n4KN090623 for perforce@freebsd.org; Tue, 9 Jun 2009 03:49:04 GMT (envelope-from dforsyth@FreeBSD.org) Date: Tue, 9 Jun 2009 03:49:04 GMT Message-Id: <200906090349.n593n4KN090623@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Cc: Subject: PERFORCE change 163854 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jun 2009 03:49:05 -0000 http://perforce.freebsd.org/chv.cgi?CH=163854 Change 163854 by dforsyth@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) ====