MPORT(3)

NAME
mport_clean_database, mport_clean_oldpackages, mport_create_primative, mport_delete_primative, mport_download, mport_err_code, mport_err_string, mport_index_load, mport_index_lookup_pkgname, mport_index_search, mport_index_entry_free_vec, mport_index_entry_free, mport_install, mport_install_primative, mport_instance_free, mport_instance_init, mport_instance_new, mport_set_msg_cb, mport_set_progress_init_cb, mport_set_progress_step_cb, mport_set_progress_free_cb, mport_set_confirm_cb, mport_stats, mport_stats_free, mport_stats_new, mport_merge_primative, mport_pkgmeta_new, mport_pkgmeta_free, mport_pkgmeta_vec_free, mport_pkgmeta_search_master, mport_pkgmeta_list, mport_pkgmeta_get_downdepends, mport_pkgmeta_get_updepends, mport_assetlist_new, mport_assetlist_free, mport_parse_plistfile, mport_settings_get, mport_settings_set, mport_update_primative, mport_createextras_new, mport_createextras_free, mport_verify_hash, mport_file_exists, mport_verify_package, mport_version_cmp, mport_lock_lock, mport_lock_unlock, mport_lock_islocked, - mport package functions

LIBRARY
libmport

SYNOPSIS
#include <mport.h>
#include <mport_private.h>
int
mport_clean_database(mportInstance *mport);
int
mport_clean_oldpackages(mportInstance *mport);
int
mport_create_primative(mportAssetList *assetlist, mportPackageMeta *pack, mportCreateExtras *extra);
int
mport_delete_primative(mportInstance *mport, mportPackageMeta *pack, int force);
int
mport_download(mportInstance *mport, const char *pkgname, bool all, bool includeDependencies, char **path);
int
mport_err_code();
const char *
mport_err_string();
int
mport_index_load(mportInstance *mport);
int
mport_index_lookup_pkgname(mportInstance *mport, const char *pkgname, mportIndexEntry ***entry_vec);
int
mport_index_search(mportInstance *mport, mportIndexEntry ***entry_vec, const char *fmt, ...);
void
mport_index_entry_free_vec(mportIndexEntry **e);
void
mport_index_entry_free(mportIndexEntry *e);
int
mport_install(mportInstance *mport, const char *pkgname, const char *version, const char *prefix);
int
mport_install_primative(mportInstance *mport, const char *filename, const char *prefix);
int
mport_instance_free(mportInstance *mport);
int
mport_instance_init(mportInstance *mport, const char *root, const char *outputPath, bool noIndex, mportVerbosity verbosity);
mportInstance *
mport_instance_new();
void
mport_set_msg_cb(mportInstance *, mport_msg_cb cb);
void
mport_set_progress_init_cb(mportInstance *mport, mport_progress_init_cb cb);
void
mport_set_progress_step_cb(mportInstance *mport, mport_progress_step_cb cb);
void
mport_set_progress_free_cb(mportInstance *mport, mport_progress_free_cb cb);
void
mport_set_confirm_cb(mportInstance *mport, mport_confirm_cb cb);
int
mport_stats(mportInstance *mport, mportStats **stats);
int
mport_stats_free(mportStats *stats);
mportStats *
mport_stats_new();
int
mport_merge_primative(const char **filenames, const char *outfile);
mportPackageMeta *
mport_pkgmeta_new();
void
mport_pkgmeta_free(mportPackageMeta *pack);
void
mport_pkgmeta_vec_free(mportPackageMeta **vec);
int
mport_pkgmeta_search_master(mportInstance *mport, mportPackageMeta ***ref, const char *fmt, ...);
int
mport_pkgmeta_list(mportInstance *mport, mportPackageMeta ***ref);
int
mport_pkgmeta_get_downdepends(mportInstance *mport, mportPackageMeta *pkg, mportPackageMeta ***pkg_vec_p);
int
mport_pkgmeta_get_updepends(mportInstance *mport, mportPackageMeta *pkg, mportPackageMeta ***pkg_vec_p);
mportAssetList *
mport_assetlist_new();
void
mport_assetlist_free(mportAssetList *list);
int
mport_parse_plistfile(FILE *fp, mportAssetList *list);
char *
mport_settings_get(mportInstance *mport, const char *name);
int
mport_settings_set(mportInstance *mport, const char *name, const char *val);
int
mport_update_primative(mportInstance *mport, const char *filename);
mportCreateExtras *
mport_createextras_new();
void
mport_createextras_free(mportCreateExtras *extra);
int
mport_verify_hash(const char *filename, const char *hash);
int
mport_file_exists(const char *file);
int
mport_verify_package(mportInstance *mport, mportPackageMeta *pack);
int
mport_version_cmp(const char *astr, const char *bstr);
int
mport_lock_lock(mportInstance *mport, mportPackageMeta *pkg);
int
mport_lock_unlock(mportInstance *mport, mportPackageMeta *pkg);
int
mport_lock_islocked(mportPackageMeta *pkg);

DESCRIPTION
These functions implement a package management library for creating, removing, and installing packages.

At a minimum, one must call mport_instance_new() and mport_instance_init() to initialize the library. This will create a master.db file if one does not exist.

At the end of the program, one must call mport_instance_free() to close the master.db and cleanup any other resources.

The following error codes are defined in <mport.h>:

[MPORT_OK]
    Operation completed successfully

[MPORT_ERR_FATAL]
    Operation failed with an error

[MPORT_ERR_WARN]
    Operation completed with a warning

ENVIRONMENT

FETCH_BIND_ADDRESS
    Specifies a hostname or IP address to which sockets used for outgoing connections will be bound.

FTP_LOGIN
    Default FTP login if none was provided in the URL.

FTP_PASSIVE_MODE
    If set to ‘no’, forces the FTP code to use active mode. If set to any other value, forces passive mode even if the application requested active mode.

FTP_PASSWORD
    Default FTP password if the remote server requests one and none was provided in the URL.

FTP_PROXY
    URL of the proxy to use for FTP requests. The document part is ignored. FTP and HTTP proxies are supported; if no scheme is specified, FTP is assumed. If the proxy is an FTP proxy,

ASSUME_ALWAYS_YES
    If set to a non empty value, will assume any question should be answered with a yes.

HANDLE_RC_SCRIPTS
    If set to a non empty value, will start/stop rc.d scripts included in the package.

PKG_DB
    Specifies an alternate location to download the mport index database and for opening it while using mport. Typically an absolute path to the file extracted... /var/db/mport/index.db is the default.

SEE ALSO
mport(1), mports(7)

HISTORY
The mport library first appeared in

AUTHORS
-nosplit The mport library was mostly written by Chris Reinhardt <ctriv@MidnightBSD.org> with numerous suggestions and contributions from Lucas Holt <luke@MidnightBSD.org>,

This manual page was written by Lucas Holt <luke@MidnightBSD.org>.

BUGS
Some parts of the library are not yet implemented.