From owner-p4-projects@FreeBSD.ORG Thu Oct 28 06:57:39 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 0868010656A4; Thu, 28 Oct 2010 06:57:39 +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 BCFD71065697 for ; Thu, 28 Oct 2010 06:57:38 +0000 (UTC) (envelope-from dforsyth@FreeBSD.org) Received: from skunkworks.freebsd.org (skunkworks.freebsd.org [IPv6:2001:4f8:fff6::2d]) by mx1.freebsd.org (Postfix) with ESMTP id A8A6F8FC1A for ; Thu, 28 Oct 2010 06:57:38 +0000 (UTC) Received: from skunkworks.freebsd.org (localhost [127.0.0.1]) by skunkworks.freebsd.org (8.14.4/8.14.4) with ESMTP id o9S6vcCu035945 for ; Thu, 28 Oct 2010 06:57:38 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o9S6vcgv035942 for perforce@freebsd.org; Thu, 28 Oct 2010 06:57:38 GMT (envelope-from dforsyth@FreeBSD.org) Date: Thu, 28 Oct 2010 06:57:38 GMT Message-Id: <201010280657.o9S6vcgv035942@skunkworks.freebsd.org> X-Authentication-Warning: skunkworks.freebsd.org: perforce set sender to dforsyth@FreeBSD.org using -f From: David Forsythe To: Perforce Change Reviews Precedence: bulk Cc: Subject: PERFORCE change 185174 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Oct 2010 06:57:39 -0000 http://p4web.freebsd.org/@@185174?ac=10 Change 185174 by dforsyth@skunk on 2010/10/28 06:57:35 Do just enough to get pkg_delete to build. Also, last commit was spaces to tabs, not tabs to spaces. Affected files ... .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#7 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#8 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#3 edit .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#4 edit Differences ... ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#7 (text+ko) ==== @@ -16,7 +16,8 @@ freebsd_database_directorydb.c \ util.c \ file.c \ - depend.c + depend.c \ + reqby.c CFLAGS+= -std=c99 ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#8 (text+ko) ==== @@ -173,3 +173,11 @@ return (pkg); } +int +pkg_db_remove(struct pkg_db *db, struct pkg *pkg) +{ + (void)db; + (void)pkg; + return (PKG_NOT_OK); +} + ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.c#3 (text+ko) ==== @@ -1,6 +1,8 @@ +#include #include #include +#include "pkg.h" #include "reqby.h" struct pkg_reqby * ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/reqby.h#3 (text+ko) ==== @@ -21,4 +21,17 @@ #include "pkg_types.h" +struct pkg_reqby *pkg_reqby_alloc(void); + +void pkg_reqby_release(struct pkg_reqby *); + +void _pkg_reqby_set_pkg(struct pkg_reqby *, + struct pkg *); + +void _pkg_reqby_set_name(struct pkg_reqby *, + const char *); + +void _pkg_reqby_set_version(struct pkg_reqby *, + const char *); + #endif ==== //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#4 (text+ko) ==== @@ -1,10 +1,13 @@ +#include #include #include #include #include #include #include +#include #include +#include #include @@ -199,7 +202,8 @@ failure = 0; match_count = 0; - + + pkgs = pkg_db_pkgs(db); if (_c->match == MATCH_ALL) { TAILQ_FOREACH(pkg, pkgs, next) if (delete(pkg, db, _c) != 0) failure++; @@ -231,14 +235,11 @@ struct pkg *rpkg; +#if 0 const char *script; - const char *rb; +#endif char pathname[PATH_MAX]; int rval; - int r; - int rb_count; - const char *dep_name; - const char *dep_origin; rval = 0; @@ -255,7 +256,7 @@ } if (_c->interactive) { - fprintf(stderr, "Delete %s?", pkg_name); + fprintf(stderr, "Delete %s?", pkg_name(pkg)); fflush(stderr); /* XXX: */ } @@ -273,7 +274,8 @@ } #endif - + +#if 0 script = pkg_require(pkg); if (script != NULL) { if (_c->verbose) printf("Executing 'require' script.\n"); @@ -289,6 +291,7 @@ warnx("RUN: %s %s %s", script, pkg_name(pkg), "DEINSTALL"); } +#endif depends = pkg_depends(pkg); TAILQ_FOREACH(depend, depends, next) { @@ -332,10 +335,12 @@ if (_c->verbose) printf("Delete file %s\n", pathname); if (!_c->fake) warnx("DELETE: %s", pathname); - +#if 0 if (pkg_preserve(pkg)) {/* Do preserve stuff... */} +#endif } +#if 0 while (pkg_freebsd_get_next_unexec(p, &e) == PKG_OK) { /* * I need to do whatever format_cmd does in here so that the @@ -375,9 +380,10 @@ warnx("RUN: %s %s %s", script, pkg_name, "DEINSTALL"); } } +#endif /* Remove the package from the database. */ - pkg_database_remove_pkg(db, pkg_name); + pkg_db_remove(db, pkg); return (rval); } @@ -389,7 +395,7 @@ } static int -pkg_info_hash_match(struct pkg_file *filw) +pkg_info_hash_match(struct pkg_file *file) { char path[PATH_MAX]; char hash[33]; @@ -416,8 +422,7 @@ link_len = readlink(path, link_buf, PATH_MAX); if (link_len > 0) calc_hash = MD5Data(link_buf, link_len, hash); - - else if (S_ISREG(sb.st_mode)) calc_hash = MD5File(path, hash); + } else if (S_ISREG(sb.st_mode)) calc_hash = MD5File(path, hash); if (calc_hash != NULL) return ((strcmp(calc_hash, pkg_file_hash(file)) == 0 ? 1 : 0)); @@ -439,12 +444,10 @@ regfree(&re); } - if (r == 0) { - return (1); - } else if (r != REG_NOMATCH) { + if (r == 0) return (1); + else if (r != REG_NOMATCH) /* XXX: Should print an error. */ return (0); - } return (0); }