From owner-p4-projects@FreeBSD.ORG Thu Aug 12 02:26:11 2010 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 78BB61065672; Thu, 12 Aug 2010 02:26:11 +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 3C46B106566C for ; Thu, 12 Aug 2010 02:26:11 +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 282BB8FC16 for ; Thu, 12 Aug 2010 02:26:11 +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 o7C2QB4h086969 for ; Thu, 12 Aug 2010 02:26:11 GMT (envelope-from dforsyth@FreeBSD.org) Received: (from perforce@localhost) by skunkworks.freebsd.org (8.14.4/8.14.4/Submit) id o7C2QAYe086966 for perforce@freebsd.org; Thu, 12 Aug 2010 02:26:10 GMT (envelope-from dforsyth@FreeBSD.org) Date: Thu, 12 Aug 2010 02:26:10 GMT Message-Id: <201008120226.o7C2QAYe086966@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 182294 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, 12 Aug 2010 02:26:11 -0000 http://p4web.freebsd.org/@@182294?ac=10 Change 182294 by dforsyth@skunk on 2010/08/12 02:25:45 Sync with main repository Affected files ... .. //depot/projects/soc2010/dforsyth_libpkg/doc/man/pkg_property.3#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/base.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/database_internal.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/exec_internal.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_database_directorydb.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_plist.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_ftp.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/freebsd_repository_path.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/internal.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/logger.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.h#2 edit .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_database.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_database.o#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_database.po#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_depend.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_file.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd_directorydb.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd_directorydb.h#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd_ftp.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd_ftp.h#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd_plist.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_freebsd_plist.h#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_install.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_install.h#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_internal.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_pkg.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_repository_local.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_repository_local.h#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_util.c#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg_util.h#2 delete .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/property.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/property.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/repository_internal.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/libpkg/util.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/lib/pkg_install.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/Makefile#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_delete/pkg_delete.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_dump/Makefile#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_dump/pkg_dump.c#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_dump/pkg_dump.h#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_validate/Makefile#1 add .. //depot/projects/soc2010/dforsyth_libpkg/pkg_install/pkg_validate/validate.c#1 add Differences ... ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/Makefile#2 (text+ko) ==== @@ -11,14 +11,22 @@ SRCS= pkg.c \ - pkg_util.c \ - pkg_freebsd_plist.c \ - pkg_freebsd_directorydb.c \ - pkg_freebsd_ftp.c + property.c \ + database.c \ + repository.c \ + pkg_freebsd.c \ + freebsd_plist.c \ + freebsd_database_directorydb.c \ + freebsd_repository_ftp.c \ + util.c \ + exec.c CFLAGS+= -std=c99 -DEBUG_FLAGS= -g +DEBUG_FLAGS+= -g +.if defined(PROFILE_BUILD) +DEBUG_FLAGS+= -pg +.endif NO_MAN= yes .include ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.c#2 (text+ko) ==== @@ -8,231 +8,191 @@ #include #include -#include "pkg_util.h" +#include "internal.h" #include "pkg.h" -/* FreeBSD callbacks. */ -#include "pkg_freebsd_plist.h" -#include "pkg_freebsd_directorydb.h" -#include "pkg_freebsd_ftp.h" +#define MAGIC 0x09999999 -#define INITIALALLOC_conflict 16 -#define INITIALALLOC_depend 16 -/* - * Huge for performance. - */ -#define INITIALALLOC_file 4096 -#define INITIALALLOC_exec 64 -#define INITIALALLOC_unexec 64 -#define INITIALALLOC_required_by 16 -#define INITIALALLOC_blob 16 +/* Create and initialize a pkg for use with libpkg. */ +struct pkg * +pkg_create(void) +{ + struct pkg *p; -#define MAGIC 0x09999999 + p = calloc(1, sizeof(*p)); + if (p == NULL) { + return (NULL); + } + + /* Set magic. */ + p->magic = MAGIC; + /* No property list. */ + p->plist = NULL; + p->vt = NULL; + p->mt = NULL; + TAILQ_INIT(&p->scripts); + strcpy(p->key, ""); + + return (p); +} /* - * Initialize a pkg for use with libpkg. Needs to be called before any safe - * interaction with a pkgdb can take place. + * Check the magic number in a package. Frontends should use this to check for + * package validity before modifying properties. The package database functions + * will always use this to check the validity of a package before adding it to + * disk or copying information into it. */ void -pkg_init(struct pkg *p, enum pkgtype t) +_pkg_check_magic(struct pkg *p, const char *func) { - p->__magic = MAGIC; - - p->depend = NULL; - p->depend_count = 0; - p->__depend_alloc = 0; - - p->blob = NULL; - p->blob_count = 0; - p->__blob_alloc = 0; - - p->required_by = NULL; - p->required_by_count = 0; - p->__required_by_alloc = 0; - - p->file = NULL; - p->file_count = 0; - p->__file_alloc = 0; - - p->conflict = NULL; - p->conflict_count = 0; - p->__conflict_alloc = 0; - - p->exec = NULL; - p->exec_count = 0; - p->__exec_alloc = 0; - - p->unexec = NULL; - p->unexec_count = 0; - p->__unexec_alloc = 0; - - /* Set up parser callbacks. */ - switch (t) { - case (FREEBSD_PLIST): - p->parse_FILE = __freebsd_plist_parse_FILE; - p->parse_fd = __freebsd_plist_parse_fd; - p->parse = __freebsd_plist_parse; - p->write_FILE = __freebsd_plist_write_FILE; - p->write_fd = __freebsd_plist_write_fd; - p->write = __freebsd_plist_write; - p->meta = __freebsd_plist_meta; - default: - break; + if (p->magic != MAGIC) { + PKG_CLIENT_CRASH(func, "magic number mismatch."); } } -/* Dealloc macros for pkg_clear. */ -#define OBJDEALLOC(pkg, pname) \ - if (pkg->__##pname##_alloc > 0) { \ - free(pkg->pname); \ - pkg->pname = NULL; \ - pkg->__##pname##_alloc = 0; \ - pkg->pname##_count = 0; \ +/* Clear all fields in a package except for its vtables. */ +void +pkg_clear(struct pkg *p) +{ + struct _script *s; + + if (p->plist != NULL) { + pkg_property_release(p->plist); + p->plist = NULL; } - -#define STRDEALLOC(pkg, pname, c) \ - if (pkg->__##pname##_alloc > 0) { \ - for (c = 0; c < pkg->pname##_count; ++c) {\ - free(pkg->pname[c]); \ - } \ - free(pkg->pname); \ - pkg->pname = NULL; \ - pkg->__##pname##_alloc = 0; \ - pkg->pname##_count = 0; \ + while (!TAILQ_EMPTY(&p->scripts)) { + s = TAILQ_FIRST(&p->scripts); + TAILQ_REMOVE(&p->scripts, s, next); + free(s->pathname); + free(s); } + TAILQ_INIT(&p->scripts); +} -/* - * Returns a pkg to it's "just-init'd" state. Only works on pkgs that have been - * initalized. - */ void -pkg_clear(struct pkg *p) +pkg_release(struct pkg *p) { - int i; + pkg_clear(p); + free(p); +} - if (p->__magic != MAGIC) { - /* Crash the client. */ - errx(1, "Pkg not initialized.\n"); +/* Retrieve the Plist from a package. If there is no Plist, it is created. */ +struct pkg_property * +pkg_get_property_list(struct pkg *p) +{ + /* "plist" could just be "" */ + if (p->plist == NULL) { + p->plist = pkg_property_plist_create("plist"); } + return (p->plist); +} - OBJDEALLOC(p, depend); - OBJDEALLOC(p, file); +/* + * Get and set the name of the key that this package uses when registering in a + * package database. The key must be in the root dictionary of the package + * property list. Making it something other than a PLSTRING is probably pretty + * stupid, because most databases probably won't have logic to interpret other + * types of property nodes. + */ +const char * +pkg_get_key(struct pkg *p) +{ + return (p->key); +} - /* Blobs have an allocated field. */ - if (p->__blob_alloc > 0) { - for (i = 0; i < p->blob_count; ++i) { - free(p->blob[i].blob); - } - free(p->blob); - p->blob = NULL; - p->__blob_alloc = 0; - p->blob_count = 0; +void +pkg_set_key(struct pkg *p, const char *key) +{ + if (key == NULL) { + PKG_CLIENT_CRASH(__func__, "Invalid input. key is NULL"); } + strcpy(p->key, key); +} - STRDEALLOC(p, conflict, i); - STRDEALLOC(p, required_by, i); - STRDEALLOC(p, exec, i); - STRDEALLOC(p, unexec, i); +void +pkg_set_parser_writer_vtable(struct pkg *p, struct parser_writer_vtable *vt) +{ + p->vt = vt; } +void +pkg_set_meta_entry_table(struct pkg *p, struct meta_entry *mt) +{ + p->mt = mt; +} -/* - * Make space for a new element if there isn't any. Return a reference to the - * element on success, return NULL on failure. - */ +struct meta_entry * +pkg_get_meta_entry_table(struct pkg *p) +{ + return (p->mt); +} -/* Object name, name in pkg, allocation field name. */ -#define DEFINEOBJADD_FN(objname, pname) \ -struct objname * \ -pkg_##pname##_add(struct pkg *p) \ -{ \ - int newalloc; \ - struct objname *tmp; \ - if (p->pname##_count >= p->__##pname##_alloc) { \ - newalloc = p->__##pname##_alloc * 2; \ - if (newalloc <= 0) { \ - newalloc = INITIALALLOC_##pname; \ - } \ - tmp = p->pname; \ - p->pname = realloc(tmp, sizeof(*tmp) * newalloc); \ - if (p->pname == NULL) { \ - p->pname = tmp; \ - return (NULL); \ - } \ - p->__##pname##_alloc = newalloc; \ - } \ - p->pname##_count++; \ - return (p->pname + p->pname##_count - 1); \ +int +pkg_parse_FILE(struct pkg *p, FILE *fp, const char *metaname) +{ + if (p->vt == NULL) { + PKG_CLIENT_CRASH(__func__, "Callback unsupported."); + } + return (p->vt->parse_FILE(p, fp, metaname)); } -DEFINEOBJADD_FN(pkg_depend, depend); -DEFINEOBJADD_FN(pkg_file, file); -DEFINEOBJADD_FN(pkg_blob, blob); +int +pkg_parse_fd(struct pkg *p, int fd, size_t size, const char *metaname) +{ + if (p->vt == NULL) { + PKG_CLIENT_CRASH(__func__, "Callback unsupported."); + } + return (p->vt->parse_fd(p, fd, size, metaname)); +} -/* - * Allocate space in the array if we need some. Returns the index that the - * string was placed at. - */ +int +pkg_parse(struct pkg *p, char *data, const char *metaname) +{ + if (p->vt == NULL) { + PKG_CLIENT_CRASH(__func__, "Callback unsupported."); + } + return (p->vt->parse(p, data, metaname)); +} -#define DEFINESTRADD_FN(pname) \ -int \ -pkg_##pname##_add(struct pkg *p, const char *str) \ -{ \ - int newalloc; \ - char **tmp; \ - if (p->pname##_count >= p->__##pname##_alloc) { \ - newalloc = p->__##pname##_alloc * 2; \ - if (newalloc <= 0) { \ - newalloc = INITIALALLOC_##pname; \ - } \ - tmp = p->pname; \ - p->pname = realloc(tmp, sizeof(*tmp) * newalloc); \ - if (p->pname == NULL) { \ - p->pname = tmp; \ - return (-1); \ - } \ - p->__##pname##_alloc = newalloc; \ - } \ - p->pname[p->pname##_count] = strdup(str); \ - if (p->pname[p->pname##_count] == NULL) { \ - return (-1); \ - } \ - p->pname##_count++; \ - return (p->pname##_count - 1); \ +int +pkg_write_FILE(struct pkg *p, FILE *fp, const char *metaname) +{ + return (p->vt->write_FILE(p, fp, metaname)); } -DEFINESTRADD_FN(conflict); -DEFINESTRADD_FN(required_by); -DEFINESTRADD_FN(exec); -DEFINESTRADD_FN(unexec); +int +pkg_register_script(struct pkg *p, const char *name, const char *pathname) +{ + struct _script *script; + + + TAILQ_FOREACH(script, &p->scripts, next) { + if (STRMATCH(script->name, name)) { + TAILQ_REMOVE(&p->scripts, script, next); + free(script->pathname); + free(script); + break; + } + } -void -pkg_database_init(struct pkg_database *db, enum pkgdbtype type) -{ - switch (type) { - case (FREEBSD_DIRDB): - db->open = __freebsd_directorydb_open; - db->close = __freebsd_directorydb_close; - db->match = __freebsd_directorydb_match; - db->add = __freebsd_directorydb_add; - db->delete = __freebsd_directorydb_delete; - break; - default: - break; + script = calloc(1, sizeof(*script)); + if (script == NULL) { + return (PKG_NOT_OK); } + script->name = name; + script->pathname = strdup(pathname); + TAILQ_INSERT_TAIL(&p->scripts, script, next); + return (PKG_OK); } -/* Repository initalizer. */ -void -pkg_repository_init(struct pkg_repository *repo, enum pkgrepotype type) +const char * +pkg_get_script_pathname(struct pkg *p, const char *name) { - switch (type) { - case (FREEBSD_FTP): - repo->open = __freebsd_ftp_open; - repo->close = __freebsd_ftp_close; - repo->fetch = __freebsd_ftp_fetch; - break; - default: - break; + struct _script *script; + TAILQ_FOREACH(script, &p->scripts, next) { + if (strcmp(script->name, name) == 0) { + return (script->pathname); + } } + return (NULL); } ==== //depot/projects/soc2010/dforsyth_libpkg/libpkg/pkg.h#2 (text+ko) ==== @@ -3,233 +3,25 @@ * See LICENSE file for license details. */ -#ifndef __PKG_H__ -#define __PKG_H__ +#ifndef __LIBPKG_PKG_H__ +#define __LIBPKG_PKG_H__ -#include /* For archive_entry. */ -#include -#include /* For FILE. */ -#include - /* Versioning is "YYYYMMDD" */ #define LIBPKG_VERSION 00000000 +/* TODO: Move most of this needs to be moved into constants.h and database.h */ + /* General Errors. */ -#define PKG_OK 0 -#define PKG_NOT_OK (-1) -#define PKG_FATAL (-2) +#define PKG_OK 0 +/* Maybe try again. */ +#define PKG_NOT_OK (-1) +/* You messed up, don't try again. */ +#define PKG_FATAL (-2) -/* Lower 16 bits for skip codes, upper 16 for database op flags. */ +#include "base.h" +#include "database.h" +#include "property.h" +#include "repository.h" +#include "exec.h" -/* Skip codes. */ -#define P_SKIPCOMMENT 0x00000001 -#define P_SKIPDESC 0x00000002 -#define P_SKIPDISPLAY 0x00000004 -#define P_SKIPMANIFEST 0x00000008 -#define P_SKIPMTREEDIRS 0x00000010 -#define P_SKIPREQUIREDBY 0x00000020 - -/* Reset database cursor. */ -#define P_FIRST 0x10000000 -/* No locks. */ -#define P_NOLOCK 0x20000000 -/* Only lock on add/delete. */ -#define P_LOCKONACT 0x40000000 -/* Create the database if it does not exist. */ -#define P_CREATE 0x80000000 -/* For non-skipped blobs, print to stdout and do not store. */ -#define P_SPIT 0x01000000 -/* Do not overwrite. */ -#define P_NOOVERWRITE 0x02000000 - -/* typedef? */ -enum pkgtype{ - FREEBSD_PLIST -}; - -enum pkgdbtype{ - FREEBSD_DIRDB, - FREEBSD_BERK -}; - -enum pkgrepotype { - FREEBSD_LOCAL, - FREEBSD_FTP -}; - -enum pkgmatch{ - PKGMATCH_ALL, - PKGMATCH_EXACT, - PKGMATCH_GLOB, - PKGMATCH_NGLOB, - PKGMATCH_REGEX, - PKGMATCH_EREGEX -}; - -struct pkg { - int __magic; /* Init. */ - int __type; - int __log_fd; - - char name[PATH_MAX]; - char origin[PATH_MAX]; - char install_date[15]; - - int fmtrev_major; - int fmtrev_minor; - - char srcdir[PATH_MAX]; - char mtree[PATH_MAX]; - - int extract_in_place; - int preserve; - - int conflict_count; - char **conflict; - int __conflict_alloc; - - int depend_count; - struct pkg_depend *depend; - int __depend_alloc; - - int file_count; - struct pkg_file *file; - int __file_alloc; - - int exec_count; - char **exec; - int __exec_alloc; - - int unexec_count; - char **unexec; - int __unexec_alloc; - - int blob_count; - struct pkg_blob *blob; - int __blob_alloc; - - int required_by_count; - char **required_by; - int __required_by_alloc; - - int (*parse_FILE) (struct pkg *, FILE *, const char *); - int (*parse_fd) (struct pkg *, int fd, size_t len, const char *); - int (*parse) (struct pkg *, char *, const char *); - int (*write_FILE) (struct pkg *, FILE *, const char *); - int (*write_fd) (struct pkg *, int, const char *); - int (*write) (struct pkg *, char **, const char *); - int (*meta) (const char *); -}; - -struct pkg_depend { - char name[PATH_MAX]; - char origin[PATH_MAX]; - char version[32]; -}; - -struct pkg_file { - /* XXX: Find constants for these. */ - char group[17]; - char hash[33]; - mode_t mode; - char owner[17]; - char name[PATH_MAX]; /* LOGIN_NAME_MAX? */ - char prefix[PATH_MAX]; - - int ignore; -}; - -struct pkg_blob { - char name[PATH_MAX]; - char *blob; -}; - -struct pkg_database { - void *__internal; - int __locking; /* Remove? */ - int __type; - - /* - * XXX: 'add' and 'delete' should really be renamed to 'register' and - * 'unregister' or something to that effect. - */ - int (*add) (struct pkg_database *, struct pkg *, u_int); - int (*close) (struct pkg_database *); - int (*delete) (struct pkg_database *, const char *, u_int); - int (*match) (struct pkg_database *, const char *, enum pkgmatch, - struct pkg *, u_int); - int (*open) (struct pkg_database *, const char *, u_int); -}; - -struct pkg_repository { - void *__internal; - int __type; - - int (*open) (struct pkg_repository *, const char *, u_int); - int (*close) (struct pkg_repository *); - FILE *(*fetch) (struct pkg_repository *, const char *, char *, size_t *, - u_int); -}; - -/* pkg */ -void -pkg_init(struct pkg *, enum pkgtype); - -void -pkg_clear(struct pkg *); - -int -pkg_conflict_add(struct pkg *, const char *); - -struct pkg_depend * -pkg_depend_add(struct pkg *); - -struct pkg_file * -pkg_file_add(struct pkg *); - -int -pkg_exec_add(struct pkg *, const char *); - -int -pkg_unexec_add(struct pkg *, const char *); - -struct pkg_blob * -pkg_blob_add(struct pkg *); - -int -pkg_required_by_add(struct pkg *, const char *); - -/* pkg_db */ -void -pkg_database_init(struct pkg_database *, enum pkgdbtype); - -/* pkgrepo */ -void -pkg_repository_init(struct pkg_repository *, enum pkgrepotype); - -/* pkg_install */ -int -pkg_install_check(const char *); - -int -pkg_install_start(struct pkg *, const char *); - -int -pkg_install_finish(struct pkg *); - -int -pkg_install_extract(struct pkg *, struct archive *, struct archive_entry *, - u_int); -int -pkg_install_undo(const char *); - -int -pkg_install_log(struct pkg *, const char *, ...); - -const char * -pkg_install_log_last_line(struct pkg *); - -int -pkg_install_undo(const char *); - -#endif +#endif