From owner-p4-projects@FreeBSD.ORG Thu Jun 18 03:56:57 2009 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 1D4E31065675; Thu, 18 Jun 2009 03:56:57 +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 B1AA5106566C for ; Thu, 18 Jun 2009 03:56:56 +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 9EC2F8FC1E for ; Thu, 18 Jun 2009 03:56:56 +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 n5I3uufo036789 for ; Thu, 18 Jun 2009 03:56:56 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.3/8.14.3/Submit) id n5I3uuvL036787 for perforce@freebsd.org; Thu, 18 Jun 2009 03:56:56 GMT (envelope-from dforsyth@FreeBSD.org) Date: Thu, 18 Jun 2009 03:56:56 GMT Message-Id: <200906180356.n5I3uuvL036787@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 164639 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: Thu, 18 Jun 2009 03:56:58 -0000 http://perforce.freebsd.org/chv.cgi?CH=164639 Change 164639 by dforsyth@squirrel on 2009/06/18 03:56:50 Did a bit of cleaning. Getting ready to ditch queue. Affected files ... .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#20 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#19 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_error.h#1 add .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.c#4 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#12 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#9 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb.c#7 edit .. //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb_pkgdb_sub.c#8 edit .. //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#13 edit Differences ... ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.c#20 (text+ko) ==== @@ -97,13 +97,12 @@ if (p == NULL) arg_rage_quit(__func__, "Not a valid package.", RAGE_AT_CLIENT); - /* + /* Yes this makes for 3 copies of the text in memory at once, but just + * until I decide how I want to handle 'dirty' packages. */ if (contents != NULL) p->contents = strdup(contents); else p->contents = NULL; - */ - p->contents = contents; return (OK); } ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg.h#19 (text+ko) ==== @@ -19,22 +19,34 @@ /* PKGDB Errors. */ -#define DB_BAD_ROOT 0x10000000 -#define DB_NOT_OPEN 0x20000000 -#define DB_OPEN 0x40000000 +#define DB_OK 0x00000000 +#define DB_NOT_OK 0x00000001 +#define DB_BAD_ROOT 0x00000002 +#define DB_NOT_OPEN 0x00000004 +#define DB_OPEN 0x00000008 +#define DB_NO_PKG 0x00000010 -#define SUB_NO_COMMENT 0x80000000 -#define SUB_NO_CONTENTS 0x01000000 -#define SUB_NO_DESC 0x02000000 -#define SUB_NO_DISPLAY 0x04000000 -#define SUB_NO_MTREE_DIRS 0x08000000 -#define SUB_NO_REQUIRED_BY 0x00100000 -#define SUB_NO_FILE 0x00200000 -#define SUB_EMPTY_FILE 0x00400000 +/* These should probably go to _private */ +#define SUB_OK 0x00000000 +#define SUB_NO_COMMENT 0x00000001 +#define SUB_NO_CONTENTS 0x00000002 +#define SUB_NO_DESC 0x00000004 +#define SUB_NO_DISPLAY 0x00000008 +#define SUB_NO_MTREE_DIRS 0x00000010 +#define SUB_NO_REQUIRED_BY 0x00000020 +#define SUB_NO_FILE 0x00000040 +#define SUB_EMPTY_FILE 0x00000080 /* PKG Errors. */ -#define NO_PKG 0x00800000 +#define PKG_OK 0x00000000 +#define PKG_NOT_OK 0x00000001 +#define PKG_PARSE_NOT_OK 0x00000002 +#define PKG_NO_COMMENT 0x00000004 +#define PKG_NO_DESC 0x00000008 +#define PKG_NO_DISPLAY 0x00000010 +#define PKG_NO_MTREE_DIRS 0x00000020 +#define PKG_NO_REQUIRED_BY 0x00000040 /* pkg_file */ ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_file.c#4 (text+ko) ==== @@ -57,38 +57,38 @@ pkg_file_set_md5(struct pkg_file *pf, const char *md5) { if (pf == NULL) - return (NULL); + return (NOT_OK); pf->md5 = md5; - return (pf); + return (OK); } int pkg_file_set_path(struct pkg_file *pf, const char *path) { if (pf == NULL) - return (NULL); + return (NOT_OK); pf->path = path; - return (pf); + return (OK); } int pkg_file_set_owner(struct pkg_file *pf, const char *owner) { if (pf == NULL) - return (NULL); + return (NOT_OK); pf->owner = owner; - return (pf); + return (OK); } int pkg_file_set_group(struct pkg_file *pf, const char *group) { if (pf == NULL) - return (NULL); + return (NOT_OK); pf->group = group; - return (pf); + return (OK); } ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.c#12 (text+ko) ==== @@ -87,11 +87,9 @@ if (text == NULL) return (NOT_OK); - /* - pl = pkg_plist_new(); if (pl == NULL) - return (MEMORY_ERR); - */ + return (NOT_OK); + /* Not sure if this is how I still want to do this, but for now, hold * a copy of the text. */ textp = strdup(text); @@ -376,6 +374,8 @@ void pkg_plist_free(struct pkg_plist *pl) { + /* TODO: Write this function. */ + free(pl); return; } ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkg_plist.h#9 (text+ko) ==== @@ -77,7 +77,7 @@ TAILQ_HEAD(pf_head, pkg_file) pf_head; /* pkg_file list. */ TAILQ_HEAD(pd_head, pkg_dep) pd_head; /* pkg_dep list. */ - int parsed; + short parsed; }; struct pkg_plist *pkg_plist_new(void); ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb.c#7 (text+ko) ==== @@ -110,9 +110,7 @@ pkgdb_hierdb_read_pkgdb_sub(struct pkgdb *db, struct pkgdb_sub *sub, const char *ident) { - int s; int status; - struct stat sb; #if 0 /* The client doesn't know about the functions in this file. */ if (!VALID_DB(x)) arg_rage_quit(__func__, "Not a valid database.", RAGE_AT_CLIENT); @@ -123,6 +121,7 @@ pkgdb_sub_reset(sub); status = OK; status |= pkgdb_sub_set_ident(sub, ident); + /* Directory is verified here. */ status |= pkgdb_sub_set_assign_db(db, sub); if ((MEMORY_ERR & status) || (BAD_IDENT & status)) ==== //depot/projects/soc2009/dforsyth_libpkg/libpkg/pkgdb_hierdb_pkgdb_sub.c#8 (text+ko) ==== @@ -36,6 +36,8 @@ return (OK); } + +/* This function checks the validity of the sub directory. */ int pkgdb_sub_set_assign_db(struct pkgdb *owner, struct pkgdb_sub *dbs) { ==== //depot/projects/soc2009/dforsyth_libpkg/pkg_info/main.c#13 (text+ko) ==== @@ -105,7 +105,7 @@ exit(EXIT_FAILURE); } - while ((status = pkgdb_pkg_next(db, p)) != NO_PKG) { + while ((status = pkgdb_pkg_next(db, p)) != DB_NO_PKG) { if (!opt_all) { /* Wont happen at this point. */ /* Do some matching magic that I haven't written yet. */ print_pkg_information(p);