本文整理汇总了C++中pkg_emit_event函数的典型用法代码示例。如果您正苦于以下问题:C++ pkg_emit_event函数的具体用法?C++ pkg_emit_event怎么用?C++ pkg_emit_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pkg_emit_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: packing_set_format
static const char *
packing_set_format(struct archive *a, pkg_formats format)
{
switch (format) {
case TXZ:
if (archive_write_set_compression_xz(a) == ARCHIVE_OK) {
return ("txz");
} else {
pkg_emit_event(PKG_EVENT_ARCHIVE_COMP_UNSUP,
/*argc*/2, "xz", "bzip2");
}
case TBZ:
if (archive_write_set_compression_bzip2(a) == ARCHIVE_OK) {
return ("tbz");
} else {
pkg_emit_event(PKG_EVENT_ARCHIVE_COMP_UNSUP,
/*argc*/2, "bzip2", "gzip");
}
case TGZ:
if (archive_write_set_compression_gzip(a) == ARCHIVE_OK) {
return ("tgz");
} else {
pkg_emit_event(PKG_EVENT_ARCHIVE_COMP_UNSUP,
/*argc*/2, "gzip", "plain tar");
}
case TAR:
archive_write_set_compression_none(a);
return ("tar");
}
return (NULL);
}
示例2: packing_append_file
int
packing_append_file(struct packing *pack, const char *filepath, const char *newpath)
{
int fd;
int len;
char linkdest[MAXPATHLEN];
char buf[BUFSIZ];
int retcode = EPKG_OK;
struct stat st;
archive_entry_clear(pack->entry);
archive_entry_copy_sourcepath(pack->entry, filepath);
retcode = archive_read_disk_entry_from_file(pack->aread, pack->entry, -1, NULL);
if (retcode != ARCHIVE_OK) {
pkg_emit_event(PKG_EVENT_ARCHIVE_ERROR, /*argc*/2,
filepath, pack->aread);
retcode = EPKG_FATAL;
goto cleanup;
}
retcode = EPKG_OK;
lstat(filepath, &st);
archive_entry_copy_stat(pack->entry, &st);
if (S_ISLNK(st.st_mode)) {
bzero(linkdest, MAXPATHLEN);
readlink(filepath, linkdest, MAXPATHLEN);
archive_entry_set_symlink(pack->entry, linkdest);
}
if (newpath != NULL)
archive_entry_set_pathname(pack->entry, newpath);
if (archive_entry_filetype(pack->entry) != AE_IFREG) {
archive_entry_set_size(pack->entry, 0);
}
archive_write_header(pack->awrite, pack->entry);
if (archive_entry_size(pack->entry) > 0) {
if ((fd = open(filepath, O_RDONLY)) < 0) {
pkg_emit_event(PKG_EVENT_IO_ERROR, /*argc*/3,
"open", filepath, strerror(errno));
retcode = EPKG_FATAL;
goto cleanup;
}
while ((len = read(fd, buf, sizeof(buf))) > 0 )
archive_write_data(pack->awrite, buf, len);
close(fd);
}
cleanup:
archive_entry_clear(pack->entry);
return (retcode);
}
示例3: pkg_emit_upgrade_finished
void
pkg_emit_upgrade_finished(struct pkg *p)
{
struct pkg_event ev;
bool syslog_enabled = false;
char *name, *version, *newversion;
ev.type = PKG_EVENT_UPGRADE_FINISHED;
ev.e_upgrade_finished.pkg = p;
pkg_config_bool(PKG_CONFIG_SYSLOG, &syslog_enabled);
if (syslog_enabled) {
const char *actions[] = {
"upgraded", "reinstalled", "downgraded"
};
int num_actions = sizeof(actions) / sizeof(*actions);
int action;
pkg_get(p, PKG_NAME, &name, PKG_VERSION, &version,
PKG_NEWVERSION, &newversion);
action = pkg_version_cmp(version, newversion) + 1;
if (action >= 0 && action < num_actions)
syslog(LOG_NOTICE, "%s %s: %s -> %s ",
name, actions[action], version, newversion);
}
pkg_emit_event(&ev);
}
示例4: pkg_emit_integritycheck_begin
void
pkg_emit_integritycheck_begin(void)
{
struct pkg_event ev;
ev.type = PKG_EVENT_INTEGRITYCHECK_BEGIN;
pkg_emit_event(&ev);
}
示例5: pkg_emit_integritycheck_finished
void
pkg_emit_integritycheck_finished(void)
{
struct pkg_event ev;
ev.type = PKG_EVENT_INTEGRITYCHECK_FINISHED;
pkg_emit_event(&ev);
}
示例6: pkg_emit_nolocaldb
void
pkg_emit_nolocaldb(void)
{
struct pkg_event ev;
ev.type = PKG_EVENT_NOLOCALDB;
pkg_emit_event(&ev);
}
示例7: pkg_emit_newpkgversion
void
pkg_emit_newpkgversion(void)
{
struct pkg_event ev;
ev.type = PKG_EVENT_NEWPKGVERSION;
pkg_emit_event(&ev);
}
示例8: pkg_emit_integritycheck_finished
void
pkg_emit_integritycheck_finished(int conflicting)
{
struct pkg_event ev;
ev.type = PKG_EVENT_INTEGRITYCHECK_FINISHED;
ev.e_integrity_finished.conflicting = conflicting;
pkg_emit_event(&ev);
}
示例9: pkg_emit_upgrade_begin
void
pkg_emit_upgrade_begin(struct pkg *p)
{
struct pkg_event ev;
ev.type = PKG_EVENT_UPGRADE_BEGIN;
ev.e_upgrade_begin.pkg = p;
pkg_emit_event(&ev);
}
示例10: pkg_emit_package_not_found
void
pkg_emit_package_not_found(const char *p)
{
struct pkg_event ev;
ev.type = PKG_EVENT_NOT_FOUND;
ev.e_not_found.pkg_name = p;
pkg_emit_event(&ev);
}
示例11: pkg_emit_fetch_finished
void
pkg_emit_fetch_finished(const char *url)
{
struct pkg_event ev;
ev.type = PKG_EVENT_FETCH_FINISHED;
ev.e_fetching.url = url;
pkg_emit_event(&ev);
}
示例12: pkg_emit_noremotedb
void
pkg_emit_noremotedb(const char *repo)
{
struct pkg_event ev;
ev.type = PKG_EVENT_NOREMOTEDB;
ev.e_remotedb.repo = repo;
pkg_emit_event(&ev);
}
示例13: pkg_emit_delete_files_finished
void
pkg_emit_delete_files_finished(struct pkg *p)
{
struct pkg_event ev;
ev.type = PKG_EVENT_DELETE_FILES_FINISHED;
ev.e_delete_files_finished.pkg = p;
pkg_emit_event(&ev);
}
示例14: pkg_emit_already_installed
void
pkg_emit_already_installed(struct pkg *p)
{
struct pkg_event ev;
ev.type = PKG_EVENT_ALREADY_INSTALLED;
ev.e_already_installed.pkg = p;
pkg_emit_event(&ev);
}
示例15: pkg_emit_delete_files_begin
void
pkg_emit_delete_files_begin(struct pkg *p)
{
struct pkg_event ev;
ev.type = PKG_EVENT_DELETE_FILES_BEGIN;
ev.e_delete_files_begin.pkg = p;
pkg_emit_event(&ev);
}